迅雷专用地址例子:thunder://QUFodHRwOi8vc29zb2J0LmNvbS9aWg==
    真实文件下载链接:http://sosobt.com/

    1、迅雷链接编码

    1. thunder:// + AA + 真实下载地址http或ftp + ZZ 然后base64编码
    2. //迅雷下载协议 + AA + 真实下载地址 + ZZ
    3. 在原地址前面加"AA",后面加"ZZ"(不包括引号),地址变为 AAhttp://sosobt.com/1.rarZZ
    4. 此地址base64编码为 QUFodHRwOi8vc29zb2J0LmNvbS8xLnJhclpa
    5. 迅雷专链即在上地址前加thunder://,即 Thunder://QUFodHRwOi8vc29zb2J0LmNvbS8xLnJhclpa

    2、快车链接编码

    1. Flashget:// + [FLASHGET] + 真实下载地址http或ftp协议 + [FLASHGET] 然后base64编码
    2. 在原地址前后都加上"[FlashGet]"(不包括引号),
    3. 地址变为 [FLASHGET]http://sosobt.com/1.rar[FLASHGET]
    4. 此地址base64编码为 W0ZMQVNIR0VUXWh0dHA6Ly9zb3NvYnQuY29tLzEucmFyW0ZMQVNIR0VUXQ==&sosobt
    5. 快车专链即在上地址前加flashget://,
    6. 注意后面还要加上"&符号",最后后面加的是好好爱的个人信息
    7. Flashget://W0ZMQVNIR0VUXWh0dHA6Ly9zb3NvYnQuY29tLzEucmFyW0ZMQVNIR0VUXQ==&sosobt

    3、QQ旋风链接编码

    1. QQdl:// + 源地址base64编码
    2. 旋风相对就简单多了,将原地址直接base64编码
    3. 旋风专链即在上地址前加QQdl://,即 qqdl://aHR0cDovL3Nvc29idC5jb20vMS5yYXI=

    4、各种云盘下载

    1. // ==UserScript==
    2. // @name Easy offline
    3. // @name:zh-CN 一键离线下载
    4. // @name:zh-TW 一鍵離綫下載
    5. // @description Find out all magnet links and torrents and video links in current page, and stream them from cloud storage automatically.
    6. // @description:zh-CN 一键自动将磁链、bt种子或其他下载资源离线下载至网盘
    7. // @description:zh-TW 一鍵自動將磁鏈、bt種子或其他下載資源離綫下載至網盤
    8. // @namespace http://tampermonkey.net/
    9. // @require https://cdn.jsdelivr.net/jquery/1.7.2/jquery.min.js
    10. // @require https://cdn.jsdelivr.net/hi-base64/0.2.0/base64.min.js
    11. // @version 1.5.8
    12. // @author Hoothin
    13. // @mail rixixi@gmail.com
    14. // @include http*://*/*
    15. // @include http*://pan.baidu.com/*
    16. // @include http*://115.com/*
    17. // @include https://www.furk.net/*
    18. // @include https://www.seedr.cc/*
    19. // @grant GM_setValue
    20. // @grant GM_getValue
    21. // @grant GM_registerMenuCommand
    22. // @grant GM_deleteValue
    23. // @grant unsafeWindow
    24. // @supportURL http://www.hoothin.com
    25. // @license MIT License
    26. // @compatible chrome
    27. // @compatible firefox
    28. // @contributionURL https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=rixixi@sina.com&item_name=Greasy+Fork+donation
    29. // @contributionAmount 1
    30. // ==/UserScript==
    31. (function() {
    32. 'use strict';
    33. var sites={
    34. baidu:{
    35. regex:/pan\.baidu\.com/,
    36. url:"https://pan.baidu.com/disk/home",
    37. bgColor:"ffffff",
    38. canMul:true,
    39. bgImg:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAABjFBMVEX////7+/v+/v/8/Pwyf/wzc/w0bvza5f4xffz5+//0+P8ybPz8/f4yevw0cPwza/z39/cwe/UxdfzSPyr4+v/2+f/m7/53nv0vf/wvce9pof1tlPwxf/gzfPYwePPp8f7Z5/7S4v7P4P7L3f7I2f2Gtf2Rr/1hkP0yd/1FiPwygfxAdPxspftYkvUtc/Dg6f7C2f7F1f54oP1flf0/hfwsbu7i7f/w9f7b5v7X5f7V4v6nyv6oxv6jwP6Ns/2Lsf1/rv1+ov1zof1xof10nf1jm/1djP0xe/2NufxalvxHj/xPhvxKgPxHffw+efw0ePyXu/mqxPg5hfiTtvdyo/dgmfdOj/dBhfVflfQvefT+9fOIqvMyefNMhvFIgO9MeePyycVjZbzKb3DaZVa/Q0Dx9f+Bp/1olv1gkPw0dvzg6Pu2zPk0gflNjPctc/c9gfX88/JJfO3n3+ni2unHxuSGktNpdtBJY8paashRW71nXqp7YpyDYJKpaIKPU33AVFXARkTVTTvFQjrUPypKwHq1AAACAklEQVQ4y4WTB3OqQBSFF3BpAk+KIBixJ2rs0fTee68vvbzee+9//O1Cio46npmFPfd8d2cY9gIASMJHUESDKFQmAZJAUKCFKELA/WSr3A3d/tZnAF99C8fVHYhiosbxxflsdr7I15SIWiCe3exA2szGmwOJXTkUkvHaTTQD9NyBLO/t7OzJ8kFObwKs2/bRdrSvL7p9ZNvrjQC/n8/nwngXzuXz+3wDED42zS13u2Wax+EGQD+pmhvudsOsnuj1gBAZSp5+/XRIYkMeVu1XyaGIcAfoycVM4Pn3qx9vcW3gRUcmE8gsJvUboNfyeDyBwLd/6sX7wtNnC45DD6vXBbRx1sOmrQ+/VFX9efomhFzFstLoNa45QKzCijMx/vXZpar+/fKSZecWijwfmxHZSgzFFBgWxXQUIJ39UX9/nhPFngHsomlRHEYxRY6mlCkOl+5fXp2vraV6IgCLm1JSoyQGxhRlUnCAi/PUEwXnWMKkooxhAIxAuNSPS+8+Qgi7GOB3zutfgnAExQSIr0JoMJw2GJSghPLSo4eDGscYEK7Gna/gy7QkLRvTK5JEP2bAgy4vvTJtLCNX5h0AMLNemvbihfqBv3zjZpHDACKM7ntI3RMFgFSYcJ3B3P0sf6kzGOxM+AFwXAK7kuNurz2pcWTt7deuna/t4LQdvbbD23b8/wPY0UTO99dD5gAAAABJRU5ErkJggg==",
    40. offFunc:function(delLink){
    41. var gsi = setInterval(function() {
    42. var newOffBtn = document.querySelector('.g-button[data-button-id=b35]');
    43. if(newOffBtn){
    44. clearInterval(gsi);
    45. newOffBtn.click();
    46. var bsi = setInterval(function() {
    47. var newTaskBtn = document.querySelector('#_disk_id_2');
    48. if(newTaskBtn){
    49. clearInterval(bsi);
    50. newTaskBtn.click();
    51. var bsl = setInterval(function() {
    52. var offLink=document.querySelector('#share-offline-link');
    53. if(offLink){
    54. clearInterval(bsl);
    55. var beginOffline=function(){
    56. if(curlink.length===0)return;
    57. if(Object.prototype.toString.call(curlink) === '[object Array]')
    58. offLink.value = curlink.shift();
    59. else{
    60. offLink.value = curlink;
    61. curlink="";
    62. }
    63. delLink();
    64. var baiduPathStr=GM_getValue("baiduPath"),isBt=/^magnet|torrent$/.test(offLink.value);
    65. if(baiduPathStr){
    66. unsafeWindow.require("function-widget-1:offlineDownload/util/newOfflineDialog.js").obtain()._checkPath=baiduPathStr;
    67. }
    68. $("#newoffline-dialog").find("span:contains('确定')[class='text']").click();
    69. if(isBt)
    70. var i=0, bsb = setInterval(function(){
    71. var btList=document.querySelector('#offlinebtlist-dialog');
    72. if(btList && btList.style.display!="none"){
    73. clearInterval(bsb);
    74. if($(".content-title-name").html()=="文件名")$("a.checked-all")[0].click();
    75. btList.querySelectorAll('.dialog-footer>.g-button')[1].click();
    76. }else if(++i>50){
    77. clearInterval(bsb);
    78. }
    79. }, 200);
    80. var ckeckEnd=function(){
    81. var bck=setInterval(function(){
    82. if(document.querySelector("#offlinelist-dialog").style.display!="none"){
    83. clearInterval(bck);
    84. beginOffline();
    85. }else if(document.querySelector("#dialog1").style.display!="none"){
    86. clearInterval(bck);
    87. var inputCode=$("#dialog1").find(".input-code");
    88. inputCode.focus();
    89. bck=setInterval(function(){
    90. if(inputCode.val().length==4){
    91. clearInterval(bck);
    92. $("#dialog1").find("span:contains('确定')[class='text']").click();
    93. ckeckEnd();
    94. }
    95. },200);
    96. }
    97. },500);
    98. };ckeckEnd();
    99. };beginOffline();
    100. }
    101. }, 500);
    102. }
    103. }, 500);
    104. }
    105. }, 500);
    106. }
    107. },
    108. pcloud:{
    109. regex:/my\.pcloud\.com/,
    110. url:"https://my.pcloud.com/",
    111. bgColor:"f1f1f1",
    112. noMag:true,
    113. noEd2k:true,
    114. noFtp:true,
    115. bgImg:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAXVBMVEX///////8bytT///8fy9UbytQbytQfy9Ufy9UmzNYbytQgy9UizNUbytT///8bytQey9Ufy9Ugy9VG1NxB09sbytRg2uFS194bytT///9G1Nzx/Pzi+PpT19+c6OxZ7rqXAAAAGHRSTlMBG/AHxYAh49O3oWJBMRUR4bOLYV9RQz9fW5zbAAAAbUlEQVQY043MRxLCMBBE0WYkOQcyXybc/5hIhUuww2/3u2pGG1WdYV1VujcyG9ceWdmcM8jDK8bHE0LqCzMQF5Y7NOnNgeE7MATBMQ+fE/q9wCwNkDUetUAZPLVuxq+z3LWlqE9OctOumFL/9QYClwvt3NkDkgAAAABJRU5ErkJggg==",
    116. offFunc:function(delLink){
    117. var psc = setInterval(function() {
    118. var upBtn = document.querySelector('div.upload_button');
    119. if (upBtn) {
    120. clearInterval(psc);
    121. upBtn.click();
    122. document.querySelector('span.remoteupload-ctrl').click();
    123. var remotearea=document.querySelector('textarea.remotearea');
    124. remotearea.value=curlink;
    125. delLink();
    126. remotearea.nextSibling.click();
    127. }
    128. }, 500);
    129. }
    130. },
    131. yyw:{
    132. regex:/115\.com/,
    133. url:"http://115.com/?tab=offline&mode=wangpan",
    134. bgColor:"21458a",
    135. bgImg:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAASFBMVEUhRYr///+XqcjV3OmJnMFTb6QoS45PbKLu8fbZ4OvBy95xiLRifKxbdqlXcqYxU5P3+Prh5u/O1uXH0eK6xduks89/lLtGZJ4ysMfhAAAAVUlEQVQY04WPSQ6AMAwD6ySkdKHs8P+fckyDhPBtRoojhyG4GP6FEjPvxhGZiKKJPM7uoAHYSif0Lgdw+tppQfOGIF4ILsea3CetvMa+UaRq+Mh7/gPkxAHFh9WDUQAAAABJRU5ErkJggg==",
    136. offFunc:function(delLink){
    137. var rsc = setInterval(function() {
    138. if (document.readyState == 'complete') {
    139. clearInterval(rsc);
    140. setTimeout(function() {
    141. unsafeWindow.Core.OFFL5Plug.OpenLink();
    142. setTimeout(function() {
    143. $('#js_offline_new_add').val(curlink);
    144. delLink();
    145. }, 1);
    146. }, 1000);
    147. }
    148. }, 300);
    149. }
    150. },
    151. furk:{
    152. regex:/www\.furk\.net/,
    153. url:"https://www.furk.net/users/files/add",
    154. bgColor:"fff",
    155. hide:false,
    156. bgImg:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAC4AAAAuCAMAAABgZ9sFAAAAflBMVEX///+CuuaGv+rjXKniTaiDu+d3tufiXq/nUqxAn9+t1vGiz/FOnt/sj8nol8bhcLJRo97b7vp5uOpCoeGQw+m31/XW6/er0++Iwe330uZUpuHssNjni8Tqf7/o9Pn68PSUx+732eucyuvzzuJjq+H0v97sm8q12vDto8/rcrjt831UAAABmUlEQVRIx+2T6W6DMBCE8dr4aEgw0KS5kzZH2/d/we7aliJlN6KR+rNjgYwYfxrwuPrXXwkeaC7ba1nqU7YrWfV83N6rm95G7ZCWlNnL6Kfa20zBA7tNEl7KSsjl5In/rsBOnqArtfx1GGXVGH112Wwuq2KnMMDp2nnUtaquOsttchik15yeLGZ68tpp7403elXo4pZn5Ld3zpg03VWFjkOme51kcGj/nu1p7wF6QPU0cjKDVIyBRrfbtdptM4XYqYIoSKP+KHQ04X17wKfDF8JJYJUt9cqrVH2sUOg0hJ4Ju5rNRSWMIb9r70uA4a2lRRSrx9stDF6ne7tCrz12XbdfLPbdAicVCdFEr5gdQGq306Qt6wz5gR81+t2tmXI6SbLT5sx4ga1YMdNidM/sAMQXOmOoBVPxeMidaaUwFsSjbVBa+NS0RdyequgYXS0pjhSmlegWcKxfRbrmdFBwjpHbMblEV+cQwiDSnUBfD8PQNMDtVBpOH2IYhjVInZHosYkxBh7GGZEeGpRg161Ib0ITQhTCMPrz+gG1shF4koHETAAAAABJRU5ErkJggg==",
    157. offFunc:function(delLink){
    158. setTimeout(function() {
    159. if(!$('#url').length)return;
    160. $('#url').val(curlink);
    161. delLink();
    162. $(":submit[value='Add download']").click();
    163. }, 500);
    164. }
    165. },
    166. seedr:{
    167. regex:/www\.seedr\.cc/,
    168. url:"https://www.seedr.cc/files",
    169. bgColor:"ca2a15",
    170. hide:false,
    171. bgImg:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAllBMVEXGKBPGKBPGKBPGKBPORDLJMh3uv7nQTDvILRjprKPmoZjbdmnLOyjKNSHtvLbrtK3opp3lm5Hhj4Tac2XZb2HXalvUXEzLOibGKBPGKBPGKBPqsarjlovehHjXaFnTWkrMQC3GKBPGKBPGKBP////44+H77u323Nj01dHxycP88vH66+n23dr019Tyz8rxzMfvw73vwrxYVj9BAAAAJHRSTlP7yb+j+/v9+/v9/f37+/39/f39/f39+/uxmSj9/f37+/uXNR2Gd9E6AAAAmUlEQVQY003NVxKDMAxFUQVsbHqv6YkMIT3731wEZoD7oZl3fgQXY7PKaKACKn93BxirwaArWsQXH8EcYYeUu4BnDRAsUKgBWjZDeqfduXKGmHbPT3YiJ9giPtj+qUJWavghxoUSHFxLAz3JIgcAypsGBzF3bAJvAvHB5PiVnm8HGoBZIffTVvWMoIIhX4KIMg5whsbcrKqvf29uDBcu2+SAAAAAAElFTkSuQmCC",
    172. offFunc:function(delLink){
    173. var sdi = setInterval(function() {
    174. if($('#upload-button').css("display") != "none"){
    175. window.clearInterval(sdi);
    176. setTimeout(function() {
    177. $(':text[name="torrent"]').val(curlink);
    178. delLink();
    179. $('#upload-button').click();
    180. }, 500);
    181. }
    182. },500);
    183. }
    184. },
    185. weiyun:{
    186. regex:/www\.weiyun\.com/,
    187. url:"https://www.weiyun.com/disk/index.html",
    188. bgColor:"3c95ee",
    189. bgImg:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAV1BMVEUed9E4htg2hNI2g84KJkMSKkMJIjwHEBr///8lh+k5k+49lu4hhegyj+wri+s/lu+s0vfg7vzX6vy/3PlWou+w1PicyfaWxvXf7fzB3fmHvfSBuvNfp/GhDGXVAAAACHRSTlPm5uDeSkhCHO7HIjkAAAB4SURBVBjTZYuJDsIwDEM9TnfDodc2rv//TtoKITqeosR+UnAcrj/szhimjj2mDRgbM8nYEj59GRfOX/Fg3a+2IUWSUh0vCfKhRUbFaiAqs1L0PVAw2vrM3sx8sFJgieUGWwNzzXAukTeSqX46B7fhX+DSARzQ9dMbRIkLk61eQagAAAAASUVORK5CYII=",
    190. offFunc:function(delLink){
    191. var rsc = setInterval(function(){
    192. var offBtn=document.querySelector('.icon-bt-s');
    193. if(offBtn){
    194. clearInterval(rsc);
    195. var wsc = setInterval(function() {
    196. offBtn.click();
    197. var textarea=document.querySelector('textarea.input-block');
    198. if(textarea){
    199. clearInterval(wsc);
    200. document.querySelector(".modal-dialog-bt ul>li:nth-child(2)").click();
    201. setTimeout(function() {
    202. textarea.value=curlink;
    203. delLink();
    204. var event = document.createEvent('HTMLEvents');
    205. event.initEvent("input", false, true);
    206. textarea.dispatchEvent(event);
    207. document.querySelector('div.modal-dialog-ft>button:nth-child(2)').click();
    208. setTimeout(function() {
    209. document.querySelector('div.modal-dialog-ft>button:nth-child(2)').click();
    210. }, 1000);
    211. }, 500);
    212. }
    213. },200);
    214. }
    215. },1000);
    216. }
    217. },
    218. bitqiu:{
    219. regex:/pan\.bitqiu\.com/,
    220. url:"https://pan.bitqiu.com",
    221. bgColor:"ffffff",
    222. bgImg:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAASFBMVEUAAAARsPUSr/QWsfkTsvUWuv8RsvkSr/URsPUSsPQr1f8RsPUSsPYRr/USr/USr/USsfQSsPUTsPURsPURsfYSsPUTsPgRr/UxdyaHAAAAF3RSTlMA1LsuMw0q8pSPBrSK28ygeHJqZjqqRB/r5Z8AAACRSURBVBjTZc9bFoMgDARQogRFBMpDZ/877UDtl/PHPTAkZsR52Tbxzvxy7HiyH/PsBFLu3hKwDNnX5dRy5aof3uF7EE6rNkRLccYTwuwKURO8EYKdYFEbxGwEnaDIHRuh5/+NZSUIWn06BghLk8YwfgGBpSvwsRGMnATHwSha81WUsI/RFyC1fheBuOO93Gv9Lw0KCbAF32RQAAAAAElFTkSuQmCC",
    223. offFunc:function(delLink){
    224. var rsc = setInterval(function(){
    225. var offBtn=document.querySelector('.js-cloud-download');
    226. if(offBtn){
    227. clearInterval(rsc);
    228. offBtn.click();
    229. var wsc = setInterval(function() {
    230. var tab=document.querySelector('.cloud-download-container');
    231. if(tab){
    232. clearInterval(wsc);
    233. var textarea=tab.querySelector('textarea');
    234. textarea.innerHTML=curlink;
    235. delLink();
    236. document.querySelector('.js-confirm').click();
    237. }
    238. },200);
    239. }
    240. },1000);
    241. }
    242. },
    243. xunlei:{
    244. regex:/lixian\.vip\.xunlei\.com/,
    245. url:"http://lixian.vip.xunlei.com/?furl=",
    246. bgColor:"2e71f1",
    247. directUrl:function(offUrl){
    248. return this.url+offUrl;
    249. },
    250. bgImg:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAAZCAMAAADzN3VRAAABC1BMVEUAAAArcPUscPQkavJSd79UdrhTdrled6kjae8ucfAqbOwoa+0pa+xTd71WdrNad61dea4pbO4vcvEsb/Aqbe8sbu8ucfArbu8ucfEpbe0oa+4vcPH///4ZYe7j8fne7fknbPAkaO41dfDa6vgcY+/o8/rV6PchZ+4bZO79//3u+fklavIiaO8VXu3x9/3t9fve7veLsfYqcfZNhvE5d/AfZO36/fz0+/ry+vrb6PrG2vnR5fbL4faXufbG3fWqyPWjw/WErPWixPR4pPR0ovOIsfJsnPJYj+9Bfe/1+v3l7f3p8Pzg7fq+0/mlw/fY6/aQtPaHrfZnl/S41fORt/KAqvKZvvFJhO8eZe4RVCzFAAAAEXRSTlMA+P74gnpzWP329OrohXJgXOQVaEcAAAFOSURBVCjPZczneoIwGIbhqNXuEQORYGIBQXDvvbfde5z/kfSTi1Kx9798z/UGIXQQUuJBSiiGwDmEPUklFIVFDcI/4doVqilUCSIFArdjlAxQFE1Ir41EMhlGlFKiEerRhPFy29O3byiyUTccx9HiVBbxYYm3jAL1ilyvPlerhl1wFnec83mRuoUQSgr2lPP7Bn3g2dJNtm6TLSggUXzMZrtdXi6X+dCR/QLEtGV1SpZltXvfGtkt5qSdcnXmpmlit8guc5K79vTHK0OCk1eaq1x6q2LlUunBUsZQEi5sj3MZMJp9bLCuynCCjUvX3yuVzKBRFLqK4TNvA+Qj8TV7Si1E4heSfKZYj/pUlzxQfFjQt2XRL/iPJDXVz43tvRBmO6SmsdaZS0N5zHZnOpMwYNoJiuU1pu5j+fwhQtGIynAQUyMXCFyeqntFPYPFD095Qx8x+n7CAAAAAElFTkSuQmCC"
    251. },
    252. xiaomi:{
    253. regex:/miwifi\.com/,
    254. url:"http://d.miwifi.com/d2r/?url=",
    255. bgColor:"f97306",
    256. directUrl:function(offUrl){
    257. return this.url+base64.encode(offUrl)+"&src=EasyOffline";
    258. },
    259. bgImg:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAeFBMVEX4cwD+/v7+/vz+/f7+zKr+mU/++vj93cf8hiv+28T+z6/+z6v8lUv+kkn8gSf+fCL98OP92sH+17z+yqf+yaX+wJX9lk/7mkz8kkb9jj79gyr6hyn9exv++/r+9/X96+H+xJz9v47+mFP+mEr+dh37dhn+dhL+cAw9Nvl9AAAAf0lEQVQY053NWQ6DMAwE0LFNEkqahLK0hdJ9u/8NcXIERpY/nkY2NuVS1zoRwDL/dL9vIkJsXcRgjwqG7uP4fLTcw5NROJGH5iUOFWcw3KBqJ9AOFe1zQzwcBXCBcqPBgc8FuIAoiILTRv4SbI/OTrAdhmuAZk5Y4h/pg2/Clqzm5QVwiFSSmAAAAABJRU5ErkJggg=="
    260. },
    261. apiv:{
    262. regex:/apiv\.ga/,
    263. url:"https://apiv.ga/magnet/",
    264. bgColor:"35271c",
    265. noHttp:true,
    266. noEd2k:true,
    267. noFtp:true,
    268. hide:true,
    269. directUrl:function(offUrl){
    270. return this.url+offUrl.split("&")[0].replace("magnet:?xt=urn:btih:","");
    271. },
    272. bgImg:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAAAS1BMVEXq5N+Lgnl/dGw1Jxzt5uDy7eju6eO1rKTk3tdPRDjb1M2vpZ1jWU9WST6+tq+qoJiYkIp4bWNCNCbg2dTIwLi5squroplYT0dFNyua0/V8AAAAA3RSTlP+/v6VFoksAAAAaklEQVQ4y+XSSw6AIAwEUMCC5Svg9/4nFQ/AsDTGWb+kk0nFNMgfQawDsKQ4AOxUReBgZm8BmEWLK1cfEJEx5CMG2riCgG4xudehiQesCp7Qe4AdWJ6oJKUAd2AJh6ItWDS1z/b1j/osuAHroA3qksST5QAAAABJRU5ErkJggg=="
    273. },
    274. torrent:{
    275. regex:/torrent\.org\.cn/,
    276. url:"http://www.torrent.org.cn/Home/torrent/download.html?hash=",
    277. bgColor:"f2f2f2",
    278. noHttp:true,
    279. noEd2k:true,
    280. noFtp:true,
    281. directUrl:function(offUrl){
    282. return this.url+offUrl.replace("magnet:?xt=urn:btih:","");
    283. },
    284. bgImg:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAAAh1BMVEUAAAARzW4RzW4RzW4RzW4RzW4RzW4RzW4RzW4RzW4RzW4RzW4RzW4RzW4RzW4RzW4RzW4RzW4RzW4RzW4RzW4RzW4RzW4RzW4RzW4RzW4RzW4RzW4RzW4RzW4RzW4RzW4RzW4RzW4RzW4RzW4RzW4RzW4RzW4RzW4RzW4RzW4RzW4RzW4RzW6Q4LCTAAAALHRSTlMABCboGRPMNdIrH/Pu6sS+pC/iuZg5CfnaeUWFZD88Dtayq5GLgFz3VE5Jaw0PQwoAAAFJSURBVDjL1ZLZdoQgEERHQBBwAfd9xnW2/v/vSxRNJifOe3JfPC1F0V1w+l+cy2m6C+u9oJYA13wkb5ZF/XBhwdfHggo3PaxQftiADzHLjaKzDwTkAvJRhqsgmw8EtgPg8NYxbRxYpMGygPjyyfKjLoqQ+r7Sos+rB7NT6/cZLGkThiwbtVUXBOqJfmisJKahh3NFUO+aTsMYvcwQe7AyagpfXO67CQrAgJmCF/B9C6nb/0Q6zKoi8vbaMac8M1OGE2IuRDehRwyGYotgwR2QuDEP4EpnW8fbzZ1NygAyas6z4/C1x2vUpEwtLjlZEuhCOpQk6SXIsjDWnmqIvlWqXucgbVtOweoZ8QgMLlXF3KTmrfieBENWm5E3qDAx1njfFosTGb6nLPegWXzBHnaGZLFM2ehgKTEtxMtdEK6Rbe2VzZOEf5Z/hQ9XijJkclXFpgAAAABJRU5ErkJggg=="
    285. },
    286. btcache:{
    287. regex:/btcache\.me/,
    288. url:"http://btcache.me/torrent/",
    289. bgColor:"f30000",
    290. noHttp:true,
    291. noEd2k:true,
    292. noFtp:true,
    293. directUrl:function(offUrl){
    294. return this.url+offUrl.replace("magnet:?xt=urn:btih:","");
    295. },
    296. bgImg:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAA9lBMVEUAAACgoqOipKUAAAC4ubq1traXl5jX19g9PT4GBga2t7ixsrOur7Cmp6jMzM1+f39ZWVpnZ2eChIXMzc3BwcKvsrLGxsacnZ3f399zdHS9vr61trZZW1upq6vIysq7vb2nqKliZGTS09O6vLzg4OC2uLhQUVHi4uK+v79OTk4hISHT1NQZGRnf4OCPkpKsra3KysxmZ2d+f3/y8vOUlZW+vr+2tridnp/Z2dmAgYJ4enptbm5YWVn39/fv7/DDw8Td3d7U1dXU1NTOztC4ubuoqamlpaWcnJyYmJp6fHxwcXFTVVX29/bHyMnHx8e3t7qgoaGHiYm1AxJpAAAAL3RSTlMAHhgF4NbW2jQU4uDg3sybVDUkHhcF6Ojk5ODc2dfJycPDra17ezkuLiUlIRUREf6sWL0AAAC0SURBVBjTjY9HEoJAAAQXVwVzAMw5Z5YMgoBizv7/M7JwoLw5t+lD1wzAYVcEPaeXLAgyHvTazTpJtvrDCe5M1nUReiiK/ERZxgNEVLYdy1GFz1uuET54IfGucTq/5qIYRGIKEjcaJ3ggFsEgrp/tnSwZJi/EMSDSqqQeJeNmXk+pwLFHlrg9CPzl16H/7ygmQ0eyCACkMuGODAUBTORzHbJSKlcb3Vw+AfE9uJgWCiNq5rcvfNwgjdumYdQAAAAASUVORK5CYII="
    297. }
    298. };
    299. var enableUrl = 'a[href^="magnet"],[href^="ed2k://|file"],[href$=".torrent"],[href$=".mp4"],[href$=".rar"],[href$=".7z"],[href$=".zip"],[href$=".rmvb"],[href$=".mkv"],[href$=".avi"],[href$=".iso"]';
    300. var disableUrl=[".torrentkitty.","bt.box.n0808.com"];
    301. var lang = navigator.appName=="Netscape"?navigator.language:navigator.userLanguage;
    302. var i18n={};
    303. var showType=!!GM_getValue("showType");
    304. $=jQuery;
    305. switch (lang){
    306. case "zh-CN":
    307. i18n={
    308. configure:"一键离线下载设置",
    309. yyw:"115网盘",
    310. baidu:"百度网盘",
    311. furk:"Furk网盘",
    312. seedr:"Seedr网盘",
    313. pcloud:"Pcloud网盘",
    314. xunlei:"迅雷离线",
    315. xiaomi:"小米路由器",
    316. weiyun:"腾讯微云",
    317. bitqiu:"比特球",
    318. apiv:"九秒云播",
    319. torrent:"Torrent.org种子下载",
    320. btcache:"Btcache.me种子下载",
    321. enable:"启用",
    322. disable:"禁用"
    323. };
    324. break;
    325. default:
    326. i18n={
    327. configure:"EasyOffline - Configure",
    328. yyw:"115",
    329. baidu:"BaiduPan",
    330. furk:"Furk",
    331. seedr:"Seedr",
    332. pcloud:"Pcloud",
    333. xunlei:"Xunlei",
    334. xiaomi:"MiWifi",
    335. weiyun:"Weiyun",
    336. bitqiu:"bitqiu",
    337. apiv:"Apiv Online play",
    338. torrent:"Torrent download in torrent.org",
    339. btcache:"Torrent download in btcache.me",
    340. enable:"Enable ",
    341. disable:"Disable "
    342. };
    343. break;
    344. }
    345. var sitesArr=[],siteSort=GM_getValue("siteSort"),siteName;
    346. if(!siteSort)siteSort=["baidu","yyw","furk","seedr"];
    347. siteSort.forEach(function(item) {
    348. var siteConfig=sites[item];
    349. siteConfig.name=item;
    350. sitesArr.push(siteConfig);
    351. });
    352. for(siteName in sites){
    353. var hasSite=false;
    354. siteSort.forEach(function(item){if(item==siteName)hasSite=true;});
    355. if(hasSite)continue;
    356. var siteConfig=sites[siteName];
    357. siteConfig.name=siteName;
    358. sitesArr.push(siteConfig);
    359. }
    360. function include(things,obj) {
    361. for (var i = things.length - 1; i >= 0; i--) {
    362. if ($(things[i]).attr('href')===$(obj).attr('href')){
    363. return true;
    364. }
    365. }
    366. }
    367. var isInited=false;
    368. function init(){
    369. if(isInited)return;
    370. isInited=true;
    371. $("body").append(parentDiv);
    372. setCss();
    373. }
    374. function setCss(){
    375. $('head').append(`
    376. <style>
    377. a.whx-a{
    378. display:inline-block;
    379. margin-left:5px;
    380. background-size:20px;
    381. border-radius:50%;
    382. border:0px;
    383. vertical-align:middle;
    384. transition:margin-top 0.25s ease;
    385. outline:none!important;
    386. padding:0px!important;
    387. height:25px!important;
    388. width:25px!important;
    389. left:0px!important;
    390. top:0px!important;
    391. background-position:center!important;
    392. background-repeat:no-repeat!important;
    393. }
    394. a.whx-a:hover{
    395. animation:rotateAni 2s infinite;
    396. animation-direction:alternate;
    397. -webkit-animation:rotateAni 2s infinite;
    398. -webkit-animation-direction:alternate;
    399. }
    400. @keyframes rotateAni{
    401. from {transform: rotate(0deg);}
    402. to {transform: rotate(360deg);}
    403. }
    404. @-webkit-keyframes rotateAni{
    405. from {transform: rotate(0deg);}
    406. to {transform: rotate(360deg);}
    407. }
    408. </style>`);
    409. }
    410. var parentDiv=$("<div style='display:none;position:absolute;z-index:99999;overflow:visible;text-align:left;'></div>");
    411. var regs=GM_getValue("eoReg");
    412. function hideIcons(){
    413. parentDiv.css("display","none");
    414. for(var node of offNodes){
    415. node.css("margin-top","0px");
    416. }
    417. }
    418. var offNodes=[];
    419. var offUrl,allUrl=[];
    420. for(var x = 0; x < sitesArr.length; x++){
    421. let offNode=$("<a></a>");
    422. offNode.addClass('whx-a').css("position","absolute").css("margin-top","0px").css("margin-left","0px").attr("target","_blank");
    423. let siteConfig=sitesArr[x];
    424. offNode.css("background-color","#"+siteConfig.bgColor).attr("title",i18n[siteConfig.name] ).attr("href", siteConfig.url).attr("name", siteConfig.name);
    425. offNode.click(function(e){
    426. offUrl=getRightUrl(offUrl);
    427. if(siteConfig.directUrl){
    428. offNode.attr('href', siteConfig.directUrl(offUrl));
    429. }else{
    430. if(e.ctrlKey && e.shiftKey && siteConfig.canMul)
    431. GM_setValue(siteConfig.name+":eoUrl",allUrl);
    432. else GM_setValue(siteConfig.name+":eoUrl",offUrl);
    433. }
    434. e.stopPropagation();
    435. });
    436. if(siteConfig.bgImg)offNode.css("background-image","url(\""+siteConfig.bgImg+"\")");
    437. if(siteConfig.hide || GM_getValue("eoHide"+siteConfig.name))continue;
    438. offNodes.push(offNode);
    439. parentDiv.prepend(offNode);
    440. }
    441. if(typeof(HTMLElement)!="undefined"){
    442. HTMLElement.prototype.contains=function(obj) {
    443. while(obj){
    444. if(obj==this)
    445. return true;
    446. obj=obj.parentNode;
    447. }
    448. return false;
    449. };
    450. }
    451. var marginTop=offNodes.length*25;
    452. parentDiv.prepend($('<div style="position:absolute;width:25px;height:'+marginTop+'px;margin-top:-'+(marginTop-25)+'px;background-color:white;opacity:0.001;"></div>'));
    453. parentDiv.mouseout(function(e){
    454. var relatedTarget=(e.relatedTarget||e.fromElement);
    455. if(relatedTarget && !parentDiv[0].contains(relatedTarget))
    456. hideIcons();
    457. });
    458. parentDiv.mouseover(function(e){
    459. e.stopPropagation();
    460. });
    461. document.addEventListener("mouseover", function(e){
    462. if(parentDiv.css("display")!="none")hideIcons();
    463. });
    464. var preNode;
    465. if(showType){
    466. document.addEventListener("click", function(){
    467. if(preNode)preNode.hide(300);
    468. });
    469. }
    470. var sNodes=[];
    471. if(!Array.prototype.indexOf)
    472. Array.prototype.indexOf = function(e){
    473. for(var i=0;i<this.length;i++){
    474. if(e===this[i]){
    475. return i;
    476. }
    477. }
    478. return -1;
    479. };
    480. function getAllEnableUrl(target) {
    481. if(GM_getValue('eoDisable_'+document.domain))return;
    482. var rawnodes=(target?$(target).find(enableUrl):$(enableUrl)).get(),customnodes=[];
    483. var nodes = [];
    484. var i;
    485. var curNode;
    486. if(regs){
    487. var aTags = (target?$(target).find("a"):$("a")).get();
    488. for(var aTag of aTags){
    489. for(var reg of regs){
    490. if(reg==="")continue;
    491. var patt=new RegExp(reg);
    492. if(patt.test(aTag.href) && $.inArray(aTag, rawnodes)==-1){
    493. customnodes.push(aTag);
    494. break;
    495. }
    496. }
    497. }
    498. }
    499. if(rawnodes.length > 0){
    500. for (i = 0; i < rawnodes.length; i++) {
    501. var disable = false;
    502. curNode = rawnodes[i];
    503. if(!/^magnet|^ed2k:\/\//.test(curNode.href)){
    504. if(/[#\?]|\/\.[^\.]+$/.test(curNode.href))continue;
    505. for(var j = 0; j < disableUrl.length; j++){
    506. var temp = disableUrl[j];
    507. if(curNode.href.indexOf(temp)!=-1){
    508. disable = true;
    509. break;
    510. }
    511. }
    512. if(disable)continue;
    513. }
    514. if(!include(nodes,curNode)){
    515. nodes.push(curNode);
    516. }
    517. }
    518. }
    519. if(customnodes.length > 0){
    520. for (i = 0; i < customnodes.length; i++) {
    521. curNode = customnodes[i];
    522. if(!include(nodes,curNode)){
    523. nodes.push(curNode);
    524. }
    525. }
    526. }
    527. if(nodes.length > 0){
    528. init();
    529. var codeList = [];
    530. var listLen = nodes.length;
    531. if (listLen !== 0) {
    532. for (i = 0; i < listLen; i++) {
    533. curNode = nodes[i];
    534. if(curNode.classList.contains("whx-a"))continue;
    535. if(target){
    536. if(sNodes.indexOf(curNode)!=-1)continue;
    537. sNodes.push(curNode);
    538. }
    539. let href=curNode.href;
    540. let clone=$("<a></a>").attr("style",curNode.getAttribute("style")).attr("href",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")');
    541. if(allUrl.toString().indexOf(href)==-1)allUrl.push(href);
    542. clone.mouseover(function(e){
    543. var basePos=clone.offset();
    544. showDiskIcons(href,basePos.top,basePos.left);
    545. e.stopPropagation();
    546. });
    547. $(curNode).after(clone);
    548. if(showType){
    549. clone.hide();
    550. $(curNode).mouseover(function(){
    551. if(clone.is(':hidden')){
    552. if(preNode)preNode.hide(300);
    553. clone.show(500);
    554. preNode=clone;
    555. }
    556. });
    557. }
    558. }
    559. }
    560. }
    561. }
    562. function showDiskIcons(url, top, left){
    563. offUrl=url;
    564. parentDiv.css("display","block");
    565. parentDiv.offset({top:top,left:left});
    566. let j=0;
    567. for(var x=0;x<offNodes.length;x++){
    568. let node=offNodes[x];
    569. let siteConfig=sites[node.attr("name")];
    570. if(/^http/i.test(offUrl) && siteConfig.noHttp){
    571. node.hide();
    572. }else if(/^magnet/i.test(offUrl) && siteConfig.noMag){
    573. node.hide();
    574. }else if(/^ftp/i.test(offUrl) && siteConfig.noFtp){
    575. node.hide();
    576. }else if(/^ed2k:\/\//i.test(offUrl) && siteConfig.noEd2k){
    577. node.hide();
    578. }else{
    579. node.show();
    580. node.css("margin-top",-j*25+"px");
    581. j++;
    582. }
    583. }
    584. var minTop=$(document).scrollTop()+(j-1)*25;
    585. if(top<minTop){
    586. parentDiv.offset({top:minTop,left:left});
    587. var lastTop=parentDiv.position().top;
    588. var lastLeft=parentDiv.position().left;
    589. parentDiv.offset({top:top,left:left});
    590. parentDiv.animate({top:lastTop+"px",left:lastLeft+"px"});
    591. }
    592. }
    593. function getRightUrl(url){
    594. var newUrl = url;
    595. if(/^magnet/.test(url)){
    596. newUrl=newUrl.split("&")[0].substring(20);
    597. if(newUrl.length==32){
    598. newUrl="magnet:?xt=urn:btih:" + base32To16(newUrl);
    599. }else{
    600. newUrl=url;
    601. }
    602. }else if(/^\/\//.test(url)){
    603. newUrl=location.protocol+url;
    604. }
    605. return newUrl;
    606. }
    607. function base32To16(str){
    608. if(str.length % 8 !== 0 || /[0189]/.test(str)){
    609. return str;
    610. }
    611. str = str.toUpperCase();
    612. var bin = "", returnStr = "", i;
    613. for(i = 0;i < str.length;i++){
    614. var charCode=str.charCodeAt(i);
    615. if(charCode<65)charCode-=24;
    616. else charCode-=65;
    617. charCode='0000'+charCode.toString(2);
    618. charCode=charCode.substr(charCode.length-5);
    619. bin+=charCode;
    620. }
    621. for(i = 0;i < bin.length;i+=4){
    622. returnStr += parseInt(bin.substring(i,i+4),2).toString(16);
    623. }
    624. return returnStr;
    625. }
    626. var i=0;
    627. var curlink;
    628. var isDisk=false;
    629. for(x = 0; x < sitesArr.length; x++){
    630. let siteConfig=sitesArr[x];
    631. if(siteConfig.regex.test(location.hostname)){
    632. isDisk=true;
    633. curlink=GM_getValue(siteConfig.name+':eoUrl');
    634. if(curlink){
    635. if(siteConfig.offFunc)siteConfig.offFunc(function(){GM_deleteValue(siteConfig.name+':eoUrl');});
    636. }
    637. break;
    638. }
    639. }
    640. if(location.href.indexOf("pan.baidu.com/wap/home") != -1){
    641. if(curlink)location.href="https://pan.baidu.com/disk/home";
    642. }else if(location.href.indexOf("github.com/hoothin/UserScripts/tree/master/Easy%20offline") != -1){
    643. setting();
    644. }else if(!isDisk){
    645. setTimeout(function(){getAllEnableUrl();},10);
    646. var MutationObserver = unsafeWindow.MutationObserver || unsafeWindow.WebKitMutationObserver || unsafeWindow.MozMutationObserver;
    647. var observer = new MutationObserver(function(records){
    648. records.map(function(record) {
    649. if(record.addedNodes.length)setTimeout(function(){getAllEnableUrl(record.addedNodes);},501);
    650. });
    651. });
    652. var option = {
    653. 'childList': true,
    654. 'subtree': true
    655. };
    656. observer.observe(document.body, option);
    657. }
    658. function setting(){
    659. $('head').append(`
    660. <style>
    661. .whx-btn{
    662. background-color:#3892ed;
    663. transition:background-color 0.15s ease;
    664. }
    665. .whx-btn:hover{
    666. background-color:#83c1ff;
    667. }
    668. </style>`);
    669. var configContent=document.createElement("div");
    670. document.body.appendChild(configContent);
    671. configContent.outerHTML=`
    672. <div id="configContent" style="display: none;">
    673. <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;">
    674. <div style="text-align:center;font-size: 12px;margin-top: 28px;">自定义需要启用一键下载的链接正则,一行一条</div>
    675. <textarea id="configInput" placeholder="例:http:.*\\.php\\?getRes=\\d+" style="position:absolute;left:20px;top:50px;width:260px;height:110px"></textarea>
    676. <div style="text-align:center;font-size:12px;margin-top:125px;" title="不需要加'我的网盘/全部文件'">度盘存储路径:<input id="baiduPath" placeholder="例:/av" style="width:170px;"></div>
    677. <div id="icons" style="position:absolute;left:0px;top:202px"></div>
    678. <label style="position:absolute;left:60px;top:230px;"><input id="showType" type="checkbox"/>仅当鼠标经过时显示图标</label>
    679. <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>
    680. <div id="configQuit" class="whx-btn" style="width:28px;height:28px;border-radius:14px;position:absolute;right:2px;top:2px;cursor:pointer;">
    681. <span style="height:28px;line-height:28px;display:block;color:#FFF;text-align:center;font-size:20px;">╳</span>
    682. </div>
    683. </div>
    684. </div>`;
    685. var configInput=document.querySelector("#configInput");
    686. var configQuit=document.querySelector("#configQuit");
    687. var configSave=document.querySelector("#configSave");
    688. var showTypeCheck=document.querySelector("#showType");
    689. var baiduPath=document.querySelector("#baiduPath");
    690. var icons=$("#icons"),dragIcon;
    691. icons[0].ondrop=function(e){
    692. var nextIcon;
    693. $("#icons>div").each(function(){
    694. nextIcon=$(this);
    695. if(e.pageX<nextIcon.offset().left){
    696. if(this!=dragIcon)
    697. nextIcon.before(dragIcon);
    698. return false;
    699. }
    700. });
    701. siteSort=[];
    702. $("#icons>div").each(function(){
    703. siteSort.push($(this).attr("name"));
    704. });
    705. GM_setValue("siteSort",siteSort);
    706. };
    707. icons[0].ondragover=function(e){
    708. e.preventDefault();
    709. };
    710. for(var x = 0; x < sitesArr.length; x++){
    711. let siteConfig=sitesArr[x];
    712. if(siteConfig.hide)continue;
    713. let icon=$("<div style='height:25px;width:25px;float:left;border-radius:50%;background-position:center;background-repeat:no-repeat;background-size:20px;margin-left:2px;cursor:pointer'></div>");
    714. icon.css("background-color","#"+siteConfig.bgColor).attr("title",i18n.disable+i18n[siteConfig.name] ).attr("draggable",true).attr("name",siteConfig.name);
    715. icon[0].ondragstart=function(e){
    716. dragIcon=this;
    717. };
    718. if(GM_getValue("eoHide"+siteConfig.name)){
    719. icon.css("opacity","0.2");
    720. icon.attr("title",i18n.enable+i18n[siteConfig.name] );
    721. }
    722. if(siteConfig.bgImg)icon.css("background-image","url(\""+siteConfig.bgImg+"\")");
    723. icon.on("click", function(){
    724. var eoHide=GM_getValue("eoHide"+siteConfig.name);
    725. if(!eoHide){
    726. var allHide=true;
    727. $("#icons>div").each(function(){
    728. if(this!=icon[0] && $(this).css("opacity")!="0.2"){
    729. allHide=false;
    730. return false;
    731. }
    732. });
    733. if(allHide){
    734. alert("不能全部禁用!");
    735. return;
    736. }
    737. }
    738. GM_setValue("eoHide"+siteConfig.name, !eoHide);
    739. icon.css("opacity",eoHide?"1":"0.2");
    740. icon.attr("title",(eoHide?i18n.disable:i18n.enable)+i18n[siteConfig.name] );
    741. });
    742. icons.append(icon);
    743. }
    744. configContent=document.querySelector("#configContent");
    745. configContent.style.display="block";
    746. if(GM_getValue("eoReg"))$(configInput).val(GM_getValue("eoReg").join("\n"));
    747. if(GM_getValue("baiduPath"))$(baiduPath).val(GM_getValue("baiduPath"));
    748. if(GM_getValue("showType"))showTypeCheck.checked=true;
    749. $(configQuit).click(function (event) {configContent.style.display="none";});
    750. $(configSave).click(function (event) {
    751. var regStr=$(configInput).val();
    752. var baiduPathStr=$(baiduPath).val();
    753. if(baiduPathStr)GM_setValue("baiduPath",baiduPathStr);
    754. if(/^\s*$/.test(regStr)){
    755. GM_deleteValue("eoReg");
    756. }else{
    757. var regStrs=regStr.split("\n");
    758. for(var reg of regStrs){
    759. try{
    760. new RegExp(reg);
    761. }catch(e){
    762. alert("含有无效正则,请重新输入");
    763. return;
    764. }
    765. }
    766. GM_setValue("eoReg",regStrs);
    767. }
    768. GM_setValue("showType", showTypeCheck.checked);
    769. alert("设置成功");
    770. });
    771. }
    772. function toggleIcon(){
    773. $('.whx-a').toggle(500);
    774. if(GM_getValue('eoDisable_'+document.domain)){
    775. GM_deleteValue('eoDisable_'+document.domain);
    776. if($('.whx-a').length<1)getAllEnableUrl();
    777. }else{
    778. GM_setValue('eoDisable_'+document.domain,true);
    779. }
    780. }
    781. function goSetting(){
    782. location.href="https://github.com/hoothin/UserScripts/tree/master/Easy offline#一键离线下载";
    783. }
    784. function checkSel(e){
    785. var sel=document.getSelection();
    786. var link=sel.toString(),validReg=/^\s*(magnet:\?xt=urn:btih:|ed2k:\/\/\|file|https?:|ftp:)/i;
    787. if(link==="" || !validReg.test(link)){
    788. if(targetA) link=targetA.href;
    789. else link=prompt("输入需要离线下载的链接:","magnet:?xt=urn:btih:");
    790. }/*else{
    791. var focusedElement = sel.focusNode.parentElement;
    792. if(focusedElement.tagName == "A"){
    793. link=focusedElement.href;
    794. }
    795. }*/
    796. if(validReg.test(link)){
    797. init();
    798. showDiskIcons(link,mouseEve.pageY-10,mouseEve.pageX-10);
    799. }
    800. }
    801. var mouseEve,targetA;
    802. document.addEventListener("mousemove", function(e) {
    803. mouseEve=e;
    804. });
    805. document.addEventListener("mouseover", function(e) {
    806. if(e.target && e.target.tagName=="A"){
    807. targetA=e.target;
    808. }else{
    809. targetA=null;
    810. }
    811. });
    812. document.addEventListener("keydown", function(e) {
    813. if(e.keyCode == 120) {
    814. if(e.altKey){
    815. checkSel(e);
    816. }else{
    817. toggleIcon();
    818. }
    819. }
    820. });
    821. GM_registerMenuCommand(i18n.configure, goSetting);
    822. })();

    5、 磁力和种子互转源代码
    https://github.com/wuhaoworld/torrent2magnet/blob/master/api/BEncode.php