theshell.ch/site/_layouts/main.html

82 lines
2.3 KiB
HTML
Raw Normal View History

<!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");
}
});
searchBar.addEventListener('keypress', function () {
sjs.search();
});
});
document.addEventListener("keypress", function(event) {
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 "~":
location.href = "{{ site.baseurl }}/";
break;
}
});
</script>
</body>
</html>