-
Notifications
You must be signed in to change notification settings - Fork 37
/
footer.php
166 lines (148 loc) · 5.78 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
<?php if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
</div>
<!-- end #body -->
<footer id="footer" role="contentinfo">
<div class="container-fluid">
<div class="row">
<div class="col-12">
© <?php echo date('Y'); ?> <a href="<?php $this->options->siteUrl(); ?>"><?php $this->options->title(); ?></a>.
<?php _e('Using <a target="_blank" href="http://www.typecho.org">Typecho</a> & <a target="_blank" href="https://github.com/txperl/Story-for-Typecho">Story</a>'); ?>.
</div>
</div>
</div>
</footer>
<script src="<?php $this->options->themeUrl('assert/js/jquery.min.js'); ?>"></script>
<script src="<?php $this->options->themeUrl('assert/js/prism.js'); ?>"></script>
<script src="<?php $this->options->themeUrl('assert/js/zoom-vanilla.min.js'); ?>"></script>
<script>
<?php if ($GLOBALS['isAutoNav'] == 'on') : ?>
var b = document.getElementsByClassName('b');
var w = document.getElementsByClassName('w');
var menupgMargin = (b.length + w.length) * 28;
var srhboxMargin = (b.length + w.length + 3) * 28;
var menusrhWidth = (b.length + w.length - 1) * 28;
document.getElementById('menu-page').style['margin-left'] = menupgMargin + 'px';
document.getElementById('search-box').style['margin-left'] = srhboxMargin + 'px';
document.getElementById('menu-search').style['width'] = menusrhWidth + 'px';
if (menusrhWidth < 140) {
document.getElementById('menu-search').setAttribute('placeholder', 'Search~');
}
<?php endif; ?>
$(document).ready(function() {
if (window.location.hash != '') {
var i = window.location.hash.indexOf('#comment');
var ii = window.location.hash.indexOf('#respond-post');
if (i != -1 || ii != -1) {
document.getElementById('btn-comments').innerText = 'hide comments';
document.getElementById('comments').style.display = 'block';
footerPosition();
}
}
});
function isMenu() {
if (document.getElementById('menu-1').style.display == 'inline') {
$('#search-box').fadeOut(200);
$('#menu-page').fadeOut(200);
$('#menu-1').fadeOut(500);
$('#menu-2').fadeOut(400);
$('#menu-3').fadeOut(300);
} else {
$('#menu-1').fadeIn(150);
$('#menu-2').fadeIn(150);
$('#menu-3').fadeIn(150);
}
}
function isMenu1() {
if (document.getElementById('menu-page').style.display == 'block') {
$('#menu-page').fadeOut(300);
} else {
$('#menu-page').fadeIn(300);
}
}
function isMenu2(c = 'none') {
if (document.getElementById('torTree')) {
if ($("#torTree").attr('style') == 'display: none;') {
$("#torTree").fadeIn(300);
$("#torTree").css('display', 'inline-block');
} else {
$("#torTree").fadeOut(300);
}
} else {
if (c != 'auto') {
alert('人家是导航树哦!只有在特定的文章页面才会出现的。');
}
}
}
function isMenu3() {
if (document.getElementById('search-box').style.display == 'block') {
$('#search-box').fadeOut(300);
} else {
$('#search-box').fadeIn(300);
}
}
function isComments() {
if (document.getElementById('btn-comments').innerText == 'show comments') {
document.getElementById('btn-comments').innerText = 'hide comments';
document.getElementById('comments').style.display = 'block';
} else {
document.getElementById('btn-comments').innerText = 'show comments';
document.getElementById('comments').style.display = 'none';
}
footerPosition();
}
function Search404() {
$('#menu-1').fadeIn(150);
$('#menu-2').fadeIn(150);
$('#menu-3').fadeIn(150);
$('#search-box').fadeIn(300);
}
function goBack() {
window.history.back();
}
function footerPosition() {
$("footer").removeClass("fixed-bottom");
var contentHeight = document.body.scrollHeight,
winHeight = window.innerHeight;
if (document.getElementsByClassName("post-content")[0]) {
var winImgNum = document.getElementsByClassName("post-content")[0].getElementsByTagName("img").length;
} else {
var winImgNum = 0;
}
if (!(contentHeight > winHeight) && winImgNum == 0) {
$("footer").addClass("fixed-bottom");
}
}
footerPosition();
$(window).resize(footerPosition);
function goToComment() {
document.getElementById('btn-comments').innerText = 'hide comments';
document.getElementById('comments').style.display = 'block';
window.location.hash = "#postFun";
footerPosition();
}
<?php if ($this->is('post')) : ?>
<?php $postConfig = post_config($this); ?>
<?php if ($postConfig['isTorTree']) : ?>
isMenu2('auto');
<?php endif; ?>
var $navs = $('.torList'),
$sections = $('.torAn'),
$window = $(window),
navLength = $navs.length - 1;
$window.on('scroll', function() {
var scrollTop = $window.scrollTop(),
len = navLength;
for (; len > -1; len--) {
var that = $sections.eq(len);
if (scrollTop >= (that.offset().top - 100)) {
$navs.removeClass('on').eq(len).addClass('on');
break;
}
$navs.removeClass('on');
}
});
<?php endif; ?>
</script>
<?php $this->footer(); ?>
</body>
</html>