search ipt for imdb title
当前为
// ==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;">☯</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();