imdb torrent links tt

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

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 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);
});