Skip to content

Commit 2c1fbae

Browse files
committed
add config
1 parent 842e101 commit 2c1fbae

1 file changed

Lines changed: 49 additions & 3 deletions

File tree

Easy offline/Easy offline.user.js

Lines changed: 49 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,13 @@
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.38
10+
// @version 1.0.39
1111
// @author Hoothin
1212
// @mail rixixi@gmail.com
1313
// @include http*://*/*
1414
// @exclude http*://www.baidu.*
1515
// @exclude http*://www.google.*
1616
// @exclude http*://www.bing.*
17-
// @exclude http*://github.com/*
1817
// @include http*://pan.baidu.com/*
1918
// @include http*://115.com/*
2019
// @include https://www.furk.net/*
@@ -147,6 +146,19 @@
147146
var curNode;
148147
var offUrl;
149148
var offNodes=[];
149+
var regs=GM_getValue("eoReg");
150+
if(regs){
151+
var aTags = $("a").get();
152+
for(var aTag of aTags){
153+
for(var reg of regs){
154+
var patt=new RegExp(reg);
155+
if(patt.test(aTag.href) && $.inArray(aTag, rawnodes)==-1){
156+
rawnodes.push(aTag);
157+
break;
158+
}
159+
}
160+
}
161+
}
150162
function hideIcons(){
151163
parentDiv.css("display","none");
152164
for(var node of offNodes){
@@ -278,7 +290,41 @@
278290
var i=0;
279291
var t=window.setInterval(function() {
280292
var curlink;
281-
if (location.href.indexOf("furk.net/users/files/add") != -1){
293+
if (location.href.indexOf("github.com/hoothin/UserScripts/tree/master/Easy%20offline") != -1){
294+
window.clearInterval(t);
295+
var configContent=document.createElement("div");
296+
document.body.appendChild(configContent);
297+
configContent.outerHTML=`
298+
<div id="configContent" style="display: none;">
299+
<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;">
300+
<div style="text-align:center;font-size: 12px;margin-top: 25px;">自定义需要启用一键下载的链接正则,一行一条</div>
301+
<textarea id="configInput" placeholder="例:http:.*\\.php\\?getRes=\\d+" style="position:absolute;left:20px;top:50px;width:260px;height:200px"></textarea>
302+
<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>
303+
<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;" />
304+
</div>
305+
</div>`;
306+
var configInput=document.querySelector("#configInput");
307+
var configQuit=document.querySelector("#configQuit");
308+
var configSave=document.querySelector("#configSave");
309+
configContent=document.querySelector("#configContent");
310+
configContent.style.display="block";
311+
$(configInput).val(GM_getValue("eoReg").join("\n"));
312+
$(configQuit).click(function (event) {configContent.style.display="none";});
313+
$(configSave).click(function (event) {
314+
var regStr=$(configInput).val();
315+
var regStrs=regStr.split("\n");
316+
for(var reg of regStrs){
317+
try{
318+
new RegExp(reg);
319+
}catch(e){
320+
alert("含有无效正则,请重新输入");
321+
return;
322+
}
323+
}
324+
GM_setValue("eoReg",regStrs);
325+
alert("设置成功");
326+
});
327+
}else if (location.href.indexOf("furk.net/users/files/add") != -1){
282328
window.clearInterval(t);
283329
curlink = GM_getValue('eoUrl');
284330
if(curlink){

0 commit comments

Comments
 (0)