hexo-theme-solitude 1.0.0 → 1.1.3
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/README.md +62 -20
- package/README_EN.md +98 -0
- package/_config.yml +162 -144
- package/layout/404.ejs +1 -1
- package/layout/layout.ejs +27 -32
- package/layout/page/about.ejs +3 -1
- package/layout/page/circle.ejs +1 -1
- package/layout/page/echarts.ejs +1 -14
- package/layout/page/links.ejs +2 -13
- package/layout/page/rss.ejs +10 -8
- package/layout/page/says.ejs +1 -0
- package/layout/partial/body.ejs +0 -1
- package/layout/partial/compoment/about/award.ejs +3 -1
- package/layout/partial/compoment/about/hobbies.ejs +44 -35
- package/layout/partial/compoment/about/other.ejs +68 -60
- package/layout/partial/compoment/aside/asideFlipCard.ejs +67 -3
- package/layout/partial/compoment/aside/asideHistory.ejs +49 -0
- package/layout/partial/compoment/aside/asideNewestPost.ejs +1 -1
- package/layout/partial/compoment/aside/asidePower.ejs +3 -3
- package/layout/partial/compoment/aside/asideSwitch.ejs +6 -0
- package/layout/partial/compoment/aside/asideToc.ejs +1 -1
- package/layout/partial/compoment/aside/asideWebInfo.ejs +8 -8
- package/layout/partial/compoment/aside/asideWelcome.ejs +33 -0
- package/layout/partial/compoment/circle/angle.ejs +2 -2
- package/layout/partial/compoment/circle/content.ejs +8 -11
- package/layout/partial/compoment/dorakika/rightmenu.ejs +90 -105
- package/layout/partial/compoment/hometop/bbTimeList.ejs +1 -1
- package/layout/partial/compoment/hometop/groupTag.ejs +1 -1
- package/layout/partial/compoment/hometop/topGroup.ejs +11 -18
- package/layout/partial/compoment/inject/body.ejs +20 -7
- package/layout/partial/compoment/inject/head.ejs +67 -3
- package/layout/partial/compoment/links/angle.ejs +26 -0
- package/layout/partial/compoment/links/banner.ejs +2 -2
- package/layout/partial/compoment/mixins/pagination.ejs +2 -2
- package/layout/partial/compoment/nav/right.ejs +6 -6
- package/layout/partial/compoment/post/award.ejs +30 -22
- package/layout/partial/compoment/post/copyright.ejs +10 -8
- package/layout/partial/compoment/post/postMeta.ejs +21 -19
- package/layout/partial/compoment/says/saysBottom.ejs +3 -3
- package/layout/partial/compoment/says/saysContent.ejs +0 -1
- package/layout/partial/compoment/says/saysFunction.ejs +15 -0
- package/layout/partial/compoment/third-party/comments/comment.ejs +1 -1
- package/layout/partial/compoment/third-party/comments/twikoo.ejs +2 -1
- package/layout/partial/compoment/third-party/search/algolia-search.ejs +2 -2
- package/layout/partial/compoment/third-party/search/local-search.ejs +2 -2
- package/layout/partial/console.ejs +10 -4
- package/layout/partial/footer.ejs +11 -9
- package/layout/partial/nav.ejs +2 -2
- package/layout/partial/sidebar.ejs +2 -2
- package/layout/post.ejs +19 -3
- package/package.json +4 -5
- package/scripts/event/welcome.js +6 -7
- package/scripts/helper/charts.js +45 -34
- package/scripts/helper/randomLinks.js +1 -1
- package/scripts/helper/related_post.js +11 -4
- package/scripts/helper/themeJsExport.js +12 -10
- package/scripts/tags/fold.js +2 -3
- package/scripts/tags/note.js +6 -2
- package/scripts/tags/tabs.js +2 -2
- package/source/css/main.css +79 -265
- package/source/css/search/algolia-search.css +1 -1
- package/source/css/search/local-search.css +1 -1
- package/source/css/var.css +3 -0
- package/source/img/default.png +0 -0
- package/source/img/error_load.png +0 -0
- package/source/img/logo-horizontal_version.png +0 -0
- package/source/img/pwa/16.png +0 -0
- package/source/img/pwa/180.png +0 -0
- package/source/img/pwa/192.png +0 -0
- package/source/img/pwa/32.png +0 -0
- package/source/img/pwa/512.png +0 -0
- package/source/img/pwa/logo.png +0 -0
- package/source/img/pwa/siteicon/splash-1125x2436.png +0 -0
- package/source/img/pwa/siteicon/splash-1136x640.png +0 -0
- package/source/img/pwa/siteicon/splash-1170x2532.png +0 -0
- package/source/img/pwa/siteicon/splash-1179x2556.png +0 -0
- package/source/img/pwa/siteicon/splash-1242x2208.png +0 -0
- package/source/img/pwa/siteicon/splash-1242x2688.png +0 -0
- package/source/img/pwa/siteicon/splash-1248x2778.png +0 -0
- package/source/img/pwa/siteicon/splash-1290x2796.png +0 -0
- package/source/img/pwa/siteicon/splash-1334x750.png +0 -0
- package/source/img/pwa/siteicon/splash-1536x2048.png +0 -0
- package/source/img/pwa/siteicon/splash-1620x2160.png +0 -0
- package/source/img/pwa/siteicon/splash-1668x2224.png +0 -0
- package/source/img/pwa/siteicon/splash-1668x2388.png +0 -0
- package/source/img/pwa/siteicon/splash-1792x828.png +0 -0
- package/source/img/pwa/siteicon/splash-2048x1536.png +0 -0
- package/source/img/pwa/siteicon/splash-2048x2732.png +0 -0
- package/source/img/pwa/siteicon/splash-2160x1620.png +0 -0
- package/source/img/pwa/siteicon/splash-2208x1242.png +0 -0
- package/source/img/pwa/siteicon/splash-2224x1668.png +0 -0
- package/source/img/pwa/siteicon/splash-2388x1668.png +0 -0
- package/source/img/pwa/siteicon/splash-2436x1125.png +0 -0
- package/source/img/pwa/siteicon/splash-2532x1170.png +0 -0
- package/source/img/pwa/siteicon/splash-2556x1179.png +0 -0
- package/source/img/pwa/siteicon/splash-2688x1242.png +0 -0
- package/source/img/pwa/siteicon/splash-2732x2048.png +0 -0
- package/source/img/pwa/siteicon/splash-2778x1248.png +0 -0
- package/source/img/pwa/siteicon/splash-2796x1290.png +0 -0
- package/source/img/pwa/siteicon/splash-640x1136.png +0 -0
- package/source/img/pwa/siteicon/splash-750x1334.png +0 -0
- package/source/img/pwa/siteicon/splash-828x1792.png +0 -0
- package/source/img/solitude-show.jpg +0 -0
- package/source/js/commentBarrage.js +145 -136
- package/source/js/extend/covercolor/local.js +104 -94
- package/source/js/extend/search/algolia-search.js +11 -0
- package/source/js/extend/search/local-search.js +12 -1
- package/source/js/main.js +212 -27
- package/source/js/rightmenu.js +402 -0
- package/source/js/txmap.js +236 -0
- package/source/lib/chuckle-post-ai.js +1 -0
- package/source/lib/circle.min.js +1 -0
- package/source/lib/friends_post.js +4 -98
- package/source/lib/snackbar.min.js +9 -0
- package/source/lib/view-image.min.js +6 -0
- package/scripts/filter/katex.js +0 -25
- package/scripts/tags/expand.js +0 -4
- package/source/img/power.png +0 -0
- package/source/js/circle.js +0 -1828
- package/source/js/extend/covercolor/web.js +0 -137
- package/source/js/post_ai.js +0 -517
- package/source/lib/snackbar.js +0 -16
- package/source/lib/view-image.js +0 -13
- /package/source/lib/{bundle.js → bundle.min.js} +0 -0
- /package/source/lib/{lazyload.js → lazyload.min.js} +0 -0
@@ -0,0 +1,402 @@
|
|
1
|
+
let rm = {};
|
2
|
+
|
3
|
+
rm.stopdragimg = Array.from(document.getElementsByTagName('img'));
|
4
|
+
rm.stopdragimg.forEach(function (img) {
|
5
|
+
img.addEventListener('dragstart', function () {
|
6
|
+
return false;
|
7
|
+
});
|
8
|
+
});
|
9
|
+
|
10
|
+
rm.showRightMenu = function (e, n = 0, t = 0) {
|
11
|
+
let o = document.getElementById('rightMenu');
|
12
|
+
o.style.top = n + 'px';
|
13
|
+
o.style.left = t + 'px';
|
14
|
+
|
15
|
+
if (e) {
|
16
|
+
o.style.display = 'block';
|
17
|
+
stopMaskScroll();
|
18
|
+
} else {
|
19
|
+
o.style.display = 'none';
|
20
|
+
}
|
21
|
+
};
|
22
|
+
|
23
|
+
rm.hideRightMenu = function () {
|
24
|
+
rm.showRightMenu(false);
|
25
|
+
document.getElementById('rightmenu-mask').style.display = 'none';
|
26
|
+
};
|
27
|
+
|
28
|
+
document.querySelector("#rightMenu").style.display = "block"
|
29
|
+
rmWidth = document.querySelector("#rightMenu").offsetWidth;
|
30
|
+
rmHeight = document.querySelector("#rightMenu").offsetHeight;
|
31
|
+
document.querySelector("#rightMenu").style.display = 'none'
|
32
|
+
|
33
|
+
rm.reloadrmSize = function () {
|
34
|
+
document.querySelector("#rightMenu").style.display = "block"
|
35
|
+
rmWidth = document.querySelector("#rightMenu").offsetWidth;
|
36
|
+
rmHeight = document.querySelector("#rightMenu").offsetHeight;
|
37
|
+
document.querySelector("#rightMenu").style.display = 'none'
|
38
|
+
}
|
39
|
+
|
40
|
+
let domhref = "", domImgSrc = "", globalEvent = null;
|
41
|
+
|
42
|
+
function imageToBlob(e) {
|
43
|
+
const n = new Image
|
44
|
+
, t = document.createElement("canvas")
|
45
|
+
, o = t.getContext("2d");
|
46
|
+
return n.crossOrigin = "",
|
47
|
+
n.src = e,
|
48
|
+
new Promise((e => {
|
49
|
+
n.onload = function () {
|
50
|
+
t.width = this.naturalWidth,
|
51
|
+
t.height = this.naturalHeight,
|
52
|
+
o.drawImage(this, 0, 0),
|
53
|
+
t.toBlob((n => {
|
54
|
+
e(n)
|
55
|
+
}
|
56
|
+
), "image/png", .75)
|
57
|
+
}
|
58
|
+
}
|
59
|
+
))
|
60
|
+
}
|
61
|
+
|
62
|
+
async function copyImage(e) {
|
63
|
+
try {
|
64
|
+
const n = await imageToBlob(e);
|
65
|
+
const t = new ClipboardItem({
|
66
|
+
"image/png": n
|
67
|
+
});
|
68
|
+
await navigator.clipboard.write([t]);
|
69
|
+
} catch (error) {
|
70
|
+
console.error('Failed to copy image: ', error);
|
71
|
+
}
|
72
|
+
}
|
73
|
+
|
74
|
+
function stopMaskScroll() {
|
75
|
+
if (document.getElementById("rightmenu-mask")) {
|
76
|
+
document.getElementById("rightmenu-mask").addEventListener("mousewheel", (function (e) {
|
77
|
+
rm.hideRightMenu()
|
78
|
+
}
|
79
|
+
), !1)
|
80
|
+
}
|
81
|
+
if (document.getElementById("rightMenu")) {
|
82
|
+
document.getElementById("rightMenu").addEventListener("mousewheel", (function (e) {
|
83
|
+
rm.hideRightMenu()
|
84
|
+
}
|
85
|
+
), !1)
|
86
|
+
}
|
87
|
+
}
|
88
|
+
|
89
|
+
window.oncontextmenu = function (e) {
|
90
|
+
if (document.body.clientWidth > 768) {
|
91
|
+
let n = e.clientX + 10;
|
92
|
+
let t = e.clientY;
|
93
|
+
let o = document.getElementsByClassName('rightMenuOther');
|
94
|
+
let i = document.getElementsByClassName('rightMenuPlugin');
|
95
|
+
let c = document.getElementById('menu-copytext');
|
96
|
+
let r = document.getElementById('menu-pastetext');
|
97
|
+
let m = document.getElementById('menu-commenttext');
|
98
|
+
let a = document.getElementById('menu-newwindow');
|
99
|
+
let u = document.getElementById('menu-copylink');
|
100
|
+
let l = document.getElementById('menu-copyimg');
|
101
|
+
let h = document.getElementById('menu-downloadimg');
|
102
|
+
let d = document.getElementById('menu-search');
|
103
|
+
let s = document.getElementById('menu-searchBaidu');
|
104
|
+
let g = document.getElementById('menu-music-toggle');
|
105
|
+
let w = document.getElementById('menu-music-back');
|
106
|
+
let f = document.getElementById('menu-music-forward');
|
107
|
+
let p = document.getElementById('menu-music-playlist');
|
108
|
+
let k = document.getElementById('menu-music-copyMusicName');
|
109
|
+
let y = e.target.href;
|
110
|
+
let M = e.target.currentSrc;
|
111
|
+
let b = false;
|
112
|
+
|
113
|
+
for (let j = 0; j < o.length; j++) {
|
114
|
+
o[j].style.display = 'block';
|
115
|
+
}
|
116
|
+
globalEvent = e;
|
117
|
+
|
118
|
+
if (selectTextNow && window.getSelection()) {
|
119
|
+
b = true;
|
120
|
+
c.style.display = 'block';
|
121
|
+
m.style.display = 'block';
|
122
|
+
d.style.display = 'block';
|
123
|
+
s.style.display = 'block';
|
124
|
+
} else {
|
125
|
+
c.style.display = 'none';
|
126
|
+
m.style.display = 'none';
|
127
|
+
s.style.display = 'none';
|
128
|
+
d.style.display = 'none';
|
129
|
+
}
|
130
|
+
|
131
|
+
if (y) {
|
132
|
+
b = true;
|
133
|
+
a.style.display = 'block';
|
134
|
+
u.style.display = 'block';
|
135
|
+
domhref = y;
|
136
|
+
} else {
|
137
|
+
a.style.display = 'none';
|
138
|
+
u.style.display = 'none';
|
139
|
+
}
|
140
|
+
|
141
|
+
if (M) {
|
142
|
+
b = true;
|
143
|
+
l.style.display = 'block';
|
144
|
+
h.style.display = 'block';
|
145
|
+
domImgSrc = M;
|
146
|
+
} else {
|
147
|
+
l.style.display = 'none';
|
148
|
+
h.style.display = 'none';
|
149
|
+
}
|
150
|
+
|
151
|
+
if (e.target.tagName.toLowerCase() === 'input' || e.target.tagName.toLowerCase() === 'textarea') {
|
152
|
+
b = true;
|
153
|
+
r.style.display = 'block';
|
154
|
+
} else {
|
155
|
+
r.style.display = 'none';
|
156
|
+
}
|
157
|
+
|
158
|
+
if (e.target.nodeName === 'METING-JS') {
|
159
|
+
b = true;
|
160
|
+
g.style.display = 'block';
|
161
|
+
w.style.display = 'block';
|
162
|
+
f.style.display = 'block';
|
163
|
+
p.style.display = 'block';
|
164
|
+
k.style.display = 'block';
|
165
|
+
} else {
|
166
|
+
g.style.display = 'none';
|
167
|
+
w.style.display = 'none';
|
168
|
+
f.style.display = 'none';
|
169
|
+
p.style.display = 'none';
|
170
|
+
k.style.display = 'none';
|
171
|
+
}
|
172
|
+
|
173
|
+
if (b) {
|
174
|
+
for (let j = 0; j < o.length; j++) {
|
175
|
+
o[j].style.display = 'none';
|
176
|
+
}
|
177
|
+
for (let j = 0; j < i.length; j++) {
|
178
|
+
i[j].style.display = 'block';
|
179
|
+
}
|
180
|
+
} else {
|
181
|
+
for (let j = 0; j < i.length; j++) {
|
182
|
+
i[j].style.display = 'none';
|
183
|
+
}
|
184
|
+
}
|
185
|
+
|
186
|
+
rm.reloadrmSize();
|
187
|
+
if (n + rmWidth > window.innerWidth) {
|
188
|
+
n -= rmWidth + 10;
|
189
|
+
}
|
190
|
+
|
191
|
+
if (t + rmHeight > window.innerHeight) {
|
192
|
+
t -= t + rmHeight - window.innerHeight;
|
193
|
+
}
|
194
|
+
rm.showRightMenu(true, t, n);
|
195
|
+
document.getElementById('rightmenu-mask').style.display = 'flex';
|
196
|
+
|
197
|
+
return false;
|
198
|
+
}
|
199
|
+
};
|
200
|
+
rm.downloadimging = !1
|
201
|
+
rm.writeClipImg = function (e) {
|
202
|
+
const n = "localhost" === window.location.hostname || "127.0.0.1" === window.location.hostname ? 0 : 1e4;
|
203
|
+
rm.hideRightMenu();
|
204
|
+
utils.snackbarShow("正在下载中,请稍后", !1, n);
|
205
|
+
if (0 == rm.downloadimging) {
|
206
|
+
rm.downloadimging = !0;
|
207
|
+
setTimeout(async function() {
|
208
|
+
await copyImage(e);
|
209
|
+
utils.snackbarShow("复制成功!图片已添加盲水印,请遵守版权协议");
|
210
|
+
rm.downloadimging = !1;
|
211
|
+
}, 1000);
|
212
|
+
}
|
213
|
+
}
|
214
|
+
|
215
|
+
rm.switchDarkMode = function () {
|
216
|
+
sco.switchDarkMode()
|
217
|
+
rm.hideRightMenu()
|
218
|
+
}
|
219
|
+
|
220
|
+
rm.copyUrl = function (e) {
|
221
|
+
var n = e;
|
222
|
+
var t = document.createElement('input');
|
223
|
+
t.id = 'copyVal';
|
224
|
+
document.body.appendChild(t);
|
225
|
+
t.value = n;
|
226
|
+
t.select();
|
227
|
+
t.setSelectionRange(0, t.value.length);
|
228
|
+
document.execCommand('copy');
|
229
|
+
document.body.removeChild(t);
|
230
|
+
}
|
231
|
+
|
232
|
+
rm.rightmenuCopyText = function (e) {
|
233
|
+
navigator.clipboard && navigator.clipboard.writeText(e),
|
234
|
+
utils.snackbarShow("复制文本成功", !1, 2e3),
|
235
|
+
rm.hideRightMenu()
|
236
|
+
}
|
237
|
+
|
238
|
+
rm.copyPageUrl = function () {
|
239
|
+
var e = window.location.href;
|
240
|
+
rm.copyUrl(e),
|
241
|
+
utils.snackbarShow("复制本页链接地址成功", !1, 2e3),
|
242
|
+
rm.hideRightMenu()
|
243
|
+
}
|
244
|
+
|
245
|
+
rm.sharePage = function () {
|
246
|
+
window;
|
247
|
+
rm.copyUrl(url),
|
248
|
+
utils.snackbarShow("复制本页链接地址成功", !1, 2e3),
|
249
|
+
rm.hideRightMenu()
|
250
|
+
}
|
251
|
+
|
252
|
+
var selectTextNow = "";
|
253
|
+
|
254
|
+
function selceText() {
|
255
|
+
var e;
|
256
|
+
e = document.selection ? document.selection.createRange().text : window.getSelection() + "",
|
257
|
+
selectTextNow = e || ""
|
258
|
+
}
|
259
|
+
|
260
|
+
function replaceAll(e, n, t) {
|
261
|
+
return e.split(n).join(t)
|
262
|
+
}
|
263
|
+
|
264
|
+
function addRightMenuClickEvent() {
|
265
|
+
document.getElementById('menu-backward').addEventListener('click', function () {
|
266
|
+
window.history.back();
|
267
|
+
rm.hideRightMenu();
|
268
|
+
});
|
269
|
+
|
270
|
+
document.getElementById('menu-forward').addEventListener('click', function () {
|
271
|
+
window.history.forward();
|
272
|
+
rm.hideRightMenu();
|
273
|
+
});
|
274
|
+
|
275
|
+
document.getElementById('menu-refresh').addEventListener('click', function () {
|
276
|
+
window.location.reload();
|
277
|
+
});
|
278
|
+
|
279
|
+
document.getElementById('menu-top').addEventListener('click', function () {
|
280
|
+
utils.scrollToDest(0, 500);
|
281
|
+
rm.hideRightMenu();
|
282
|
+
});
|
283
|
+
|
284
|
+
Array.from(document.getElementsByClassName('menu-link')).forEach(function (element) {
|
285
|
+
element.addEventListener('click', rm.hideRightMenu);
|
286
|
+
});
|
287
|
+
|
288
|
+
var menuDarkmode = document.getElementById('menu-darkmode');
|
289
|
+
menuDarkmode.onclick = null;
|
290
|
+
menuDarkmode.addEventListener('click', rm.switchDarkMode);
|
291
|
+
|
292
|
+
document.getElementById('menu-randomPost').addEventListener('click', function () {
|
293
|
+
toRandomPost();
|
294
|
+
});
|
295
|
+
|
296
|
+
var menuCommentBarrage = document.getElementById('menu-commentBarrage');
|
297
|
+
menuCommentBarrage.onclick = null;
|
298
|
+
menuCommentBarrage.addEventListener('click', sco.switchCommentBarrage);
|
299
|
+
|
300
|
+
var rightmenuMask = document.getElementById('rightmenu-mask');
|
301
|
+
rightmenuMask.addEventListener('click', rm.hideRightMenu);
|
302
|
+
rightmenuMask.addEventListener('contextmenu', function () {
|
303
|
+
rm.hideRightMenu();
|
304
|
+
return false;
|
305
|
+
});
|
306
|
+
|
307
|
+
document.getElementById('menu-copy').addEventListener('click', rm.copyPageUrl);
|
308
|
+
document.getElementById('menu-pastetext').addEventListener('click', rm.pasteText);
|
309
|
+
|
310
|
+
document.getElementById('menu-copytext').addEventListener('click', function () {
|
311
|
+
rm.rightmenuCopyText(selectTextNow);
|
312
|
+
utils.snackbarShow("复制成功,复制和转载请标注本文地址");
|
313
|
+
});
|
314
|
+
|
315
|
+
document.getElementById('menu-commenttext').addEventListener('click', function () {
|
316
|
+
rm.rightMenuCommentText(selectTextNow);
|
317
|
+
});
|
318
|
+
|
319
|
+
document.getElementById('menu-newwindow').addEventListener('click', function () {
|
320
|
+
window.open(domhref);
|
321
|
+
rm.hideRightMenu();
|
322
|
+
});
|
323
|
+
|
324
|
+
document.getElementById('menu-copylink').addEventListener('click', rm.copyLink);
|
325
|
+
|
326
|
+
document.getElementById('menu-downloadimg').addEventListener('click', function () {
|
327
|
+
sco.downloadImage(domImgSrc, "sco");
|
328
|
+
});
|
329
|
+
|
330
|
+
document.getElementById('menu-copyimg').addEventListener('click', function () {
|
331
|
+
rm.writeClipImg(domImgSrc);
|
332
|
+
});
|
333
|
+
|
334
|
+
document.getElementById('menu-searchBaidu').addEventListener('click', rm.searchBaidu);
|
335
|
+
|
336
|
+
document.getElementById('menu-music-toggle').addEventListener('click', sco.musicToggle);
|
337
|
+
document.getElementById('menu-music-back').addEventListener('click', sco.musicSkipBack);
|
338
|
+
document.getElementById('menu-music-forward').addEventListener('click', sco.musicSkipForward);
|
339
|
+
|
340
|
+
document.getElementById('menu-music-copyMusicName').addEventListener('click', function () {
|
341
|
+
rm.rightmenuCopyText(sco.musicGetName());
|
342
|
+
utils.snackbarShow("复制歌曲名称成功", false, 3000);
|
343
|
+
});
|
344
|
+
}
|
345
|
+
|
346
|
+
document.onmouseup = document.ondbclick = selceText
|
347
|
+
rm.readClipboard = function () {
|
348
|
+
navigator.clipboard && navigator.clipboard.readText().then((e => rm.insertAtCaret(globalEvent.target, e)))
|
349
|
+
}
|
350
|
+
|
351
|
+
rm.insertAtCaret = function (e, n) {
|
352
|
+
const t = e.selectionStart
|
353
|
+
, o = e.selectionEnd;
|
354
|
+
if (document.selection)
|
355
|
+
e.focus(),
|
356
|
+
document.selection.createRange().text = n,
|
357
|
+
e.focus();
|
358
|
+
else if (t || "0" == t) {
|
359
|
+
var i = e.scrollTop;
|
360
|
+
e.value = e.value.substring(0, t) + n + e.value.substring(o, e.value.length),
|
361
|
+
e.focus(),
|
362
|
+
e.selectionStart = t + n.length,
|
363
|
+
e.selectionEnd = t + n.length,
|
364
|
+
e.scrollTop = i
|
365
|
+
} else
|
366
|
+
e.value += n,
|
367
|
+
e.focus()
|
368
|
+
}
|
369
|
+
|
370
|
+
rm.pasteText = function () {
|
371
|
+
rm.readClipboard();
|
372
|
+
rm.hideRightMenu()
|
373
|
+
}
|
374
|
+
|
375
|
+
rm.rightMenuCommentText = function (e) {
|
376
|
+
rm.hideRightMenu();
|
377
|
+
var n = document.getElementsByClassName("el-textarea__inner")[0];
|
378
|
+
let t = document.createEvent("HTMLEvents");
|
379
|
+
t.initEvent("input", !0, !0);
|
380
|
+
let o = replaceAll(e, "\n", "\n> ");
|
381
|
+
n.value = "> " + o + "\n\n",
|
382
|
+
n.dispatchEvent(t);
|
383
|
+
var i = document.querySelector("#post-comment").offsetTop;
|
384
|
+
window.scrollTo(0, i - 80),
|
385
|
+
n.focus(),
|
386
|
+
n.setSelectionRange(-1, -1),
|
387
|
+
document.getElementById("comment-tips") && document.getElementById("comment-tips").classList.add("show")
|
388
|
+
}
|
389
|
+
|
390
|
+
rm.searchBaidu = function () {
|
391
|
+
utils.snackbarShow("即将跳转到百度搜索", !1, 2e3),
|
392
|
+
setTimeout((function () {
|
393
|
+
window.open("https://www.baidu.com/s?wd=" + selectTextNow)
|
394
|
+
}
|
395
|
+
), "2000"),
|
396
|
+
rm.hideRightMenu()
|
397
|
+
}
|
398
|
+
|
399
|
+
rm.copyLink = function () {
|
400
|
+
rm.rightmenuCopyText(domhref),
|
401
|
+
utils.snackbarShow("已复制链接地址")
|
402
|
+
}
|
@@ -0,0 +1,236 @@
|
|
1
|
+
|
2
|
+
function getDistance(e1, n1, e2, n2) {
|
3
|
+
const R = 6371
|
4
|
+
const {sin, cos, asin, PI, hypot} = Math
|
5
|
+
let getPoint = (e, n) => {
|
6
|
+
e *= PI / 180
|
7
|
+
n *= PI / 180
|
8
|
+
return {x: cos(n) * cos(e), y: cos(n) * sin(e), z: sin(n)}
|
9
|
+
}
|
10
|
+
|
11
|
+
let a = getPoint(e1, n1)
|
12
|
+
let b = getPoint(e2, n2)
|
13
|
+
let c = hypot(a.x - b.x, a.y - b.y, a.z - b.z)
|
14
|
+
let r = asin(c / 2) * 2 * R
|
15
|
+
return Math.round(r);
|
16
|
+
}
|
17
|
+
|
18
|
+
function showWelcome() {
|
19
|
+
|
20
|
+
let dist = getDistance(longitude, Latitude, ipLoacation.result.location.lng, ipLoacation.result.location.lat); //这里换成自己的经纬度
|
21
|
+
let pos = ipLoacation.result.ad_info.nation;
|
22
|
+
let ip;
|
23
|
+
let posdesc;
|
24
|
+
//根据国家、省份、城市信息自定义欢迎语
|
25
|
+
switch (ipLoacation.result.ad_info.nation) {
|
26
|
+
case "日本":
|
27
|
+
posdesc = "よろしく,一起去看樱花吗";
|
28
|
+
break;
|
29
|
+
case "美国":
|
30
|
+
posdesc = "Let us live in peace!";
|
31
|
+
break;
|
32
|
+
case "英国":
|
33
|
+
posdesc = "想同你一起夜乘伦敦眼";
|
34
|
+
break;
|
35
|
+
case "俄罗斯":
|
36
|
+
posdesc = "干了这瓶伏特加!";
|
37
|
+
break;
|
38
|
+
case "法国":
|
39
|
+
posdesc = "C'est La Vie";
|
40
|
+
break;
|
41
|
+
case "德国":
|
42
|
+
posdesc = "Die Zeit verging im Fluge.";
|
43
|
+
break;
|
44
|
+
case "澳大利亚":
|
45
|
+
posdesc = "一起去大堡礁吧!";
|
46
|
+
break;
|
47
|
+
case "加拿大":
|
48
|
+
posdesc = "拾起一片枫叶赠予你";
|
49
|
+
break;
|
50
|
+
case "中国":
|
51
|
+
pos = ipLoacation.result.ad_info.province + " " + ipLoacation.result.ad_info.city + " " + ipLoacation.result.ad_info.district;
|
52
|
+
ip = ipLoacation.result.ip;
|
53
|
+
switch (ipLoacation.result.ad_info.province) {
|
54
|
+
case "北京市":
|
55
|
+
posdesc = "北——京——欢迎你~~~";
|
56
|
+
break;
|
57
|
+
case "天津市":
|
58
|
+
posdesc = "讲段相声吧";
|
59
|
+
break;
|
60
|
+
case "河北省":
|
61
|
+
posdesc = "山势巍巍成壁垒,天下雄关铁马金戈由此向,无限江山";
|
62
|
+
break;
|
63
|
+
case "山西省":
|
64
|
+
posdesc = "展开坐具长三尺,已占山河五百余";
|
65
|
+
break;
|
66
|
+
case "内蒙古自治区":
|
67
|
+
posdesc = "天苍苍,野茫茫,风吹草低见牛羊";
|
68
|
+
break;
|
69
|
+
case "辽宁省":
|
70
|
+
posdesc = "我想吃烤鸡架!";
|
71
|
+
break;
|
72
|
+
case "吉林省":
|
73
|
+
posdesc = "状元阁就是东北烧烤之王";
|
74
|
+
break;
|
75
|
+
case "黑龙江省":
|
76
|
+
posdesc = "很喜欢哈尔滨大剧院";
|
77
|
+
break;
|
78
|
+
case "上海市":
|
79
|
+
posdesc = "众所周知,中国只有两个城市";
|
80
|
+
break;
|
81
|
+
case "江苏省":
|
82
|
+
switch (ipLoacation.result.ad_info.city) {
|
83
|
+
case "南京市":
|
84
|
+
posdesc = "这是我挺想去的城市啦";
|
85
|
+
break;
|
86
|
+
case "苏州市":
|
87
|
+
posdesc = "上有天堂,下有苏杭";
|
88
|
+
break;
|
89
|
+
default:
|
90
|
+
posdesc = "散装是必须要散装的";
|
91
|
+
break;
|
92
|
+
}
|
93
|
+
break;
|
94
|
+
case "浙江省":
|
95
|
+
posdesc = "东风渐绿西湖柳,雁已还人未南归";
|
96
|
+
break;
|
97
|
+
case "河南省":
|
98
|
+
switch (ipLoacation.result.ad_info.city) {
|
99
|
+
case "郑州市":
|
100
|
+
posdesc = "豫州之域,天地之中";
|
101
|
+
break;
|
102
|
+
case "南阳市":
|
103
|
+
posdesc = "臣本布衣,躬耕于南阳此南阳非彼南阳!";
|
104
|
+
break;
|
105
|
+
case "驻马店市":
|
106
|
+
posdesc = "峰峰有奇石,石石挟仙气嵖岈山的花很美哦!";
|
107
|
+
break;
|
108
|
+
case "开封市":
|
109
|
+
posdesc = "刚正不阿包青天";
|
110
|
+
break;
|
111
|
+
case "洛阳市":
|
112
|
+
posdesc = "洛阳牡丹甲天下";
|
113
|
+
break;
|
114
|
+
default:
|
115
|
+
posdesc = "可否带我品尝河南烩面啦?";
|
116
|
+
break;
|
117
|
+
}
|
118
|
+
break;
|
119
|
+
case "安徽省":
|
120
|
+
posdesc = "蚌埠住了,芜湖起飞";
|
121
|
+
break;
|
122
|
+
case "福建省":
|
123
|
+
posdesc = "井邑白云间,岩城远带山";
|
124
|
+
break;
|
125
|
+
case "江西省":
|
126
|
+
posdesc = "落霞与孤鹜齐飞,秋水共长天一色";
|
127
|
+
break;
|
128
|
+
case "山东省":
|
129
|
+
posdesc = "遥望齐州九点烟,一泓海水杯中泻";
|
130
|
+
break;
|
131
|
+
case "湖北省":
|
132
|
+
switch (ipLoacation.result.ad_info.city) {
|
133
|
+
case "黄冈市":
|
134
|
+
posdesc = "红安将军县!辈出将才!";
|
135
|
+
break;
|
136
|
+
default:
|
137
|
+
posdesc = "来碗热干面~";
|
138
|
+
break;
|
139
|
+
}
|
140
|
+
break;
|
141
|
+
case "湖南省":
|
142
|
+
posdesc = "74751,长沙斯塔克";
|
143
|
+
break;
|
144
|
+
case "广东省":
|
145
|
+
switch (ipLoacation.result.ad_info.city) {
|
146
|
+
case "广州市":
|
147
|
+
posdesc = "看小蛮腰,喝早茶了嘛~";
|
148
|
+
break;
|
149
|
+
case "深圳市":
|
150
|
+
switch (ipLoacation.result.ad_info.district) {
|
151
|
+
case "坪山区":
|
152
|
+
posdesc = "好巧!博主也在坪山区生活喔~";
|
153
|
+
break;
|
154
|
+
default:
|
155
|
+
posdesc = "今天你996了嘛~";
|
156
|
+
break;
|
157
|
+
}
|
158
|
+
break;
|
159
|
+
case "阳江市":
|
160
|
+
posdesc = "阳春合水!博主家乡~ 欢迎来玩~";
|
161
|
+
break;
|
162
|
+
default:
|
163
|
+
posdesc = "来两斤福建人~";
|
164
|
+
break;
|
165
|
+
}
|
166
|
+
break;
|
167
|
+
case "广西壮族自治区":
|
168
|
+
posdesc = "桂林山水甲天下";
|
169
|
+
break;
|
170
|
+
case "海南省":
|
171
|
+
posdesc = "朝观日出逐白浪,夕看云起收霞光";
|
172
|
+
break;
|
173
|
+
case "四川省":
|
174
|
+
posdesc = "康康川妹子";
|
175
|
+
break;
|
176
|
+
case "贵州省":
|
177
|
+
posdesc = "茅台,学生,再塞200";
|
178
|
+
break;
|
179
|
+
case "云南省":
|
180
|
+
posdesc = "玉龙飞舞云缠绕,万仞冰川直耸天";
|
181
|
+
break;
|
182
|
+
case "西藏自治区":
|
183
|
+
posdesc = "躺在茫茫草原上,仰望蓝天";
|
184
|
+
break;
|
185
|
+
case "陕西省":
|
186
|
+
posdesc = "来份臊子面加馍";
|
187
|
+
break;
|
188
|
+
case "甘肃省":
|
189
|
+
posdesc = "羌笛何须怨杨柳,春风不度玉门关";
|
190
|
+
break;
|
191
|
+
case "青海省":
|
192
|
+
posdesc = "牛肉干和老酸奶都好好吃";
|
193
|
+
break;
|
194
|
+
case "宁夏回族自治区":
|
195
|
+
posdesc = "大漠孤烟直,长河落日圆";
|
196
|
+
break;
|
197
|
+
case "新疆维吾尔自治区":
|
198
|
+
posdesc = "驼铃古道丝绸路,胡马犹闻唐汉风";
|
199
|
+
break;
|
200
|
+
case "台湾省":
|
201
|
+
posdesc = "我在这头,大陆在那头";
|
202
|
+
break;
|
203
|
+
case "香港特别行政区":
|
204
|
+
posdesc = "永定贼有残留地鬼嚎,迎击光非岁玉";
|
205
|
+
break;
|
206
|
+
case "澳门特别行政区":
|
207
|
+
posdesc = "性感荷官,在线发牌";
|
208
|
+
break;
|
209
|
+
default:
|
210
|
+
posdesc = "带我去你的城市逛逛吧!";
|
211
|
+
break;
|
212
|
+
}
|
213
|
+
break;
|
214
|
+
default:
|
215
|
+
posdesc = "带我去你的国家逛逛吧";
|
216
|
+
break;
|
217
|
+
}
|
218
|
+
|
219
|
+
//根据本地时间切换欢迎语
|
220
|
+
let timeChange;
|
221
|
+
let date = new Date();
|
222
|
+
if (date.getHours() >= 5 && date.getHours() < 11) timeChange = "<span class='welcome-time'>🌤️ 早上好,一日之计在于晨</span>";
|
223
|
+
else if (date.getHours() >= 11 && date.getHours() < 13) timeChange = "<span class='welcome-time'>☀️ 中午好,记得午休喔~</span>";
|
224
|
+
else if (date.getHours() >= 13 && date.getHours() < 17) timeChange = "<span class='welcome-time'>🕞 下午好,饮茶先啦!</span>";
|
225
|
+
else if (date.getHours() >= 17 && date.getHours() < 19) timeChange = "<span class='welcome-time'>🚶♂️ 即将下班,记得按时吃饭~</span>";
|
226
|
+
else if (date.getHours() >= 19 && date.getHours() < 24) timeChange = "<span class='welcome-time'>🌙 晚上好,夜生活嗨起来!</span>";
|
227
|
+
else timeChange = "<span class='welcome-time'>夜深了,早点休息,少熬夜</span>";
|
228
|
+
|
229
|
+
try {
|
230
|
+
//自定义文本和需要放的位置
|
231
|
+
document.getElementById("welcome-info").innerHTML =
|
232
|
+
`<span>热烈欢迎来自~</span><br><span><span style="color: var(--icat-card-welcome);font-weight: bold;">${pos}</span> 的喵友</span><br><span class="welcome-message">${posdesc}</span><br>您当前位置距博主约 <b><span style="color: var(--icat-card-welcome);font-weight: bold;">${dist}</span></b> 公里!<br><span>您的IP地址为:${ip}</span><br>${timeChange}`;
|
233
|
+
} catch (err) {
|
234
|
+
// console.log("Pjax无法获取#welcome-info元素🙄🙄🙄")
|
235
|
+
}
|
236
|
+
}
|