Better Primewire

adds popup links to AddToWatched, AddToFavorites, and AddToWatched on some pages.

当前为 2016-01-09 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Better Primewire
  3. // @namespace http://mcimino.reaktix.com/
  4. // @version 0.5.2
  5. // @description adds popup links to AddToWatched, AddToFavorites, and AddToWatched on some pages.
  6. // @match https://www.primewire.ag/*
  7. // @match https://www.primewire.org/*
  8. // @match https://www.primewire.is/*
  9. // @copyright 2012+, You
  10. // @grant none
  11. // ==/UserScript==
  12.  
  13. //console.log("towatch",(window.location.href.match(/towatch/)===null),"favorites",(window.location.href.match(/favorites/)===null));
  14. //console.log((window.location.href.match(/towatch/)===null)&(window.location.href.match(/favorites/)===null));
  15.  
  16. popup = function(x){return window.open("https://www.primewire.ag"+x,"myframe","width=400,height=400");};
  17.  
  18. for(a=0;a<document.links.length;a++){
  19. var b = document.links[a];
  20.  
  21. //prepend AddToFavs to AddToWatched
  22. c = b.href.match(/(https:..www.primewire.ag.addtowatched.php.id.)([0-9]*)(.action.watched.whattodo.add)/);
  23. if (c!==undefined){
  24. if (c.length>0){
  25. d = '<a href="/addtofavs.php?id=' + c[2] + '&whattodo=add">Add to Favs</a> | ' + b.outerHTML;
  26. //console.log(a,d);
  27. b.outerHTML = d;
  28. a+=1;
  29. }
  30. }
  31.  
  32. //prepend AddToWatched to DeleteFav
  33. c = b.href.match(/(https:..www.primewire.ag.addtofavs.php.id=)([0-9]*)(.whattodo.delete)/);
  34. if (c!==undefined){
  35. if (c.length>0){
  36. d = '<a href="/addtowatched.php?id=' + c[2] + '&action=watched&whattodo=add">Add to Watched</a> | ' + b.outerHTML;
  37. b.outerHTML = d;
  38. a+=1;
  39. }
  40. }
  41.  
  42. //append AddToWatched AddToFavs to titles, but only if not already looking at the towatch
  43. if ((window.location.href.match(/towatch/)===null)&
  44. (window.location.href.match(/favorites/)===null)&
  45. (window.location.href.match(/watched/)===null)){
  46. c = b.href.match(/(https:..www.primewire.ag.watch-)([0-9]*)(.*)/);
  47. if (c!==undefined){
  48. //ignore the Featured list
  49. if (b.innerHTML.slice(0,8)!="<strong>"){
  50. /*
  51. d = '<table style="width:inherit;"><tr>'
  52. d += '<td style="text-align:center"><a href="/addtowatched.php?id=' + c[2] + '&action=towatch&whattodo=add"><img width=15 style="border:0px" src="/images/add_icon_towatch.png" /></a></td>'
  53. d += '<td style="text-align:center"><a href="/addtowatched.php?id=' + c[2] + '&action=watched&whattodo=add"><img width=15 style="border:0px" src="/images/add_icon_watched.png" /></a></td>'
  54. d += '<td style="text-align:center"><a href="/addtofavs.php?id=' + c[2] + '&whattodo=add"><img width=15 style="border:0px" src="/images/add_icon_fav.png" /></a></td>'
  55. d += '</tr></table>'
  56. */
  57.  
  58. d = '<table style="width:inherit;"><tr>';
  59. d += '<td style="text-align:center"><img width=15 style="border:0px" src="/images/add_icon_towatch.png" onclick=\'popup("/addtowatched.php?id=' + c[2] + '&action=towatch&whattodo=add");\'/></td>';
  60. d += '<td style="text-align:center"><img width=15 style="border:0px" src="/images/add_icon_watched.png" onclick=\'popup("/addtowatched.php?id=' + c[2] + '&action=watched&whattodo=add")\'/></td>';
  61. d += '<td style="text-align:center"><img width=15 style="border:0px" src="/images/add_icon_fav.png" onclick=\'popup("/addtofavs.php?id=' + c[2] + '&whattodo=add")\'/></td>';
  62. d += '</tr></table>';
  63.  
  64.  
  65. d = b.outerHTML + d;
  66. b.outerHTML = d;
  67. //a+=3;
  68. //console.log(a,d);
  69. }
  70. }
  71. }
  72. }