hexo-theme-solitude 1.4.3 → 1.4.5
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/_config.yml +152 -148
- package/languages/en-US.yml +1 -1
- package/languages/zh-CN.yml +1 -1
- package/languages/zh-TW.yml +1 -1
- package/layout/includes/footer.pug +2 -5
- package/layout/includes/inject/body.pug +4 -7
- package/layout/includes/inject/head.pug +1 -4
- package/layout/includes/loading.pug +1 -1
- package/layout/includes/page/album.pug +1 -2
- package/layout/includes/page/gallery.pug +2 -2
- package/layout/includes/widgets/aside/asideInfoCard.pug +1 -1
- package/layout/includes/widgets/home/bb/json.pug +1 -1
- package/layout/includes/widgets/home/bb/local.pug +1 -4
- package/layout/includes/widgets/home/bb/memos.pug +2 -1
- package/layout/includes/widgets/page/about/award.pug +6 -3
- package/layout/includes/widgets/page/says/json.pug +10 -6
- package/layout/includes/widgets/page/says/memos.pug +10 -6
- package/package.json +1 -1
- package/plugins.yml +1 -1
- package/scripts/event/cdn.js +0 -1
- package/scripts/filter/lazyload.js +2 -3
- package/scripts/generator/gallery.js +47 -0
- package/source/css/_layout/basic.styl +0 -3
- package/source/css/_page/{about → _about}/reward.styl +7 -0
- package/source/css/_page/{gallery → _gallery}/index.styl +5 -0
- package/source/css/_page/_home/home-top.styl +125 -302
- package/source/css/_page/_home/index.styl +9 -4
- package/source/css/_page/_home/recent-post.styl +1 -0
- package/source/css/_page/index.styl +3 -152
- package/source/css/_page/share.styl +318 -0
- package/source/css/_widgets/_aside/info.styl +3 -0
- package/source/img/loading.gif +0 -0
- package/source/js/covercolor/local.js +11 -11
- package/source/js/main.js +63 -55
- package/source/js/search/algolia.js +1 -3
- package/source/js/search/local.js +1 -3
- package/source/js/utils.js +8 -27
- /package/source/css/_page/{about → _about}/author.styl +0 -0
- /package/source/css/_page/{about → _about}/buff.styl +0 -0
- /package/source/css/_page/{about → _about}/careers.styl +0 -0
- /package/source/css/_page/{about → _about}/contentinfo.styl +0 -0
- /package/source/css/_page/{about → _about}/game.styl +0 -0
- /package/source/css/_page/{about → _about}/index.styl +0 -0
- /package/source/css/_page/{about → _about}/like.styl +0 -0
- /package/source/css/_page/{about → _about}/maxim.styl +0 -0
- /package/source/css/_page/{about → _about}/myphoto.styl +0 -0
- /package/source/css/_page/{about → _about}/oneself.styl +0 -0
- /package/source/css/_page/{about → _about}/personalities.styl +0 -0
- /package/source/css/_page/{about → _about}/skills.styl +0 -0
- /package/source/css/_page/{about → _about}/statistic.styl +0 -0
- /package/source/css/_page/{about → _about}/tenyear.styl +0 -0
package/source/js/main.js
CHANGED
@@ -64,37 +64,45 @@ const scrollFn = function () {
|
|
64
64
|
}
|
65
65
|
}
|
66
66
|
|
67
|
+
let ticking = false;
|
68
|
+
|
67
69
|
const percent = () => {
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
70
|
+
if (!ticking) {
|
71
|
+
window.requestAnimationFrame(() => {
|
72
|
+
let scrollTop = document.documentElement.scrollTop || window.pageYOffset;
|
73
|
+
let totalHeight = Math.max(document.body.scrollHeight, document.documentElement.scrollHeight, document.body.offsetHeight, document.documentElement.offsetHeight, document.body.clientHeight, document.documentElement.clientHeight) - document.documentElement.clientHeight;
|
74
|
+
let scrollPercent = Math.round(scrollTop / totalHeight * 100);
|
75
|
+
let percentElement = document.querySelector("#percent");
|
76
|
+
let viewportBottom = window.scrollY + document.documentElement.clientHeight;
|
77
|
+
let remainingScroll = totalHeight - scrollTop;
|
78
|
+
|
79
|
+
if ((document.getElementById("post-comment") || document.getElementById("footer")).offsetTop < viewportBottom || scrollPercent > 90) {
|
80
|
+
document.querySelector("#nav-totop").classList.add("long");
|
81
|
+
percentElement.innerHTML = "返回顶部";
|
82
|
+
} else {
|
83
|
+
document.querySelector("#nav-totop").classList.remove("long");
|
84
|
+
if (scrollPercent >= 0) {
|
85
|
+
percentElement.innerHTML = scrollPercent + "";
|
86
|
+
}
|
87
|
+
}
|
84
88
|
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
89
|
+
let elementsToHide = document.querySelectorAll(".needEndHide");
|
90
|
+
if (remainingScroll < 100) {
|
91
|
+
elementsToHide.forEach(function (element) {
|
92
|
+
element.classList.add("hide");
|
93
|
+
});
|
94
|
+
} else {
|
95
|
+
elementsToHide.forEach(function (element) {
|
96
|
+
element.classList.remove("hide");
|
97
|
+
});
|
98
|
+
}
|
99
|
+
ticking = false;
|
100
|
+
});
|
101
|
+
ticking = true;
|
94
102
|
}
|
103
|
+
};
|
95
104
|
|
96
|
-
|
97
|
-
}
|
105
|
+
window.onscroll = percent;
|
98
106
|
|
99
107
|
|
100
108
|
const showTodayCard = () => {
|
@@ -109,10 +117,15 @@ const showTodayCard = () => {
|
|
109
117
|
}
|
110
118
|
|
111
119
|
const changeTimeFormat = () => {
|
112
|
-
const timeElements = document.getElementsByTagName("time")
|
113
|
-
|
114
|
-
|
115
|
-
|
120
|
+
const timeElements = Array.from(document.getElementsByTagName("time"));
|
121
|
+
const lang = GLOBAL_CONFIG.lang.time;
|
122
|
+
const currentDate = new Date();
|
123
|
+
|
124
|
+
timeElements.forEach(timeElement => {
|
125
|
+
const datetime = timeElement.getAttribute("datetime");
|
126
|
+
const timeObj = new Date(datetime);
|
127
|
+
const daysDiff = utils.timeDiff(timeObj, currentDate);
|
128
|
+
|
116
129
|
let timeString;
|
117
130
|
if (daysDiff === 0) {
|
118
131
|
timeString = lang.recent;
|
@@ -121,16 +134,16 @@ const changeTimeFormat = () => {
|
|
121
134
|
} else if (daysDiff === 2) {
|
122
135
|
timeString = lang.berforeyesterday;
|
123
136
|
} else if (daysDiff <= 7) {
|
124
|
-
timeString = daysDiff
|
137
|
+
timeString = `${daysDiff}${lang.daybefore}`;
|
125
138
|
} else {
|
126
|
-
if (timeObj.getFullYear() !==
|
127
|
-
timeString = timeObj.getFullYear()
|
139
|
+
if (timeObj.getFullYear() !== currentDate.getFullYear()) {
|
140
|
+
timeString = `${timeObj.getFullYear()}/${timeObj.getMonth() + 1}/${timeObj.getDate()}`;
|
128
141
|
} else {
|
129
|
-
timeString =
|
142
|
+
timeString = `${timeObj.getMonth() + 1}/${timeObj.getDate()}`;
|
130
143
|
}
|
131
144
|
}
|
132
|
-
|
133
|
-
}
|
145
|
+
timeElement.textContent = timeString;
|
146
|
+
});
|
134
147
|
}
|
135
148
|
|
136
149
|
const initObserver = () => {
|
@@ -281,7 +294,7 @@ let sco = {
|
|
281
294
|
htmlClassList.toggle("hide-aside");
|
282
295
|
htmlClassList.contains("hide-aside") ? document.querySelector("#consoleHideAside").classList.add("on") : document.querySelector("#consoleHideAside").classList.remove("on");
|
283
296
|
},
|
284
|
-
switchKeyboard: function() {
|
297
|
+
switchKeyboard: function () {
|
285
298
|
sco_keyboards = !sco_keyboards;
|
286
299
|
const consoleKeyboard = document.querySelector("#consoleKeyboard");
|
287
300
|
if (sco_keyboards) {
|
@@ -323,37 +336,31 @@ let sco = {
|
|
323
336
|
GLOBAL_CONFIG.rightside && (document.querySelector(".menu-darkmode-text").textContent = "深色模式");
|
324
337
|
}
|
325
338
|
},
|
326
|
-
hideTodayCard:
|
327
|
-
|
328
|
-
|
329
|
-
toTop: function () {
|
330
|
-
utils.scrollToDest(0)
|
331
|
-
},
|
339
|
+
hideTodayCard: () => document.getElementById('todayCard').classList.add('hide'),
|
340
|
+
toTop: () => utils.scrollToDest(0),
|
341
|
+
|
332
342
|
showConsole: function () {
|
333
343
|
let el = document.getElementById('console')
|
334
|
-
if (!el.classList.contains('show')) {
|
344
|
+
if (el && !el.classList.contains('show')) {
|
335
345
|
el.classList.add('show')
|
336
346
|
}
|
337
347
|
},
|
338
348
|
hideConsole: function () {
|
339
349
|
const el = document.getElementById('console')
|
340
|
-
|
341
|
-
el.classList.remove('show')
|
342
|
-
}
|
350
|
+
el && el.classList.remove('show')
|
343
351
|
},
|
344
352
|
reflashEssayWaterFall: function () {
|
345
|
-
|
353
|
+
const el = document.getElementById('waterfall')
|
354
|
+
el && (() => {
|
346
355
|
setTimeout(function () {
|
347
356
|
waterfall('#waterfall');
|
348
|
-
|
357
|
+
el.classList.add('show');
|
349
358
|
}, 500);
|
350
|
-
}
|
359
|
+
})();
|
351
360
|
},
|
352
361
|
addRuntime: function () {
|
353
362
|
let el = document.getElementById('runtimeshow')
|
354
|
-
|
355
|
-
el.innerText = utils.timeDiff(new Date(GLOBAL_CONFIG.runtime), new Date()) + GLOBAL_CONFIG.lang.time.runtime
|
356
|
-
}
|
363
|
+
el && GLOBAL_CONFIG.runtime && (el.innerText = utils.timeDiff(new Date(GLOBAL_CONFIG.runtime), new Date()) + GLOBAL_CONFIG.lang.time.runtime)
|
357
364
|
},
|
358
365
|
toTalk: function (txt) {
|
359
366
|
const inputs = ["#wl-edit", ".el-textarea__inner"]
|
@@ -832,5 +839,6 @@ document.addEventListener('DOMContentLoaded', function () {
|
|
832
839
|
})
|
833
840
|
|
834
841
|
window.onkeydown = function (e) {
|
835
|
-
123 === e.keyCode && utils.snackbarShow("开发者模式已打开,请遵循GPL协议", !1, 3e3)
|
842
|
+
(123 === e.keyCode || (17 === e.ctrlKey && 16 === e.shiftKey && 67 === e.keyCode)) && utils.snackbarShow("开发者模式已打开,请遵循GPL协议", !1, 3e3);
|
843
|
+
(27 === e.keyCode) && sco.hideConsole();
|
836
844
|
}
|
@@ -1,10 +1,8 @@
|
|
1
|
-
let openSearch
|
2
|
-
|
3
1
|
window.addEventListener("load", () => {
|
4
2
|
const $searchMask = document.getElementById("search-mask");
|
5
3
|
const $searchDialog = document.querySelector("#algolia-search .search-dialog");
|
6
4
|
|
7
|
-
openSearch = () => {
|
5
|
+
window.openSearch = () => {
|
8
6
|
utils.animateIn($searchMask, "to_show 0.5s");
|
9
7
|
$searchDialog.style.display = "block";
|
10
8
|
setTimeout(() => {
|
@@ -1,10 +1,8 @@
|
|
1
|
-
let openSearch
|
2
|
-
|
3
1
|
window.onload = () => {
|
4
2
|
let idx, store = [];
|
5
3
|
const $searchMask = document.getElementById("search-mask");
|
6
4
|
const $searchDialog = document.querySelector("#local-search .search-dialog");
|
7
|
-
openSearch = () => {
|
5
|
+
window.openSearch = () => {
|
8
6
|
utils.animateIn($searchMask, "to_show 0.5s");
|
9
7
|
$searchDialog.style.display = "block";
|
10
8
|
setTimeout(() => {
|
package/source/js/utils.js
CHANGED
@@ -72,10 +72,7 @@ const utils = {
|
|
72
72
|
const dur = (typeof duration !== 'undefined') ? duration : 5000
|
73
73
|
document.styleSheets[0].addRule(':root', '--sco-snackbar-time:' + dur + 'ms!important')
|
74
74
|
Snackbar.show({
|
75
|
-
text: text,
|
76
|
-
showAction: sa,
|
77
|
-
duration: dur,
|
78
|
-
pos: 'top-center'
|
75
|
+
text: text, showAction: sa, duration: dur, pos: 'top-center'
|
79
76
|
})
|
80
77
|
},
|
81
78
|
|
@@ -112,8 +109,7 @@ const utils = {
|
|
112
109
|
if (currentPos > pos || isNavFixed) pos = pos - 70
|
113
110
|
if ('scrollBehavior' in document.documentElement.style) {
|
114
111
|
window.scrollTo({
|
115
|
-
top: pos,
|
116
|
-
behavior: 'smooth'
|
112
|
+
top: pos, behavior: 'smooth'
|
117
113
|
})
|
118
114
|
return
|
119
115
|
}
|
@@ -180,10 +176,7 @@ const utils = {
|
|
180
176
|
},
|
181
177
|
lazyloadImg: function () {
|
182
178
|
window.lazyLoadInstance = new LazyLoad({
|
183
|
-
elements_selector: 'img',
|
184
|
-
threshold: 0,
|
185
|
-
data_src: 'lazy-src',
|
186
|
-
callback_error: (img) => {
|
179
|
+
elements_selector: 'img', threshold: 0, data_src: 'lazy-src', callback_error: (img) => {
|
187
180
|
img.setAttribute("src", GLOBAL_CONFIG.lazyload.error);
|
188
181
|
}
|
189
182
|
})
|
@@ -212,30 +205,18 @@ const utils = {
|
|
212
205
|
|
213
206
|
if (!window.fancyboxRun) {
|
214
207
|
Fancybox.bind('[data-fancybox]', {
|
215
|
-
Hash: false,
|
216
|
-
Thumbs: {
|
208
|
+
Hash: false, Thumbs: {
|
217
209
|
showOnStart: false
|
218
|
-
},
|
219
|
-
Images: {
|
210
|
+
}, Images: {
|
220
211
|
Panzoom: {
|
221
212
|
maxScale: 4
|
222
213
|
}
|
223
|
-
},
|
224
|
-
Carousel: {
|
214
|
+
}, Carousel: {
|
225
215
|
transition: 'slide'
|
226
|
-
},
|
227
|
-
Toolbar: {
|
216
|
+
}, Toolbar: {
|
228
217
|
display: {
|
229
218
|
left: ['infobar'],
|
230
|
-
middle: [
|
231
|
-
'zoomIn',
|
232
|
-
'zoomOut',
|
233
|
-
'toggle1to1',
|
234
|
-
'rotateCCW',
|
235
|
-
'rotateCW',
|
236
|
-
'flipX',
|
237
|
-
'flipY'
|
238
|
-
],
|
219
|
+
middle: ['zoomIn', 'zoomOut', 'toggle1to1', 'rotateCCW', 'rotateCW', 'flipX', 'flipY'],
|
239
220
|
right: ['slideshow', 'thumbs', 'close']
|
240
221
|
}
|
241
222
|
}
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|