-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathheader.php
More file actions
424 lines (383 loc) · 21 KB
/
header.php
File metadata and controls
424 lines (383 loc) · 21 KB
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
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
<?php if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
<?php ob_start(); ?>
<!DOCTYPE HTML>
<!--根据时间切换配色和logo -->
<?php
date_default_timezone_set('Asia/Shanghai');
$hour = date('H');
if ($hour >= 6 && $hour < 22) {
$theme = $this->options->css;
} else {
$theme = 'black';
};
?>
<?php echo '<html lang="zh-Hans-CN" xmlns="//www.w3.org/1999/xhtml" class="'. $theme .'">' ?>
<?php echo '<head>' ?>
<!--<base target="_blank"/>-->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>
<?php $this->archiveTitle(array(
'category' => _t('分类 %s 下的文章'),
'search' => _t('包含关键字 %s 的文章'),
'tag' => _t('标签 %s 下的文章'),
'author' => _t('%s 发布的文章')
), '', ' - ');
?>
靳闯博客
<?php if($this->is('index')): ?> - <?php $this->options->description() ?>
<?php endif; ?>
</title>
<!--<?php $this->options->title(); ?>-->
<?php $this->header('generator=&template=&pingback=&xmlrpc=&wlw=&atom='); ?>
<meta name="description" content="typecho博客">
<!--icon图标-->
<link href="<?php $this->options->ico() ?>" rel="shortcut icon">
<!--jquery-->
<script src="<?php $this->options->themeUrl('js/jquery.min.js'); ?>"></script>
<!--fontawesome图标 -->
<link rel="stylesheet" href="<?php $this->options->themeUrl('css/font-awesome.min.css'); ?>">
<!--字体样式-->
<link rel="stylesheet" href="<?php $this->options->themeUrl('css/fonts.css'); ?>">
<!--主题样式-->
<link rel="stylesheet" href="<?php $this->options->themeUrl('css/' . $this->options->css . '.css'); ?>">
<!--暗黑样式-->
<link rel="stylesheet" href="<?php $this->options->themeUrl('css/dark.css'); ?>">
<!--加载进度条-->
<?php if ($this->options->Gress== 'able'): ?>
<script src="<?php $this->options->themeUrl('js/gress.min.js'); ?>"></script>
<?php endif; ?>
<!--灯箱 此js为合并js,包含文章下方分享的js-->
<?php if ($this->options->Zoom == 'able'): ?>
<link rel="stylesheet" href="<?php $this->options->themeUrl('css/zoom.css'); ?>">
<script src="<?php $this->options->themeUrl('js/zoom-share.min.js'); ?>"></script>
<?php endif; ?>
<!--网站公告-->
<?php if ($this->options->Demo== 'able'): ?>
<link rel="stylesheet" href="<?php $this->options->themeUrl('css/sweetalert.css'); ?>">
<script src="<?php $this->options->themeUrl('js/sweetalert.min.js'); ?>"></script>
<?php endif; ?>
<!--代码高亮-->
<?php if ($this->options->Prism== 'able'): ?>
<!--<link rel="stylesheet" href="<?php $this->options->themeUrl('css/prism.css'); ?>">-->
<link rel="stylesheet" href="<?php $this->options->themeUrl('hljs/github.min.css'); ?>">
<script src="<?php $this->options->themeUrl('hljs/highlight.min.js'); ?>"></script>
<script>hljs.highlightAll();</script>
<?php endif; ?>
<!--文章分享-->
<link rel="stylesheet" href="<?php $this->options->themeUrl('css/share.min.css'); ?>">
<!--js-->
<script>
//主题判断
var html = document.getElementsByTagName("html")[0];
var deftheme = html.getAttribute("class");
var currentTheme = deftheme.includes('black') ? deftheme : 'green';
if (currentTheme === 'green') {
newtheme = 'black'
} else {
newtheme = 'green'
}
var cookieTheme = getCookie("theme");
if (cookieTheme) {
currentTheme = cookieTheme;
setDocumentTheme(currentTheme);
}
function setDocumentTheme(theme) {
html.className = '';
html.classList.add(theme);
}
function setCookie(name, value) {
var expires = new Date();
expires.setHours(24, 0, 0, 0);
var timeDiff = expires.getTime() - Date.now();
document.cookie = name + "=" + value + "; expires=" + new Date(Date.now() + timeDiff) + "; path=/";
}
function getCookie(name) {
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for (var i = 0; i < ca.length; i++) {
var c = ca[i];
while (c.charAt(0) == ' ') c = c.substring(1, c.length);
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
}
return null;
}
</script>
</head>
<!--body开始-->
<body>
<!-- header -->
<header id="header">
<!--切换样式-->
<button id="toggle-style">
<i class="fa fa-moon-o"></i>
<i class="fa fa-certificate"></i>
</button>
<script>
document.getElementById("toggle-style").addEventListener("click", function() {
if (currentTheme === newtheme) {
setDocumentTheme(deftheme);
currentTheme = deftheme;
scrollTOP();
} else if (currentTheme === deftheme) {
setDocumentTheme(newtheme);
currentTheme = newtheme;
scrollTOP();
}
setCookie("theme", currentTheme);
});
</script>
<!--背景视频-->
<!--<div class="header-video" id="header-video">
<video oncontextmenu="return false" id="vd" controlslist="nodownload" autoplay loop muted >
<source src="视频地址" type="video/mp4" />
</video>
</div>-->
<!--顶部内容-->
<div class="header-top">
<div class="scrolltop"></div>
<div class="intro">
<!--标题-->
<div class="intro-sitename" title="靳闯博客">
<!--头像-->
<div class="ulogo">
<img src="<?php $this->options->logoUrl(); ?>" class="intro-logo">
<!--<?php echo '<img src="' . $logo_path . '" class="intro-logo">' ?>-->
</div>
<a class="sitename" href="<?php $this->options->siteUrl(); ?>" >
<?php $this->options->title() ?>
</a>
</div>
<nav>
<!--手机版导航菜单图标-->
<div class="collapse">
<div class="ulogo">
<img src="<?php $this->options->logoUrl(); ?>" class="intro-logo">
<!--<?php echo '<img src="' . $logo_path . '" class="intro-logo">' ?>-->
</div>
<!--<i class="fa fa-th-list"></i>-->
</div>
<ul class="header-menu">
<a class="lixue" target="_self" href="<?php $this->options->siteUrl(); ?>">
<li>文章</li>
</a>
<!--导航菜单-->
<?php $this->widget('Widget_Contents_Page_List')->to($pages); ?>
<?php while($pages->next()): ?>
<a class="lixue" target="_self" <?php if($this->is('page', $pages->slug)): ?><?php endif; ?>href="<?php $pages->permalink(); ?>">
<li><?php $pages->title(); ?></li>
</a>
<?php endwhile; ?>
<script>
function highlightCurrentLink() {
function getCurrentUrl() {
return window.location.href.replace(/\/$/, "");
}
var links = document.querySelectorAll('.lixue');
var currentUrl = getCurrentUrl();
// 获取当前页面的域名
var domain = window.location.hostname;
for (var i = 0; i < links.length; i++) {
var link = links[i];
if (link.href.replace(/\/$/, "") === currentUrl) {
link.classList.add('hactive');
}
}
if (/^\d+\.html$/.test(currentUrl.split('/').pop())) {
var link = document.querySelector('.lixue');
link.setAttribute('href', 'https://' + domain);
link.classList.add('hactive');
}
// 检查当前页面是否在下面的集合中(没有这个需求可以删掉下面的代码)
var pages = [
"https://" + domain + "/logo.html",
"https://" + domain + "/tv.html",
"https://" + domain + "/video.html",
"https://" + domain + "/wallpaper.html",
"https://" + domain + "/shorts.html",
"https://" + domain + "/shuimo.html",
"https://" + domain + "/touxiang.html"
];
if (pages.includes(currentUrl)) {
// 然后获取这个yule.html链接
var menuLink = document.querySelector('a[href="https://' + domain + '/yule.html"]');
// 添加高亮样式
menuLink.classList.add('hactive');
}
}
highlightCurrentLink();
</script>
</ul>
</nav>
<!--搜索模块-->
<?php if ($this->options->search == 'able'): ?>
<div class="headertop-search">
<form id="search-form" role="search" method="get" class="searchtop-form is-active" action="/index.php">
<label>
<input type="search" class="searchtop-field" placeholder="输入搜索内容" value="" name="s">
</label>
</form>
</div>
<?php endif; ?>
</div> <!-- intro end -->
<div class="tool">
<!--时间-年月日-->
<div class="tools time" id="beijing" >
<script>window.onload = function() {startTime();};</script>
</div>
<!--时间-农历-->
<div class="tools solarlunar">
<script src="<?php $this->options->themeUrl('js/nongli.min.js'); ?>" type="text/javascript"></script>
<script src="<?php $this->options->themeUrl('js/time.js'); ?>" type="text/javascript"></script>
<script>
$(function () {
var lunar = calendar.solar2lunar();
$('.solarlunar').html(''+'农历: '+lunar.gzYear +'年'+'·'+ lunar.IMonthCn+lunar.IDayCn+'');
});
</script>
</div>
<!--时间-周-->
<div class="tools week">
<script>document.write("星期" + "日一二三四五六".charAt(new Date().getDay()))</script>
</div>
<!--音乐分享-->
<div class="tools" id="share_home">
<button id="playButton" title="5首歌曲连续播放">播放音乐</button>
</div>
<!--连续随机播放-->
<script type="text/javascript">
var music_name = ["1.mp3","2.mp3","3.mp3","4.mp3","5.mp3"];
var arr = music_name.map(function(name) {
//这里是歌曲目录列表url地址,然后拼接上面music_name列表中的歌曲名称
return "https://xxx.com/mp3list/ 或者 /mp3/list/ " + name;
});
//监听页面第一次鼠标点击,自动播放歌曲
//var firstMouseClickDetected = false;
/*document.addEventListener('mousedown', function firstMouseClickHandler() {
if (!firstMouseClickDetected) {
if (myAudio.src === '') {
myAudio.src = playlist[currentTrack];
}
myAudio.play();
playButton.innerHTML = '暂停音乐';
firstMouseClickDetected = true;
}
document.removeEventListener('mousedown', firstMouseClickHandler);
});*/
var playlist = shuffle(arr.slice());
var currentTrack = 0;
var hasClickedOnce = false;
var myAudio = new Audio();
myAudio.loop = false;
myAudio.preload = "none";
myAudio.controls = true;
myAudio.controlsList = "nodownload";
myAudio.src = playlist[currentTrack];
var playButton = document.getElementById("playButton");
playButton.addEventListener('click', function() {
if (myAudio.paused) {
if (myAudio.src === '') {
myAudio.src = playlist[currentTrack];
}
myAudio.play();
playButton.innerHTML = '暂停音乐';
} else {
myAudio.pause();
playButton.innerHTML = '播放音乐';
}
});
myAudio.addEventListener('ended', playEndedHandler);
function playEndedHandler() {
currentTrack++;
if (currentTrack < playlist.length) {
myAudio.src = playlist[currentTrack];
myAudio.play();
} else {
currentTrack = 0;
myAudio.src = playlist[currentTrack];
myAudio.play();
}
};
document.addEventListener('click', function() {
if (!hasClickedOnce) {
if (myAudio.paused && myAudio.src === '') {
myAudio.src = playlist[currentTrack];
myAudio.play();
playButton.innerHTML = '暂停音乐';
hasClickedOnce = true; // Set the flag to prevent further clicks.
}
}
});
document.getElementById("share_home").appendChild(myAudio);
function shuffle(array) {
for (let i = array.length - 1; i > 0; i--) {
const j = Math.floor(Math.random() * (i + 1));
[array[i], array[j]] = [array[j], array[i]];
}
return array;
};
</script>
</div> <!-- tool end -->
</div> <!-- header-top end -->
<!--描述-->
<div class="header-siteinfo">
<a class="siteurl" href="<?php $this->options->siteUrl(); ?>" ><?php $this->options->description() ?></a>
</div>
<!--图标按钮-->
<div class="header-social">
<a style="display:none" target="_self" title="公告" href="javascript:;" id="demo">小站告示
<i class="fa fa-bullhorn"></i>
</a>
<a class="contact flink">
<i class="fa fa-envelope"></i>
<div class="icon"><?php $this->options->mlink(); ?></div>
</a>
<a class="contact flink">
<i class="fa fa-qq"></i>
<div class="icon"><?php $this->options->qqlink(); ?></div>
</a>
<script>
var contacts = document.querySelectorAll('.contact');
Array.prototype.forEach.call(contacts, function(contact) {
var div = contact.querySelector('.icon');
contact.addEventListener('mouseenter', function() {
div.classList.add('icons');
});
contact.addEventListener('mouseleave', function() {
div.classList.remove('icons');
});
});
</script>
<a class="flink" href="<?php $this->options->musiclink(); ?>" target="_blank">
<i class="fa fa-headphones"></i>
</a>
<a class="flink" href="<?php $this->options->glink(); ?>" target="_blank">
<i class="fa fa-github"></i>
</a>
</div> <!-- header-social end -->
<!--搜索模块-->
<?php if ($this->options->search == 'able'): ?>
<div class="header-search">
<form id="search-form" role="search" method="get" class="search-form is-active" action="/index.php">
<label>
<input type="search" class="search-field" placeholder="输入搜索内容" value="" name="s">
</label>
</form>
</div>
<?php endif; ?>
<!--波浪样式-->
<div class="twiiuii_layout" id="wave">
<svg class="teditorial" id="teditorial" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 24 150 38" preserveAspectRatio="none">
<defs><path id="tgentle-wave" d="M-160 44 c30 0 58-18 88-18 s58 18 88 18 58-18 88-18 58 18 88 18 v20h-352z" />
</defs>
<g class="tparallax">
<use xlink:href="#tgentle-wave" x="50" y="0" fill="transparent"/>
<use xlink:href="#tgentle-wave" x="50" y="3" fill="transparent"/>
<use xlink:href="#tgentle-wave" x="50" y="6" fill="transparent"/>
<use xlink:href="#tgentle-wave" x="50" y="9" fill="transparent"/>
<use xlink:href="#tgentle-wave" x="50" y="12" fill="transparent"/>
</g>
</svg>
</div>
</header>