-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathdefault.hbs
executable file
·111 lines (89 loc) · 3.53 KB
/
default.hbs
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
100
101
102
103
104
105
106
107
108
109
110
111
<!doctype html>
<html>
<head>
<meta charset="UTF-8" />
<title>{{@blog.title}}</title>
<meta name="description" content="{{meta_description}}" />
<meta name="HandheldFriendly" content="True" />
<meta name="MobileOptimized" content="320" />
<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1" />
<link href="//fonts.googleapis.com/css?family=Roboto+Condensed:300italic,300" rel="stylesheet" type="text/css">
<link rel="stylesheet" type="text/css" href="{{asset "css/default.css"}}" />
<link rel="stylesheet" type="text/css" href="{{asset "css/index.css"}}" />
{{ghost_head}}
<script>
/* @group NIGHT MODE */
function checkNightMode() {
if (getCookie('nightMode') == 'true') {
document.body.classList.toggle('night')
}
}
function nightMode() {
setCookie('nightMode', document.body.classList.toggle('night'), 9999999);
}
/* @end NIGHT MODE */
/* @group COOKIE */
function getCookie(name) {
var i, x, y, values = document.cookie.split('; ');
for (i = 0; i < values.length; i++) {
x = values[i].substr(0, values[i].indexOf('='));
y = values[i].substr(values[i].indexOf('=') + 1);
x = x.replace(/^\s+|\s+$/g, '');
if (x == name) {
return decodeURIComponent(y.replace(/\+/g, ' '));
}
}
return '';
}
function setCookie(name, value, days) {
clearCookie(name);
createCookie(name, value, days);
}
function createCookie(name, value, days) {
var expires;
if (days) {
var date = new Date();
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
expires = '; expires=' + date.toGMTString();
}
else {
expires = '';
}
window.parent.document.cookie = name + '=' + value + expires + '; path=/';
}
function clearCookie(name) {
createCookie(name, '', -1);
}
/* @end COOKIE */
/* @group CSS */
function showPage() {
window.setTimeout(function(){document.body.style.opacity = '1'}, 100);
}
function addTransitionCSS() {
window.setTimeout(function(){addTransitionCSSTimeout()}, 100);
}
function addTransitionCSSTimeout() {
var sheets = document.styleSheets;
for (var i = 0; i < sheets.length; i++) {
if (sheets[i].href && sheets[i].href.indexOf('index.css') != -1) {
sheets[i].insertRule('body,aside.night-toggle{transition:background .6s}', sheets[i].cssRules.length);
}
}
}
/* @end CSS */
</script>
</head>
<body onload="checkNightMode(); addTransitionCSS(); showPage();">
<aside class="site-cover">
<header class="site-header" style="background-image: url({{@blog.cover}});">
<h1>{{#if @blog.logo}}<i class="site-logo" style="background-image:url({{@blog.logo}})"></i>{{/if}}{{@blog.title}}</h1>
<p>{{@blog.description}}</p>
</header>
</aside>
<div class="outer-wrapper"><div class="inner-wrapper">
<main class="site-main">
{{{body}}}
</main>
</div></div>
</body>
</html>