-
Notifications
You must be signed in to change notification settings - Fork 14
/
post.hbs
executable file
·118 lines (96 loc) · 3.75 KB
/
post.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
112
113
114
115
116
117
118
<!doctype html>
<html>
<head>
<meta charset="UTF-8" />
<title>{{{@blog.title}}} ~ {{{meta_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/post.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()}, 500);
}
function addTransitionCSSTimeout() {
var sheets = document.styleSheets;
for (var i = 0; i < sheets.length; i++) {
if (sheets[i].href && sheets[i].href.indexOf('post.css') != -1) {
sheets[i].insertRule('body,aside.night-toggle,.blog-post,.blog,.post-content pre,.post-content code,.post-content hr,.post-content blockquote{transition:background .6s}', sheets[i].cssRules.length);
}
}
}
/* @end CSS */
</script>
</head>
<body onload="checkNightMode(); addTransitionCSS(); showPage();">
<aside class="night-toggle" onclick="nightMode()"></aside>
<div class="outer-wrapper"><div class="inner-wrapper">
<main class="blog">
<article class="blog-post {{post_class}}">
{{#post}}
<header class="post-header">
<h1>{{{title}}}</h1>
</header>
<section class="post-content">
{{content}}
</section>
<footer class="post-footer">
<time datetime="{{date format='YYYY-MM-DD'}}">{{date format="DD MMM YYYY"}}</time>
</footer>
{{/post}}
</article>
</main>
</div></div>
</body>
</html>