/
default.html
99 lines (83 loc) · 3.32 KB
/
default.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
<!DOCTYPE html>
<html lang="en-us">
{% include head.html %}
<body class="sidebar-overlay">
<nav>
{% include sidebar.html %}
</nav>
<!-- Wrap is the content to shift when toggling the sidebar. We wrap the
content to avoid any CSS collisions with our real content. -->
<div class="wrap">
<header class="masthead">
<div class="container">
<h3 class="masthead-title">
<a href="{{ site.baseurl }}/" title="Home">{{ site.title | newline_to_br }}</a>
<br><small>{{ site.tagline }}</small>
</h3>
</div>
<button class="sidebar-toggle"
aria-label="Open navigation menu"
aria-expanded="false"
aria-controls="sidebar">
</button>
</header>
<main class="container content" id="main">
{{ content }}
</main>
</div>
<script>
// Highlight search Query
var url = window.location.href;
if (url.lastIndexOf("?q=") > 0) {
// get the index of the parameter, add three (to account for length)
var stringloc = url.lastIndexOf("?q=") + 3;
// get the substring (query) and decode
var searchquery = decodeURIComponent(url.substr(stringloc));
// regex matches at beginning of line, end of line or word boundary, useful for poetry
var regex = new RegExp("(?:^|\\b)(" + searchquery + ")(?:$|\\b)", "gim");
// get, add mark and then set content
var content = document.getElementById("main").innerHTML;
document.getElementById("main").innerHTML = content.replace(regex, "<mark>$1</mark>");
}
// Support sidebar toggle
(function(document) {
var toggle = document.querySelector('.sidebar-toggle');
var sidebar = document.querySelector('#sidebar');
var sidebarNavLink = document.querySelector('.sidebar-nav-item');
var checkbox = document.querySelector('#sidebar-checkbox');
// Toggle sidebar
toggle.addEventListener('click', function(e) {
e.preventDefault();
checkbox.checked = !checkbox.checked;
toggle.setAttribute('aria-expanded', checkbox.checked);
sidebar.setAttribute('aria-hidden', !checkbox.checked);
});
// Make sure we focus on the menu once it opens to aid tab navigation
sidebar.addEventListener('transitionend', function() {sidebarNavLink.focus()});
// Clicking anywhere in the sidebar should close the menu
sidebar.addEventListener('click', function(e) {
checkbox.checked = false;
toggle.setAttribute('aria-expanded', false);
sidebar.setAttribute('aria-hidden', true);
})
})(document);
</script>
<!-- Facebook SDK for JavaScript -->
<script>
window.fbAsyncInit = function() {
FB.init({
appId : '589495744558280',
xfbml : true,
version : 'v2.6'
});
};
(function(d, s, id){
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) {return;}
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/sdk.js";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
</script>
</body>
</html>