Clean and Simple FilesTube

Show directly the links and their source and remove All the Ads and unnecessary items from Filestube.to

  1. // ==UserScript==
  2. // @name Clean and Simple FilesTube
  3. // @namespace Clean-and-Simple-FilesTube
  4. // @require http://code.jquery.com/jquery.min.js
  5. // @author DarkSkul
  6. // @description Show directly the links and their source and remove All the Ads and unnecessary items from Filestube.to
  7. // @include http://www.filestube.to/*
  8. // @grant GM_addStyle
  9. // @grant GM_xmlhttpRequest
  10. // @grant GM_setClipboard
  11. // @version 9.3
  12. // @source
  13.  
  14. // ==/UserScript==
  15.  
  16. var idnb = 1;
  17. function replaceURLWithHTMLLinks(text) {
  18. var exp = /((https?|ftp|file):\/\/[^\n\r]+)/ig;
  19. return text.replace(exp,"<a style='text-decoration:none;' href='$1'><font color=red>$1</font></a><br>");
  20. }
  21.  
  22. function RemoveBoldTag(strg) {
  23. strg=strg.replace(/<span style="font-weight:bold;">/g,"");
  24. strg=strg.replace(/<\/span>/g,"");
  25. strg=strg.replace(/<\/*b>/g,"");
  26. return strg;
  27. }
  28.  
  29. function getLinks(loadUrl,resultLink) {
  30. GM_xmlhttpRequest({
  31. method: "GET",
  32. url: loadUrl,
  33. onload: function(response) {
  34. code = response.responseText;
  35. //Get source
  36. source = $(code).find('.fSrc').html();
  37. //Get dl links
  38. var nbLines=0;
  39. var urls = "";
  40. $(code).find(".file-link-main").each(function(){
  41. urls = urls + $(this).attr('href') + "\n";
  42. nbLines=nbLines+1;
  43. });
  44. //Add copy button
  45. copyId = 'successCopy' + idnb;
  46. $(resultLink)
  47. .nextAll("br:first")
  48. .replaceWith("<button id='"+ copyId + "' type='button' >Copy links</button><br>");
  49. jcopyId = "#" + copyId;
  50. $(jcopyId).click(function() {
  51. GM_setClipboard(urls);
  52. $(this).after("<span> Links copied! </span>");
  53. });
  54. //Add DL links
  55. if(nbLines < 6)
  56. $(resultLink).parent().append(replaceURLWithHTMLLinks(urls));
  57. else
  58. $(resultLink).parent().append("<div style='height:130px;max-height:130px;overflow-y:scroll;width:700px;'>"+replaceURLWithHTMLLinks(urls)+"</div>");
  59. //Add source link
  60. $(resultLink).parent().append("<a href='" + source + "' style='text-decoration:none;'><font color=green>" + source + "</font></a>");
  61. idnb = idnb+1;
  62. }
  63. });
  64. }
  65.  
  66. str = location.href;
  67. $(document).ready(function(){
  68. if( str.search(/filestube.to\/?$/ig) !== -1 ) { // Home page
  69. //style
  70. $(".logo").css("margin-top","50px");
  71. //Hide unwanted items
  72. GM_addStyle(".hB, .mcl {\ndisplay:none !important;\n}");
  73. }
  74. else if( (str.search(/filestube.to\/[^\/]+\/.+/ig) !== -1) || (str.search(/query\.html/ig) !== -1) ) { // Results page
  75. //style
  76. $("#results-holder").css("padding-left", "5%");
  77. $("#results").css("width", "100%");
  78. $(".iRss").clone().css("margin-right", "10%").css("padding", "0px 10px").appendTo(".cf");
  79. $("#pager").css("padding", "0");
  80. //links & source
  81. $("a.rL").each(function(){
  82. url = $(this).attr('href');
  83. getLinks(url, $(this));
  84. });
  85. //Hide unwanted items
  86. GM_addStyle("#most-popular-topics, .rBvi, #spla, .rQ, .rB, .spL, .rSt, .rS, .rate, .alt_button, #recent {\ndisplay:none !important;\n}");
  87. }
  88. else { // Download page
  89. //smaller title
  90. title = $(".fH > h1").html();
  91. $(".fH > h1").replaceWith("<h3>" + title + "</h3>");
  92. //Hide unwanted items
  93. $("#disqus_thread").remove();
  94. GM_addStyle(".dsq-brlink, .lS, #ac_form, .sr, #ajx_rate, H2, .fSl, .rl > DL ~ * {\ndisplay:none !important;\n}");
  95. //source
  96. sourcelink=$('.fSrc').html();
  97. $('.fSrc').attr('href',sourcelink);
  98. }
  99. //global ads
  100. GM_addStyle("#stkTgl, #uB, .fBx, .ft, .ftP, .fdb, .rr, .spF {\ndisplay:none !important;\n}");
  101. });