@mlikiowa/nanaeo 1.0.1702966759079 → 1.0.1702967739786

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. package/2022/08/04/NewBlog/index.html +3473 -0
  2. package/2022/08/13/GaussWave/index.html +3407 -0
  3. package/about/index.html +3236 -0
  4. package/archives/2022/08/index.html +3411 -0
  5. package/archives/2022/index.html +3411 -0
  6. package/archives/index.html +3308 -0
  7. package/asset/Sotheby.ttf +0 -0
  8. package/asset/backimg.png +0 -0
  9. package/atom.xml +171 -0
  10. package/categories/DevLog/index.html +3351 -0
  11. package/categories/SiteLog/index.html +3351 -0
  12. package/categories/index.html +3174 -0
  13. package/category/devlog/atom.xml +58 -0
  14. package/category/devlog/feed.json +19 -0
  15. package/category/devlog/rss.xml +62 -0
  16. package/category/sitelog/atom.xml +125 -0
  17. package/category/sitelog/feed.json +20 -0
  18. package/category/sitelog/rss.xml +129 -0
  19. package/content.json +1 -0
  20. package/css/Readme.html +9 -0
  21. package/css/first.css +1504 -0
  22. package/css/style.css +7106 -0
  23. package/favicon.ico +0 -0
  24. package/feed.json +31 -0
  25. package/friends/index.html +3661 -0
  26. package/index.html +3421 -0
  27. package/js/app.js +1223 -0
  28. package/js/plugins/aplayer.js +186 -0
  29. package/js/plugins/parallax.js +191 -0
  30. package/js/plugins/rightMenu.js +577 -0
  31. package/js/plugins/rightMenus.js +618 -0
  32. package/js/plugins/tags/contributors.js +92 -0
  33. package/js/plugins/tags/friends.js +93 -0
  34. package/js/plugins/tags/sites.js +96 -0
  35. package/js/search/hexo.js +192 -0
  36. package/package.json +1 -1
  37. package/rss.xml +175 -0
  38. package/tag/devlog/atom.xml +58 -0
  39. package/tag/devlog/feed.json +19 -0
  40. package/tag/devlog/rss.xml +62 -0
  41. package/tag/gauss/atom.xml +58 -0
  42. package/tag/gauss/feed.json +19 -0
  43. package/tag/gauss/rss.xml +62 -0
  44. package/tag/hexo/atom.xml +125 -0
  45. package/tag/hexo/feed.json +20 -0
  46. package/tag/hexo/rss.xml +129 -0
  47. package/tag/hexothemes/atom.xml +125 -0
  48. package/tag/hexothemes/feed.json +20 -0
  49. package/tag/hexothemes/rss.xml +129 -0
  50. package/tag/sitelog/atom.xml +125 -0
  51. package/tag/sitelog/feed.json +20 -0
  52. package/tag/sitelog/rss.xml +129 -0
  53. package/tags/DevLog/index.html +3351 -0
  54. package/tags/Gauss/index.html +3351 -0
  55. package/tags/Hexo/index.html +3351 -0
  56. package/tags/HexoThemes/index.html +3351 -0
  57. package/tags/SiteLog/index.html +3351 -0
  58. package/tags/index.html +3159 -0
  59. package/volantis-sw.js +797 -0
