IMDb+

Add external search links most popular torrent sites to IMDb. Every feature can be enabled/disabled in settings.

  1. // ==UserScript==
  2. // @name IMDb+
  3. // @namespace https://greasyfork.org/ru/users/19952-xant1k-bt
  4. // @description Add external search links most popular torrent sites to IMDb. Every feature can be enabled/disabled in settings.
  5. // @include http://www.imdb.com/title/tt*
  6. // @require https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js
  7. // @grant GM_getValue
  8. // @grant GM_setValue
  9. // @grant GM_addStyle
  10. // @version 1.0
  11. // @author Sergiu Negara
  12. // @license The MIT License (MIT)
  13. // ==/UserScript==
  14.  
  15. jQuery(document).ready(function($) {
  16. var m = {};
  17. m.Id = getMovieId();
  18. m.Tt = getMovieTt();
  19. m.TtYr = getMovieTt() + "+" + getMovieYr();
  20. var l = {};
  21. // Info
  22. l.kp = ["Kinopoisk", "http://www.kinopoisk.ru/index.php?first=yes&kp_query=" + m.Tt, "http://www.kinopoisk.ru/favicon.ico"];
  23. // TV Series
  24. l.btn = ["Broadcast", "https://broadcasthe.net/torrents.php?imdb=tt" + m.Id, "https://broadcasthe.net/favicon.ico"];
  25. l.btv = ["BitmeTV", "http://www.bitmetv.org/browse.php?search=" + m.TtYr, "https://i.imgur.com/qCecxho.png"];
  26. // All
  27. l.rt = ["RuTracker", "http://rutracker.org/forum/tracker.php?nm=" + m.TtYr, "http://rutracker.org/favicon.ico"];
  28. l.kg = ["Karagarga", "https://karagarga.net/browse.php?search_type=imdb&search=" + m.TtYr, "https://karagarga.net/favicon.ico"];
  29. l.cg = ["Cinemageddon", "http://cinemageddon.net/browse.php?search=" + m.TtYr, "http://cinemageddon.net/favicon.ico"];
  30. l.ct = ["Cinematik", "http://cinematik.net/browse.php?search=" + m.TtYr, "http://cinematik.net/favicon.ico"];
  31. l.ptp = ["PassThePopcorn", "https://tls.passthepopcorn.me/torrents.php?searchstr=" + m.TtYr, "https://tls.passthepopcorn.me/favicon.ico"];
  32. l.kz = ["Kinozal", "http://kinozal.tv/browse.php?s=" + m.TtYr, "http://kinozal.tv/favicon.ico"];
  33. l.rr = ["Rutor", "http://ru-tor.net/search/" + m.TtYr, "http://ru-tor.net/favicon.ico"];
  34. l.nnm = ["NNMClub", "http://nnm-club.me/forum/tracker.php?nm=" + m.TtYr, "http://nnm-club.me/favicon.ico"];
  35. l.x264 = ["x264", "http://x264.me/browse.php?search=" + m.TtYr, "http://x264.me/favicon.ico"];
  36. l.adc = ["AsiaDVDClub", "http://asiandvdclub.org/browse.php?search=" + m.TtYr, "http://asiandvdclub.org/favicon.ico"];
  37. // HD
  38. l.hdb = ["HDBits", "https://hdbits.org/browse.php?search=" + m.TtYr, "https://hdbits.org/favicon.ico"];
  39. l.hdc = ["HDClub", "http://hdclub.org/browse.php?search=" + m.TtYr, "http://hdclub.org/favicon.ico"];
  40. l.hdt = ["HDTracker", "http://hdtracker.me/browse.php?search=" + m.TtYr, "http://hdtracker.me/favicon.ico"];
  41. l.chd = ["CHD", "https://chdbits.org/torrents.php?search=" + m.TtYr, "https://chdbits.org/favicon.ico"];
  42. l.hdw = ["HDWinG", "https://hdwing.com/browse.php?search=" + m.TtYr, "http://hdwing.com/favicon.ico"];
  43. l.hds = ["HDSpain", "https://www.hd-spain.com/browse.php?" + m.TtYr, "https://www.hd-spain.com/favicon.ico"];
  44. l.shd = ["SceneHD", "https://scenehd.org/browse.php?search=" + m.TtYr, "http://scenehd.org/favicon.ico"];
  45. l.bhd = ["BitHDTV", "https://www.bit-hdtv.com/torrents.php?search=" + m.TtYr, "https://www.bit-hdtv.com/favicon.ico"];
  46. l.ahd = ["AwesomeHD", "https://awesome-hd.net/torrents.php?searchstr=" + m.TtYr, "https://awesome-hd.net/favicon.ico"];
  47. // Functions
  48. function getMovieId() {
  49. var id = location.pathname.match(/title\/tt(.*?)\//i)[1];
  50. return id;
  51. }
  52.  
  53. function getMovieTt() {
  54. var title = document.title.replace(/^(.+) \((.*)([0-9]{4})(.*)$/gi, '$1');
  55. return encodeURIComponent(title);
  56. }
  57.  
  58. function getMovieYr() {
  59. var year = document.title.replace(/^(.+) \((.*)([0-9]{4})(.*)$/gi, '$3');
  60. return encodeURIComponent(year);
  61. }
  62.  
  63. function IMDbPlusStyle() {
  64. var s = '#title-overview-widget #IMDbPlus { padding: 5px 0 0 230px; }' + '#title-overview-widget #IMDbPlus a { margin: 5px 1px; }' + '#title-overview-widget #IMDbPlus #IMDbPlus-Feature-Settings { margin-left: 1px; }' + '#action-box #IMDbPlus #IMDbPlus-Feature-Settings { margin-top: 10px; }' + '#IMDbPlus-SettingsBox { display: none; margin-left: -404px; padding: 20px; position: absolute; top: 10%; left: 50%; width: 768px; z-index: 999; }' + '#IMDbPlus-SettingsBox > h2 { font-size: 21px }' + '#IMDbPlus-SettingsBox #IMDbPlus-Options { margin: 20px 0;}' + '#IMDbPlus-SettingsBox #IMDbPlus-Options .IMDbPlus-OptionField label { display: inline-block; width: 150px; }' + '#IMDbPlus-SettingsBox button { margin: 8px 0 0; }' + '#IMDbPlus-SettingsBox #IMDbPlus-SettingsBox-Close { float: right; }';
  65. GM_addStyle(s);
  66. }
  67.  
  68. function IMDbPlusInit() {
  69. var fh, oh;
  70. fh = '<div id="IMDbPlus"><hr>';
  71. oh = '<div id="IMDbPlus-SettingsBox" class="aux-content-widget-2"><h2>IMDb+ Options</h2><ul id="IMDbPlus-Options">';
  72. $.each(l, function(key, val) {
  73. if (GM_getValue("IMDbPlus-Option-" + val[0], 1)) {
  74. fh += '<a class="IMDbPlus-Button linkasbutton-secondary" id="IMDbPlus-Feature-' + val[0] + '" href="' + val[1] + '" target="_blank" title="' + val[0] + '"><img alt="' + val[0] + '" src="' + val[2] + '" width="16" height="16"></a>';
  75. }
  76. oh += '<li id="IMDbPlus-Option-' + val[0] + '-Field" class="IMDbPlus-OptionField"><label for="IMDbPlus-Option-' + val[0] + '">' + val[0] + '</label> <input id="IMDbPlus-Option-' + val[0] + '" type="checkbox"' + ((GM_getValue("IMDbPlus-Option-" + val[0], 1)) ? ' checked' : '') + '></li>';
  77. });
  78. fh += '<a class="IMDbPlus-Button linkasbutton-secondary" id="IMDbPlus-Feature-Settings" title="Open settings frame"><img alt="Settings" src="https://i.imgur.com/j9VseXa.png"></a></div>';
  79. oh += '</ul><hr>' + '<button id="IMDbPlus-SettingsBox-Save" class="primary">Save</button>' + '<button id="IMDbPlus-SettingsBox-Close" class="primary">Close</button>' + '</div>';
  80. IMDbPlusStyle();
  81. $((location.pathname.match(/combined/)) ? '#action-box' : '#title-overview-widget').append(fh);
  82. $('body').append(oh);
  83. }
  84. IMDbPlusInit();
  85.  
  86. function showOpts() {
  87. $('#wrapper').css('visibility', 'hidden').animate({
  88. opacity: 0
  89. }, 500);
  90. $('#IMDbPlus-SettingsBox').show(500);
  91. }
  92.  
  93. function hideOpts() {
  94. $('#IMDbPlus-SettingsBox').hide(500);
  95. $('#wrapper').css('visibility', 'visible').animate({
  96. opacity: 1
  97. }, 500);
  98. }
  99.  
  100. function saveOpts() {
  101. $('.IMDbPlus-OptionField').each(function() {
  102. var inputElm = $('input', this),
  103. inputId = inputElm.attr('id');
  104. GM_setValue(inputId, (inputElm.is(":checked") ? 1 : 0));
  105. });
  106. hideOpts();
  107. window.location.reload();
  108. }
  109. // Interactions
  110. $('#IMDbPlus-Feature-Settings').click(showOpts);
  111. $('#IMDbPlus-SettingsBox-Close').click(hideOpts);
  112. $('#IMDbPlus-SettingsBox-Save').click(saveOpts);
  113. $(document).keyup(function(e) {
  114. if (e.keyCode == 27) {
  115. hideOpts();
  116. }
  117. });
  118. });