sinzmise-cetastories 2.0.0-1731114112124 → 2.0.0-1731116663626
Sign up to get free protection for your applications and to get access to all the features.
- package/404/index.html +1 -4033
- package/about/index.html +1 -4041
- package/album/index.html +1 -4050
- package/archives/2021/12/index.html +1 -3917
- package/archives/2021/index.html +1 -3917
- package/archives/2022/12/index.html +1 -3917
- package/archives/2022/index.html +1 -3917
- package/archives/2023/01/index.html +1 -4072
- package/archives/2023/02/index.html +1 -3917
- package/archives/2023/03/index.html +1 -4063
- package/archives/2023/04/index.html +1 -3992
- package/archives/2023/07/index.html +1 -4217
- package/archives/2023/08/index.html +1 -4067
- package/archives/2023/09/index.html +1 -3917
- package/archives/2023/10/index.html +1 -3917
- package/archives/2023/11/index.html +1 -3917
- package/archives/2023/12/index.html +1 -3918
- package/archives/2023/index.html +1 -4591
- package/archives/2023/page/2/index.html +1 -4572
- package/archives/2023/page/3/index.html +1 -3930
- package/archives/2024/01/index.html +1 -4142
- package/archives/2024/02/index.html +1 -3922
- package/archives/2024/03/index.html +1 -3916
- package/archives/2024/04/index.html +1 -3997
- package/archives/2024/05/index.html +1 -4065
- package/archives/2024/06/index.html +1 -3917
- package/archives/2024/07/index.html +1 -3917
- package/archives/2024/08/index.html +1 -3992
- package/archives/2024/09/index.html +1 -3917
- package/archives/2024/10/index.html +1 -3984
- package/archives/2024/index.html +1 -4576
- package/archives/2024/page/2/index.html +1 -4433
- package/archives/index.html +1 -4560
- package/archives/page/2/index.html +1 -4560
- package/archives/page/3/index.html +1 -4560
- package/archives/page/4/index.html +1 -4560
- package/archives/page/5/index.html +1 -4560
- package/assets/algolia/algoliasearch.js +3 -7182
- package/assets/algolia/algoliasearchLite.js +3 -4445
- package/atom.xml +31 -31
- package/bbs/bbs.html +1 -4012
- package/bbs/bbs.js +2 -12
- package/bbs/index.html +1 -4031
- package/categories/index.html +1 -4050
- package/categories//344/270/252/344/272/272/345/260/217/350/256/260/index.html +1 -4570
- package/categories//344/270/252/344/272/272/345/260/217/350/256/260/page/2/index.html +1 -4485
- package/categories//346/255/214/346/233/262/346/224/266/351/233/206/index.html +1 -3920
- package/categories//346/270/270/346/210/217/347/233/270/345/205/263/index.html +1 -4148
- package/categories//347/253/231/347/202/271/346/212/230/350/205/276/index.html +1 -4610
- package/categories//347/253/231/347/202/271/346/212/230/350/205/276/page/2/index.html +1 -4148
- package/categories//351/241/271/347/233/256/346/212/230/350/205/276/index.html +1 -4072
- package/charts/index.html +1 -4039
- package/comments/index.html +1 -4052
- package/css/custom2.css +2 -3
- package/css/first.css +2 -1868
- package/css/pace/big-counter.css +2 -39
- package/css/pace/corner-indicator.css +2 -72
- package/css/pace/flash.css +2 -76
- package/css/pace/mac-osx.css +2 -86
- package/css/pace/pace.css +2 -50
- package/css/plane.css +2 -59
- package/css/style.css +2 -8585
- package/css/tags.css +2 -3516
- package/essay/index.html +1 -4050
- package/fcircle/index.html +1 -4075
- package/games +2 -2
- package/index.html +1 -4717
- package/js/app.js +2 -1341
- package/js/autoload.js +2 -62
- package/js/ceta/fancybox.css +2 -2
- package/js/ceta/fancybox.umd.js +2 -2
- package/js/ceta/iconfontInkss.js +2 -1
- package/js/ceta/message.css +2 -6
- package/js/ceta/message.js +2 -6
- package/js/clock.js +2 -1
- package/js/kslink.js +2 -38
- package/js/newyear.js +2 -76
- package/js/plane.js +2 -2200
- package/js/plugins/aplayer.js +2 -186
- package/js/plugins/parallax.js +2 -191
- package/js/plugins/rightMenus.js +2 -623
- package/js/plugins/tags/contributors.js +2 -92
- package/js/plugins/tags/friends.js +2 -93
- package/js/plugins/tags/sites.js +2 -96
- package/js/search/algolia.js +2 -239
- package/js/search/hexo.js +2 -195
- package/js/search/meilisearch.js +2 -220
- package/js/txmap.js +2 -248
- package/link/index.html +1 -6180
- package/load.html +1 -294
- package/maps/assets/algolia/algoliasearch.js.map +1 -0
- package/maps/assets/algolia/algoliasearchLite.js.map +1 -0
- package/maps/bbs/bbs.js.map +1 -0
- package/maps/css/custom2.css.map +1 -0
- package/maps/css/first.css.map +1 -0
- package/maps/css/pace/big-counter.css.map +1 -0
- package/maps/css/pace/corner-indicator.css.map +1 -0
- package/maps/css/pace/flash.css.map +1 -0
- package/maps/css/pace/mac-osx.css.map +1 -0
- package/maps/css/pace/pace.css.map +1 -0
- package/maps/css/plane.css.map +1 -0
- package/maps/css/style.css.map +1 -0
- package/maps/css/tags.css.map +1 -0
- package/maps/js/app.js.map +1 -0
- package/maps/js/autoload.js.map +1 -0
- package/maps/js/ceta/fancybox.css.map +1 -0
- package/maps/js/ceta/fancybox.umd.js.map +1 -0
- package/maps/js/ceta/iconfontInkss.js.map +1 -0
- package/maps/js/ceta/message.css.map +1 -0
- package/maps/js/ceta/message.js.map +1 -0
- package/maps/js/clock.js.map +1 -0
- package/maps/js/kslink.js.map +1 -0
- package/maps/js/newyear.js.map +1 -0
- package/maps/js/plane.js.map +1 -0
- package/maps/js/plugins/aplayer.js.map +1 -0
- package/maps/js/plugins/parallax.js.map +1 -0
- package/maps/js/plugins/rightMenus.js.map +1 -0
- package/maps/js/plugins/tags/contributors.js.map +1 -0
- package/maps/js/plugins/tags/friends.js.map +1 -0
- package/maps/js/plugins/tags/sites.js.map +1 -0
- package/maps/js/search/algolia.js.map +1 -0
- package/maps/js/search/hexo.js.map +1 -0
- package/maps/js/search/meilisearch.js.map +1 -0
- package/maps/js/txmap.js.map +1 -0
- package/maps/sw.js.map +1 -0
- package/maps/weichuncai/css/style.css.map +1 -0
- package/maps/weichuncai/js/common.js.map +1 -0
- package/maps/weichuncai/js/jquery.js.map +1 -0
- package/maps/weichuncai/wcc-config.js.map +1 -0
- package/music/index.html +1 -4033
- package/package.json +1 -1
- package/page/2/index.html +1 -4578
- package/page/3/index.html +1 -4575
- package/page/4/index.html +1 -4572
- package/page/5/index.html +1 -3924
- package/posts/10021/index.html +5 -4130
- package/posts/10045/index.html +1 -4224
- package/posts/10733/index.html +1 -4125
- package/posts/10996/index.html +5 -4127
- package/posts/12779/index.html +1 -4134
- package/posts/13624/index.html +1 -4179
- package/posts/15688/index.html +1 -4133
- package/posts/15748/index.html +5 -4121
- package/posts/15799/index.html +1 -4130
- package/posts/15842/index.html +5 -4121
- package/posts/16107/index.html +1 -4111
- package/posts/18063/index.html +1 -4124
- package/posts/20412/index.html +1 -4134
- package/posts/21375/index.html +1 -4124
- package/posts/22945/index.html +4 -4169
- package/posts/23021/index.html +1 -4104
- package/posts/27531/index.html +5 -4121
- package/posts/28536/index.html +1 -4116
- package/posts/28733/index.html +1 -4168
- package/posts/29196/index.html +1 -4106
- package/posts/38917/index.html +1 -4144
- package/posts/38964/index.html +1 -4208
- package/posts/42487/index.html +1 -4135
- package/posts/42580/index.html +1 -4128
- package/posts/45875/index.html +1 -4118
- package/posts/46640/index.html +1 -4147
- package/posts/48762/index.html +1 -4109
- package/posts/50710/index.html +1 -4114
- package/posts/52677/index.html +1 -4125
- package/posts/53662/index.html +1 -4123
- package/posts/54386/index.html +1 -4116
- package/posts/54481/index.html +1 -4133
- package/posts/54787/index.html +5 -4124
- package/posts/56467/index.html +1 -4121
- package/posts/57692/index.html +1 -4143
- package/posts/58203/index.html +1 -4116
- package/posts/61417/index.html +1 -4117
- package/posts/61712/index.html +1 -4113
- package/posts/646/index.html +1 -4106
- package/posts/64856/index.html +1 -4120
- package/posts/64935/index.html +1 -4120
- package/search.xml +70 -70
- package/seas/index.html +1 -4050
- package/sw.js +2 -798
- package/tags/Flash/347/233/270/345/205/263/index.html +1 -3924
- package/tags/Steam/346/270/270/346/210/217/index.html +1 -3924
- package/tags/Windows/350/275/257/344/273/266/index.html +1 -3997
- package/tags/index.html +1 -4033
- package/tags//344/270/252/344/272/272/345/260/217/350/256/260/index.html +1 -4570
- package/tags//344/270/252/344/272/272/345/260/217/350/256/260/page/2/index.html +1 -4485
- package/tags//345/205/266/345/256/203/346/270/270/346/210/217/index.html +1 -4073
- package/tags//345/212/240/350/275/275/345/212/250/347/224/273/index.html +1 -3924
- package/tags//346/202/254/346/265/256/345/256/240/347/211/251-/347/234/213/346/235/277/345/250/230/index.html +1 -3925
- package/tags//346/255/214/346/233/262/346/224/266/351/233/206/index.html +1 -3920
- package/tags//346/270/270/346/210/217/347/233/270/345/205/263/index.html +1 -4148
- package/tags//347/253/231/347/202/271/345/272/225/351/203/250/351/255/224/346/224/271/index.html +1 -3924
- package/tags//347/253/231/347/202/271/346/212/230/350/205/276/index.html +1 -4610
- package/tags//347/253/231/347/202/271/346/212/230/350/205/276/page/2/index.html +1 -4148
- package/tags//350/207/252/345/273/272/351/203/250/347/275/262/index.html +1 -4224
- package/tags//351/241/265/351/235/242/351/255/224/346/224/271/index.html +1 -4075
- package/tags//351/241/271/347/233/256/346/212/230/350/205/276/index.html +1 -4072
- package/update/index.html +1 -4112
- package/weichuncai/css/style.css +2 -25
- package/weichuncai/js/common.js +2 -449
- package/weichuncai/js/jquery.js +2 -139
- package/weichuncai/wcc-config.js +2 -17
package/js/plugins/rightMenus.js
CHANGED
@@ -1,623 +1,2 @@
|
|
1
|
-
|
2
|
-
|
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',
|
549
|
-
'.new-meta-box', 'button.btn-copy', 'iframe'
|
550
|
-
]);
|
551
|
-
DOMController.setStyleList([
|
552
|
-
['body', 'backgroundColor', 'unset'], ['#l_main, .copyright.license', 'width', '100%'],
|
553
|
-
['#post', 'boxShadow', 'none'], ['#post', 'background', 'none'], ['#post', 'padding', '0'],
|
554
|
-
['h1', 'textAlign', 'center'], ['h1', 'fontWeight', '600'], ['h1', 'fontSize', '2rem'], ['h1', 'marginBottom', '20px'],
|
555
|
-
['.tab-pane', 'display', 'block'], ['.tab-content', 'borderTop', 'none'], ['.highlight>table pre', 'whiteSpace', 'pre-wrap'],
|
556
|
-
['.highlight>table pre', 'wordBreak', 'break-all'], ['.fancybox img', 'height', 'auto'], ['.fancybox img', 'weight', 'auto'],
|
557
|
-
['.copyright.license', 'margin', '0'], ['.copyright.license', 'padding', '1.25em 20px'],
|
558
|
-
['figure.highlight, .copyright.license', 'display', 'inline-block'],
|
559
|
-
]);
|
560
|
-
setTimeout(() => {
|
561
|
-
window.print();
|
562
|
-
document.body.innerHTML = '';
|
563
|
-
window.location.reload();
|
564
|
-
}, 50);
|
565
|
-
}
|
566
|
-
|
567
|
-
fn.readMode = () => {
|
568
|
-
if (typeof ScrollReveal === 'function') ScrollReveal().clean('#comments');
|
569
|
-
DOMController.setStyle('#l_header', 'opacity', 0);
|
570
|
-
DOMController.fadeToggleList([
|
571
|
-
document.querySelector('#l_cover'), document.querySelector('footer'),
|
572
|
-
document.querySelector('#s-top'), document.querySelector('.article-meta#bottom'),
|
573
|
-
document.querySelector('.prev-next'), document.querySelector('#l_side'),
|
574
|
-
document.querySelector('#comments'),
|
575
|
-
]);
|
576
|
-
DOMController.toggleClassList([
|
577
|
-
[document.querySelector('#l_main'), 'common_read'], [document.querySelector('#l_main'), 'common_read_main'],
|
578
|
-
[document.querySelector('#l_body'), 'common_read'], [document.querySelector('#safearea'), 'common_read'],
|
579
|
-
[document.querySelector('#pjax-container'), 'common_read'], [document.querySelector('#read_bkg'), 'common_read_hide'],
|
580
|
-
[document.querySelector('h1'), 'common_read_h1'], [document.querySelector('#post'), 'post_read'],
|
581
|
-
[document.querySelector('#l_cover'), 'read_cover'], [document.querySelector('.widget.toc-wrapper'), 'post_read']
|
582
|
-
]);
|
583
|
-
DOMController.setStyle('.copyright.license', 'margin', '15px 0');
|
584
|
-
volantis.isReadModel = volantis.isReadModel === undefined ? true : !volantis.isReadModel;
|
585
|
-
if (volantis.isReadModel) {
|
586
|
-
if (RightMenus.messageRightMenu) VolantisApp.message('系统提示', '阅读模式已开启,您可以点击屏幕空白处退出。', {
|
587
|
-
backgroundColor: 'var(--color-read-post)',
|
588
|
-
icon: rightMenuConfig.options.iconPrefix + ' fa-book-reader',
|
589
|
-
displayMode: 1,
|
590
|
-
time: 5000
|
591
|
-
});
|
592
|
-
document.querySelector('#l_body').removeEventListener('click', fn.readMode);
|
593
|
-
document.querySelector('#l_body').addEventListener('click', (event) => {
|
594
|
-
if (DOMController.hasClass(event.target, 'common_read')) {
|
595
|
-
fn.readMode();
|
596
|
-
}
|
597
|
-
});
|
598
|
-
} else {
|
599
|
-
document.querySelector('#l_body').removeEventListener('click', fn.readMode);
|
600
|
-
document.querySelector('#post').removeEventListener('click', fn.readMode);
|
601
|
-
DOMController.setStyle('.prev-next', 'display', 'flex');
|
602
|
-
DOMController.setStyle('.copyright.license', 'margin', '15px -40px');
|
603
|
-
DOMController.setStyle('#l_header', 'opacity', 'unset');
|
604
|
-
}
|
605
|
-
}
|
606
|
-
|
607
|
-
return {
|
608
|
-
init: fn.initEvent,
|
609
|
-
hideMenu: fn.hideMenu,
|
610
|
-
readMode: fn.readMode
|
611
|
-
}
|
612
|
-
})()
|
613
|
-
|
614
|
-
Object.freeze(RightMenus);
|
615
|
-
volantis.requestAnimationFrame(() => {
|
616
|
-
if (document.readyState !== 'loading') {
|
617
|
-
RightMenus.initialMenu();
|
618
|
-
} else {
|
619
|
-
document.addEventListener("DOMContentLoaded", function () {
|
620
|
-
RightMenus.initialMenu();
|
621
|
-
})
|
622
|
-
}
|
623
|
-
});
|
1
|
+
const RightMenus={defaultEvent:["copyText","copyLink","copyPaste","copyAll","copyCut","copyImg","printMode","readMode"],defaultGroup:["navigation","inputBox","seletctText","elementCheck","elementImage","articlePage"],messageRightMenu:volantis.GLOBAL_CONFIG.plugins.message.enable&&volantis.GLOBAL_CONFIG.plugins.message.rightmenu.enable,corsAnywhere:volantis.GLOBAL_CONFIG.plugins.rightmenus.options.corsAnywhere,urlRegx:/^((https|http)?:\/\/)+[A-Za-z0-9]+\.[A-Za-z0-9]+[\/=\?%\-&_~`@[\]\':+!]*([^<>\"\"])*$/,imgRegx:/\.(jpe?g|png|webp|svg|gif|jifi)(-|_|!|\?|\/)?.*$/,initialMenu:()=>{RightMenus.fun.init(),volantis.pjax.send((()=>{RightMenus.fun.hideMenu(),volantis.isReadModel&&RightMenus.fun.readMode()}))},readClipboard:async()=>{let e;switch((await navigator.permissions.query({name:"clipboard-read"})).state){case"granted":case"prompt":e=await navigator.clipboard.readText();break;default:window.clipboardRead=!1}return e},writeClipText:e=>navigator.clipboard.writeText(e).then((()=>Promise.resolve())).catch((e=>Promise.reject(e))),writeClipImg:async(e,t,n)=>{const i=new Image;i.crossOrigin="Anonymous",i.addEventListener("load",(()=>{let e=document.createElement("canvas"),o=e.getContext("2d");e.width=i.width,e.height=i.height,o.drawImage(i,0,0),e.toBlob((e=>{navigator.clipboard.write([new ClipboardItem({"image/png":e})]).then((e=>{t(e)})).catch((e=>{n(e)}))}),"image/png")}),!1),i.src=`${e}?(lll¬ω¬)~~`},insertAtCaret:(e,t)=>{const n=e.selectionStart,i=e.selectionEnd;if(document.selection)e.focus(),document.selection.createRange().text=t,e.focus();else if(n||"0"==n){var o=e.scrollTop;e.value=e.value.substring(0,n)+t+e.value.substring(i,e.value.length),e.focus(),e.selectionStart=n+t.length,e.selectionEnd=n+t.length,e.scrollTop=o}else e.value+=t,e.focus()}};RightMenus.fun=(()=>{const e=volantis.GLOBAL_CONFIG.plugins.rightmenus,t={},n=document.getElementById("rightmenu-wrapper"),i=document.getElementById("rightmenu-content"),o=document.querySelectorAll("#rightmenu-content li.menuLoad-Content"),a=document.querySelectorAll("#rightmenu-content li, #rightmenu-content hr, #menuMusic"),l=document.getElementById("read_bkg"),s=document.getElementById("menuMusic"),r=document.querySelector("#menuMusic .backward"),c=document.querySelector("#menuMusic .toggle"),d=document.querySelector("#menuMusic .forward");let u={mouseEvent:null,isInputBox:!1,selectText:"",inputValue:"",isLink:!1,linkUrl:"",isMediaLink:!1,mediaLinkUrl:"",isImage:!1,isArticle:!1,pathName:"",isReadClipboard:!0,isShowMusic:!1,statusCheck:!1};const m=Object.assign({},u);return t.initEvent=()=>{t.elementAppend(),t.contextmenu(),t.menuEvent()},t.elementAppend=()=>{l&&l.parentNode.removeChild(l);const e=document.createElement("div");e.className="common_read_bkg common_read_hide",e.id="read_bkg",window.document.body.appendChild(e)},t.menuPosition=e=>{try{let o=e.clientX,a=e.clientY,l=document.documentElement.clientWidth||document.body.clientWidth,s=document.documentElement.clientHeight||document.body.clientHeight;n.style.display="block",t.menuControl(e);let r=i.offsetWidth,c=i.offsetHeight,d=o+r>l?o-r+10:o,u=a+c>s?a-c+10:a;u=a+c>s&&u<c&&a<c?u+(s-c-u-10):u,n.style.left=`${d}px`,n.style.top=`${u}px`,volantis.GLOBAL_CONFIG.plugins.message.rightmenu.notice&&t.menuNotic()}catch(e){return console.error(e),t.hideMenu(),!0}return!1},t.menuControl=n=>{t.globalDataSet(n),s&&(s.style.display=u.isShowMusic?"block":"none"),o.forEach((t=>{t.style.display="none";const n=t.firstElementChild.nodeName,i=t.firstElementChild.getAttribute("data-group"),o=t.firstElementChild.getAttribute("data-event");if(u.statusCheck||u.isArticle)switch(i){case"inputBox":u.isInputBox&&(t.style.display="block","copyCut"!==o||u.selectText||(t.style.display="none"),"copyAll"!==o||u.inputValue||(t.style.display="none"),"copyPaste"!==o||u.isReadClipboard||(t.style.display="none"));break;case"seletctText":u.selectText&&(t.style.display="block");break;case"elementCheck":(u.isLink||u.isMediaLink)&&(t.style.display="block");break;case"elementImage":u.isImage&&(t.style.display="block");break;case"articlePage":u.isArticle&&(t.style.display="block");break;default:t.style.display="A"===n?u.isArticle&&!u.statusCheck&&e.options.articleShowLink?"block":"none":"block"}else("A"===n||RightMenus.defaultGroup.every((e=>i!==e)))&&(t.style.display="block")})),volantis.mouseEvent=n,volantis.rightmenu.method.handle.start();let i={item:null,hide:!0};a.forEach((e=>{if("HR"===e.nodeName){if(e.style.display="block",!i.item)return void(i.item=e);(i.hide||"hr"===i.item.nextElementSibling.nodeName)&&(i.item.style.display="none"),i.item=e,i.hide=!0}else"block"===e.style.display&&i.hide&&(i.hide=!1)})),i.item&&i.hide&&(i.item.style.display="none")},t.globalDataSet=t=>{u=Object.assign({},m),u.mouseEvent=t,u.selectText=window.getSelection().toString(),"input"!==t.target.tagName.toLowerCase()&&"textarea"!==t.target.tagName.toLowerCase()||(u.isInputBox=!0,u.inputValue=t.target.value),u.isInputBox&&!1===window.clipboardRead&&(u.isReadClipboard=!1),t.target.href&&RightMenus.urlRegx.test(t.target.href)&&(u.isLink=!0,u.linkUrl=t.target.href),t.target.currentSrc&&RightMenus.urlRegx.test(t.target.currentSrc)&&(u.isMediaLink=!0,u.mediaLinkUrl=t.target.currentSrc),u.isMediaLink&&RightMenus.imgRegx.test(u.mediaLinkUrl)&&(u.isImage=!0),document.querySelector("#post.article")&&(u.isArticle=!0,u.pathName=window.location.pathname),volantis.GLOBAL_CONFIG.plugins.aplayer?.enable&&"undefined"!=typeof RightMenuAplayer&&void 0!==RightMenuAplayer.APlayer.player&&(e.options.musicAlwaysShow||"play"===RightMenuAplayer.APlayer.status||"undefined"===RightMenuAplayer.APlayer.status)&&(u.isShowMusic=!0),(u.selectText||u.isInputBox||u.isLink||u.isMediaLink)&&(u.statusCheck=!0)},t.contextmenu=()=>{window.document.oncontextmenu=e=>e.ctrlKey||document.body.offsetWidth<=500?(t.hideMenu(),!0):t.menuPosition(e),n.oncontextmenu=e=>(e.stopPropagation(),e.preventDefault(),!1),window.removeEventListener("blur",t.hideMenu),window.addEventListener("blur",t.hideMenu),document.body.removeEventListener("click",t.hideMenu),document.body.addEventListener("click",t.hideMenu)},t.menuEvent=()=>{o.forEach((n=>{let i=n.firstElementChild.getAttribute("data-event");const o=n.firstElementChild.getAttribute("id"),a=n.firstElementChild.getAttribute("data-group");"A"!==n.firstElementChild.nodeName&&n.addEventListener("click",(()=>{try{RightMenus.defaultEvent.every((e=>i!==e))?"seletctText"===a?RightMenusFunction[o](u.selectText):"elementCheck"===a?RightMenusFunction[o](u.isLink?u.linkUrl:u.mediaLinkUrl):"elementImage"===a?RightMenusFunction[o](u.mediaLinkUrl):RightMenusFunction[o]():t[i]()}catch(t){"rightMenus"===volantis.GLOBAL_CONFIG.debug&&console.error({id:o,error:t,globalData:u,groupName:a,eventName:i}),RightMenus.messageRightMenu&&VolantisApp.message("错误提示",t,{icon:e.options.iconPrefix+" fa-exclamation-square red",time:"15000"})}}))})),d&&c&&d&&(r.onclick=e=>{e.preventDefault(),e.stopPropagation(),RightMenuAplayer.aplayerBackward()},c.onclick=e=>{e.preventDefault(),e.stopPropagation(),RightMenuAplayer.aplayerToggle()},d.onclick=e=>{e.preventDefault(),e.stopPropagation(),RightMenuAplayer.aplayerForward()})},t.hideMenu=()=>{n.style.display=null,n.style.left=null,n.style.top=null},t.menuNotic=()=>{const t="true"===localStorage.getItem("NoticeRightMenu");RightMenus.messageRightMenu&&!t&&VolantisApp.message("右键菜单","唤醒原系统菜单请使用:<kbd>Ctrl</kbd> + <kbd>右键</kbd>",{icon:e.options.iconPrefix+" fa-exclamation-square red",displayMode:1,time:9e3},(()=>{localStorage.setItem("NoticeRightMenu","true")}))},t.copyText=()=>{VolantisApp.utilWriteClipText(u.selectText).then((()=>{RightMenus.messageRightMenu&&VolantisApp.messageCopyright()})).catch((t=>{RightMenus.messageRightMenu&&VolantisApp.message("系统提示",t,{icon:e.options.iconPrefix+" fa-exclamation-square red",displayMode:1,time:9e3})}))},t.copyLink=()=>{VolantisApp.utilWriteClipText(u.linkUrl||u.mediaLinkUrl).then((()=>{RightMenus.messageRightMenu&&VolantisApp.messageCopyright()})).catch((t=>{RightMenus.messageRightMenu&&VolantisApp.message("系统提示",t,{icon:e.options.iconPrefix+" fa-exclamation-square red",displayMode:1,time:9e3})}))},t.copyAll=()=>{u.mouseEvent.target.select()},t.copyPaste=async()=>{const e=await RightMenus.readClipboard()||"";RightMenus.messageRightMenu&&!1===window.clipboardRead?VolantisApp.message("系统提示","未授予剪切板读取权限!"):RightMenus.messageRightMenu&&""===e?VolantisApp.message("系统提示","仅支持复制文本内容!"):RightMenus.insertAtCaret(u.mouseEvent.target,e)},t.copyCut=()=>{const e=u.mouseEvent.target.selectionStart,n=u.mouseEvent.target.selectionEnd,i=u.inputValue;t.copyText(u.selectText),u.mouseEvent.target.value=i.substring(0,e)+i.substring(n,i.length),u.mouseEvent.target.selectionStart=e,u.mouseEvent.target.selectionEnd=e,u.mouseEvent.target.focus()},t.copyImg=()=>{volantis.GLOBAL_CONFIG.plugins.message.rightmenu.notice&&VolantisApp.message("系统提示","复制中,请等待。",{icon:e.options.iconPrefix+" fa-images"}),RightMenus.writeClipImg(u.mediaLinkUrl,(t=>{RightMenus.messageRightMenu&&(VolantisApp.hideMessage(),VolantisApp.message("系统提示","图片复制成功!",{icon:e.options.iconPrefix+" fa-images"}))}),(t=>{console.error(t),RightMenus.messageRightMenu&&(VolantisApp.hideMessage(),VolantisApp.message("系统提示","复制失败:"+t,{icon:e.options.iconPrefix+" fa-exclamation-square red",time:9e3}))}))},t.printMode=()=>{if(window.location.pathname===u.pathName)if(RightMenus.messageRightMenu){const e='是否打印当前页面?<br><em style="font-size: 80%">建议打印时勾选背景图形</em><br>';VolantisApp.question("",e,{time:9e3},(()=>{t.printHtml()}))}else t.printHtml()},t.printHtml=()=>{volantis.isReadModel&&t.readMode(),DOMController.setAttribute("details","open","true"),DOMController.removeList([".cus-article-bkg",".iziToast-overlay",".iziToast-wrapper",".prev-next","footer","#l_header","#l_cover","#l_side","#comments","#s-top","#BKG","#rightmenu-wrapper",".nav-tabs",".parallax-mirror",".new-meta-item.share",".new-meta-box","button.btn-copy","iframe"]),DOMController.setStyleList([["body","backgroundColor","unset"],["#l_main, .copyright.license","width","100%"],["#post","boxShadow","none"],["#post","background","none"],["#post","padding","0"],["h1","textAlign","center"],["h1","fontWeight","600"],["h1","fontSize","2rem"],["h1","marginBottom","20px"],[".tab-pane","display","block"],[".tab-content","borderTop","none"],[".highlight>table pre","whiteSpace","pre-wrap"],[".highlight>table pre","wordBreak","break-all"],[".fancybox img","height","auto"],[".fancybox img","weight","auto"],[".copyright.license","margin","0"],[".copyright.license","padding","1.25em 20px"],["figure.highlight, .copyright.license","display","inline-block"]]),setTimeout((()=>{window.print(),document.body.innerHTML="",window.location.reload()}),50)},t.readMode=()=>{"function"==typeof ScrollReveal&&ScrollReveal().clean("#comments"),DOMController.setStyle("#l_header","opacity",0),DOMController.fadeToggleList([document.querySelector("#l_cover"),document.querySelector("footer"),document.querySelector("#s-top"),document.querySelector(".article-meta#bottom"),document.querySelector(".prev-next"),document.querySelector("#l_side"),document.querySelector("#comments")]),DOMController.toggleClassList([[document.querySelector("#l_main"),"common_read"],[document.querySelector("#l_main"),"common_read_main"],[document.querySelector("#l_body"),"common_read"],[document.querySelector("#safearea"),"common_read"],[document.querySelector("#pjax-container"),"common_read"],[document.querySelector("#read_bkg"),"common_read_hide"],[document.querySelector("h1"),"common_read_h1"],[document.querySelector("#post"),"post_read"],[document.querySelector("#l_cover"),"read_cover"],[document.querySelector(".widget.toc-wrapper"),"post_read"]]),DOMController.setStyle(".copyright.license","margin","15px 0"),volantis.isReadModel=void 0===volantis.isReadModel||!volantis.isReadModel,volantis.isReadModel?(RightMenus.messageRightMenu&&VolantisApp.message("系统提示","阅读模式已开启,您可以点击屏幕空白处退出。",{backgroundColor:"var(--color-read-post)",icon:e.options.iconPrefix+" fa-book-reader",displayMode:1,time:5e3}),document.querySelector("#l_body").removeEventListener("click",t.readMode),document.querySelector("#l_body").addEventListener("click",(e=>{DOMController.hasClass(e.target,"common_read")&&t.readMode()}))):(document.querySelector("#l_body").removeEventListener("click",t.readMode),document.querySelector("#post").removeEventListener("click",t.readMode),DOMController.setStyle(".prev-next","display","flex"),DOMController.setStyle(".copyright.license","margin","15px -40px"),DOMController.setStyle("#l_header","opacity","unset"))},{init:t.initEvent,hideMenu:t.hideMenu,readMode:t.readMode}})(),Object.freeze(RightMenus),volantis.requestAnimationFrame((()=>{"loading"!==document.readyState?RightMenus.initialMenu():document.addEventListener("DOMContentLoaded",(function(){RightMenus.initialMenu()}))}));
|
2
|
+
//# sourceMappingURL=../../maps/js/plugins/rightMenus.js.map
|