Skip to content

Commit 485b6d4

Browse files
committed
fix
1 parent 48c0fe9 commit 485b6d4

1 file changed

Lines changed: 16 additions & 8 deletions

File tree

Easy offline/Easy offline.user.js

Lines changed: 16 additions & 8 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.40
10+
// @version 1.0.41
1111
// @author Hoothin
1212
// @mail rixixi@gmail.com
1313
// @include http*://*/*
@@ -137,9 +137,9 @@
137137
}
138138

139139
function getAllEnableUrl() {
140-
if(GM_getValue('eoDisable_'+location.href))return;
140+
if(GM_getValue('eoDisable_'+document.domain))return;
141141
var parentDiv=$("<div style='display:none;position:relative;z-index:99999;overflow:visible;text-align:left;'></div>");
142-
var rawnodes = $(enableUrl).get();
142+
var rawnodes = $(enableUrl).get(),customnodes=[];
143143
var nodes = [];
144144
var i,x;
145145
var curNode;
@@ -152,7 +152,7 @@
152152
for(var reg of regs){
153153
var patt=new RegExp(reg);
154154
if(patt.test(aTag.href) && $.inArray(aTag, rawnodes)==-1){
155-
rawnodes.push(aTag);
155+
customnodes.push(aTag);
156156
break;
157157
}
158158
}
@@ -216,6 +216,14 @@
216216
}
217217
}
218218
}
219+
if(customnodes.length > 0){
220+
for (i = 0; i < customnodes.length; i++) {
221+
curNode = customnodes[i];
222+
if(!include(nodes,curNode)){
223+
nodes.push(curNode);
224+
}
225+
}
226+
}
219227

220228
if(nodes.length > 0){
221229
$("body").append(parentDiv);
@@ -409,7 +417,7 @@
409417
}, 500);
410418
GM_deleteValue('eoUrl');
411419
}
412-
}else if(i > 6 || ((i++) === 0 && $(enableUrl).length > 0)){
420+
}else if(i > 2 || ((i++) === 0 && $(enableUrl).length > 0)){
413421
window.clearInterval(t);
414422
getAllEnableUrl();
415423
}
@@ -419,11 +427,11 @@
419427
}
420428
function toggleIcon(){
421429
$('.whx-a').toggle(500);
422-
if(GM_getValue('eoDisable_'+location.href)){
423-
GM_deleteValue('eoDisable_'+location.href);
430+
if(GM_getValue('eoDisable_'+document.domain)){
431+
GM_deleteValue('eoDisable_'+document.domain);
424432
if($('.whx-a').length<1)getAllEnableUrl();
425433
}else{
426-
GM_setValue('eoDisable_'+location.href,true);
434+
GM_setValue('eoDisable_'+document.domain,true);
427435
}
428436
}
429437
GM_registerMenuCommand(i18n.toggle, toggleIcon);

0 commit comments

Comments
 (0)