// ==UserScript== // @id www.imdb.com-c4030d09-bff0-4bc8-95b9-78af565930e3@scriptish // @name IPT Search for IMDB, TVmaze, next-episode // @version 1.4 // @namespace // @author // @description Adds a button to "IMDB", "TVmaze" and "next-episode.net" to search for the current title on IPTorrents // @include http://www.imdb.com/title/* // @include http://www.tvmaze.com/shows/* // @include http://next-episode.net/* // @run-at document-end // @attribute_value bla // @downloadURL none // ==/UserScript== var query = ''; var params = '?ipts=1'; function insertAfter(parent, node, referenceNode) { parent.insertBefore(node, referenceNode.nextSibling); } if (window.location.href.indexOf('imdb.com') !== -1) { var imdb_id = window.location.href.split('/'); query = imdb_id[imdb_id.length - 2]; params +='&72=&73='; // movies and tv var parent = document.getElementById('img_primary'); var parent2 = document.getElementsByClassName('subtext'); if (parent2.length){ parent2[0].innerHTML = parent2[0].innerHTML + '
'; }else{ parent.innerHTML = parent.innerHTML + ''; } selector = document.getElementsByClassName('iptsearch')[0]; } if (window.location.href.indexOf('tvmaze.com') !== -1) { var imdb_id = window.location.href.split('/'); query = imdb_id[imdb_id.length - 1]; params += '&73='; //tv var parent = document.getElementById('main-img'); parent.innerHTML = parent.innerHTML + ''; selector = document.getElementsByClassName('iptsearch')[0]; } if (window.location.href.indexOf('next-episode.net') !== -1) { var imdb_id = window.location.href.split('/'); query = imdb_id[imdb_id.length - 1]; params += '&73='; //tv var parent = document.getElementById('top_section'); parent.innerHTML = parent.innerHTML + ''; selector = document.getElementsByClassName('iptsearch')[0]; } 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(query){ var ipt_link = 'https://'+localStorage['www']+localStorage['domain']+'/t'+params+'&q='+query+'&qf=#torrents'; var style = ""; var link = 'Search on iptorrents'; var opts = ' '; // $('.pro-title-link').html(style + link + opts); selector.innerHTML = (style + link + opts); var WwwSelect = document.getElementById('ipts-www'); WwwSelect.onchange = function(){ localStorage['www'] = WwwSelect.value; genLinks(); } var DomainSelect = document.getElementById('ipts-domain'); DomainSelect.onchange = function(){ localStorage['domain'] = DomainSelect.value; // localStorage['www'] = $(this).val(); genLinks(query); } } genLinks(query);