IPT Search for IMDB

search ipt for imdb title

目前為 2015-09-10 提交的版本,檢視 最新版本

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

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

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

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

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

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

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @id             www.imdb.com-c4030d09-bff0-4bc8-95b9-78af565930e3@scriptish
// @name           IPT Search for IMDB
// @version        1.2
// @namespace      
// @author         
// @description    search ipt for imdb title
// @include        http://www.imdb.com/title/*
// @run-at         document-end
// @attribute_value bla
// ==/UserScript==

var imdb_id = window.location.href.split('/');
imdb_id = imdb_id[imdb_id.length - 2];


var www = [
	'',
	'www.'
];

var sels = [
	'iptorrents.com',
	'iptorrents.us',
	'ipt.rocks',
	'iptorrents.me',
	'iptorrents.ru',
	'ipt.af'
];

var data = {
  'www': localStorage['www'],
  'domain': localStorage['domain']
}

if (typeof localStorage['www'] === 'undefined') {
  localStorage['www'] = www[0];
}
if (typeof localStorage['domain'] === 'undefined') {
  localStorage['domain'] = sels[0];
}


db = 1;

function genLinks(){
	var ipt_link = 'https://'+localStorage['www']+localStorage['domain']+'/t?q='+imdb_id+'&qf=#torrents';
	var style = "<style>#set:checked ~ #ipts {display:block !important}</style>";
	var link = '<input type="checkbox" id="set" style="display:none"><label for="set" id="settings" style="cursor: pointer; font-size: 20px; margin-right: 10px; color: #939393; line-height: 0px; position: relative; top: 4px;">&#9775;</label><a style="line-height:20px;color: #000;" href="'+ipt_link+'" target="_blank"><b>Search on iptorrents</b></a>';
	var opts = '<div style="display: none" id="ipts">';
	opts += '<select id="www">';
	for (var e = 0; e < www.length; e++) {
		var selected = '';
		if (www[e] === localStorage['www']) {
			selected = 'selected="selected"';
		}
		opts += '<option value="'+www[e]+'" '+selected+'>'+www[e]+'</option>';
	}
	opts += '</select>';
	opts += '<select id="domain">';
	for (var e = 0; e < sels.length; e++) {
		var selected = '';
		if (sels[e] === localStorage['domain']) {
			selected = 'selected="selected"';
		}
		opts += '<option value="'+sels[e]+'" '+selected+'>'+sels[e]+'</option>';
	}
	opts += '</select>';
	opts += '</div>';
	// $('.pro-title-link').html(style + link + opts);
	document.getElementsByClassName('pro-title-link')[0].innerHTML = (style + link + opts);

	var WwwSelect = document.getElementById('www');
	WwwSelect.onchange = function(){
		localStorage['www'] = WwwSelect.value;
		genLinks();   
	}
	var DomainSelect = document.getElementById('domain');
	DomainSelect.onchange = function(){
		localStorage['domain'] = DomainSelect.value;
		// localStorage['www'] = $(this).val();
		genLinks();   
	}
}
genLinks();