q78kgblog 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/HexoSeoAutoPush.yml +36 -0
- package/404.html +933 -0
- package/BingSiteAuth.xml +4 -0
- package/CNAME +1 -0
- package/about/index.html +1096 -0
- package/archives/2022/06/index.html +942 -0
- package/archives/2022/index.html +942 -0
- package/archives/2023/02/index.html +942 -0
- package/archives/2023/04/index.html +942 -0
- package/archives/2023/05/index.html +942 -0
- package/archives/2023/08/index.html +942 -0
- package/archives/2023/09/index.html +942 -0
- package/archives/2023/index.html +942 -0
- package/archives/2024/01/index.html +942 -0
- package/archives/2024/02/index.html +942 -0
- package/archives/2024/index.html +942 -0
- package/archives/index.html +942 -0
- package/assets/css/APlayer.min.css +3 -0
- package/assets/douban-loading.gif +0 -0
- package/assets/js/APlayer.min.js +2 -0
- package/assets/js/Meting.min.js +1 -0
- package/atom.xml +311 -0
- package/baidusitemap.xml +43 -0
- package/bangumis/index.html +1247 -0
- package/bigpie/index.html +714 -0
- package/bing.json +1 -0
- package/categories/Hello-World/index.html +954 -0
- package/categories/Hexo/index.html +954 -0
- package/categories/index.html +710 -0
- package/categories//345/271/264/347/273/210/346/200/273/347/273/223/index.html +954 -0
- package/categories//346/201/260/351/245/255/index.html +954 -0
- package/categories//347/264/240/346/235/220/index.html +954 -0
- package/categories//351/227/262/350/201/212/346/235/202/350/260/210/index.html +954 -0
- package/content.json +1 -0
- package/css/404page.css +65 -0
- package/css/ariasakablog.css +5632 -0
- package/css/commentBarrage.css +111 -0
- package/css/danmaku.css +89 -0
- package/css/essay.css +306 -0
- package/css/iconfont.css +55 -0
- package/css/iconfont.ttf +0 -0
- package/css/iconfont.woff +0 -0
- package/css/iconfont.woff2 +0 -0
- package/css/index.css +7006 -0
- package/css/people.css +18 -0
- package/css/stylessimple.css +40 -0
- package/css/swiper.min.css +701 -0
- package/css/swiperstyle.css +567 -0
- package/css/var.css +0 -0
- package/essay/index.html +701 -0
- package/favicon.ico +0 -0
- package/fcircle/index.html +733 -0
- package/fontawesome/index.html +716 -0
- package/google.txt +10 -0
- package/googlebe706248808ee393.html +1 -0
- package/img/144.png +0 -0
- package/img/16.png +0 -0
- package/img/1666416625095-iPhone X.png +0 -0
- package/img/1666416702650-Macbook Pro 2016 (1).png +0 -0
- package/img/1666416764216-Nexus 9.png +0 -0
- package/img/180.png +0 -0
- package/img/192.png +0 -0
- package/img/20200904222157.png +0 -0
- package/img/20200924153652.png +0 -0
- package/img/256.png +0 -0
- package/img/36.png +0 -0
- package/img/48.png +0 -0
- package/img/512.png +0 -0
- package/img/72.png +0 -0
- package/img/72645310.jpg +0 -0
- package/img/8DSTSS20990281646044689944.PNG +0 -0
- package/img/96.png +0 -0
- package/img/O35HOG22090681654187900371.jpg +0 -0
- package/img/a.webp +0 -0
- package/img/ad.png +0 -0
- package/img/apple-touch-icon.png +0 -0
- package/img/avatar.jpg +0 -0
- package/img/buYgVO22990681624844309044.jpg +0 -0
- package/img/comment.png +0 -0
- package/img/favicon.ico +0 -0
- package/img/favicon.jpg +0 -0
- package/img/friend_404.gif +0 -0
- package/img/mqaizf23990681654186719414.jpeg +0 -0
- package/img/nyancat.gif +0 -0
- package/img/siteshot.png +0 -0
- package/img/uTools_1666416859497-iMac.png +0 -0
- package/img-col/index.html +802 -0
- package/index.html +1056 -0
- package/js/aplayersave.js +268 -0
- package/js/baiduhistory.js +76 -0
- package/js/bbtalk.js +11354 -0
- package/js/bbtalklunbo.js +78 -0
- package/js/browser.js +35 -0
- package/js/calendar.js +380 -0
- package/js/cate.js +22 -0
- package/js/commentBarrage.js +240 -0
- package/js/commentsCount.js +43 -0
- package/js/copy.js +23 -0
- package/js/countup.js +209 -0
- package/js/cursor.js +82 -0
- package/js/danmaku.js +106 -0
- package/js/day.js +199 -0
- package/js/dianzan.js +249 -0
- package/js/dis.js +255 -0
- package/js/dist/baiduhistory.dev.js +102 -0
- package/js/dist/bbtalk.dev.js +12876 -0
- package/js/dist/bbtalklunbo.dev.js +45 -0
- package/js/dist/calendar.dev.js +395 -0
- package/js/dist/fixbugpjax.dev.js +8 -0
- package/js/dist/gongnong.dev.js +565 -0
- package/js/dist/heimu.dev.js +19 -0
- package/js/dist/links.dev.js +13 -0
- package/js/dist/main.dev.js +845 -0
- package/js/dist/resizeTop.dev.js +50 -0
- package/js/dist/seo.dev.js +33 -0
- package/js/dist/twikoo.all.min.dev.js +1 -0
- package/js/fixbugpjax.js +7 -0
- package/js/fixed_card_widget.js +46 -0
- package/js/fps.js +58 -0
- package/js/gitalker.js +11 -0
- package/js/gsap.min.js +11 -0
- package/js/heimu.js +16 -0
- package/js/hide.show.js +17 -0
- package/js/jike.js +121 -0
- package/js/jikewater.js +60 -0
- package/js/languages.js +511 -0
- package/js/latest.js +49 -0
- package/js/local-search.js +476 -0
- package/js/lunar.js +1071 -0
- package/js/lyxTalk.js +12 -0
- package/js/main.js +783 -0
- package/js/nav.js +30 -0
- package/js/noie.js +3 -0
- package/js/owo.js +52 -0
- package/js/people.js +175 -0
- package/js/pikaday.js +109 -0
- package/js/random.js +1 -0
- package/js/randomFriend.js +95 -0
- package/js/resizeTop.js +43 -0
- package/js/rightmenu.js +335 -0
- package/js/sakura.js +164 -0
- package/js/search/algolia.js +155 -0
- package/js/search/local-search.js +188 -0
- package/js/settings.js +353 -0
- package/js/sitetime.js +25 -0
- package/js/smooth-scrolling.js +546 -0
- package/js/sw-toolbox.js +16 -0
- package/js/swiperinit.js +23 -0
- package/js/tw_cn.js +100 -0
- package/js/twikoo.all.min.js +2 -0
- package/js/utils.js +278 -0
- package/js/welcome.js +107 -0
- package/js/welcomeconsole.js +23 -0
- package/links/index.html +842 -0
- package/live2d-widget/LICENSE +674 -0
- package/live2d-widget/README.md +188 -0
- package/live2d-widget/assets/screenshot-1.png +0 -0
- package/live2d-widget/assets/screenshot-2.png +0 -0
- package/live2d-widget/assets/screenshot-3.png +0 -0
- package/live2d-widget/autoload.js +63 -0
- package/live2d-widget/demo/demo.html +34 -0
- package/live2d-widget/demo/login.html +271 -0
- package/live2d-widget/live2d.min.js +1 -0
- package/live2d-widget/package.json +31 -0
- package/live2d-widget/rollup.config.js +38 -0
- package/live2d-widget/src/index.js +178 -0
- package/live2d-widget/src/message.js +22 -0
- package/live2d-widget/src/model.js +75 -0
- package/live2d-widget/src/tools.js +78 -0
- package/live2d-widget/src/utils.js +5 -0
- package/live2d-widget/src/waifu-tips.js +3 -0
- package/live2d-widget/waifu-tips.js +5 -0
- package/live2d-widget/waifu-tips.json +255 -0
- package/live2d-widget/waifu.css +310 -0
- package/manifest.json +1 -0
- package/noie.html +69 -0
- package/othersite/index.html +779 -0
- package/owo.json +1 -0
- package/package.json +1 -0
- package/people.html +24 -0
- package/posts/164ef646/index.html +1027 -0
- package/posts/228c2ef8/index.html +1014 -0
- package/posts/4a17b156/index.html +1010 -0
- package/posts/6f3c565b/index.html +1013 -0
- package/posts/7da7c3f6/index.html +1070 -0
- package/posts/a9a6c1fb/index.html +1041 -0
- package/posts/c262e439/index.html +1002 -0
- package/posts/c81531cf/index.html +1080 -0
- package/posts/da2093a1/index.html +1022 -0
- package/posts/e54f7476/index.html +1052 -0
- package/projects.html +424 -0
- package/random.html +32 -0
- package/robots.txt +17 -0
- package/search.xml +309 -0
- package/sitemap.txt +62 -0
- package/sitemap.xml +488 -0
- package/sw.js +190 -0
- package/swReg.js +29 -0
- package/tags/AI/index.html +955 -0
- package/tags/Butterfly/index.html +955 -0
- package/tags/Cloudflare/index.html +955 -0
- package/tags/DiffSinger/index.html +955 -0
- package/tags/Hexo/index.html +955 -0
- package/tags/Next/index.html +955 -0
- package/tags/RAID/index.html +955 -0
- package/tags/VPS/index.html +955 -0
- package/tags/Vercel/index.html +955 -0
- package/tags/Workers/index.html +955 -0
- package/tags/hello-world/index.html +955 -0
- package/tags/index.html +710 -0
- package/tags//344/270/273/351/242/230/index.html +955 -0
- package/tags//344/272/221/346/234/215/345/212/241/345/231/250/index.html +955 -0
- package/tags//344/276/277/345/256/234/index.html +955 -0
- package/tags//345/206/231/344/275/234/index.html +955 -0
- package/tags//345/245/263/346/200/247/346/204/217/350/257/206/index.html +955 -0
- package/tags//345/255/246/344/271/240/index.html +955 -0
- package/tags//345/256/266/351/207/214/344/272/221/index.html +955 -0
- package/tags//345/271/264/347/273/210/346/200/273/347/273/223/index.html +955 -0
- package/tags//346/200/247/344/273/267/346/257/224/index.html +955 -0
- package/tags//346/212/230/350/205/276/index.html +955 -0
- package/tags//346/217/220/344/276/233/345/225/206/index.html +955 -0
- package/tags//346/227/245/345/270/270/index.html +955 -0
- package/tags//346/234/215/345/212/241/345/231/250/index.html +955 -0
- package/tags//346/265/252/346/275/256/index.html +955 -0
- package/tags//347/256/200/347/210/261/index.html +955 -0
- package/tags//350/207/252/345/212/250/346/240/207/346/263/250/index.html +955 -0
- package/tags//350/256/272/346/226/207/index.html +955 -0
- package/tags//350/260/267/346/255/214/347/277/273/350/257/221/index.html +955 -0
- package/tags//350/264/237/350/275/275/345/235/207/350/241/241/index.html +955 -0
- package/tags//351/207/221/345/217/245/index.html +955 -0
- package/tags//351/255/224/346/224/271/index.html +955 -0
@@ -0,0 +1,845 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
4
|
+
|
5
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }
|
6
|
+
|
7
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); }
|
8
|
+
|
9
|
+
function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); }
|
10
|
+
|
11
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } }
|
12
|
+
|
13
|
+
document.addEventListener('DOMContentLoaded', function () {
|
14
|
+
var blogNameWidth, menusWidth, searchWidth, $nav;
|
15
|
+
var mobileSidebarOpen = false;
|
16
|
+
|
17
|
+
var adjustMenu = function adjustMenu(init) {
|
18
|
+
if (init) {
|
19
|
+
blogNameWidth = document.getElementById('site-name').offsetWidth;
|
20
|
+
var $menusEle = document.querySelectorAll('#menus .menus_item');
|
21
|
+
menusWidth = 0;
|
22
|
+
$menusEle.length && $menusEle.forEach(function (i) {
|
23
|
+
menusWidth += i.offsetWidth;
|
24
|
+
});
|
25
|
+
var $searchEle = document.querySelector('#search-button');
|
26
|
+
searchWidth = $searchEle ? $searchEle.offsetWidth : 0;
|
27
|
+
$nav = document.getElementById('nav');
|
28
|
+
}
|
29
|
+
|
30
|
+
var hideMenuIndex = '';
|
31
|
+
if (window.innerWidth < 768) hideMenuIndex = true;else hideMenuIndex = blogNameWidth + menusWidth + searchWidth > $nav.offsetWidth - 120;
|
32
|
+
|
33
|
+
if (hideMenuIndex) {
|
34
|
+
$nav.classList.add('hide-menu');
|
35
|
+
} else {
|
36
|
+
$nav.classList.remove('hide-menu');
|
37
|
+
}
|
38
|
+
}; // 初始化header
|
39
|
+
|
40
|
+
|
41
|
+
var initAdjust = function initAdjust() {
|
42
|
+
adjustMenu(true);
|
43
|
+
$nav.classList.add('show');
|
44
|
+
}; // sidebar menus
|
45
|
+
|
46
|
+
|
47
|
+
var sidebarFn = {
|
48
|
+
open: function open() {
|
49
|
+
btf.sidebarPaddingR();
|
50
|
+
document.body.style.overflow = 'hidden';
|
51
|
+
btf.animateIn(document.getElementById('menu-mask'), 'to_show 0.5s');
|
52
|
+
document.getElementById('sidebar-menus').classList.add('open');
|
53
|
+
mobileSidebarOpen = true;
|
54
|
+
},
|
55
|
+
close: function close() {
|
56
|
+
var $body = document.body;
|
57
|
+
$body.style.overflow = '';
|
58
|
+
$body.style.paddingRight = '';
|
59
|
+
btf.animateOut(document.getElementById('menu-mask'), 'to_hide 0.5s');
|
60
|
+
document.getElementById('sidebar-menus').classList.remove('open');
|
61
|
+
mobileSidebarOpen = false;
|
62
|
+
}
|
63
|
+
};
|
64
|
+
/**
|
65
|
+
* 首頁top_img底下的箭頭
|
66
|
+
*/
|
67
|
+
|
68
|
+
var scrollDownInIndex = function scrollDownInIndex() {
|
69
|
+
var $scrollDownEle = document.getElementById('scroll-down');
|
70
|
+
$scrollDownEle && $scrollDownEle.addEventListener('click', function () {
|
71
|
+
btf.scrollToDest(document.getElementById('content-inner').offsetTop, 300);
|
72
|
+
});
|
73
|
+
};
|
74
|
+
/**
|
75
|
+
* 代碼
|
76
|
+
* 只適用於Hexo默認的代碼渲染
|
77
|
+
*/
|
78
|
+
|
79
|
+
|
80
|
+
var addHighlightTool = function addHighlightTool() {
|
81
|
+
var highLight = GLOBAL_CONFIG.highlight;
|
82
|
+
if (!highLight) return;
|
83
|
+
var isHighlightCopy = highLight.highlightCopy;
|
84
|
+
var isHighlightLang = highLight.highlightLang;
|
85
|
+
var isHighlightShrink = GLOBAL_CONFIG_SITE.isHighlightShrink;
|
86
|
+
var highlightHeightLimit = highLight.highlightHeightLimit;
|
87
|
+
var isShowTool = isHighlightCopy || isHighlightLang || isHighlightShrink !== undefined;
|
88
|
+
var $figureHighlight = highLight.plugin === 'highlighjs' ? document.querySelectorAll('figure.highlight') : document.querySelectorAll('pre[class*="language-"]');
|
89
|
+
if (!((isShowTool || highlightHeightLimit) && $figureHighlight.length)) return;
|
90
|
+
var isPrismjs = highLight.plugin === 'prismjs';
|
91
|
+
var highlightShrinkEle = '';
|
92
|
+
var highlightCopyEle = '';
|
93
|
+
var highlightShrinkClass = isHighlightShrink === true ? 'closed' : '';
|
94
|
+
|
95
|
+
if (isHighlightShrink !== undefined) {
|
96
|
+
highlightShrinkEle = "<i class=\"fas fa-angle-down expand ".concat(highlightShrinkClass, "\"></i>");
|
97
|
+
}
|
98
|
+
|
99
|
+
if (isHighlightCopy) {
|
100
|
+
highlightCopyEle = '<div class="copy-notice"></div><i class="fas fa-paste copy-button"></i>';
|
101
|
+
}
|
102
|
+
|
103
|
+
var copy = function copy(text, ctx) {
|
104
|
+
if (document.queryCommandSupported && document.queryCommandSupported('copy')) {
|
105
|
+
document.execCommand('copy');
|
106
|
+
|
107
|
+
if (GLOBAL_CONFIG.Snackbar !== undefined) {
|
108
|
+
btf.snackbarShow(GLOBAL_CONFIG.copy.success);
|
109
|
+
} else {
|
110
|
+
var prevEle = ctx.previousElementSibling;
|
111
|
+
prevEle.innerText = GLOBAL_CONFIG.copy.success;
|
112
|
+
prevEle.style.opacity = 1;
|
113
|
+
setTimeout(function () {
|
114
|
+
prevEle.style.opacity = 0;
|
115
|
+
}, 700);
|
116
|
+
}
|
117
|
+
} else {
|
118
|
+
if (GLOBAL_CONFIG.Snackbar !== undefined) {
|
119
|
+
btf.snackbarShow(GLOBAL_CONFIG.copy.noSupport);
|
120
|
+
} else {
|
121
|
+
ctx.previousElementSibling.innerText = GLOBAL_CONFIG.copy.noSupport;
|
122
|
+
}
|
123
|
+
}
|
124
|
+
}; // click events
|
125
|
+
|
126
|
+
|
127
|
+
var highlightCopyFn = function highlightCopyFn(ele) {
|
128
|
+
var $buttonParent = ele.parentNode;
|
129
|
+
$buttonParent.classList.add('copy-true');
|
130
|
+
var selection = window.getSelection();
|
131
|
+
var range = document.createRange();
|
132
|
+
if (isPrismjs) range.selectNodeContents($buttonParent.querySelectorAll('pre code')[0]);else range.selectNodeContents($buttonParent.querySelectorAll('table .code pre')[0]);
|
133
|
+
selection.removeAllRanges();
|
134
|
+
selection.addRange(range);
|
135
|
+
var text = selection.toString();
|
136
|
+
copy(text, ele.lastChild);
|
137
|
+
selection.removeAllRanges();
|
138
|
+
$buttonParent.classList.remove('copy-true');
|
139
|
+
};
|
140
|
+
|
141
|
+
var highlightShrinkFn = function highlightShrinkFn(ele) {
|
142
|
+
var $nextEle = _toConsumableArray(ele.parentNode.children).slice(1);
|
143
|
+
|
144
|
+
ele.firstChild.classList.toggle('closed');
|
145
|
+
|
146
|
+
if (btf.isHidden($nextEle[$nextEle.length - 1])) {
|
147
|
+
$nextEle.forEach(function (e) {
|
148
|
+
e.style.display = 'block';
|
149
|
+
});
|
150
|
+
} else {
|
151
|
+
$nextEle.forEach(function (e) {
|
152
|
+
e.style.display = 'none';
|
153
|
+
});
|
154
|
+
}
|
155
|
+
};
|
156
|
+
|
157
|
+
var highlightToolsFn = function highlightToolsFn(e) {
|
158
|
+
var $target = e.target.classList;
|
159
|
+
if ($target.contains('expand')) highlightShrinkFn(this);else if ($target.contains('copy-button')) highlightCopyFn(this);
|
160
|
+
};
|
161
|
+
|
162
|
+
var expandCode = function expandCode() {
|
163
|
+
this.classList.toggle('expand-done');
|
164
|
+
};
|
165
|
+
|
166
|
+
function createEle(lang, item, service) {
|
167
|
+
var fragment = document.createDocumentFragment();
|
168
|
+
|
169
|
+
if (isShowTool) {
|
170
|
+
var hlTools = document.createElement('div');
|
171
|
+
hlTools.className = "highlight-tools ".concat(highlightShrinkClass);
|
172
|
+
hlTools.innerHTML = highlightShrinkEle + lang + highlightCopyEle;
|
173
|
+
hlTools.addEventListener('click', highlightToolsFn);
|
174
|
+
fragment.appendChild(hlTools);
|
175
|
+
}
|
176
|
+
|
177
|
+
if (highlightHeightLimit && item.offsetHeight > highlightHeightLimit + 30) {
|
178
|
+
var ele = document.createElement('div');
|
179
|
+
ele.className = 'code-expand-btn';
|
180
|
+
ele.innerHTML = '<i class="fas fa-angle-double-down"></i>';
|
181
|
+
ele.addEventListener('click', expandCode);
|
182
|
+
fragment.appendChild(ele);
|
183
|
+
}
|
184
|
+
|
185
|
+
if (service === 'hl') {
|
186
|
+
item.insertBefore(fragment, item.firstChild);
|
187
|
+
} else {
|
188
|
+
item.parentNode.insertBefore(fragment, item);
|
189
|
+
}
|
190
|
+
}
|
191
|
+
|
192
|
+
if (isHighlightLang) {
|
193
|
+
if (isPrismjs) {
|
194
|
+
$figureHighlight.forEach(function (item) {
|
195
|
+
var langName = item.getAttribute('data-language') ? item.getAttribute('data-language') : 'Code';
|
196
|
+
var highlightLangEle = "<div class=\"code-lang\">".concat(langName, "</div>");
|
197
|
+
btf.wrap(item, 'figure', {
|
198
|
+
"class": 'highlight'
|
199
|
+
});
|
200
|
+
createEle(highlightLangEle, item);
|
201
|
+
});
|
202
|
+
} else {
|
203
|
+
$figureHighlight.forEach(function (item) {
|
204
|
+
var langName = item.getAttribute('class').split(' ')[1];
|
205
|
+
if (langName === 'plain' || langName === undefined) langName = 'Code';
|
206
|
+
var highlightLangEle = "<div class=\"code-lang\">".concat(langName, "</div>");
|
207
|
+
createEle(highlightLangEle, item, 'hl');
|
208
|
+
});
|
209
|
+
}
|
210
|
+
} else {
|
211
|
+
if (isPrismjs) {
|
212
|
+
$figureHighlight.forEach(function (item) {
|
213
|
+
btf.wrap(item, 'figure', {
|
214
|
+
"class": 'highlight'
|
215
|
+
});
|
216
|
+
createEle('', item);
|
217
|
+
});
|
218
|
+
} else {
|
219
|
+
$figureHighlight.forEach(function (item) {
|
220
|
+
createEle('', item, 'hl');
|
221
|
+
});
|
222
|
+
}
|
223
|
+
}
|
224
|
+
};
|
225
|
+
/**
|
226
|
+
* PhotoFigcaption
|
227
|
+
*/
|
228
|
+
|
229
|
+
|
230
|
+
function addPhotoFigcaption() {
|
231
|
+
document.querySelectorAll('#article-container img').forEach(function (item) {
|
232
|
+
var parentEle = item.parentNode;
|
233
|
+
var altValue = item.title || item.alt;
|
234
|
+
|
235
|
+
if (altValue && !parentEle.parentNode.classList.contains('justified-gallery')) {
|
236
|
+
var ele = document.createElement('div');
|
237
|
+
ele.className = 'img-alt is-center';
|
238
|
+
ele.textContent = altValue;
|
239
|
+
parentEle.insertBefore(ele, item.nextSibling);
|
240
|
+
}
|
241
|
+
});
|
242
|
+
}
|
243
|
+
/**
|
244
|
+
* Lightbox
|
245
|
+
*/
|
246
|
+
|
247
|
+
|
248
|
+
var runLightbox = function runLightbox() {
|
249
|
+
btf.loadLightbox(document.querySelectorAll('#article-container img:not(.no-lightbox)'));
|
250
|
+
};
|
251
|
+
/**
|
252
|
+
* justified-gallery 圖庫排版
|
253
|
+
*/
|
254
|
+
|
255
|
+
|
256
|
+
var runJustifiedGallery = function runJustifiedGallery(ele) {
|
257
|
+
ele.forEach(function (item) {
|
258
|
+
var $imgList = item.querySelectorAll('img');
|
259
|
+
$imgList.forEach(function (i) {
|
260
|
+
var dataLazySrc = i.getAttribute('data-lazy-src');
|
261
|
+
if (dataLazySrc) i.src = dataLazySrc;
|
262
|
+
btf.wrap(i, 'div', {
|
263
|
+
"class": 'fj-gallery-item'
|
264
|
+
});
|
265
|
+
});
|
266
|
+
});
|
267
|
+
|
268
|
+
if (window.fjGallery) {
|
269
|
+
setTimeout(function () {
|
270
|
+
btf.initJustifiedGallery(ele);
|
271
|
+
}, 100);
|
272
|
+
return;
|
273
|
+
}
|
274
|
+
|
275
|
+
var newEle = document.createElement('link');
|
276
|
+
newEle.rel = 'stylesheet';
|
277
|
+
newEle.href = GLOBAL_CONFIG.source.justifiedGallery.css;
|
278
|
+
document.body.appendChild(newEle);
|
279
|
+
getScript("".concat(GLOBAL_CONFIG.source.justifiedGallery.js)).then(function () {
|
280
|
+
btf.initJustifiedGallery(ele);
|
281
|
+
});
|
282
|
+
};
|
283
|
+
/**
|
284
|
+
* 滾動處理
|
285
|
+
*/
|
286
|
+
|
287
|
+
|
288
|
+
var scrollFn = function scrollFn() {
|
289
|
+
var $rightside = document.getElementById('rightside');
|
290
|
+
var innerHeight = window.innerHeight + 56; // 當滾動條小于 56 的時候
|
291
|
+
|
292
|
+
if (document.body.scrollHeight <= innerHeight) {
|
293
|
+
$rightside.style.cssText = 'opacity: 1; transform: translateX(-58px)';
|
294
|
+
return;
|
295
|
+
} // find the scroll direction
|
296
|
+
|
297
|
+
|
298
|
+
function scrollDirection(currentTop) {
|
299
|
+
var result = currentTop > initTop; // true is down & false is up
|
300
|
+
|
301
|
+
initTop = currentTop;
|
302
|
+
return result;
|
303
|
+
}
|
304
|
+
|
305
|
+
var initTop = 0;
|
306
|
+
var isChatShow = true;
|
307
|
+
var $header = document.getElementById('page-header');
|
308
|
+
var isChatBtnHide = typeof chatBtnHide === 'function';
|
309
|
+
var isChatBtnShow = typeof chatBtnShow === 'function';
|
310
|
+
$header.classList.add('nav-fixed');
|
311
|
+
$header.classList.add('nav-visible');
|
312
|
+
|
313
|
+
window.scrollCollect = function () {
|
314
|
+
return btf.throttle(function (e) {
|
315
|
+
var currentTop = window.scrollY || document.documentElement.scrollTop;
|
316
|
+
var isDown = scrollDirection(currentTop);
|
317
|
+
$header.classList.add('nav-fixed');
|
318
|
+
$header.classList.add('nav-visible');
|
319
|
+
|
320
|
+
if (currentTop > 0) {
|
321
|
+
if (isDown) {
|
322
|
+
if ($header.classList.contains('nav-visible')) $header.classList.add('nav-visible');
|
323
|
+
|
324
|
+
if (isChatBtnShow && isChatShow === true) {
|
325
|
+
chatBtnHide();
|
326
|
+
isChatShow = false;
|
327
|
+
}
|
328
|
+
} else {
|
329
|
+
if (!$header.classList.contains('nav-visible')) $header.classList.add('nav-visible');
|
330
|
+
|
331
|
+
if (isChatBtnHide && isChatShow === false) {
|
332
|
+
chatBtnShow();
|
333
|
+
isChatShow = true;
|
334
|
+
}
|
335
|
+
}
|
336
|
+
|
337
|
+
$header.classList.add('nav-fixed');
|
338
|
+
|
339
|
+
if (window.getComputedStyle($rightside).getPropertyValue('opacity') === '0') {
|
340
|
+
$rightside.style.cssText = ' transform: translateX(-58px)';
|
341
|
+
}
|
342
|
+
} else {
|
343
|
+
if (currentTop === 0) {
|
344
|
+
$header.classList.remove('nav-fixed', 'nav-visible');
|
345
|
+
} // $rightside.style.cssText = "opacity: ''; transform: ''"
|
346
|
+
|
347
|
+
}
|
348
|
+
|
349
|
+
if (document.body.scrollHeight <= innerHeight) {//$rightside.style.cssText = 'opacity: 0.8; transform: translateX(-58px)'
|
350
|
+
}
|
351
|
+
}, 200)();
|
352
|
+
};
|
353
|
+
|
354
|
+
window.addEventListener('scroll', scrollCollect);
|
355
|
+
};
|
356
|
+
/**
|
357
|
+
* toc,anchor
|
358
|
+
*/
|
359
|
+
|
360
|
+
|
361
|
+
var scrollFnToDo = function scrollFnToDo() {
|
362
|
+
var isToc = GLOBAL_CONFIG_SITE.isToc;
|
363
|
+
var isAnchor = GLOBAL_CONFIG.isAnchor;
|
364
|
+
var $article = document.getElementById('article-container');
|
365
|
+
if (!($article && (isToc || isAnchor))) return;
|
366
|
+
var $tocLink, $cardToc, scrollPercent, autoScrollToc, isExpand;
|
367
|
+
|
368
|
+
if (isToc) {
|
369
|
+
var $cardTocLayout = document.getElementById('card-toc');
|
370
|
+
$cardToc = $cardTocLayout.getElementsByClassName('toc-content')[0];
|
371
|
+
$tocLink = $cardToc.querySelectorAll('.toc-link');
|
372
|
+
var $tocPercentage = $cardTocLayout.querySelector('.toc-percentage');
|
373
|
+
isExpand = $cardToc.classList.contains('is-expand');
|
374
|
+
|
375
|
+
scrollPercent = function scrollPercent(currentTop) {
|
376
|
+
var docHeight = $article.clientHeight;
|
377
|
+
var winHeight = document.documentElement.clientHeight;
|
378
|
+
var headerHeight = $article.offsetTop;
|
379
|
+
var contentMath = docHeight > winHeight ? docHeight - winHeight : document.documentElement.scrollHeight - winHeight;
|
380
|
+
var scrollPercent = (currentTop - headerHeight) / contentMath;
|
381
|
+
var scrollPercentRounded = Math.round(scrollPercent * 100);
|
382
|
+
var percentage = scrollPercentRounded > 100 ? 100 : scrollPercentRounded <= 0 ? 0 : scrollPercentRounded;
|
383
|
+
$tocPercentage.textContent = percentage;
|
384
|
+
};
|
385
|
+
|
386
|
+
window.mobileToc = {
|
387
|
+
open: function open() {
|
388
|
+
$cardTocLayout.style.cssText = 'animation: toc-open .3s; opacity: 1; right: 55px';
|
389
|
+
},
|
390
|
+
close: function close() {
|
391
|
+
$cardTocLayout.style.animation = 'toc-close .2s';
|
392
|
+
setTimeout(function () {
|
393
|
+
$cardTocLayout.style.cssText = "opacity:''; animation: ''; right: ''";
|
394
|
+
}, 100);
|
395
|
+
}
|
396
|
+
}; // toc元素點擊
|
397
|
+
|
398
|
+
$cardToc.addEventListener('click', function (e) {
|
399
|
+
e.preventDefault();
|
400
|
+
var target = e.target.classList;
|
401
|
+
if (target.contains('toc-content')) return;
|
402
|
+
var $target = target.contains('toc-link') ? e.target : e.target.parentElement;
|
403
|
+
btf.scrollToDest(btf.getEleTop(document.getElementById(decodeURI($target.getAttribute('href')).replace('#', ''))), 300);
|
404
|
+
|
405
|
+
if (window.innerWidth < 900) {
|
406
|
+
window.mobileToc.close();
|
407
|
+
}
|
408
|
+
});
|
409
|
+
|
410
|
+
autoScrollToc = function autoScrollToc(item) {
|
411
|
+
var activePosition = item.getBoundingClientRect().top;
|
412
|
+
var sidebarScrollTop = $cardToc.scrollTop;
|
413
|
+
|
414
|
+
if (activePosition > document.documentElement.clientHeight - 100) {
|
415
|
+
$cardToc.scrollTop = sidebarScrollTop + 150;
|
416
|
+
}
|
417
|
+
|
418
|
+
if (activePosition < 100) {
|
419
|
+
$cardToc.scrollTop = sidebarScrollTop - 150;
|
420
|
+
}
|
421
|
+
};
|
422
|
+
} // find head position & add active class
|
423
|
+
|
424
|
+
|
425
|
+
var list = $article.querySelectorAll('h1,h2,h3,h4,h5,h6');
|
426
|
+
var detectItem = '';
|
427
|
+
|
428
|
+
var findHeadPosition = function findHeadPosition(top) {
|
429
|
+
if (top === 0) {
|
430
|
+
return false;
|
431
|
+
}
|
432
|
+
|
433
|
+
var currentId = '';
|
434
|
+
var currentIndex = '';
|
435
|
+
list.forEach(function (ele, index) {
|
436
|
+
if (top > btf.getEleTop(ele) - 80) {
|
437
|
+
var id = ele.id;
|
438
|
+
currentId = id ? '#' + encodeURI(id) : '';
|
439
|
+
currentIndex = index;
|
440
|
+
}
|
441
|
+
});
|
442
|
+
if (detectItem === currentIndex) return;
|
443
|
+
if (isAnchor) btf.updateAnchor(currentId);
|
444
|
+
detectItem = currentIndex;
|
445
|
+
|
446
|
+
if (isToc) {
|
447
|
+
$cardToc.querySelectorAll('.active').forEach(function (i) {
|
448
|
+
i.classList.remove('active');
|
449
|
+
});
|
450
|
+
|
451
|
+
if (currentId === '') {
|
452
|
+
return;
|
453
|
+
}
|
454
|
+
|
455
|
+
var currentActive = $tocLink[currentIndex];
|
456
|
+
currentActive.classList.add('active');
|
457
|
+
setTimeout(function () {
|
458
|
+
autoScrollToc(currentActive);
|
459
|
+
}, 0);
|
460
|
+
if (isExpand) return;
|
461
|
+
var parent = currentActive.parentNode;
|
462
|
+
|
463
|
+
for (; !parent.matches('.toc'); parent = parent.parentNode) {
|
464
|
+
if (parent.matches('li')) parent.classList.add('active');
|
465
|
+
}
|
466
|
+
}
|
467
|
+
}; // main of scroll
|
468
|
+
|
469
|
+
|
470
|
+
window.tocScrollFn = function () {
|
471
|
+
return btf.throttle(function () {
|
472
|
+
var currentTop = window.scrollY || document.documentElement.scrollTop;
|
473
|
+
isToc && scrollPercent(currentTop);
|
474
|
+
findHeadPosition(currentTop);
|
475
|
+
}, 100)();
|
476
|
+
};
|
477
|
+
|
478
|
+
window.addEventListener('scroll', tocScrollFn);
|
479
|
+
};
|
480
|
+
/**
|
481
|
+
* Rightside
|
482
|
+
*/
|
483
|
+
|
484
|
+
|
485
|
+
var rightSideFn = {
|
486
|
+
switchReadMode: function switchReadMode() {
|
487
|
+
// read-mode
|
488
|
+
var $body = document.body;
|
489
|
+
$body.classList.add('read-mode');
|
490
|
+
var newEle = document.createElement('button');
|
491
|
+
newEle.type = 'button';
|
492
|
+
newEle.className = 'fas fa-sign-out-alt exit-readmode';
|
493
|
+
$body.appendChild(newEle);
|
494
|
+
|
495
|
+
function clickFn() {
|
496
|
+
$body.classList.remove('read-mode');
|
497
|
+
newEle.remove();
|
498
|
+
newEle.removeEventListener('click', clickFn);
|
499
|
+
}
|
500
|
+
|
501
|
+
newEle.addEventListener('click', clickFn);
|
502
|
+
},
|
503
|
+
switchDarkMode: function switchDarkMode() {
|
504
|
+
// Switch Between Light And Dark Mode
|
505
|
+
var nowMode = document.documentElement.getAttribute('data-theme') === 'dark' ? 'dark' : 'light';
|
506
|
+
|
507
|
+
if (nowMode === 'light') {
|
508
|
+
activateDarkMode();
|
509
|
+
saveToLocal.set('theme', 'dark', 2);
|
510
|
+
GLOBAL_CONFIG.Snackbar !== undefined && btf.snackbarShow(GLOBAL_CONFIG.Snackbar.day_to_night);
|
511
|
+
} else {
|
512
|
+
activateLightMode();
|
513
|
+
saveToLocal.set('theme', 'light', 2);
|
514
|
+
GLOBAL_CONFIG.Snackbar !== undefined && btf.snackbarShow(GLOBAL_CONFIG.Snackbar.night_to_day);
|
515
|
+
} // handle some cases
|
516
|
+
|
517
|
+
|
518
|
+
typeof utterancesTheme === 'function' && utterancesTheme();
|
519
|
+
typeof changeGiscusTheme === 'function' && changeGiscusTheme();
|
520
|
+
(typeof FB === "undefined" ? "undefined" : _typeof(FB)) === 'object' && window.loadFBComment();
|
521
|
+
window.DISQUS && document.getElementById('disqus_thread').children.length && setTimeout(function () {
|
522
|
+
return window.disqusReset();
|
523
|
+
}, 200);
|
524
|
+
typeof runMermaid === 'function' && window.runMermaid();
|
525
|
+
},
|
526
|
+
showOrHideBtn: function showOrHideBtn(e) {
|
527
|
+
// rightside 點擊設置 按鈕 展開
|
528
|
+
var rightsideHideClassList = document.getElementById('rightside-config-hide').classList;
|
529
|
+
rightsideHideClassList.toggle('show');
|
530
|
+
|
531
|
+
if (e.classList.contains('show')) {
|
532
|
+
rightsideHideClassList.add('status');
|
533
|
+
setTimeout(function () {
|
534
|
+
rightsideHideClassList.remove('status');
|
535
|
+
}, 300);
|
536
|
+
}
|
537
|
+
|
538
|
+
e.classList.toggle('show');
|
539
|
+
},
|
540
|
+
scrollToTop: function scrollToTop() {
|
541
|
+
// Back to top
|
542
|
+
btf.scrollToDest(0, 500);
|
543
|
+
},
|
544
|
+
hideAsideBtn: function hideAsideBtn() {
|
545
|
+
// Hide aside
|
546
|
+
var $htmlDom = document.documentElement.classList;
|
547
|
+
$htmlDom.contains('hide-aside') ? saveToLocal.set('aside-status', 'show', 2) : saveToLocal.set('aside-status', 'hide', 2);
|
548
|
+
$htmlDom.toggle('hide-aside');
|
549
|
+
},
|
550
|
+
runMobileToc: function runMobileToc() {
|
551
|
+
if (window.getComputedStyle(document.getElementById('card-toc')).getPropertyValue('opacity') === '0') window.mobileToc.open();else window.mobileToc.close();
|
552
|
+
}
|
553
|
+
};
|
554
|
+
document.getElementById('rightside').addEventListener('click', function (e) {
|
555
|
+
var $target = e.target.id ? e.target : e.target.parentNode;
|
556
|
+
|
557
|
+
switch ($target.id) {
|
558
|
+
case 'go-up':
|
559
|
+
rightSideFn.scrollToTop();
|
560
|
+
break;
|
561
|
+
|
562
|
+
case 'rightside_config':
|
563
|
+
rightSideFn.showOrHideBtn($target);
|
564
|
+
break;
|
565
|
+
|
566
|
+
case 'mobile-toc-button':
|
567
|
+
rightSideFn.runMobileToc();
|
568
|
+
break;
|
569
|
+
|
570
|
+
case 'readmode':
|
571
|
+
rightSideFn.switchReadMode();
|
572
|
+
break;
|
573
|
+
|
574
|
+
case 'darkmode':
|
575
|
+
rightSideFn.switchDarkMode();
|
576
|
+
break;
|
577
|
+
|
578
|
+
case 'hide-aside-btn':
|
579
|
+
rightSideFn.hideAsideBtn();
|
580
|
+
break;
|
581
|
+
|
582
|
+
default:
|
583
|
+
break;
|
584
|
+
}
|
585
|
+
});
|
586
|
+
/**
|
587
|
+
* menu
|
588
|
+
* 側邊欄sub-menu 展開/收縮
|
589
|
+
*/
|
590
|
+
|
591
|
+
var clickFnOfSubMenu = function clickFnOfSubMenu() {
|
592
|
+
document.querySelectorAll('#sidebar-menus .site-page.group').forEach(function (item) {
|
593
|
+
item.addEventListener('click', function () {
|
594
|
+
this.classList.toggle('hide');
|
595
|
+
});
|
596
|
+
});
|
597
|
+
};
|
598
|
+
/**
|
599
|
+
* 複製時加上版權信息
|
600
|
+
*/
|
601
|
+
|
602
|
+
|
603
|
+
var addCopyright = function addCopyright() {
|
604
|
+
var copyright = GLOBAL_CONFIG.copyright;
|
605
|
+
|
606
|
+
document.body.oncopy = function (e) {
|
607
|
+
e.preventDefault();
|
608
|
+
var textFont;
|
609
|
+
var copyFont = window.getSelection(0).toString();
|
610
|
+
|
611
|
+
if (copyFont.length > copyright.limitCount) {
|
612
|
+
textFont = copyFont + '\n' + '\n' + '\n' + copyright.languages.author + '\n' + copyright.languages.link + window.location.href + '\n' + copyright.languages.source + '\n' + copyright.languages.info;
|
613
|
+
} else {
|
614
|
+
textFont = copyFont;
|
615
|
+
}
|
616
|
+
|
617
|
+
if (e.clipboardData) {
|
618
|
+
return e.clipboardData.setData('text', textFont);
|
619
|
+
} else {
|
620
|
+
return window.clipboardData.setData('text', textFont);
|
621
|
+
}
|
622
|
+
};
|
623
|
+
};
|
624
|
+
/**
|
625
|
+
* 網頁運行時間
|
626
|
+
*/
|
627
|
+
|
628
|
+
|
629
|
+
var addRuntime = function addRuntime() {
|
630
|
+
var $runtimeCount = document.getElementById('runtimeshow');
|
631
|
+
|
632
|
+
if ($runtimeCount) {
|
633
|
+
var publishDate = $runtimeCount.getAttribute('data-publishDate');
|
634
|
+
$runtimeCount.innerText = btf.diffDate(publishDate) + ' ' + GLOBAL_CONFIG.runtime;
|
635
|
+
}
|
636
|
+
};
|
637
|
+
/**
|
638
|
+
* 最後一次更新時間
|
639
|
+
*/
|
640
|
+
|
641
|
+
|
642
|
+
var addLastPushDate = function addLastPushDate() {
|
643
|
+
var $lastPushDateItem = document.getElementById('last-push-date');
|
644
|
+
|
645
|
+
if ($lastPushDateItem) {
|
646
|
+
var lastPushDate = $lastPushDateItem.getAttribute('data-lastPushDate');
|
647
|
+
$lastPushDateItem.innerText = btf.diffDate(lastPushDate, true);
|
648
|
+
}
|
649
|
+
};
|
650
|
+
/**
|
651
|
+
* table overflow
|
652
|
+
*/
|
653
|
+
|
654
|
+
|
655
|
+
var addTableWrap = function addTableWrap() {
|
656
|
+
var $table = document.querySelectorAll('#article-container :not(.highlight) > table, #article-container > table');
|
657
|
+
|
658
|
+
if ($table.length) {
|
659
|
+
$table.forEach(function (item) {
|
660
|
+
btf.wrap(item, 'div', {
|
661
|
+
"class": 'table-wrap'
|
662
|
+
});
|
663
|
+
});
|
664
|
+
}
|
665
|
+
};
|
666
|
+
/**
|
667
|
+
* tag-hide
|
668
|
+
*/
|
669
|
+
|
670
|
+
|
671
|
+
var clickFnOfTagHide = function clickFnOfTagHide() {
|
672
|
+
var $hideInline = document.querySelectorAll('#article-container .hide-button');
|
673
|
+
|
674
|
+
if ($hideInline.length) {
|
675
|
+
$hideInline.forEach(function (item) {
|
676
|
+
item.addEventListener('click', function (e) {
|
677
|
+
var $this = this;
|
678
|
+
$this.classList.add('open');
|
679
|
+
var $fjGallery = $this.nextElementSibling.querySelectorAll('.fj-gallery');
|
680
|
+
$fjGallery.length && btf.initJustifiedGallery($fjGallery);
|
681
|
+
});
|
682
|
+
});
|
683
|
+
}
|
684
|
+
};
|
685
|
+
|
686
|
+
var tabsFn = {
|
687
|
+
clickFnOfTabs: function clickFnOfTabs() {
|
688
|
+
document.querySelectorAll('#article-container .tab > button').forEach(function (item) {
|
689
|
+
item.addEventListener('click', function (e) {
|
690
|
+
var $this = this;
|
691
|
+
var $tabItem = $this.parentNode;
|
692
|
+
|
693
|
+
if (!$tabItem.classList.contains('active')) {
|
694
|
+
var $tabContent = $tabItem.parentNode.nextElementSibling;
|
695
|
+
var $siblings = btf.siblings($tabItem, '.active')[0];
|
696
|
+
$siblings && $siblings.classList.remove('active');
|
697
|
+
$tabItem.classList.add('active');
|
698
|
+
var tabId = $this.getAttribute('data-href').replace('#', '');
|
699
|
+
|
700
|
+
var childList = _toConsumableArray($tabContent.children);
|
701
|
+
|
702
|
+
childList.forEach(function (item) {
|
703
|
+
if (item.id === tabId) item.classList.add('active');else item.classList.remove('active');
|
704
|
+
});
|
705
|
+
var $isTabJustifiedGallery = $tabContent.querySelectorAll("#".concat(tabId, " .fj-gallery"));
|
706
|
+
|
707
|
+
if ($isTabJustifiedGallery.length > 0) {
|
708
|
+
btf.initJustifiedGallery($isTabJustifiedGallery);
|
709
|
+
}
|
710
|
+
}
|
711
|
+
});
|
712
|
+
});
|
713
|
+
},
|
714
|
+
backToTop: function backToTop() {
|
715
|
+
document.querySelectorAll('#article-container .tabs .tab-to-top').forEach(function (item) {
|
716
|
+
item.addEventListener('click', function () {
|
717
|
+
btf.scrollToDest(btf.getEleTop(btf.getParents(this, '.tabs')), 300);
|
718
|
+
});
|
719
|
+
});
|
720
|
+
}
|
721
|
+
};
|
722
|
+
|
723
|
+
var toggleCardCategory = function toggleCardCategory() {
|
724
|
+
var $cardCategory = document.querySelectorAll('#aside-cat-list .card-category-list-item.parent i');
|
725
|
+
|
726
|
+
if ($cardCategory.length) {
|
727
|
+
$cardCategory.forEach(function (item) {
|
728
|
+
item.addEventListener('click', function (e) {
|
729
|
+
e.preventDefault();
|
730
|
+
var $this = this;
|
731
|
+
$this.classList.toggle('expand');
|
732
|
+
var $parentEle = $this.parentNode.nextElementSibling;
|
733
|
+
|
734
|
+
if (btf.isHidden($parentEle)) {
|
735
|
+
$parentEle.style.display = 'block';
|
736
|
+
} else {
|
737
|
+
$parentEle.style.display = 'none';
|
738
|
+
}
|
739
|
+
});
|
740
|
+
});
|
741
|
+
}
|
742
|
+
};
|
743
|
+
|
744
|
+
var switchComments = function switchComments() {
|
745
|
+
var switchDone = false;
|
746
|
+
var $switchBtn = document.querySelector('#comment-switch > .switch-btn');
|
747
|
+
$switchBtn && $switchBtn.addEventListener('click', function () {
|
748
|
+
this.classList.toggle('move');
|
749
|
+
document.querySelectorAll('#post-comment > .comment-wrap > div').forEach(function (item) {
|
750
|
+
if (btf.isHidden(item)) {
|
751
|
+
item.style.cssText = 'display: block;animation: tabshow .5s';
|
752
|
+
} else {
|
753
|
+
item.style.cssText = "display: none;animation: ''";
|
754
|
+
}
|
755
|
+
});
|
756
|
+
|
757
|
+
if (!switchDone && typeof loadOtherComment === 'function') {
|
758
|
+
switchDone = true;
|
759
|
+
loadOtherComment();
|
760
|
+
}
|
761
|
+
});
|
762
|
+
};
|
763
|
+
|
764
|
+
var addPostOutdateNotice = function addPostOutdateNotice() {
|
765
|
+
var data = GLOBAL_CONFIG.noticeOutdate;
|
766
|
+
var diffDay = btf.diffDate(GLOBAL_CONFIG_SITE.postUpdate);
|
767
|
+
|
768
|
+
if (diffDay >= data.limitDay) {
|
769
|
+
var ele = document.createElement('div');
|
770
|
+
ele.className = 'post-outdate-notice';
|
771
|
+
ele.textContent = data.messagePrev + ' ' + diffDay + ' ' + data.messageNext;
|
772
|
+
var $targetEle = document.getElementById('article-container');
|
773
|
+
|
774
|
+
if (data.position === 'top') {
|
775
|
+
$targetEle.insertBefore(ele, $targetEle.firstChild);
|
776
|
+
} else {
|
777
|
+
$targetEle.appendChild(ele);
|
778
|
+
}
|
779
|
+
}
|
780
|
+
};
|
781
|
+
|
782
|
+
var lazyloadImg = function lazyloadImg() {
|
783
|
+
window.lazyLoadInstance = new LazyLoad({
|
784
|
+
elements_selector: 'img',
|
785
|
+
threshold: 0,
|
786
|
+
data_src: 'lazy-src'
|
787
|
+
});
|
788
|
+
};
|
789
|
+
|
790
|
+
var relativeDate = function relativeDate(selector) {
|
791
|
+
selector.forEach(function (item) {
|
792
|
+
var $this = item;
|
793
|
+
var timeVal = $this.getAttribute('datetime');
|
794
|
+
$this.innerText = btf.diffDate(timeVal, true);
|
795
|
+
$this.style.display = 'inline';
|
796
|
+
});
|
797
|
+
};
|
798
|
+
|
799
|
+
var unRefreshFn = function unRefreshFn() {
|
800
|
+
window.addEventListener('resize', function () {
|
801
|
+
adjustMenu(false);
|
802
|
+
btf.isHidden(document.getElementById('toggle-menu')) && mobileSidebarOpen && sidebarFn.close();
|
803
|
+
});
|
804
|
+
document.getElementById('menu-mask').addEventListener('click', function (e) {
|
805
|
+
sidebarFn.close();
|
806
|
+
});
|
807
|
+
clickFnOfSubMenu();
|
808
|
+
GLOBAL_CONFIG.islazyload && lazyloadImg();
|
809
|
+
GLOBAL_CONFIG.copyright !== undefined && addCopyright();
|
810
|
+
};
|
811
|
+
|
812
|
+
window.refreshFn = function () {
|
813
|
+
initAdjust();
|
814
|
+
|
815
|
+
if (GLOBAL_CONFIG_SITE.isPost) {
|
816
|
+
GLOBAL_CONFIG.noticeOutdate !== undefined && addPostOutdateNotice();
|
817
|
+
GLOBAL_CONFIG.relativeDate.post && relativeDate(document.querySelectorAll('#post-meta time'));
|
818
|
+
} else {
|
819
|
+
GLOBAL_CONFIG.relativeDate.homepage && relativeDate(document.querySelectorAll('#recent-posts time'));
|
820
|
+
GLOBAL_CONFIG.runtime && addRuntime();
|
821
|
+
addLastPushDate();
|
822
|
+
toggleCardCategory();
|
823
|
+
}
|
824
|
+
|
825
|
+
scrollFnToDo();
|
826
|
+
GLOBAL_CONFIG_SITE.isHome && scrollDownInIndex();
|
827
|
+
addHighlightTool();
|
828
|
+
GLOBAL_CONFIG.isPhotoFigcaption && addPhotoFigcaption();
|
829
|
+
scrollFn();
|
830
|
+
var $jgEle = document.querySelectorAll('#article-container .fj-gallery');
|
831
|
+
$jgEle.length && runJustifiedGallery($jgEle);
|
832
|
+
runLightbox();
|
833
|
+
addTableWrap();
|
834
|
+
clickFnOfTagHide();
|
835
|
+
tabsFn.clickFnOfTabs();
|
836
|
+
tabsFn.backToTop();
|
837
|
+
switchComments();
|
838
|
+
document.getElementById('toggle-menu').addEventListener('click', function () {
|
839
|
+
sidebarFn.open();
|
840
|
+
});
|
841
|
+
};
|
842
|
+
|
843
|
+
refreshFn();
|
844
|
+
unRefreshFn();
|
845
|
+
});
|