@@ -0,0 +1,618 @@
1
+
2
+ const RightMenus = {
3
+ defaultEvent: ['copyText', 'copyLink', 'copyPaste', 'copyAll', 'copyCut', 'copyImg', 'printMode', 'readMode'],
4
+ defaultGroup: ['navigation', 'inputBox', 'seletctText', 'elementCheck', 'elementImage', 'articlePage'],
5
+ messageRightMenu: volantis.GLOBAL_CONFIG.plugins.message.enable && volantis.GLOBAL_CONFIG.plugins.message.rightmenu.enable,
6
+ corsAnywhere: volantis.GLOBAL_CONFIG.plugins.rightmenus.options.corsAnywhere,
7
+ urlRegx: /^((https|http)?:\/\/)+[A-Za-z0-9]+\.[A-Za-z0-9]+[\/=\?%\-&_~`@[\]\':+!]*([^<>\"\"])*$/,
8
+ imgRegx: /\.(jpe?g|png|webp|svg|gif|jifi)(-|_|!|\?|\/)?.*$/,
9
+
10
+ /**
11
+ * 加载右键菜单
12
+ */
13
+ initialMenu: () => {
14
+ RightMenus.fun.init();
15
+ volantis.pjax.send(() => {
16
+ RightMenus.fun.hideMenu();
17
+ if (volantis.isReadModel) RightMenus.fun.readMode();
18
+ })
19
+ },
20
+
21
+ /**
22
+ * 读取剪切板
23
+ * @returns text
24
+ */
25
+ readClipboard: async () => {
26
+ let clipboardText;
27
+ const result = await navigator.permissions.query({ name: 'clipboard-read' });
28
+ switch (result.state) {
29
+ case 'granted':
30
+ case 'prompt':
31
+ clipboardText = await navigator.clipboard.readText()
32
+ break;
33
+ default:
34
+ window.clipboardRead = false;
35
+ break;
36
+ }
37
+ return clipboardText;
38
+ },
39
+
40
+ /**
41
+ * 写入文本到剪切板
42
+ * @param {String} text
43
+ */
44
+ writeClipText: text => {
45
+ return navigator.clipboard
46
+ .writeText(text)
47
+ .then(() => {
48
+ return Promise.resolve()
49
+ })
50
+ .catch(err => {
51
+ return Promise.reject(err)
52
+ })
53
+ },
54
+
55
+ /**
56
+ * 写入图片到剪切板
57
+ * @param {*} link
58
+ * @param {*} success
59
+ * @param {*} error
60
+ */
61
+ writeClipImg: async (link, success, error) => {
62
+ const image = new Image;
63
+ image.crossOrigin = "Anonymous";
64
+ image.addEventListener('load', () => {
65
+ let canvas = document.createElement("canvas");
66
+ let context = canvas.getContext("2d");
67
+ canvas.width = image.width;
68
+ canvas.height = image.height;
69
+ context.drawImage(image, 0, 0);
70
+ canvas.toBlob(blob => {
71
+ navigator.clipboard.write([
72
+ new ClipboardItem({ 'image/png': blob })
73
+ ]).then(e => {
74
+ success(e)
75
+ }).catch(e => {
76
+ error(e)
77
+ })
78
+ }, 'image/png')
79
+ }, false)
80
+ image.src = `${link}?(lll¬ω¬)`;
81
+ },
82
+
83
+ /**
84
+ * 粘贴文本到剪切板
85
+ * @param {*} elemt
86
+ * @param {*} value
87
+ */
88
+ insertAtCaret: (elemt, value) => {
89
+ const startPos = elemt.selectionStart,
90
+ endPos = elemt.selectionEnd;
91
+ if (document.selection) {
92
+ elemt.focus();
93
+ var sel = document.selection.createRange();
94
+ sel.text = value;
95
+ elemt.focus();
96
+ } else {
97
+ if (startPos || startPos == '0') {
98
+ var scrollTop = elemt.scrollTop;
99
+ elemt.value = elemt.value.substring(0, startPos) + value + elemt.value.substring(endPos, elemt.value.length);
100
+ elemt.focus();
101
+ elemt.selectionStart = startPos + value.length;
102
+ elemt.selectionEnd = startPos + value.length;
103
+ elemt.scrollTop = scrollTop;
104
+ } else {
105
+ elemt.value += value;
106
+ elemt.focus();
107
+ }
108
+ }
109
+ }
110
+ }
111
+
112
+ /**
113
+ * 事件处理区域
114
+ */
115
+ RightMenus.fun = (() => {
116
+ const rightMenuConfig = volantis.GLOBAL_CONFIG.plugins.rightmenus;
117
+
118
+ const
119
+ fn = {},
120
+ _rightMenuWrapper = document.getElementById('rightmenu-wrapper'),
121
+ _rightMenuContent = document.getElementById('rightmenu-content'),
122
+ _rightMenuList = document.querySelectorAll('#rightmenu-content li.menuLoad-Content'),
123
+ _rightMenuListWithHr = document.querySelectorAll('#rightmenu-content li, #rightmenu-content hr, #menuMusic'),
124
+ _readBkg = document.getElementById('read_bkg'),
125
+ _menuMusic = document.getElementById('menuMusic'),
126
+ _backward = document.querySelector('#menuMusic .backward'),
127
+ _toggle = document.querySelector('#menuMusic .toggle'),
128
+ _forward = document.querySelector('#menuMusic .forward');
129
+
130
+ // 公共数据
131
+ let globalData = {
132
+ mouseEvent: null,
133
+ isInputBox: false,
134
+ selectText: '',
135
+ inputValue: '',
136
+ isLink: false,
137
+ linkUrl: '',
138
+ isMediaLink: false,
139
+ mediaLinkUrl: '',
140
+ isImage: false,
141
+ isArticle: false,
142
+ pathName: '',
143
+ isReadClipboard: true,
144
+ isShowMusic: false,
145
+ statusCheck: false
146
+ }
147
+ const globalDataBackup = Object.assign({}, globalData);
148
+
149
+ /**
150
+ * 初始化监听事件处理
151
+ */
152
+ fn.initEvent = () => {
153
+ fn.elementAppend();
154
+ fn.contextmenu();
155
+ fn.menuEvent();
156
+ }
157
+
158
+ /**
159
+ * 预置元素设定
160
+ */
161
+ fn.elementAppend = () => {
162
+ // 阅读模式
163
+ if (_readBkg) _readBkg.parentNode.removeChild(_readBkg);
164
+ const readBkg = document.createElement("div");
165
+ readBkg.className = "common_read_bkg common_read_hide";
166
+ readBkg.id = "read_bkg";
167
+ window.document.body.appendChild(readBkg);
168
+ }
169
+
170
+ /**
171
+ * 右键菜单位置设定
172
+ * @param {*} event
173
+ */
174
+ fn.menuPosition = (event) => {
175
+ try {
176
+ let mouseClientX = event.clientX;
177
+ let mouseClientY = event.clientY;
178
+ let screenWidth = document.documentElement.clientWidth || document.body.clientWidth;
179
+ let screenHeight = document.documentElement.clientHeight || document.body.clientHeight;
180
+
181
+ _rightMenuWrapper.style.display = 'block';
182
+ fn.menuControl(event);
183
+
184
+ let menuWidth = _rightMenuContent.offsetWidth;
185
+ let menuHeight = _rightMenuContent.offsetHeight;
186
+ let showLeft = mouseClientX + menuWidth > screenWidth ? mouseClientX - menuWidth + 10 : mouseClientX;
187
+ let showTop = mouseClientY + menuHeight > screenHeight ? mouseClientY - menuHeight + 10 : mouseClientY;
188
+ showTop = mouseClientY + menuHeight > screenHeight && showTop < menuHeight && mouseClientY < menuHeight ?
189
+ showTop + (screenHeight - menuHeight - showTop - 10) : showTop;
190
+ _rightMenuWrapper.style.left = `${showLeft}px`;
191
+ _rightMenuWrapper.style.top = `${showTop}px`;
192
+ if (volantis.GLOBAL_CONFIG.plugins.message.rightmenu.notice) fn.menuNotic();
193
+ } catch (error) {
194
+ console.error(error);
195
+ fn.hideMenu();
196
+ return true;
197
+ }
198
+ return false;
199
+ }
200
+
201
+ /**
202
+ * 菜单项控制
203
+ * @param {*} event
204
+ */
205
+ fn.menuControl = (event) => {
206
+ fn.globalDataSet(event);
207
+ if (!!_menuMusic) _menuMusic.style.display = globalData.isShowMusic ? 'block' : 'none';
208
+ _rightMenuList.forEach(item => {
209
+ item.style.display = 'none';
210
+ const nodeName = item.firstElementChild.nodeName;
211
+ const groupName = item.firstElementChild.getAttribute('data-group');
212
+ const itemEvent = item.firstElementChild.getAttribute('data-event');
213
+ if (globalData.statusCheck || globalData.isArticle) {
214
+ switch (groupName) {
215
+ case 'inputBox':
216
+ if (globalData.isInputBox) {
217
+ item.style.display = 'block';
218
+ if (itemEvent === 'copyCut' && !globalData.selectText) item.style.display = 'none';
219
+ if (itemEvent === 'copyAll' && !globalData.inputValue) item.style.display = 'none';
220
+ if (itemEvent === 'copyPaste' && !globalData.isReadClipboard) item.style.display = 'none';
221
+ }
222
+ break;
223
+ case 'seletctText':
224
+ if (!!globalData.selectText) item.style.display = 'block';
225
+ break;
226
+ case 'elementCheck':
227
+ if (globalData.isLink || globalData.isMediaLink) item.style.display = 'block';
228
+ break;
229
+ case 'elementImage':
230
+ if (globalData.isImage) item.style.display = 'block';
231
+ break;
232
+ case 'articlePage':
233
+ if (globalData.isArticle) item.style.display = 'block';
234
+ break;
235
+ default:
236
+ item.style.display = nodeName === 'A'
237
+ ? globalData.isArticle && !globalData.statusCheck && rightMenuConfig.options.articleShowLink
238
+ ? 'block'
239
+ : 'none'
240
+ : 'block';
241
+ break;
242
+ }
243
+ } else if (nodeName === 'A' || RightMenus.defaultGroup.every(item => { return groupName !== item })) {
244
+ item.style.display = 'block';
245
+ }
246
+ })
247
+
248
+ // 执行外部事件
249
+ volantis.mouseEvent = event;
250
+ volantis.rightmenu.method.handle.start()
251
+
252
+ // 过滤 HR 元素
253
+ let elementHrItem = { item: null, hide: true };
254
+ _rightMenuListWithHr.forEach((item) => {
255
+ if (item.nodeName === "HR") {
256
+ item.style.display = 'block';
257
+ if (!elementHrItem.item) {
258
+ elementHrItem.item = item;
259
+ return;
260
+ }
261
+ if (elementHrItem.hide || elementHrItem.item.nextElementSibling.nodeName === "hr") {
262
+ elementHrItem.item.style.display = 'none';
263
+ }
264
+ elementHrItem.item = item;
265
+ elementHrItem.hide = true;
266
+ } else {
267
+ if (item.style.display === 'block' && elementHrItem.hide) {
268
+ elementHrItem.hide = false;
269
+ }
270
+ }
271
+ })
272
+ if (!!elementHrItem.item && elementHrItem.hide) elementHrItem.item.style.display = 'none';
273
+ }
274
+
275
+ /**
276
+ * 元素状态判断/全局数据设置
277
+ * @param {*} event
278
+ */
279
+ fn.globalDataSet = (event) => {
280
+ globalData = Object.assign({}, globalDataBackup);
281
+ globalData.mouseEvent = event;
282
+ globalData.selectText = window.getSelection().toString();
283
+
284
+ // 判断是否为输入框
285
+ if (event.target.tagName.toLowerCase() === 'input' || event.target.tagName.toLowerCase() === 'textarea') {
286
+ globalData.isInputBox = true;
287
+ globalData.inputValue = event.target.value;
288
+ }
289
+
290
+ // 判断是否允许读取剪切板
291
+ if (globalData.isInputBox && window.clipboardRead === false) {
292
+ globalData.isReadClipboard = false;
293
+ }
294
+
295
+ // 判断是否包含链接
296
+ if (!!event.target.href && RightMenus.urlRegx.test(event.target.href)) {
297
+ globalData.isLink = true;
298
+ globalData.linkUrl = event.target.href;
299
+ }
300
+
301
+ // 判断是否包含媒体链接
302
+ if (!!event.target.currentSrc && RightMenus.urlRegx.test(event.target.currentSrc)) {
303
+ globalData.isMediaLink = true;
304
+ globalData.mediaLinkUrl = event.target.currentSrc;
305
+ }
306
+
307
+ // 判断是否为图片地址
308
+ if (globalData.isMediaLink && RightMenus.imgRegx.test(globalData.mediaLinkUrl)) {
309
+ globalData.isImage = true;
310
+ }
311
+
312
+ // 判断是否为文章页面
313
+ if (!!(document.querySelector('#post.article') || null)) {
314
+ globalData.isArticle = true;
315
+ globalData.pathName = window.location.pathname;
316
+ }
317
+
318
+ // 判断是否显示音乐控制器
319
+ if (volantis.GLOBAL_CONFIG.plugins.aplayer?.enable
320
+ && typeof RightMenuAplayer !== 'undefined'
321
+ && RightMenuAplayer.APlayer.player !== undefined) {
322
+ if (rightMenuConfig.options.musicAlwaysShow
323
+ || RightMenuAplayer.APlayer.status === 'play'
324
+ || RightMenuAplayer.APlayer.status === 'undefined') {
325
+ globalData.isShowMusic = true;
326
+ }
327
+ }
328
+
329
+ // 设定校验状态
330
+ if (!!globalData.selectText || globalData.isInputBox || globalData.isLink || globalData.isMediaLink) {
331
+ globalData.statusCheck = true;
332
+ }
333
+ }
334
+
335
+ /**
336
+ * 全局右键监听函数
337
+ */
338
+ fn.contextmenu = () => {
339
+ window.document.oncontextmenu = (event) => {
340
+ if (event.ctrlKey || document.body.offsetWidth <= 500) {
341
+ fn.hideMenu();
342
+ return true;
343
+ }
344
+ return fn.menuPosition(event);
345
+ }
346
+
347
+ _rightMenuWrapper.oncontextmenu = (event) => {
348
+ event.stopPropagation();
349
+ event.preventDefault();
350
+ return false;
351
+ }
352
+
353
+ window.removeEventListener('blur', fn.hideMenu);
354
+ window.addEventListener('blur', fn.hideMenu);
355
+ document.body.removeEventListener('click', fn.hideMenu);
356
+ document.body.addEventListener('click', fn.hideMenu);
357
+ }
358
+
359
+ /**
360
+ * 菜单项事件处理函数
361
+ */
362
+ fn.menuEvent = () => {
363
+ _rightMenuList.forEach(item => {
364
+ let eventName = item.firstElementChild.getAttribute('data-event');
365
+ const id = item.firstElementChild.getAttribute('id');
366
+ const groupName = item.firstElementChild.getAttribute('data-group');
367
+ if (item.firstElementChild.nodeName === "A") return;
368
+ item.addEventListener('click', () => {
369
+ try {
370
+ if (RightMenus.defaultEvent.every(item => { return eventName !== item })) {
371
+ if (groupName === 'seletctText') {
372
+ RightMenusFunction[id](globalData.selectText)
373
+ } else if (groupName === 'elementCheck') {
374
+ RightMenusFunction[id](globalData.isLink ? globalData.linkUrl : globalData.mediaLinkUrl)
375
+ } else if (groupName === 'elementImage') {
376
+ RightMenusFunction[id](globalData.mediaLinkUrl)
377
+ } else {
378
+ RightMenusFunction[id]()
379
+ }
380
+ } else {
381
+ fn[eventName]()
382
+ }
383
+ } catch (error) {
384
+ if (volantis.GLOBAL_CONFIG.debug === "rightMenus") {
385
+ console.error({
386
+ id: id,
387
+ error: error,
388
+ globalData: globalData,
389
+ groupName: groupName,
390
+ eventName: eventName
391
+ });
392
+ }
393
+ if (RightMenus.messageRightMenu) {
394
+ VolantisApp.message('错误提示', error, {
395
+ icon: rightMenuConfig.options.iconPrefix + ' fa-exclamation-square red',
396
+ time: '15000'
397
+ });
398
+ }
399
+ }
400
+ })
401
+ })
402
+
403
+ if (_forward && _toggle && _forward) {
404
+ _backward.onclick = (e) => {
405
+ e.preventDefault();
406
+ e.stopPropagation();
407
+ RightMenuAplayer.aplayerBackward();
408
+ }
409
+ _toggle.onclick = (e) => {
410
+ e.preventDefault();
411
+ e.stopPropagation();
412
+ RightMenuAplayer.aplayerToggle();
413
+ }
414
+ _forward.onclick = (e) => {
415
+ e.preventDefault();
416
+ e.stopPropagation();
417
+ RightMenuAplayer.aplayerForward();
418
+ }
419
+ }
420
+ }
421
+
422
+ /**
423
+ * 隐藏菜单显示
424
+ */
425
+ fn.hideMenu = () => {
426
+ _rightMenuWrapper.style.display = null;
427
+ _rightMenuWrapper.style.left = null;
428
+ _rightMenuWrapper.style.top = null;
429
+ }
430
+
431
+ /**
432
+ * 右键菜单覆盖提示
433
+ */
434
+ fn.menuNotic = () => {
435
+ const NoticeRightMenu = localStorage.getItem('NoticeRightMenu') === 'true';
436
+ if (RightMenus.messageRightMenu && !NoticeRightMenu)
437
+ VolantisApp.message('右键菜单', '唤醒原系统菜单请使用:<kbd>Ctrl</kbd> + <kbd>右键</kbd>', {
438
+ icon: rightMenuConfig.options.iconPrefix + ' fa-exclamation-square red',
439
+ displayMode: 1,
440
+ time: 9000
441
+ }, () => {
442
+ localStorage.setItem('NoticeRightMenu', 'true')
443
+ });
444
+ }
445
+
446
+ fn.copyText = () => {
447
+ VolantisApp.utilWriteClipText(globalData.selectText)
448
+ .then(() => {
449
+ if (RightMenus.messageRightMenu) {
450
+ VolantisApp.messageCopyright();
451
+ }
452
+ }).catch(e => {
453
+ if (RightMenus.messageRightMenu) {
454
+ VolantisApp.message('系统提示', e, {
455
+ icon: rightMenuConfig.options.iconPrefix + ' fa-exclamation-square red',
456
+ displayMode: 1,
457
+ time: 9000
458
+ });
459
+ }
460
+ })
461
+ }
462
+
463
+ fn.copyLink = () => {
464
+ VolantisApp.utilWriteClipText(globalData.linkUrl || globalData.mediaLinkUrl)
465
+ .then(() => {
466
+ if (RightMenus.messageRightMenu) {
467
+ VolantisApp.messageCopyright();
468
+ }
469
+ }).catch(e => {
470
+ if (RightMenus.messageRightMenu) {
471
+ VolantisApp.message('系统提示', e, {
472
+ icon: rightMenuConfig.options.iconPrefix + ' fa-exclamation-square red',
473
+ displayMode: 1,
474
+ time: 9000
475
+ });
476
+ }
477
+ })
478
+ }
479
+
480
+ fn.copyAll = () => {
481
+ globalData.mouseEvent.target.select();
482
+ }
483
+
484
+ fn.copyPaste = async () => {
485
+ const result = await RightMenus.readClipboard() || '';
486
+ if (RightMenus.messageRightMenu && window.clipboardRead === false) {
487
+ VolantisApp.message('系统提示', '未授予剪切板读取权限!');
488
+ } else if (RightMenus.messageRightMenu && result === '') {
489
+ VolantisApp.message('系统提示', '仅支持复制文本内容!');
490
+ } else {
491
+ RightMenus.insertAtCaret(globalData.mouseEvent.target, result);
492
+ }
493
+ }
494
+
495
+ fn.copyCut = () => {
496
+ const statrPos = globalData.mouseEvent.target.selectionStart;
497
+ const endPos = globalData.mouseEvent.target.selectionEnd;
498
+ const inputStr = globalData.inputValue;
499
+ fn.copyText(globalData.selectText);
500
+ globalData.mouseEvent.target.value = inputStr.substring(0, statrPos) + inputStr.substring(endPos, inputStr.length);
501
+ globalData.mouseEvent.target.selectionStart = statrPos;
502
+ globalData.mouseEvent.target.selectionEnd = statrPos;
503
+ globalData.mouseEvent.target.focus();
504
+ }
505
+
506
+ fn.copyImg = () => {
507
+ if (volantis.GLOBAL_CONFIG.plugins.message.rightmenu.notice) {
508
+ VolantisApp.message('系统提示', '复制中,请等待。', {
509
+ icon: rightMenuConfig.options.iconPrefix + ' fa-images'
510
+ })
511
+ }
512
+ RightMenus.writeClipImg(globalData.mediaLinkUrl, e => {
513
+ if (RightMenus.messageRightMenu) {
514
+ VolantisApp.hideMessage();
515
+ VolantisApp.message('系统提示', '图片复制成功!', {
516
+ icon: rightMenuConfig.options.iconPrefix + ' fa-images'
517
+ });
518
+ }
519
+ }, (e) => {
520
+ console.error(e);
521
+ if (RightMenus.messageRightMenu) {
522
+ VolantisApp.hideMessage();
523
+ VolantisApp.message('系统提示', '复制失败:' + e, {
524
+ icon: rightMenuConfig.options.iconPrefix + ' fa-exclamation-square red',
525
+ time: 9000
526
+ });
527
+ }
528
+ })
529
+ }
530
+
531
+ fn.printMode = () => {
532
+ if (window.location.pathname === globalData.pathName) {
533
+ if (RightMenus.messageRightMenu) {
534
+ const message = '是否打印当前页面?<br><em style="font-size: 80%">建议打印时勾选背景图形</em><br>'
535
+ VolantisApp.question('', message, { time: 9000 }, () => { fn.printHtml() })
536
+ } else {
537
+ fn.printHtml()
538
+ }
539
+ }
540
+ }
541
+
542
+ fn.printHtml = () => {
543
+ if (volantis.isReadModel) fn.readMode();
544
+ DOMController.setAttribute('details', 'open', 'true');
545
+ DOMController.removeList([
546
+ '.cus-article-bkg', '.iziToast-overlay', '.iziToast-wrapper', '.prev-next',
547
+ 'footer', '#l_header', '#l_cover', '#l_side', '#comments', '#s-top', '#BKG',
548
+ '#rightmenu-wrapper', '.nav-tabs', '.parallax-mirror', '.new-meta-item.share', 'div.footer'
549
+ ]);
550
+ DOMController.setStyleList([
551
+ ['body', 'backgroundColor', 'unset'], ['#l_main', 'width', '100%'], ['#post', 'boxShadow', 'none'],
552
+ ['#post', 'background', 'none'], ['#post', 'padding', '0'], ['h1', 'textAlign', 'center'],
553
+ ['h1', 'fontWeight', '600'], ['h1', 'fontSize', '2rem'], ['h1', 'marginBottom', '20px'],
554
+ ['.tab-pane', 'display', 'block'], ['.tab-content', 'borderTop', 'none'], ['.highlight>table pre', 'whiteSpace', 'pre-wrap'],
555
+ ['.highlight>table pre', 'wordBreak', 'break-all'], ['.fancybox img', 'height', 'auto'], ['.fancybox img', 'weight', 'auto']
556
+ ]);
557
+ setTimeout(() => {
558
+ window.print();
559
+ document.body.innerHTML = '';
560
+ window.location.reload();
561
+ }, 50);
562
+ }
563
+
564
+ fn.readMode = () => {
565
+ if (typeof ScrollReveal === 'function') ScrollReveal().clean('#comments');
566
+ DOMController.fadeToggleList([
567
+ document.querySelector('#l_header'), document.querySelector('footer'),
568
+ document.querySelector('#s-top'), document.querySelector('.article-meta#bottom'),
569
+ document.querySelector('.prev-next'), document.querySelector('#l_side'),
570
+ document.querySelector('#comments')
571
+ ]);
572
+ DOMController.toggleClassList([
573
+ [document.querySelector('#l_main'), 'common_read'], [document.querySelector('#l_main'), 'common_read_main'],
574
+ [document.querySelector('#l_body'), 'common_read'], [document.querySelector('#safearea'), 'common_read'],
575
+ [document.querySelector('#pjax-container'), 'common_read'], [document.querySelector('#read_bkg'), 'common_read_hide'],
576
+ [document.querySelector('h1'), 'common_read_h1'], [document.querySelector('#post'), 'post_read'],
577
+ [document.querySelector('#l_cover'), 'read_cover'], [document.querySelector('.widget.toc-wrapper'), 'post_read']
578
+ ]);
579
+ DOMController.setStyle('.copyright.license', 'margin', '15px 0');
580
+ volantis.isReadModel = volantis.isReadModel === undefined ? true : !volantis.isReadModel;
581
+ if (volantis.isReadModel) {
582
+ if (RightMenus.messageRightMenu) VolantisApp.message('系统提示', '阅读模式已开启,您可以点击屏幕空白处退出。', {
583
+ backgroundColor: 'var(--color-read-post)',
584
+ icon: rightMenuConfig.options.iconPrefix + ' fa-book-reader',
585
+ displayMode: 1,
586
+ time: 5000
587
+ });
588
+ document.querySelector('#l_body').removeEventListener('click', fn.readMode);
589
+ document.querySelector('#l_body').addEventListener('click', (event) => {
590
+ if (DOMController.hasClass(event.target, 'common_read')) {
591
+ fn.readMode();
592
+ }
593
+ });
594
+ } else {
595
+ document.querySelector('#l_body').removeEventListener('click', fn.readMode);
596
+ document.querySelector('#post').removeEventListener('click', fn.readMode);
597
+ DOMController.setStyle('.prev-next', 'display', 'flex');
598
+ DOMController.setStyle('.copyright.license', 'margin', '15px -40px');
599
+ }
600
+ }
601
+
602
+ return {
603
+ init: fn.initEvent,
604
+ hideMenu: fn.hideMenu,
605
+ readMode: fn.readMode
606
+ }
607
+ })()
608
+
609
+ Object.freeze(RightMenus);
610
+ volantis.requestAnimationFrame(() => {
611
+ if (document.readyState !== 'loading') {
612
+ RightMenus.initialMenu();
613
+ } else {
614
+ document.addEventListener("DOMContentLoaded", function () {
615
+ RightMenus.initialMenu();
616
+ })
617
+ }
618
+ });