Greasy Fork is available in English.

1Tool Short Links Elongator

Elongates all 1Tool short links to their direct links

  1. // ==UserScript==
  2.  
  3. // @name 1Tool Short Links Elongator
  4.  
  5. // @namespace DevelopmentSimplyPut(developmentsimplyput.blogspot.com)
  6.  
  7. // @description Elongates all 1Tool short links to their direct links
  8.  
  9. // @include *
  10.  
  11. // @version 0.0.1.20141015204859
  12. // ==/UserScript==
  13.  
  14. String.prototype.ReplaceAll = function(stringToFind,stringToReplace){
  15. var temp = this;
  16. var index = temp.indexOf(stringToFind);
  17.  
  18. while(index != -1){
  19.  
  20. temp = temp.replace(stringToFind,stringToReplace);
  21. index = temp.indexOf(stringToFind);
  22. }
  23. return temp;
  24. }
  25.  
  26. Array.prototype.unique = function () {
  27. var r = new Array();
  28. o:for(var i = 0, n = this.length; i < n; i++)
  29. {
  30. for(var x = 0, y = r.length; x < y; x++)
  31. {
  32. if(r[x]==this[i])
  33. {
  34. continue o;
  35. }
  36. }
  37. r[r.length] = this[i];
  38. }
  39. return r;
  40. }
  41.  
  42. function Run(Urls)
  43. {
  44. if(Urls.length>0)
  45. {
  46. for(i=0;i<Urls.length;i++)
  47. GetDirectLink(Urls[i]);
  48. }
  49. }
  50.  
  51. function GetDirectLink(str)
  52. {
  53. GM_xmlhttpRequest(
  54. {
  55. method: "GET",
  56. url: 'http://1tool.biz/2.php?id=' + str.replace('http://1tool.biz/',""),
  57. headers:{'User-agent': 'Mozilla/4.0 (compatible) Greasemonkey', 'Content-type':'application/x-www-form-urlencoded'},
  58. onload:function(result)
  59. {
  60. var parts1=new Array();
  61. var parts2=new Array();
  62. parts1=result.responseText.split('onclick="NewWindow(');
  63. parts2=parts1[1].split("'");
  64. result=parts2[1];
  65. (document.getElementsByTagName("body"))[0].innerHTML=(document.getElementsByTagName("body"))[0].innerHTML.ReplaceAll(str,result);
  66. }
  67. }
  68. );
  69. }
  70.  
  71. var DirectUrls=new Array();
  72. var Urls=new Array();
  73. var UrlsPattern=/http:\/\/1tool\.biz\/(?:\w*)/g;
  74. Urls=(document.getElementsByTagName("body"))[0].innerHTML.match(UrlsPattern);
  75.  
  76. Urls=Urls.unique();
  77. Run(Urls);