q78kgblog 0.0.0-1720441708496 → 0.0.0-1720859005089
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/404.html +3 -3
- package/about/index.html +5 -5
- package/archives/2023/02/index.html +4 -4
- package/archives/2023/04/index.html +4 -4
- package/archives/2023/05/index.html +4 -4
- package/archives/2023/08/index.html +4 -4
- package/archives/2023/09/index.html +4 -4
- package/archives/2023/index.html +4 -4
- package/archives/2024/01/index.html +4 -4
- package/archives/2024/02/index.html +4 -4
- package/archives/2024/index.html +4 -4
- package/archives/index.html +4 -4
- package/atom.xml +9 -9
- package/baidusitemap.xml +8 -8
- package/bangumis/index.html +4 -4
- package/bigpie/index.html +3 -3
- package/categories/Hexo/index.html +4 -4
- package/categories/index.html +3 -3
- package/categories//345/271/264/347/273/210/346/200/273/347/273/223/index.html +4 -4
- package/categories//347/264/240/346/235/220/index.html +4 -4
- package/categories//351/227/262/350/201/212/346/235/202/350/260/210/index.html +4 -4
- package/content.json +1 -1
- package/css/404page.css +1 -65
- package/css/ariasakablog.css +1 -6669
- package/css/commentBarrage.css +1 -118
- package/css/danmaku.css +1 -106
- package/css/essay.css +1 -306
- package/css/iconfont.css +1 -55
- package/css/index.css +1 -7006
- package/css/people.css +1 -18
- package/css/stylessimple.css +1 -40
- package/css/swiperstyle.css +1 -567
- package/fcircle/index.html +3 -3
- package/fontawesome/index.html +3 -3
- package/index.html +11 -11
- package/js/aplayersave.js +1 -268
- package/js/baiduhistory.js +1 -76
- package/js/browser.js +1 -35
- package/js/calendar.js +1 -380
- package/js/cate.js +1 -22
- package/js/commentBarrage.js +17 -232
- package/js/commentsCount.js +1 -43
- package/js/copy.js +1 -23
- package/js/countup.js +1 -209
- package/js/cursor.js +1 -82
- package/js/danmaku.js +0 -106
- package/js/day.js +13 -195
- package/js/dianzan.js +1 -249
- package/js/dis.js +4 -252
- package/js/dist/baiduhistory.dev.js +1 -102
- package/js/dist/bbtalk.dev.js +159 -12872
- package/js/dist/bbtalklunbo.dev.js +1 -45
- package/js/dist/calendar.dev.js +1 -395
- package/js/dist/fixbugpjax.dev.js +1 -8
- package/js/dist/gongnong.dev.js +1 -565
- package/js/dist/heimu.dev.js +1 -19
- package/js/dist/links.dev.js +1 -13
- package/js/dist/main.dev.js +5 -843
- package/js/dist/resizeTop.dev.js +1 -50
- package/js/dist/seo.dev.js +1 -33
- package/js/dist/twikoo.all.min.dev.js +946 -1
- package/js/fixbugpjax.js +1 -7
- package/js/fixed_card_widget.js +1 -46
- package/js/fps.js +1 -58
- package/js/gitalker.js +1 -11
- package/js/heimu.js +1 -16
- package/js/hide.show.js +1 -17
- package/js/languages.js +1 -511
- package/js/latest.js +1 -49
- package/js/local-search.js +2 -476
- package/js/lunar.js +1 -1071
- package/js/lyxTalk.js +1 -12
- package/js/main.js +5 -781
- package/js/nav.js +1 -30
- package/js/noie.js +1 -3
- package/js/owo.js +1 -52
- package/js/people.js +2 -175
- package/js/randomFriend.js +1 -95
- package/js/resizeTop.js +1 -43
- package/js/rightmenu.js +3 -333
- package/js/sakura.js +1 -164
- package/js/search/algolia.js +4 -154
- package/js/search/local-search.js +1 -188
- package/js/settings.js +3 -343
- package/js/sitetime.js +1 -25
- package/js/smooth-scrolling.js +1 -546
- package/js/sw-toolbox.js +1 -16
- package/js/swiperinit.js +1 -23
- package/js/tw_cn.js +1 -100
- package/js/utils.js +1 -278
- package/js/welcome.js +1 -107
- package/js/welcomeconsole.js +1 -23
- package/links/index.html +3 -3
- package/othersite/index.html +3 -3
- package/package.json +1 -1
- package/posts/164ef646/index.html +6 -6
- package/posts/228c2ef8/index.html +6 -6
- package/posts/a9a6c1fb/index.html +6 -6
- package/posts/c262e439/index.html +6 -6
- package/posts/c81531cf/index.html +6 -6
- package/posts/ccdf7cfc/index.html +6 -6
- package/posts/de1f83f4/index.html +6 -6
- package/posts/e54f7476/index.html +6 -6
- package/sitemap.xml +49 -49
- package/sw.js +2 -193
- package/swReg.js +1 -29
- package/tags/AI/index.html +5 -5
- package/tags/Butterfly/index.html +5 -5
- package/tags/Cloudflare/index.html +5 -5
- package/tags/DiffSinger/index.html +5 -5
- package/tags/Hexo/index.html +5 -5
- package/tags/Next/index.html +5 -5
- package/tags/RAID/index.html +5 -5
- package/tags/Vercel/index.html +5 -5
- package/tags/Workers/index.html +5 -5
- package/tags/index.html +3 -3
- package/tags//344/270/273/351/242/230/index.html +5 -5
- package/tags//345/206/231/344/275/234/index.html +5 -5
- package/tags//345/245/263/346/200/247/346/204/217/350/257/206/index.html +5 -5
- package/tags//345/255/246/344/271/240/index.html +5 -5
- package/tags//345/256/266/351/207/214/344/272/221/index.html +5 -5
- package/tags//345/271/264/347/273/210/346/200/273/347/273/223/index.html +5 -5
- package/tags//346/212/230/350/205/276/index.html +5 -5
- package/tags//346/227/245/345/270/270/index.html +5 -5
- package/tags//346/234/215/345/212/241/345/231/250/index.html +5 -5
- package/tags//346/265/252/346/275/256/index.html +5 -5
- package/tags//347/256/200/347/210/261/index.html +5 -5
- package/tags//350/207/252/345/212/250/346/240/207/346/263/250/index.html +5 -5
- package/tags//350/256/272/346/226/207/index.html +5 -5
- package/tags//350/260/267/346/255/214/347/277/273/350/257/221/index.html +5 -5
- package/tags//350/264/237/350/275/275/345/235/207/350/241/241/index.html +5 -5
- package/tags//351/207/221/345/217/245/index.html +5 -5
- package/tags//351/255/224/346/224/271/index.html +5 -5
package/js/rightmenu.js
CHANGED
@@ -1,335 +1,5 @@
|
|
1
|
+
console.log("Codes uses GPL Licence");function setMask(){return document.getElementsByClassName("rmMask")[0]!=null?document.getElementsByClassName("rmMask")[0]:(mask=document.createElement("div"),mask.className="rmMask",mask.style.width=window.innerWidth+"px",mask.style.height=window.innerHeight+"px",mask.style.background="#fff",mask.style.opacity=".0",mask.style.position="fixed",mask.style.top="0",mask.style.left="0",mask.style.zIndex=998,document.body.appendChild(mask),document.getElementById("rightMenu").style.zIndex=19198,mask)}function insertAtCursor(t,e){if(document.selection)t.focus(),sel=document.selection.createRange(),sel.text=e,sel.select();else if(t.selectionStart||t.selectionStart=="0"){var n=t.selectionStart,o=t.selectionEnd,s=t.scrollTop;t.value=t.value.substring(0,n)+e+t.value.substring(o,t.value.length),s>0&&(t.scrollTop=s),t.focus(),t.selectionStart=n+e.length,t.selectionEnd=n+e.length}else t.value+=e,t.focus()}let rmf={};rmf.showRightMenu=function(t,e=0,n=0){let o=$("#rightMenu");o.css("top",e+"px").css("left",n+"px"),t?o.show():o.hide()},rmf.switchDarkMode=function(){(document.documentElement.getAttribute("data-theme")==="dark"?"dark":"light")==="light"?(activateDarkMode(),saveToLocal.set("theme","dark",2),GLOBAL_CONFIG.Snackbar!==void 0&&btf.snackbarShow(GLOBAL_CONFIG.Snackbar.day_to_night)):(activateLightMode(),saveToLocal.set("theme","light",2),GLOBAL_CONFIG.Snackbar!==void 0&&btf.snackbarShow(GLOBAL_CONFIG.Snackbar.night_to_day)),typeof utterancesTheme=="function"&&utterancesTheme(),typeof FB=="object"&&window.loadFBComment(),window.DISQUS&&document.getElementById("disqus_thread").children.length&&setTimeout(()=>window.disqusReset(),200)},rmf.yinyong=function(){var t=document.getElementsByClassName("el-textarea__inner")[0],e=document.createEvent("HTMLEvents");e.initEvent("input",!0,!0),t.value=d.value="> "+getSelection().toString()+`
|
1
2
|
|
2
|
-
console.log(
|
3
|
-
"Codes uses GPL Licence"
|
4
|
-
)
|
5
|
-
function setMask(){//设置遮罩层
|
6
|
-
if(document.getElementsByClassName("rmMask")[0]!=undefined){
|
7
|
-
return document.getElementsByClassName("rmMask")[0];
|
8
|
-
}
|
9
|
-
mask = document.createElement('div');
|
10
|
-
mask.className = "rmMask";
|
11
|
-
mask.style.width = window.innerWidth + 'px';
|
12
|
-
mask.style.height = window.innerHeight + 'px';
|
13
|
-
mask.style.background = '#fff';
|
14
|
-
mask.style.opacity = '.0';
|
15
|
-
mask.style.position = 'fixed';
|
16
|
-
mask.style.top = '0';
|
17
|
-
mask.style.left = '0';
|
18
|
-
mask.style.zIndex = 998;
|
19
|
-
document.body.appendChild(mask);
|
20
|
-
document.getElementById("rightMenu").style.zIndex=19198;
|
21
|
-
return mask;
|
22
|
-
}
|
3
|
+
`,t.dispatchEvent(e),console.log(getSelection().toString()),document.getElementsByClassName("el-textarea__inner")[0].value="> "+getSelection().toString()+`
|
23
4
|
|
24
|
-
function insertAtCursor(
|
25
|
-
|
26
|
-
//IE 浏览器
|
27
|
-
if (document.selection) {
|
28
|
-
myField.focus();
|
29
|
-
sel = document.selection.createRange();
|
30
|
-
sel.text = myValue;
|
31
|
-
sel.select();
|
32
|
-
}
|
33
|
-
|
34
|
-
//FireFox、Chrome等
|
35
|
-
else if (myField.selectionStart || myField.selectionStart == '0') {
|
36
|
-
var startPos = myField.selectionStart;
|
37
|
-
var endPos = myField.selectionEnd;
|
38
|
-
|
39
|
-
// 保存滚动条
|
40
|
-
var restoreTop = myField.scrollTop;
|
41
|
-
myField.value = myField.value.substring(0, startPos) + myValue + myField.value.substring(endPos, myField.value.length);
|
42
|
-
|
43
|
-
if (restoreTop > 0) {
|
44
|
-
myField.scrollTop = restoreTop;
|
45
|
-
}
|
46
|
-
|
47
|
-
myField.focus();
|
48
|
-
myField.selectionStart = startPos + myValue.length;
|
49
|
-
myField.selectionEnd = startPos + myValue.length;
|
50
|
-
} else {
|
51
|
-
myField.value += myValue;
|
52
|
-
myField.focus();
|
53
|
-
}
|
54
|
-
}
|
55
|
-
let rmf = {};
|
56
|
-
rmf.showRightMenu = function (isTrue, x = 0, y = 0) {
|
57
|
-
let $rightMenu = $('#rightMenu');
|
58
|
-
$rightMenu.css('top', x + 'px').css('left', y + 'px');
|
59
|
-
|
60
|
-
if (isTrue) {
|
61
|
-
$rightMenu.show();
|
62
|
-
} else {
|
63
|
-
$rightMenu.hide();
|
64
|
-
}
|
65
|
-
}
|
66
|
-
rmf.switchDarkMode = function () {
|
67
|
-
const nowMode = document.documentElement.getAttribute('data-theme') === 'dark' ? 'dark' : 'light'
|
68
|
-
if (nowMode === 'light') {
|
69
|
-
activateDarkMode()
|
70
|
-
saveToLocal.set('theme', 'dark', 2)
|
71
|
-
GLOBAL_CONFIG.Snackbar !== undefined && btf.snackbarShow(GLOBAL_CONFIG.Snackbar.day_to_night)
|
72
|
-
} else {
|
73
|
-
activateLightMode()
|
74
|
-
saveToLocal.set('theme', 'light', 2)
|
75
|
-
GLOBAL_CONFIG.Snackbar !== undefined && btf.snackbarShow(GLOBAL_CONFIG.Snackbar.night_to_day)
|
76
|
-
}
|
77
|
-
// handle some cases
|
78
|
-
typeof utterancesTheme === 'function' && utterancesTheme()
|
79
|
-
typeof FB === 'object' && window.loadFBComment()
|
80
|
-
window.DISQUS && document.getElementById('disqus_thread').children.length && setTimeout(() => window.disqusReset(), 200)
|
81
|
-
};
|
82
|
-
rmf.yinyong=function(){
|
83
|
-
var e = document.getElementsByClassName("el-textarea__inner")[0],
|
84
|
-
t = document.createEvent("HTMLEvents");
|
85
|
-
t.initEvent("input", !0, !0), e.value = d.value = "> "+getSelection().toString()+"\n\n", e.dispatchEvent(t);
|
86
|
-
console.log(getSelection().toString());
|
87
|
-
document.getElementsByClassName("el-textarea__inner")[0].value="> "+getSelection().toString()+"\n\n";
|
88
|
-
Snackbar.show({
|
89
|
-
text: '为保证最佳评论阅读体验,建议不要删除空行',
|
90
|
-
pos: 'top-center',
|
91
|
-
showAction: false,
|
92
|
-
})
|
93
|
-
}
|
94
|
-
rmf.copyWordsLink = function () {
|
95
|
-
let url = window.location.href
|
96
|
-
let txa = document.createElement("textarea");
|
97
|
-
txa.value = url;
|
98
|
-
document.body.appendChild(txa)
|
99
|
-
txa.select();
|
100
|
-
document.execCommand("Copy");
|
101
|
-
document.body.removeChild(txa);
|
102
|
-
Snackbar.show({
|
103
|
-
text: '链接复制成功!快去分享吧!',
|
104
|
-
pos: 'top-right',
|
105
|
-
showAction: false
|
106
|
-
});
|
107
|
-
}
|
108
|
-
rmf.switchReadMode = function () {
|
109
|
-
const $body = document.body
|
110
|
-
$body.classList.add('read-mode')
|
111
|
-
const newEle = document.createElement('button')
|
112
|
-
newEle.type = 'button'
|
113
|
-
newEle.className = 'fas fa-sign-out-alt exit-readmode'
|
114
|
-
$body.appendChild(newEle)
|
115
|
-
|
116
|
-
function clickFn() {
|
117
|
-
$body.classList.remove('read-mode')
|
118
|
-
newEle.remove()
|
119
|
-
newEle.removeEventListener('click', clickFn)
|
120
|
-
}
|
121
|
-
|
122
|
-
newEle.addEventListener('click', clickFn)
|
123
|
-
}
|
124
|
-
|
125
|
-
//复制选中文字
|
126
|
-
rmf.copySelect = function () {
|
127
|
-
document.execCommand('Copy', false, null);
|
128
|
-
//这里可以写点东西提示一下 已复制
|
129
|
-
}
|
130
|
-
|
131
|
-
//回到顶部
|
132
|
-
rmf.scrollToTop = function () {
|
133
|
-
document.getElementsByClassName("menus_items")[1].setAttribute("style","");
|
134
|
-
document.getElementById("name-container").setAttribute("style","display:none");
|
135
|
-
btf.scrollToDest(0, 500);
|
136
|
-
}
|
137
|
-
rmf.translate = function () {
|
138
|
-
document.getElementById("translateLink").click();
|
139
|
-
}
|
140
|
-
rmf.searchinThisPage=()=>{
|
141
|
-
document.getElementsByClassName("local-search-box--input")[0].value=window.getSelection().toString()
|
142
|
-
document.getElementsByClassName("search")[0].click()
|
143
|
-
var evt = document.createEvent("HTMLEvents");evt.initEvent("input", false, false);document.getElementsByClassName("local-search-box--input")[0].dispatchEvent(evt);
|
144
|
-
// try{document.body.removeChild(mask);}catch(err){}
|
145
|
-
}
|
146
|
-
rmf.downloadImage=function(imgsrc, name) { //下载图片地址和图片名
|
147
|
-
btf.snackbarShow('正在下载中,请稍后',false,10000)
|
148
|
-
setTimeout(function(){
|
149
|
-
let image = new Image();
|
150
|
-
// 解决跨域 Canvas 污染问题
|
151
|
-
image.setAttribute("crossOrigin", "anonymous");
|
152
|
-
image.onload = function() {
|
153
|
-
let canvas = document.createElement("canvas");
|
154
|
-
canvas.width = image.width;
|
155
|
-
canvas.height = image.height;
|
156
|
-
let context = canvas.getContext("2d");
|
157
|
-
context.drawImage(image, 0, 0, image.width, image.height);
|
158
|
-
let url = canvas.toDataURL("image/png"); //得到图片的base64编码数据
|
159
|
-
let a = document.createElement("a"); // 生成一个a元素
|
160
|
-
let event = new MouseEvent("click"); // 创建一个单击事件
|
161
|
-
a.download = name || "photo"; // 设置图片名称
|
162
|
-
a.href = url; // 将生成的URL设置为a.href属性
|
163
|
-
a.dispatchEvent(event); // 触发a的单击事件
|
164
|
-
};
|
165
|
-
image.src = imgsrc;
|
166
|
-
btf.snackbarShow('图片已添加盲水印,请遵守版权协议');
|
167
|
-
rm.downloadimging = false;
|
168
|
-
}, "10000");
|
169
|
-
}
|
170
|
-
document.body.addEventListener('touchmove', function(e){
|
171
|
-
|
172
|
-
}, { passive: false });
|
173
|
-
function popupMenu() {
|
174
|
-
//window.oncontextmenu=function(){return false;}
|
175
|
-
window.oncontextmenu = function (event) {
|
176
|
-
if(event.ctrlKey)return true;
|
177
|
-
|
178
|
-
$('.rightMenu-group.hide').hide();
|
179
|
-
if (document.getSelection().toString()) {
|
180
|
-
$('#menu-text').show();
|
181
|
-
}
|
182
|
-
if (document.getElementById('post')) {
|
183
|
-
$('#menu-post').show();
|
184
|
-
} else {
|
185
|
-
if (document.getElementById('page')) {
|
186
|
-
$('#menu-post').show();
|
187
|
-
}
|
188
|
-
}
|
189
|
-
var el = window.document.body;
|
190
|
-
el = event.target;
|
191
|
-
var a=/^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w\.-]+)+[\w\-\._~:/?#[\]@!\$&'\*\+,;=.]+$/
|
192
|
-
if (a.test(window.getSelection().toString())&&el.tagName!="A"){
|
193
|
-
$('#menu-too').show()
|
194
|
-
}
|
195
|
-
if (el.tagName == 'A') {
|
196
|
-
$('#menu-to').show()
|
197
|
-
rmf.open = function () {
|
198
|
-
if(el.href.indexOf("http://")==-1&&el.href.indexOf("https://")==-1||el.href.indexOf("anjiurine.top")!=-1){
|
199
|
-
pjax.loadUrl(el.href)
|
200
|
-
}
|
201
|
-
else{
|
202
|
-
location.href = el.href
|
203
|
-
}
|
204
|
-
}
|
205
|
-
rmf.openWithNewTab = function () {
|
206
|
-
window.open(el.href);
|
207
|
-
// window.location.reload();
|
208
|
-
}
|
209
|
-
rmf.copyLink = function () {
|
210
|
-
let url = el.href
|
211
|
-
let txa = document.createElement("textarea");
|
212
|
-
txa.value = url;
|
213
|
-
document.body.appendChild(txa)
|
214
|
-
txa.select();
|
215
|
-
document.execCommand("Copy");
|
216
|
-
document.body.removeChild(txa);
|
217
|
-
}
|
218
|
-
}
|
219
|
-
if (el.tagName == 'IMG') {
|
220
|
-
$('#menu-img').show()
|
221
|
-
rmf.openWithNewTab = function () {
|
222
|
-
window.open(el.src);
|
223
|
-
// window.location.reload();
|
224
|
-
}
|
225
|
-
rmf.click = function () {
|
226
|
-
el.click()
|
227
|
-
}
|
228
|
-
rmf.copyLink = function () {
|
229
|
-
let url = el.src
|
230
|
-
let txa = document.createElement("textarea");
|
231
|
-
txa.value = url;
|
232
|
-
document.body.appendChild(txa)
|
233
|
-
txa.select();
|
234
|
-
document.execCommand("Copy");
|
235
|
-
document.body.removeChild(txa);
|
236
|
-
}
|
237
|
-
rmf.saveAs=function(){
|
238
|
-
var url = el.src;
|
239
|
-
var filename = url.split("/")[-1];
|
240
|
-
rmf.downloadImage(url, filename);
|
241
|
-
}
|
242
|
-
} else if (el.tagName == "TEXTAREA" || el.tagName == "INPUT") {
|
243
|
-
$('#menu-paste').show();
|
244
|
-
// rmf.paste=function(){
|
245
|
-
// input.addEventListener('paste', async event => {
|
246
|
-
// event.preventDefault();
|
247
|
-
// const text = await navigator.clipboard.readText();
|
248
|
-
// el.value+=text;
|
249
|
-
// });
|
250
|
-
// }
|
251
|
-
rmf.paste = function () {
|
252
|
-
navigator.permissions
|
253
|
-
.query({
|
254
|
-
name: 'clipboard-read'
|
255
|
-
})
|
256
|
-
.then(result => {
|
257
|
-
if (result.state == 'granted' || result.state == 'prompt') {
|
258
|
-
//读取剪贴板
|
259
|
-
navigator.clipboard.readText().then(text => {
|
260
|
-
console.log(text)
|
261
|
-
insertAtCursor(el, text)
|
262
|
-
})
|
263
|
-
} else {
|
264
|
-
Snackbar.show({
|
265
|
-
text: '请允许读取剪贴板!',
|
266
|
-
pos: 'top-center',
|
267
|
-
showAction: false,
|
268
|
-
})
|
269
|
-
}
|
270
|
-
})
|
271
|
-
}
|
272
|
-
}
|
273
|
-
let pageX = event.clientX + 10;
|
274
|
-
let pageY = event.clientY;
|
275
|
-
let rmWidth = $('#rightMenu').width();
|
276
|
-
let rmHeight = $('#rightMenu').height();
|
277
|
-
if (pageX + rmWidth > window.innerWidth) {
|
278
|
-
pageX -= rmWidth + 10;
|
279
|
-
}
|
280
|
-
if (pageY + rmHeight > window.innerHeight) {
|
281
|
-
pageY -= pageY + rmHeight - window.innerHeight;
|
282
|
-
}
|
283
|
-
mask=setMask();
|
284
|
-
window.onscroll=()=>{
|
285
|
-
rmf.showRightMenu(false);
|
286
|
-
window.onscroll=()=>{}
|
287
|
-
document.body.removeChild(mask);
|
288
|
-
}
|
289
|
-
$(".rightMenu-item").click(()=>{
|
290
|
-
document.body.removeChild(mask);
|
291
|
-
})
|
292
|
-
$(window).resize(()=>{
|
293
|
-
rmf.showRightMenu(false);
|
294
|
-
document.body.removeChild(mask);
|
295
|
-
})
|
296
|
-
mask.onclick=()=>{
|
297
|
-
document.body.removeChild(mask);
|
298
|
-
}
|
299
|
-
rmf.showRightMenu(true, pageY, pageX);
|
300
|
-
return false;
|
301
|
-
};
|
302
|
-
|
303
|
-
window.addEventListener('click', function () {
|
304
|
-
rmf.showRightMenu(false);
|
305
|
-
});
|
306
|
-
}
|
307
|
-
if (!(navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i))) {
|
308
|
-
popupMenu()
|
309
|
-
}
|
310
|
-
const box = document.documentElement
|
311
|
-
|
312
|
-
function addLongtabListener(target, callback) {
|
313
|
-
let timer = 0 // 初始化timer
|
314
|
-
|
315
|
-
target.ontouchstart = () => {
|
316
|
-
timer = 0 // 重置timer
|
317
|
-
timer = setTimeout(() => {
|
318
|
-
callback();
|
319
|
-
timer = 0
|
320
|
-
}, 380) // 超时器能成功执行,说明是长按
|
321
|
-
}
|
322
|
-
|
323
|
-
target.ontouchmove = () => {
|
324
|
-
clearTimeout(timer) // 如果来到这里,说明是滑动
|
325
|
-
timer = 0
|
326
|
-
}
|
327
|
-
|
328
|
-
target.ontouchend = () => { // 到这里如果timer有值,说明此触摸时间不足380ms,是点击
|
329
|
-
if (timer) {
|
330
|
-
clearTimeout(timer)
|
331
|
-
}
|
332
|
-
}
|
333
|
-
}
|
334
|
-
|
335
|
-
addLongtabListener(box, popupMenu)
|
5
|
+
`,Snackbar.show({text:"\u4E3A\u4FDD\u8BC1\u6700\u4F73\u8BC4\u8BBA\u9605\u8BFB\u4F53\u9A8C\uFF0C\u5EFA\u8BAE\u4E0D\u8981\u5220\u9664\u7A7A\u884C",pos:"top-center",showAction:!1})},rmf.copyWordsLink=function(){let t=window.location.href,e=document.createElement("textarea");e.value=t,document.body.appendChild(e),e.select(),document.execCommand("Copy"),document.body.removeChild(e),Snackbar.show({text:"\u94FE\u63A5\u590D\u5236\u6210\u529F\uFF01\u5FEB\u53BB\u5206\u4EAB\u5427\uFF01",pos:"top-right",showAction:!1})},rmf.switchReadMode=function(){const t=document.body;t.classList.add("read-mode");const e=document.createElement("button");e.type="button",e.className="fas fa-sign-out-alt exit-readmode",t.appendChild(e);function n(){t.classList.remove("read-mode"),e.remove(),e.removeEventListener("click",n)}e.addEventListener("click",n)},rmf.copySelect=function(){document.execCommand("Copy",!1,null)},rmf.scrollToTop=function(){document.getElementsByClassName("menus_items")[1].setAttribute("style",""),document.getElementById("name-container").setAttribute("style","display:none"),btf.scrollToDest(0,500)},rmf.translate=function(){document.getElementById("translateLink").click()},rmf.searchinThisPage=()=>{document.getElementsByClassName("local-search-box--input")[0].value=window.getSelection().toString(),document.getElementsByClassName("search")[0].click();var t=document.createEvent("HTMLEvents");t.initEvent("input",!1,!1),document.getElementsByClassName("local-search-box--input")[0].dispatchEvent(t)},rmf.downloadImage=function(t,e){btf.snackbarShow("\u6B63\u5728\u4E0B\u8F7D\u4E2D\uFF0C\u8BF7\u7A0D\u540E",!1,1e4),setTimeout(function(){let n=new Image;n.setAttribute("crossOrigin","anonymous"),n.onload=function(){let o=document.createElement("canvas");o.width=n.width,o.height=n.height,o.getContext("2d").drawImage(n,0,0,n.width,n.height);let l=o.toDataURL("image/png"),c=document.createElement("a"),i=new MouseEvent("click");c.download=e||"photo",c.href=l,c.dispatchEvent(i)},n.src=t,btf.snackbarShow("\u56FE\u7247\u5DF2\u6DFB\u52A0\u76F2\u6C34\u5370\uFF0C\u8BF7\u9075\u5B88\u7248\u6743\u534F\u8BAE"),rm.downloadimging=!1},"10000")},document.body.addEventListener("touchmove",function(t){},{passive:!1});function popupMenu(){window.oncontextmenu=function(t){if(t.ctrlKey)return!0;$(".rightMenu-group.hide").hide(),document.getSelection().toString()&&$("#menu-text").show(),(document.getElementById("post")||document.getElementById("page"))&&$("#menu-post").show();var e=window.document.body;e=t.target;var n=/^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w\.-]+)+[\w\-\._~:/?#[\]@!\$&'\*\+,;=.]+$/;n.test(window.getSelection().toString())&&e.tagName!="A"&&$("#menu-too").show(),e.tagName=="A"&&($("#menu-to").show(),rmf.open=function(){e.href.indexOf("http://")==-1&&e.href.indexOf("https://")==-1||e.href.indexOf("anjiurine.top")!=-1?pjax.loadUrl(e.href):location.href=e.href},rmf.openWithNewTab=function(){window.open(e.href)},rmf.copyLink=function(){let i=e.href,a=document.createElement("textarea");a.value=i,document.body.appendChild(a),a.select(),document.execCommand("Copy"),document.body.removeChild(a)}),e.tagName=="IMG"?($("#menu-img").show(),rmf.openWithNewTab=function(){window.open(e.src)},rmf.click=function(){e.click()},rmf.copyLink=function(){let i=e.src,a=document.createElement("textarea");a.value=i,document.body.appendChild(a),a.select(),document.execCommand("Copy"),document.body.removeChild(a)},rmf.saveAs=function(){var i=e.src,a=i.split("/")[-1];rmf.downloadImage(i,a)}):(e.tagName=="TEXTAREA"||e.tagName=="INPUT")&&($("#menu-paste").show(),rmf.paste=function(){navigator.permissions.query({name:"clipboard-read"}).then(i=>{i.state=="granted"||i.state=="prompt"?navigator.clipboard.readText().then(a=>{console.log(a),insertAtCursor(e,a)}):Snackbar.show({text:"\u8BF7\u5141\u8BB8\u8BFB\u53D6\u526A\u8D34\u677F\uFF01",pos:"top-center",showAction:!1})})});let o=t.clientX+10,s=t.clientY,l=$("#rightMenu").width(),c=$("#rightMenu").height();return o+l>window.innerWidth&&(o-=l+10),s+c>window.innerHeight&&(s-=s+c-window.innerHeight),mask=setMask(),window.onscroll=()=>{rmf.showRightMenu(!1),window.onscroll=()=>{},document.body.removeChild(mask)},$(".rightMenu-item").click(()=>{document.body.removeChild(mask)}),$(window).resize(()=>{rmf.showRightMenu(!1),document.body.removeChild(mask)}),mask.onclick=()=>{document.body.removeChild(mask)},rmf.showRightMenu(!0,s,o),!1},window.addEventListener("click",function(){rmf.showRightMenu(!1)})}navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i)||popupMenu();const box=document.documentElement;function addLongtabListener(t,e){let n=0;t.ontouchstart=()=>{n=0,n=setTimeout(()=>{e(),n=0},380)},t.ontouchmove=()=>{clearTimeout(n),n=0},t.ontouchend=()=>{n&&clearTimeout(n)}}addLongtabListener(box,popupMenu);
|