Thunder Link Sonar

popup one hidden thunder link,Like this page (迅雷链接探测): www.skycn.com/soft/4639.html http://www.xdowns.com/soft/softdown.asp?softid=58240

  1. // ==UserScript==
  2. // @name Thunder Link Sonar
  3.  
  4. // @description popup one hidden thunder link,Like this page (迅雷链接探测): www.skycn.com/soft/4639.html http://www.xdowns.com/soft/softdown.asp?softid=58240
  5. // @include http://*/*
  6. // @version 1.0
  7. // @namespace http://userscripts.org/users/tumuyan
  8. // @homepage https://greasyfork.org/scripts/10912
  9. // @auther tumuyan
  10. // @icon http://s3.amazonaws.com/uso_ss/icon/152745/large.PNG
  11. // ==/UserScript==
  12.  
  13. // decode=0,not decode the thunder link ;decode=1, auto decode the thunder link
  14. // sonar=1,use fun.sonar1();sonar=2,use fun.sonar2()
  15.  
  16.  
  17. var decode=1
  18. var sonar=2
  19.  
  20. var base64DecodeChars = new Array(
  21. -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
  22. -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
  23. -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63,
  24. 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, -1, -1,
  25. -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
  26. 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1,
  27. -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
  28. 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1
  29. );
  30. // showlink("http://www.douban.com")
  31. function showlink(link){
  32. var close=prompt('Thunder Link Get!',link)
  33. if (close!=null)
  34. window.location.href=link
  35. else
  36. {window.close()}
  37. }
  38. function base64decode(str) {
  39. var c1, c2, c3, c4;
  40. var i, len, out;
  41. len = str.length;
  42. i = 0;
  43. out = "";
  44. while(i < len) {
  45. /* c1 */
  46. do {
  47. c1 = base64DecodeChars[str.charCodeAt(i++) & 0xff];
  48. } while(i < len && c1 == -1);
  49. if(c1 == -1)
  50. break;
  51. /* c2 */
  52. do {
  53. c2 = base64DecodeChars[str.charCodeAt(i++) & 0xff];
  54. } while(i < len && c2 == -1);
  55. if(c2 == -1)
  56. break;
  57. out += String.fromCharCode((c1 << 2) | ((c2 & 0x30) >> 4));
  58. /* c3 */
  59. do {
  60. c3 = str.charCodeAt(i++) & 0xff;
  61. if(c3 == 61)
  62. return out;
  63. c3 = base64DecodeChars[c3];
  64. } while(i < len && c3 == -1);
  65. if(c3 == -1)
  66. break;
  67. out += String.fromCharCode(((c2 & 0XF) << 4) | ((c3 & 0x3C) >> 2));
  68. /* c4 */
  69. do {
  70. c4 = str.charCodeAt(i++) & 0xff;
  71. if(c4 == 61)
  72. return out;
  73. c4 = base64DecodeChars[c4];
  74. } while(i < len && c4 == -1);
  75. if(c4 == -1)
  76. break;
  77. out += String.fromCharCode(((c3 & 0x03) << 6) | c4);
  78. }
  79. return out;
  80. }
  81.  
  82.  
  83.  
  84. function display(){
  85. var no=".style.display='none'"
  86. var loaddiv = document.createElement("div");
  87. loaddiv.innerHTML = '<div id="loading_div" style="position:fixed;width:108%;height:100%; left:0px;top:0px;background-color:#ffffff;filter:alpha(opacity=100)"><div style="text-align:center;padding-top:300px">发现雷区<hr style="height:1px;width:50%"> <a href="#" onclick="this.parentNode.parentNode' + no + '" >show page</a></div></div> ';
  88. document.body.appendChild(loaddiv);
  89. }
  90.  
  91. function sonar0()
  92. {
  93. var link1 = document.body.innerHTML.match(/thunderhref="http.*?"/)
  94. var link2 = document.body.innerHTML.match(/thunderhref="ed2k.*?"/)
  95. var link3 = document.body.innerHTML.match(/'thunder:\/\/.*?'/)
  96. if (link1) {showlink(link1[0].replace('thunderhref="','').replace('"',''))}
  97. else if(link2) {showlink(link2[0].replace('thunderhref="','').replace('"',''))}
  98. else if(link3) {
  99. if (decode)
  100. {
  101. link = link3[0].replace("'thunder://","").replace("'","")
  102. link = link.replace(/ +$|\/$/g,"")
  103. link = base64decode(link).replace(/^AA|ZZ$/gi,"")
  104. showlink(link)
  105. }
  106. else {showlink(link3[0].replace("'",""))}
  107. }
  108. }
  109.  
  110.  
  111.  
  112. function sonar1()
  113. {
  114. var link = link1[0].replace(/thunderhref="/,"");
  115. link = link.replace('"',"");
  116. if (decode)
  117. {
  118. link = link.replace("thunder://","")
  119. link = link.replace(/ +$|\/$/g,"")
  120. link = base64decode(link).replace(/^AA|ZZ$/gi,"")
  121. }
  122. showlink(link)
  123. }
  124.  
  125.  
  126. function sonar2(link1)
  127. {
  128. var link = link1[0].replace('="',"").replace("href","")
  129. link = link.replace('"',"")
  130. if (decode)
  131. {
  132. link = link.replace("thunder://","")
  133. link = link.replace(/ +$|\/$/g,"")
  134. link = base64decode(link).replace(/^AA|ZZ$/gi,"")
  135. }
  136. showlink(link)
  137. }
  138.  
  139. if (sonar==2)
  140. {
  141. var link1 = document.body.innerHTML.match(/="thunder[href]{0,4}.*?\={0,2}"/)
  142. if (link1 )
  143. {
  144. if (document.body.textContent.match(link1[0])) {}
  145. else { display();sonar2(link1) }
  146. }
  147. else { sonar0()}
  148. }
  149.  
  150. else if (sonar==1)
  151. {
  152. var link1 = document.body.innerHTML.match(/thunderhref="thunder.*?\={0,2}"/)
  153. if (link1){ display();sonar1(link1)}
  154. else {sonar0()}
  155. }