-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathfooter.html
208 lines (199 loc) · 8.26 KB
/
footer.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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
<footer class="footer bg-white">
<div class="footer-social">
<div class="footer-container clearfix">
<div class="social-list">
#tag social("weibo")
<a class="social weibo" target="blank" href="http://weibo.com/${site_option('social_weibo')}">微博</a>
#end
#tag social("zhihu")
<a class="social zhihu" target="blank"
href="https://www.zhihu.com/people/${site_option('social_zhihu')}">知乎</a>
#end
<a class="social rss" target="blank" href="/feed">RSS</a>
#tag social("github")
<a class="social github" target="blank"
href="https://github.com/${site_option('social_github')}">Github</a>
#end
#tag social("twitter")
<a class="social twitter" target="blank" href="https://twitter.com/${site_option('social_twitter')}">Twitter</a>
#end
</div>
</div>
</div>
<div class="footer-meta">
<div class="footer-container">
<div class="meta-item meta-copyright">
<div class="meta-copyright-info">
<a href="${site_url()}" class="info-logo">
<img src="/templates/themes/default/static/img/logo.png" alt="${site_title()}">
</a>
<div class="info-text">
<p>一生有所追求.</p>
<p>Powered by <a href="https://github.com/otale/tale" target="_blank" rel="nofollow">Tale</a>
</p>
<p>© 2017 <a href="https://github.com/biezhi">biezhi</a></p>
</div>
</div>
</div>
<div class="meta-item meta-posts">
<h3 class="meta-title">最新文章</h3>
#for(article : recent_articles(8))
<li>
<a href="${permalink()}">${title()}</a>
</li>
#end
</div>
<div class="meta-item meta-comments">
<h3 class="meta-title">最新评论</h3>
#for(comm : recent_comments(8))
<li>
<a href="${site_url('/article/')}${comm.cid}#comment-${comm.coid}">${comm.author}:${comm.content}</a>
</li>
#end
</div>
</div>
</div>
</footer>
#if(is_post)
<div id="directory-content" class="directory-content">
<div id="directory"></div>
</div>
<script>
var postDirectoryBuild = function() {
var postChildren = function children(childNodes, reg) {
var result = [],
isReg = typeof reg === 'object',
isStr = typeof reg === 'string',
node, i, len;
for (i = 0, len = childNodes.length; i < len; i++) {
node = childNodes[i];
if ((node.nodeType === 1 || node.nodeType === 9) &&
(!reg ||
isReg && reg.test(node.tagName.toLowerCase()) ||
isStr && node.tagName.toLowerCase() === reg)) {
result.push(node);
}
}
return result;
},
createPostDirectory = function(article, directory, isDirNum) {
var contentArr = [],
titleId = [],
levelArr, root, level,
currentList, list, li, link, i, len;
levelArr = (function(article, contentArr, titleId) {
var titleElem = postChildren(article.childNodes, /^h\d$/),
levelArr = [],
lastNum = 1,
lastRevNum = 1,
count = 0,
guid = 1,
id = 'directory' + (Math.random() + '').replace(/\D/, ''),
lastRevNum, num, elem;
while (titleElem.length) {
elem = titleElem.shift();
contentArr.push(elem.innerHTML);
num = +elem.tagName.match(/\d/)[0];
if (num > lastNum) {
levelArr.push(1);
lastRevNum += 1;
} else if (num === lastRevNum ||
num > lastRevNum && num <= lastNum) {
levelArr.push(0);
lastRevNum = lastRevNum;
} else if (num < lastRevNum) {
levelArr.push(num - lastRevNum);
lastRevNum = num;
}
count += levelArr[levelArr.length - 1];
lastNum = num;
elem.id = elem.id || (id + guid++);
titleId.push(elem.id);
}
if (count !== 0 && levelArr[0] === 1) levelArr[0] = 0;
return levelArr;
})(article, contentArr, titleId);
currentList = root = document.createElement('ul');
dirNum = [0];
for (i = 0, len = levelArr.length; i < len; i++) {
level = levelArr[i];
if (level === 1) {
list = document.createElement('ul');
if (!currentList.lastElementChild) {
currentList.appendChild(document.createElement('li'));
}
currentList.lastElementChild.appendChild(list);
currentList = list;
dirNum.push(0);
} else if (level < 0) {
level *= 2;
while (level++) {
if (level % 2) dirNum.pop();
currentList = currentList.parentNode;
}
}
dirNum[dirNum.length - 1]++;
li = document.createElement('li');
link = document.createElement('a');
link.href = '#' + titleId[i];
link.innerHTML = !isDirNum ? contentArr[i] :
dirNum.join('.') + ' ' + contentArr[i] ;
li.appendChild(link);
currentList.appendChild(li);
}
directory.appendChild(root);
};
createPostDirectory(document.getElementById('post-content'),document.getElementById('directory'), true);
};
postDirectoryBuild();
</script>
#end
<script src="//cdn.bootcss.com/headroom/0.9.1/headroom.min.js"></script>
<script src="//cdn.bootcss.com/highlight.js/9.9.0/highlight.min.js"></script>
<script src="//cdn.bootcss.com/instantclick/3.0.1/instantclick.min.js"></script>
<script type="text/javascript">
#if(is_post)
var postDirectory = new Headroom(document.getElementById("directory-content"), {
tolerance: 0,
offset : 100,
classes: {
initial: "initial",
pinned: "pinned",
unpinned: "unpinned"
}
});
#end
var header = new Headroom(document.getElementById("header"), {
tolerance: 10,
offset : 80,
classes: {
initial: "animated",
pinned: "slideDown",
unpinned: "slideUp"
}
});
header.init();
$('#search-inp').keypress(function (e) {
var key = e.which; //e.which是按键的值
if (key == 13) {
var q = $(this).val();
if (q && q != '') {
window.location.href = '/search/' + q;
}
}
});
</script>
<script data-no-instant>
InstantClick.on('change', function (isInitialLoad) {
var blocks = document.querySelectorAll('pre code');
for (var i = 0; i < blocks.length; i++) {
hljs.highlightBlock(blocks[i]);
}
if (isInitialLoad === false) {
if (typeof ga !== 'undefined') ga('send', 'pageview', location.pathname + location.search);
}
});
InstantClick.init();
</script>
</body>
</html>