Skip to content

Commit b908138

Browse files
committed
add showType
1 parent 18c649b commit b908138

1 file changed

Lines changed: 42 additions & 6 deletions

File tree

Easy offline/Easy offline.user.js

Lines changed: 42 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
// @description:zh-TW 一鍵自動將磁鏈、bt種子或其他下載資源離綫下載至網槃
88
// @namespace http://tampermonkey.net/
99
// @require http://cdnjs.cloudflare.com/ajax/libs/jquery/1.7.2/jquery.min.js
10-
// @version 1.0.41
10+
// @version 1.0.42
1111
// @author Hoothin
1212
// @mail rixixi@gmail.com
1313
// @include http*://*/*
@@ -79,6 +79,7 @@
7979
var disableUrl=[".torrentkitty.","bt.box.n0808.com"];
8080
var lang = navigator.appName=="Netscape"?navigator.language:navigator.userLanguage;
8181
var i18n={};
82+
var showType=!!GM_getValue("showType");
8283
$=jQuery;
8384
switch (lang){
8485
case "zh-CN":
@@ -169,7 +170,10 @@
169170
offNode.addClass('whx-a').css("position","absolute").css("margin-top","0px").css("margin-left","0px").attr("target","_blank");
170171
let siteConfig=sites[x];
171172
offNode.css("background-color","#"+siteConfig.bgColor).attr("title",i18n[siteConfig.name] ).attr("href", siteConfig.url);
172-
if(siteConfig.name!="xunlei")offNode.click(function (event) {GM_setValue("eoUrl",getRightMagnetUrl(offUrl));});
173+
offNode.click(function(e){
174+
if(siteConfig.name!="xunlei")GM_setValue("eoUrl",getRightMagnetUrl(offUrl));
175+
e.stopPropagation();
176+
});
173177
if(siteConfig.bgImg)offNode.css("background-image","url(\""+siteConfig.bgImg+"\")");
174178
/*switch(x){
175179
case 0:
@@ -232,6 +236,12 @@
232236
listLen = nodes.length;
233237
setCss();
234238
if (listLen !== 0) {
239+
var preNode;
240+
if(showType){
241+
document.addEventListener("click", function(){
242+
if(preNode)preNode.hide(300);
243+
});
244+
}
235245
for (i = 0; i < listLen; i++) {
236246
curNode = nodes[i];
237247
let clone=$("<a></a>").attr("style",curNode.getAttribute("style")).attr("href",curNode.getAttribute("href")).addClass('whx-a').css("background-color","#e1e1e1").css("background-image",'url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAAZCAMAAADzN3VRAAAARVBMVEUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADc6ur3AAAAFnRSTlMAYM5vMOA/ENGegK2olI6G1b97Z0sXENA+jAAAAKFJREFUKM+FklkSxCAIRHFfss3K/Y86iQSDVqzpH7FfgQpCVfAmGx+gl9JI0qrxrcNLzooEbKUG4EKWdkCiDRV0N0RTrZ5wvdgTTgp4SzCAHxAPZkAM5GOJWuuT7FE5OVPOBFLTYb3Oc2YB5uJ8+G6pgkTGt74ntcCJHiwFLHw10Tdc93jlGXGvSRtsHNpuPs+/o1ODfxAtSL0f7HPC+L/9AF60G3QxO1UaAAAAAElFTkSuQmCC")');
@@ -259,6 +269,16 @@
259269
e.stopPropagation();
260270
});
261271
$(curNode).after(clone);
272+
if(showType){
273+
clone.hide();
274+
$(curNode).mouseover(function(){
275+
if(clone.is(':hidden')){
276+
if(preNode)preNode.hide(300);
277+
clone.show(500);
278+
preNode=clone;
279+
}
280+
});
281+
}
262282
}
263283
}
264284
}
@@ -299,23 +319,38 @@
299319
var curlink;
300320
if (location.href.indexOf("github.com/hoothin/UserScripts/tree/master/Easy%20offline") != -1){
301321
window.clearInterval(t);
322+
$('head').append(`
323+
<style>
324+
.whx-btn{
325+
background-color:#3892ed;
326+
transition:background-color 0.25s ease;
327+
}
328+
.whx-btn:hover{
329+
background-color:#83c1ff;
330+
}
331+
</style>`);
302332
var configContent=document.createElement("div");
303333
document.body.appendChild(configContent);
304334
configContent.outerHTML=`
305335
<div id="configContent" style="display: none;">
306336
<div style="width:300px;height:300px;position:fixed;left:50%;top:50%;margin-top:-150px;margin-left:-150px;z-index:100000;background-color:#ffffff;border:1px solid #afb3b6;border-radius:10px;opacity:0.95;filter:alpha(opacity=95);box-shadow:5px 5px 20px 0px #000;">
307-
<div style="text-align:center;font-size: 12px;margin-top: 25px;">自定义需要启用一键下载的链接正则,一行一条</div>
308-
<textarea id="configInput" placeholder="例:http:.*\\.php\\?getRes=\\d+" style="position:absolute;left:20px;top:50px;width:260px;height:200px"></textarea>
309-
<button id="configSave" type="button" style="position:absolute;left:110px;top:260px;width:80px;height:30px;background-color:#3892ed;color:white;border-radius:5px;border:0px;">设置</button>
310-
<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAeCAMAAAAM7l6QAAAA5FBMVEUAAAD+/v7////9/f7////////+/v7+/v7////+/v7+/v7////+/v7+/v7////+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7////////////+/v7+/v7+/v7+/v7+/v4uje3///82ke7s9P3N5PtQoPDI4fqCu/Tu9v5Im+/6/P+VxfZgqPFNnvDp8/3f7fq42Pmnz/d1tPNvsfNkq/JCmO/4+/7X6fz19/rn8PqYx/aNwfV8uPRqrvJZpfFUovAzkO3Q5vu92/mr0fieyva92fWx0vQ6lO5pygFTAAAAJHRSTlMAmfD+RMGwgj2mknlIKR/36+XGnIyHfnJfVDk2My8S4E1CJBvTatKDAAABY0lEQVQoz4WSZ1fCMBRA05ahLPfemkspBUFwgGz3+P//x/hK6ZBzvB/ak96+kZeoGCtFK5eziitqCSfWOnM2CuWUrOyQYPc0bjM2htHXh+/ffQ4lQ6zEPoZ6TwdUp10M56EtAe5MR7y0HGAeX7Ghe6MTzIZwFtTfBrepUzw4UFSGY8CUTTMGLo3eglv58By21pRnB7aNBqTwPfWq/OVey9sH22wZXiWo6Yr3GtRl/f0IRyoPYy14v97YWjVY12BPrcK9XvhaZPUdWCoLbR35yOoW5P7R8eQ3JrmbSp6HVmSrXuTrmNYyUAs2JkL6D6YjG1PgNGXK87F4nWAsUxmL2gyH6oVD7cuhdqFg9CE4T/oPE6CsgvBOP21715AP7ugaDFK+3YD1KyUcAG47bn0TSylxFd8WDTwMMByoBSUHw+jd9/3JbQODnVExygUS7FRUksPVtdDZW8dqCZm8lc1auxcq4gc02GVGTUchmgAAAABJRU5ErkJggg==" id="configQuit" style="position:absolute;right:0px;top:0px;cursor: pointer;" />
337+
<div style="text-align:center;font-size: 12px;margin-top: 28px;">自定义需要启用一键下载的链接正则,一行一条</div>
338+
<textarea id="configInput" placeholder="例:http:.*\\.php\\?getRes=\\d+" style="position:absolute;left:20px;top:50px;width:260px;height:170px"></textarea>
339+
<label style="position:absolute;left:60px;top:225px;"><input id="showType" type="checkbox"/>仅当鼠标经过时显示图标</label>
340+
<button id="configSave" class="whx-btn" type="button" style="position:absolute;left:110px;top:260px;width:80px;height:30px;color:white;border-radius:5px;border:0px;outline:none;">设置</button>
341+
<div id="configQuit" class="whx-btn" style="width:28px;height:28px;border-radius:14px;position:absolute;right:2px;top:2px;cursor:pointer;">
342+
<span style="height:28px;line-height:28px;display:block;color:#FFF;text-align:center;font-size:20px;">╳</span>
343+
</div>
311344
</div>
312345
</div>`;
313346
var configInput=document.querySelector("#configInput");
314347
var configQuit=document.querySelector("#configQuit");
315348
var configSave=document.querySelector("#configSave");
349+
var showTypeCheck=document.querySelector("#showType");
316350
configContent=document.querySelector("#configContent");
317351
configContent.style.display="block";
318352
if(GM_getValue("eoReg"))$(configInput).val(GM_getValue("eoReg").join("\n"));
353+
if(GM_getValue("showType"))showTypeCheck.checked=true;
319354
$(configQuit).click(function (event) {configContent.style.display="none";});
320355
$(configSave).click(function (event) {
321356
var regStr=$(configInput).val();
@@ -329,6 +364,7 @@
329364
}
330365
}
331366
GM_setValue("eoReg",regStrs);
367+
GM_setValue("showType", showTypeCheck.checked);
332368
alert("设置成功");
333369
});
334370
}else if (location.href.indexOf("furk.net/users/files/add") != -1){

0 commit comments

Comments
 (0)