theshell.ch/site/_layouts/main.html

108 lines
3.1 KiB
HTML

<!DOCTYPE html>
<html>
{% include head.html %}
<body id="bdy">
<header class="header">
{% include header.html %}
</header>
<main class="container">
{{ content }}
</main>
{% include footer.html %}
<script src="https://cdn.rawgit.com/christian-fei/Simple-Jekyll-Search/master/dest/simple-jekyll-search.min.js"></script>
<script>
document.addEventListener('DOMContentLoaded', function() {
var searchBar = document.getElementById('search-bar');
var results = document.getElementById('search-results');
var sjs = SimpleJekyllSearch({
searchInput: searchBar,
resultsContainer: results,
json: '/search.json',
searchResultTemplate:
'<li><a href="{url}"><h3>{title}</h3><h4>{category}</h4></a></li>',
success: function(sr) {
results.setAttribute("class", sr.length <= 1 ? "" : "show");
console.log(sr);
}
});
searchBar.addEventListener('keypress', function () {
sjs.search();
});
});
document.addEventListener("keypress", function(event) {
if (document.searching) {
console.log("is Searching");
return
}
switch (event.key) {
case "w":
case "k":
window.scrollTo (0,0);
break;
case "a":
case "h":
var previous = "{{ page.previous-page }}";
if (previous) {
location.href = "{{ site.baseurl }}/" + previous;
}
break;
case "d":
case "l":
var next = "{{ page.next-page }}";
if (next) {
location.href = "{{ site.baseurl }}/" + next;
}
break;
case "s":
case "j":
var topicPage;
var topic = "{{ page.category-page }}";
switch (topic) {
case "basic":
case "intermediate":
case "advanced":
topicPage = "{{ site.baseurl }}/pages/topic/cmd/" + topic + ".html";
break;
case "fs":
case "scripts":
topicPage = "{{ site.baseurl }}/pages/topic/" + topic + ".html";
break;
}
if (topicPage) {
location.href = topicPage;
}
break;
case "0":
case "~":
location.href = "{{ site.baseurl }}/";
break;
case "1":
location.href = "{{ site.baseurl }}/pages/topic/cmd/basic.html";
break;
case "2":
location.href = "{{ site.baseurl }}/pages/topic/cmd/interm.html";
break;
case "3":
location.href = "{{ site.baseurl }}/pages/topic/cmd/advanced.html";
break;
case "4":
location.href = "{{ site.baseurl }}/pages/topic/fs.html";
break;
case "5":
location.href = "{{ site.baseurl }}/pages/topic/scripts.html";
break;
case "6":
location.href = "{{ site.baseurl }}/pages/topic/about.html";
break;
}
});
</script>
</body>
</html>