🏠 Home 

HDBits torrent search

Searches for torrents with the same name as the current one


Install this script?
  1. // ==UserScript==
  2. // @name HDBits torrent search
  3. // @namespace https://greasyfork.org/users/19952-xant1k-bt
  4. // @description Searches for torrents with the same name as the current one
  5. // @include https://hdbits.org/details.php?id=*
  6. // @version 1.0
  7. // @author deva
  8. // ==/UserScript==
  9. title = document.getElementsByTagName('h1')[0];
  10. titleString = new String(title.innerHTML);
  11. searchLink = document.createElement('a');
  12. searchLink.innerHTML = 'search on HDBits';
  13. if(titleString.match(/s[0-9][0-9]e[0-9][0-9]/i) != null){// show
  14. titleString = titleString.match(/^(.*?)( -)? s[0-9][0-9]e[0-9][0-9]/i)[1];
  15. }else if(titleString.match(/ - /i) != null){
  16. titleString = titleString.match(/^(.*?) - /i)[1];
  17. }// else just use original string
  18. searchLink.href='browse.php?search='+titleString;
  19. searchLink.title = 'search HDBits for "' + titleString + '"';
  20. table = myNextSibling(title);
  21. tbody = myFirstChild(table);
  22. linkTD = tbody.firstChild.firstChild.nextSibling;
  23. linkTD.appendChild(document.createTextNode(' | '));
  24. linkTD.appendChild(searchLink);
  25. // helping functions
  26. function myFirstChild(obj){
  27. temp = obj.firstChild;
  28. while(temp.nodeType == 3){ //TEXT_NODE = 3
  29. temp = temp.nextSibling;
  30. }
  31. return temp;
  32. }
  33. function myNextSibling(obj){
  34. temp = obj.nextSibling;
  35. while(temp.nodeType == 3){ //TEXT_NODE = 3
  36. temp = temp.nextSibling;
  37. }
  38. return temp;
  39. }