This repository has been archived by the owner on Jul 26, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 55
/
Copy pathfooter.php
281 lines (272 loc) · 10.1 KB
/
footer.php
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
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
<?php if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
<?php if ($this->user->hasLogin()) { ?>
<?php if ($this->is('single')) { ?>
<a href="<?php $this->options->adminUrl(); ?>write-<?php echo $this->is('post')?'post':'page'; ?>.php?cid=<?php echo $this->cid;?>">
<button id="adminbtn" class="btn btn-icon-only rounded-circle btn-primary admin-btn">
<span class="btn-inner--icon"><i class="fa fa-pencil" aria-hidden="true"></i></span>
</button>
</a>
<?php } else { ?>
<a href="<?php $this->options->adminUrl(); ?>">
<button id="adminbtn" class="btn btn-icon-only rounded-circle btn-primary admin-btn">
<span class="btn-inner--icon"><i class="fa fa-cogs" aria-hidden="true"></i></span>
</button>
</a>
<?php } ?>
<?php } ?>
</main>
<!-- Footer -->
<footer class="footer">
<div class="container">
<?php if ($this->options->footerWidget) { ?>
<div class="row">
<div class="col-md-4 widget">
<h5>最新评论</h5>
<?php $comments_recent = $this->widget('Widget_Comments_Recent', 'pageSize=5');
if ($comments_recent->have())
{
_e('<ul>');
while($comments_recent->next())
{
_e('<li><a href="' . "$comments_recent->permalink" . '" class="footer-link">' . "$comments_recent->author" . ': ');
$comments_recent->excerpt(35, '...');
_e('</a></li>');
}
_e('</ul>');
}
else
{
_e('暂无评论');
}
?>
</div>
<div class="col-md-4 widget">
<h5>最新文章</h5>
<ul><?php $this->widget('Widget_Contents_Post_Recent', 'pageSize=6')->parse('<li><a href="{permalink}" class="footer-link">{title}</a></li>'); ?></ul>
</div>
<div class="col-md-4 widget">
<h5>近期归档</h5>
<ul><?php $this->widget('Widget_Contents_Post_Date', 'limit=6&type=month&format=F Y')->parse('<li><a href="{permalink}" class="footer-link">{date}</a></li>'); ?></ul>
</div>
</div>
<hr/>
<?php } ?>
<div class="row">
<div class="col-md-6">
<div class="copyright">
<?php _e($this->options->footerText); ?>
</div>
</div>
<div class="col-md-6">
<ul class="nav nav-footer justify-content-end">
<li class="nav-item">
<a class="nav-link" href="<?php $this->options->siteUrl(); ?>">首页</a>
</li>
<?php $this->widget('Widget_Contents_Page_List')->to($pages);
while($pages->next()): ?>
<li class="nav-item">
<a class="nav-link" href="<?php $pages->permalink(); ?>"><?php $pages->title(); ?></a>
</li>
<?php endwhile; ?>
<?php if($this->user->hasLogin()): ?>
<li class="nav-item"><a class="nav-link" href="<?php $this->options->adminUrl(); ?>">进入后台(<?php $this->user->screenName(); ?>)</a></li>
<li class="nav-item"><a class="nav-link" href="<?php $this->options->logoutUrl(); ?>">退出</a></li>
<?php else: ?>
<li class="nav-item"><a class="nav-link" href="<?php $this->options->adminUrl('login.php'); ?>">登录</a></li>
<?php endif; ?>
</ul>
</div>
</div>
</div>
</footer>
<?php if($this->options->Pjax) _e('</div>'); ?>
<a id="scrollup" href="#" style="display: none;">
<button id="scrollbtn" class="btn btn-icon-only rounded-circle btn-secondary scrollup-btn">
<span class="btn-inner--icon"><i class="fa fa-arrow-up" aria-hidden="true"></i></span>
</button>
</a>
<!-- Core -->
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/umd/popper.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js"></script>
<!-- Optional plugins -->
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/headroom.min.js"></script>
<!-- Theme JS -->
<script src="<?php $this->options->themeUrl("assets/js/argon.min.js"); ?>"></script>
<script src="<?php $this->options->themeUrl("assets/js/bbrender.js"); ?>"></script>
<!-- scrollup -->
<script>
$(function(){
var scrollBottom = parseInt($("#adminbtn").css("bottom")) + parseInt($("#adminbtn").css("height")) + 25;
$("#scrollbtn").css("bottom", scrollBottom);
var resizeTimer;
$(window).resize(function(e) {
if ($("#adminbtn").length > 0)
{
clearTimeout(resizeTimer);
resizeTimer = setTimeout(function() {
scrollBottom = parseInt($("#adminbtn").css("bottom")) + parseInt($("#adminbtn").css("height")) + 25;
$("#scrollbtn").css("bottom", scrollBottom);
}, 250);
}
});
var scrollLock = 0;
if ($(window).scrollTop() > 500) $("#scrollup").fadeIn(400);
$(window).scroll(function() {
if (!scrollLock)
{
if ($(window).scrollTop() > 500) $("#scrollup").fadeIn(400);
else $("#scrollup").fadeOut(400);
}
});
$("#scrollup").click(function() {
scrollLock = 1;
$("#scrollup").fadeOut(400);
$("html,body").animate({scrollTop: "0px"}, 500, function() {
scrollLock = 0;
});
});
});
</script>
<!-- Pjax -->
<script>
function init(){
<?php if($this->options->prismjs and $this->options->prismLine): ?>
var pres = document.querySelectorAll('pre');
var lineNumberClassName = 'line-numbers';
pres.forEach(function (item, index) {
item.className = item.className == '' ? lineNumberClassName : item.className + ' ' + lineNumberClassName;
});
Prism.highlightAll(false,null);
<?php endif; ?>
$("img").Lazy({
threshold: 700,
effect: 'fadeIn',
effectTime: 1000,
defaultImage: "<?php $this->options->themeUrl("images/Loading.gif"); ?>"
});
$("div[data-src]").Lazy({
threshold: 700,
effect: 'fadeIn',
placeholder: "<?php $this->options->themeUrl("images/Loading.gif"); ?>",
effectTime: 1000
});
<?php if($this->options->katex): ?>
try{
renderMathInElement(document.body,{
delimiters: [
{left: "$$", right: "$$", display: true},
{left: "$", right: "$", display: false}
]
})
}catch(e){}
<?php endif; ?>
parseBbcode()
parseBblink()
<?php if($this->options->Pjax): ?>
;<?php $this->options->pjaxcomp() ?>;
try{
window.onload()
}catch(e){}
<?php endif; ?>
<?php if ($this->options->viewerEnable): ?>
setTimeout(() => {
$('.content').viewer({
url: 'data-src'
})
},300)
<?php endif; ?>
}
<?php if ($this->options->viewerEnable): ?>
function destroy(){
// viewerjs
var viewer = $('.content').data('viewer');
if(viewer){
viewer.destroy()
}
}
window.addEventListener("popstate", function(e) {
setTimeout(() => {
$('.content').viewer({
url: 'data-src'
})
},300)
}, false);
<?php endif; ?>
</script>
<?php if($this->options->Pjax): ?>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/jquery.pjax.js"></script>
<script src="<?php $this->options->themeUrl("assets/js/progress.js"); ?>"></script>
<script>
var pgid = 0
$(document).pjax('a[href^="<?php Helper::options()->siteUrl()?>"]:not(a[target="_blank"], a[no-pjax], a[href^="<?php Helper::options()->siteUrl()?>/admin"])',
{
container: '#pjax-container',
fragment: '#pjax-container',
timeout: 8000
}).on('pjax:send', function() {
pgid = start_progress()
$(".black-cover").fadeIn(400)
$('html,body').animate({ scrollTop: $('html').offset().top}, 500)
<?php if ($this->options->viewerEnable): ?>
destroy()
<?php endif; ?>
}).on('pjax:complete', function() {
$(".black-cover").fadeOut(400)
stop_progress(pgid)
init()
})
$("#search").submit(function() {
var att = $(this).serializeArray()
for(var i in att){
if(att[i].name=="s"){
$.pjax({url: <?php if ($this->options->rewrite): ?>"<?php $this->options->siteUrl(); ?>search/"+att[i].value+"/"<?php else: ?>"<?php $this->options->siteUrl(); ?>index.php/search/"+att[i].value+"/"<?php endif; ?>, container: '#pjax-container',fragment: '#pjax-container',timeout:8000})
}
}
return false
})
</script>
<div class="black-cover" style="display: none;"></div>
<?php endif; ?>
<!-- KaTeX JS -->
<?php if($this->options->katex): ?>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/contrib/auto-render.min.js"></script>
<?php endif; ?>
<!-- Prism JS -->
<?php if($this->options->prismjs): ?>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/components/prism-core.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/plugins/autoloader/prism-autoloader.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/plugins/toolbar/prism-toolbar.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/plugins/show-language/prism-show-language.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/plugins/copy-to-clipboard/prism-copy-to-clipboard.min.js"></script>
<?php if($this->options->prismLine): ?>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/plugins/line-numbers/prism-line-numbers.min.js"></script>
<?php endif; ?>
<?php endif; ?>
<!-- Alert -->
<div id="modal-notification" class="modal fade show" id="modal-notification" style="z-index: 102;display: none;">
<div class="modal-dialog modal-sm">
<div class="modal-content">
<div class="modal-header">
<h5 id="msgMain" class="modal-title" id="mySmallModalLabel"></h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close" onclick="$('#modal-notification').hide('normal');">
<span aria-hidden="true">×</span>
</button>
</div>
<div id="msgDetail" class="modal-body"></div>
</div>
</div>
</div>
<script>
function alert(main,detail){
$("#msgMain").html(main)
if(detail) $("#msgDetail").html(detail)
else $("#msgDetail").html("")
$("#modal-notification").show("normal");
}
init()
</script>
<!-- Typecho footer -->
<?php $this->footer(); ?>
</body>
</html>