imdb torrent links tt

Provides links to popular torrent sites while Browsing IMDB movie\TV-show pages

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name        imdb torrent links tt
// @namespace   imdb torrent links tt
// @description Provides links to popular torrent sites while Browsing IMDB movie\TV-show pages
// @include       *imdb.com*
// @version       1.0
// @grant                          none
// ==/UserScript==
function insertAfter(newNode, referenceNode) {
  referenceNode.parentNode.insertBefore(newNode, referenceNode.nextSibling);
}
function getPureTitle(node) {
  text = '';
  for (var i = 0; i < node.childNodes.length; ++i)
  if (node.childNodes[i].nodeType === 3)
        text += node.childNodes[i].textContent;
  return text.trim();
}
function getIdentifier()
{
  var metaTags = document.getElementsByTagName('meta');
  for (var i = 0; i < metaTags.length; ++i) {
        if(metaTags[i].getAttribute('property') === 'pageId')
        return metaTags[i].getAttribute('content');
  }
}

var pageId = getIdentifier();
var titleBar = document.getElementsByClassName('title_wrapper')[0].children[0];
var span = document.createElement("span");
insertAfter(span, titleBar);

var sites = [
  { basePath: "https://passthepopcorn.me/torrents.php?searchstr=", icon: 'https://i.imgur.com/6oVyOyJ.gif', iconHeight: 17, iconWidth: 17 },
  { basePath: "http://www.iptorrents.com/t?o=size;q=", icon: 'http://i.imgur.com/cmbcH7k.png', iconHeight: 16, iconWidth: 16, },
  { basePath: "http://filelist.ro/browse.php?cat=0&searchin=0&sort=3&search=", icon: 'http://i.imgur.com/tfnsPEn.jpg', iconHeight: 16, iconWidth: 16, },
  { basePath: "https://hd-torrents.org/torrents.php?&order=size&search=", icon: 'http://i.imgur.com/iQfuiyn.png', iconHeight: 16, iconWidth: 16, },
  { basePath: "https://www.fuzer.me/browse.php?ref_=basic&query=", icon: 'https://i.imgur.com/NDcWOfZ.png', iconHeight: 15, iconWidth: 15, },
];


sites.forEach(function(site) {
  var link = document.createElement("a");
  link.innerHTML = "<img src="+site.icon+" height="+site.iconHeight+" width="+site.iconWidth+">";
  link.setAttribute("target","_blank");
  link.setAttribute("href",site.basePath + pageId

);
  span.appendChild(document.createTextNode(' '));
  span.appendChild(link);
});