IMDb->DirectSearch Fixed

By mohanr Last update Jun 23, 2011 — Installed 6,142 times.

There are 6 previous versions of this script.

// ==UserScript==
// @name          'IMDb->DirectSearch Fixed'
// @namespace     http://determinist.org/greasemonkey/
// @description   Fast & simple: Search directly from IMDb for reviews, torrents, subtitles and much more using movie title or IMDb-ID.

// @include       http://*.imdb.com/title/*/
// @include       http://*.imdb.com/title/*/#*
// @include       http://*.imdb.com/title/*/combined*
// @include       http://*.imdb.com/title/*/maindetails*

// @include       http://imdb.com/title/*/
// @include       http://imdb.com/title/*/#*
// @include       http://imdb.com/title/*/combined*
// @include       http://imdb.com/title/*/maindetails*
// ==/UserScript==

//2007 modified by mohanr 
/*
 BEGIN LICENSE BLOCK
Copyright (C) 2005 Arvid Jakobsson

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You can download a copy of the GNU General Public License at
http://www.gnu.org/licenses/gpl.html
or get a free printed copy by writing to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
END LICENSE BLOCK
*/


// --------------- SEARCH ENGINES --------------- 

var trackers = new Array();

//Torrentz
trackers.push(new SearchEngine("Torrentz", "http://www.torrentz.com/search?q=%title&s=U", false, "data:image/gif;base64,R0lGODlhEAAQAPcAAClKaylScylSezFSczFSezFahDFajDFjjDlahDljjEJjhEJrjEJrlEprjEprlEpzlFJrjFJzjFJzlFJznGN7nGOEnGOEpWuEnGuMpXuUrYScrZSlvZStxqWtvaW1xq29zrW9zrXGzsbO1sbO3s7W3tbe597n597n7+fv7+/v9/f39/f3/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////ywAAAAAEAAQAAAIrwANHDAgkODAgggNFBC4cKFChQMbPmx4oEDFiQUWoNi4MUGBjyBBJuCwQQXJkChDogi5QMJHBBIeIChAoMDKmhJMqNhQIOeJBjUJ3CTw4UOFnxJSVKBJQGjTAiIkEMUQoUTTqyiukmgwwEMGCCMIDCAQwOkAASIoBBBRIcKIswMGBEgRIK6GEh5QKAAbN26AEn4JdDBxYUCDEHL9DgDQl3HdxY0hM54seTHly5UZBwQAOw=="));

//ThePirateBay
trackers.push(new SearchEngine("The Pirate Bay (Video)", "http://thepiratebay.org/search/%title/0/7/0", false, "data:image/x-icon;base64,Qk04AwAAAAAAADYAAAAoAAAAEAAAABAAAAABABgAAAAAAAAAAADgTAAA4EwAAAAAAAAAAAAA/////////////////////////////////////////////////////v7+/////////////Pz8vb297Ozs////////////////////////////////4uLiSUlJ3d3d////////8/PzEhIScnJy8fHx////////////////////8fHxwsLCWFhYAAAAyMjI////////5+fnEBAQICAgQkJCV1dXZWVli4uLiYmJUlJSKioqPT09bm5uHh4eYWFhwcHBubm5bGxsQEBAp6end3d3FBQUAAAAFBQUOTk5ISEhGRkZPT09WVlZQkJCKioqJycnenp6AAAAQUFBPz8/YGBgjo6O0dHR+/v7////////7+/vxcXFnZ2dg4ODExMTQEBAv7+/AAAAgoKCjo6OpaWltra2qqqqpqampaWlpKSkra2tr6+vsbGx5eXll5eXW1tb1NTUcXFxmJiYAwMDAAAANzc3VFRUGxsbAAAAX19fPDw8ERERAAAAQUFB/v7+/Pz8////////nJycAAAAAAAAAAAAHx8fCwsLAAAAJiYmBQUFAAAAAAAAKysr+vr6////////////nJycAAAAAAAADw8PAAAAAAAAAAAAAAAADQ0NAwMDAAAANjY2+vr6////////////rq6uAAAANjY25eXlWVlZHx8fJycnIyMj0dHRhoaGAAAAV1dX////////////////r6+vAAAALS0t0tLSX19fsrKy2dnZZWVlsrKyiIiIAAAAWVlZ////////////////r6+vAAAAAAAABQUFAgICExMTEBAQAwMDAwMDAQEBAAAAWlpa////////////////q6urAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVFRU////////////////19fXSUlJQUFBQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQkJCQkJCqKio/////////////////////////v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+////////////AAA="));

//isoHunt
trackers.push(new SearchEngine("isoHunt (Video/Movies)", "http://isohunt.com/torrents/%title?ihp=1&iht=1&ihs1=2&iho1=d", false, "data:image/x-icon;base64,AAABAAEAEBAAAAEAGABoAwAAFgAAACgAAAAQAAAAIAAAAAEAGAAAAAAAQAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD39vX28e/5+fUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACkim2EWjTazb0AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACkimdmMwDBq5oAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADQv6qymH4AAACulH1mMwCpi3EAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD08O16UCaAXDPs5N/Mu6xmMwCgfl8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD7+viadFNzRRPl3tjn39dyRBaJYz4AAAAAAAAAAAC7qJaQbUvfzsYAAAAAAAAAAAAAAAC1m4ZmMwDGs57p4tqFXjh9VCXo4dgAAAAAAADZyrx1SByMbEUAAAAAAAAAAAAAAADJvKtsPQujh2n7+/qUd1dmMwB1Rxl3SRx3SRx1RxlmNAGKZj/l2NMAAAAAAAAAAADk1c5wQBGNZ0H18O2niGNmMwBtPA52SRx2SRx2SRxtPQxoNQPl2tQAAAAAAAAAAADz8eyHXz9xQxXt6OTMvrNpNwW1mYQAAAAAAAAAAACxloNmMwC6p40AAAAAAAAAAAAAAACjgGJsOgrTx7Xs49uFXjeXdlXv6uMAAAAAAADXzb9sPAujgWYAAAAAAAAAAAAAAAC/rZlmNAG4n4gAAAAAAAAAAAAAAAAAAAAAAADn39d3TCGDWS7PwbQAAAAAAAAAAADx7ei6pI7Yyr0AAAAAAAAAAAAAAAAAAAAAAAAAAACJZD9rOgrIs54AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADGsZxmMwCkjnAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADSwLdtPQqDWjL08vAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADy7uju6eQAAADx/wAA8f8AAPH/AACR/wAAAf8AAAHHAACAxwAAgAMAAIADAACA4wAAwGMAAMfhAADH8QAA//EAAP/wAAD/+QAA"));

//Google torrents
trackers.push(new SearchEngine("Google search for torrents", "http://www.google.com/search?hl=en&lr=&q=filetype:torrent+%title", false, "data:image/x-icon;base64,AAABAAEAEBAAAAAAAABoBQAAFgAAACgAAAAQAAAAIAAAAAEACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAACAAAAAgIAAgAAAAIAAgACAgAAAwMDAAICAgAAAAP8AAP8AAAD//wD/AAAA/wD/AP//AAD///8A//3/AP39/wD6/f8A+P3/AP/8/wD9/P8A+vz/AP/7/wD/+v8A/vr/APz6/wD4+v8A+/n/APP5/wD/+P8A+vj/AO/4/wDm+P8A2fj/AP/3/wD/9v8A9vb/AP/1/wD69f8A9PT/AO30/wD/8/8A//L/APnx/wD28P8A///+APj//gD2//4A9P/+AOP//gD//f4A6f/9AP///AD2//wA8//8APf9/AD///sA/v/7AOD/+wD/+vsA9/X7APr/+gDv/voA///5AP/9+QD/+/kA+e35AP//+ADm//gA4f/4AP/9+AD0+/gA///3APv/9wDz//cA8f/3AO3/9wD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uscfLTFbIy8SOhA0Inq5Y77GNBMYIxQUJzM2Vxx2wEmfyCYWMRldXCg5MU0aicRUms58SUVeRkwjPBRSNIfBMkSgvWkyPxVHFIaMSx1/0S9nkq7WdWo1a43Jt2UqgtJERGJ5m6K8y92znpNWIYS1UQ89Mmg5cXNaX0EkGyyI3KSsp6mvpaqosaatq7axsQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="));

//Wikipedia
trackers.push(new SearchEngine("Wikipedia", "http://en.wikipedia.org/wiki/Special:Search?search=%title&go=Go", false, "data:image/x-icon;base64,AAABAAEAEBAQAAEABAAoAQAAFgAAACgAAAAQAAAAIAAAAAEABAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAEAgQAhIOEAMjHyABIR0gA6ejpAGlqaQCpqKkAKCgoAPz9/AAZGBkAmJiYANjZ2ABXWFcAent6ALm6uQA8OjwAiIiIiIiIiIiIiI4oiL6IiIiIgzuIV4iIiIhndo53KIiIiB/WvXoYiIiIfEZfWBSIiIEGi/foqoiIgzuL84i9iIjpGIoMiEHoiMkos3FojmiLlUipYliEWIF+iDe0GoRa7D6GPbjcu1yIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"));

//Criticker
trackers.push(new SearchEngine("Criticker", "http://www.criticker.com/?st=movies&h=%title&g=Go", false, "data:image/x-icon;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAC2UlEQVQ4jZXRS0zSAQDH8X9LW2td29o6dHdrlT0PbTUru/RcHaqtfJR6MMsydU6tbD2kBA0FLbMSJRBTnKaCj5JUFDPA1BDDZz5SSwwjH2XfDpzaGlu/82+fw+8n8B+RqevQvnpHcU0bsWI1AMLM7A8a3towWj/+VZ5bWGRsyompsw+VrpW7eRUERtwjo1BPdGoBkXcUHqDlvYMinYlYsYokqYazSY/YFXyLdYHRrNx2Dh//EJZtDsLXP5g1eyLR1JiobuogQarxABbbEGn5VRy8IGb9gcsEhKVyJvEhSVkvkBXVUd5g5m13P6MT02SpaomXqImVqAi5lusB+kcmuf+skuvyUqacs143UJQ3kVvSQFtXHzH3lcwvLCKMTTqRKmtIy69m+tt3r4BGb+L8jTziJWqOX37A/MJPhImvLlKytSRINThdbq9AvekDj7UGbP2jXLqrYMblRpj+5kb05CXx6UU0W3uxD47T5RjBah+m/cMArZ19NFt7aTT3kl6g42ScjERpMfvDRbi+zyE4XT/I1tRzO7ec1TvCWL0znFU7wli5/TwrtobisyWE5ZuDWbYpCMHvNOkFOvo+TRB9T8n41AyCe26e9EIdyVkl5BS/wtDeQ52pm5qWLnTN76ls7KDCYKHCYOFBoZ4jlzK4Jitlb5iIT5+/IswvLCJT15EiL8XY4fC6Qf/IJKl5L7EPjBMnUdHtGEX49WuJZ2VvyFTq0Rs7vQJDY184FS/nVk4ZgREizLZBBABFRTM35aWoda1egS/OWVKytVh6hkmWFmNot3kAZaWRlIdl+B1LYHfoHU7GybmS9hyxohpllZHXbTZsA2M4hieIuPkUiULH4SgJtS1dHsDaM0Sj2c5VsYqLqQUcipKw4UQiawOiPG9sCcXHPwTfjWfZFy7ijdlOsqyEstdmD/CvLC39xuWeY3B0iiZLL8oqIzeytRyNzuCJ1sCJmEwKK438AVDHNLqxwXrgAAAAAElFTkSuQmCC"));

//Rotten Tomatoes via IMDb-ID
trackers.push(new SearchEngine("Rotten Tomatoes via IMDb-ID", "http://www.rottentomatoes.com/alias?type=imdbid&s=%imdb-id", true, "data:image/x-icon;base64,AAABAAEAEBAAAAAAAAAoAQAAFgAAACgAAAAQAAAAIAAAAAEABAAAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJ51AAMjQ1AAAAAAAAAAAABC+AAAs8BIAzO8SAD+61QAYXEAAsgYIABC+AAABALIAsgYIAAEAAACyBggAAAAAERAAAAAAAAEREQAAAAAAARERAAEQERAAERAAEREREQAREBEREAEREBEREREAAAEREREQAAAAABEREQAAAAAREBEREQAAAREAEREREAABEQARABEREAERAREAEREQAAAREQABEQAAABERAAAAAAAAEREAAAAAAAAREAAAAAD8f3cA+D93hfg5AAAccADwDEF3rIQDAADgH3eA8D8AAMQPAJyMBwAAjMF3aIjBAALw43dQ8P93//D//2nx/3ei"));

var allmovie_title = new String(getTitle());
allmovie_title = allmovie_title.replace(/ /g,"+");
//AllMovie
trackers.push(new SearchEngine("Allrovi", "http://www.allrovi.com/search/movies/" + allmovie_title , false, "data:image/x-icon;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAACXBIWXMAAA7DAAAOwwHHb6hkAAACBklEQVQokWP4////gwsXVzc0T4qJx4OWVdZc3rsPqJjh7pmzPcHhPUFhxKBTGzYxrKhtwCIXHN7hE9Dm6QtiB4a2uHt3+QX1BIfNzsxhmByTgKmh0zcQaNDOqTO6A0MnhEcfXrJsbk5Bl1/wpOh4BiAGqugOCAEaCURd/sFAbqub14m1618/fATkTo5NBDp9Q1dvu6c/0DMMQAw0pj88eklp5cq6xmmJqUBtre7eR5avfHrjJkhDTMLPr9/WtXW2e8E0AB1wbuv2z2/fvnn8+OOr1yuq6xqd3PBp6PYPWVhYCrQa6Nx7Z889vHipydn9yLIVuG3wC5qenHZ6w6bbJ0+9uHvv4aXLQCcdXrocu4YJkbFT45PePXl6/9z5OVm5J9dteHTlKjAcDy9b8eT6DaBrIRrWNLVBPd0fFgX0659fvydExlRb2p5cux6orsXVE2jD64cPe0MigMH498/f3bPmAKMFagMwZN4+fvL4ytULO3YBrQL6fnpi6vLquj+//1w/cgRoyY0jR///+7+upb0vJAIUD52+QTNSM4Bm75u3AMjdNmnKvLzCdm9/oJ6d02Z0BYRMiIjZO2fesspaoHMYFhWXg6LWL6jFzavNwxfoS6DVkOjr8IamDmC0tnr4AK2amZbFcPXAISJTHhDtX7CIARjtZ7duA7oBf/IGBiAwRf35/RsAknmV/hUMm9MAAAAASUVORK5CYII="));


//opensubtitles.org  via IMDb-ID
trackers.push(new SearchEngine("opensubtitles.org  via IMDb-ID", "http://www.opensubtitles.org/en/search/sublanguageid-eng/imdbid-%imdb-id", true, "data:application/octet-stream;base64,AAABAAEAEBAAAAEAGABoAwAAFgAAACgAAAAQAAAAIAAAAAEAGAAAAAAAAAAAAEgAAABIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///////8AAAD///////8AAAD///////8AAAD///////8AAAD///////8AAAAAAAD///////8AAAD///////8AAAD///////8AAAD///////8AAAD///////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACqqqr///////+qqqoAAAAAAADMzMzu7u7///////9VVVUAAAAAAAAAAAAAAAB3d3eZmZkAAAAAAACZmZmIiIgAAACIiIgAAAAAAABERETd3d0AAAAAAAAAAAAAAADu7u4REREAAAAAAAARERHu7u4AAABERET////////d3d0zMzMAAAAAAAAAAAAAAADd3d0iIiIAAAAAAAARERHd3d0AAADd3d1EREQAAAAAAAAAAAAAAAAAAAAAAAAAAAB3d3eZmZkAAAAAAACqqqp3d3cAAADMzMxEREQAAAARERHd3d0AAAAAAAAAAAAAAAAAAACZmZn///////+qqqoAAAAAAAAiIiLu7u7////////u7u4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///////8AAAD///////8AAAD///////8AAAD///////8AAAD///////8AAAAAAAD///////8AAAD///////8AAAD///////8AAAD///////8AAAD///////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"));

//Subscene.com
trackers.push(new SearchEngine("Subscene.com", "http://subscene.com/filmsearch.aspx?q=%title", false, "data:image/x-icon;base64,Qk02AwAAAAAAADYAAAAoAAAAEAAAABAAAAABABgAAAAAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAZP/MAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAZP/MZP/MAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAZP/MZP/MAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAZP/MZP/MZP/MZP/MZP/MAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAZP/MZP/MZP/MZP/MZP/MAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAZP/MZP/MZP/MZP/MZP/MZP/MZP/MAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAZP/MZP/MAAAAAAAAZP/MZP/MZP/MZP/MZP/MAAAAAAAAAAAAAAAAAAAAAAAAAAAAZP/MAAAAAAAAZP/MZP/MZP/MZP/MZP/MZP/MZP/MAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAZP/MZP/MZP/MZP/MZP/MAAAAZP/MZP/MAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAZP/MZP/MZP/MZP/MZP/MAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAZP/MZP/MZP/MZP/MAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAZP/MZP/MZP/MZP/MZP/MAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAZP/MZP/MAAAAAAAAZP/MZP/MAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAZP/MAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"));

//Google subtitles
trackers.push(new SearchEngine("Google search for subtitles", "http://www.google.com/search?hl=en&lr=&q=download+subtitle+%title", false, "data:image/x-icon;base64,AAABAAEAEBAAAAAAAABoBQAAFgAAACgAAAAQAAAAIAAAAAEACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAACAAAAAgIAAgAAAAIAAgACAgAAAwMDAAICAgAAAAP8AAP8AAAD//wD/AAAA/wD/AP//AAD///8A//3/AP39/wD6/f8A+P3/AP/8/wD9/P8A+vz/AP/7/wD/+v8A/vr/APz6/wD4+v8A+/n/APP5/wD/+P8A+vj/AO/4/wDm+P8A2fj/AP/3/wD/9v8A9vb/AP/1/wD69f8A9PT/AO30/wD/8/8A//L/APnx/wD28P8A///+APj//gD2//4A9P/+AOP//gD//f4A6f/9AP///AD2//wA8//8APf9/AD///sA/v/7AOD/+wD/+vsA9/X7APr/+gDv/voA///5AP/9+QD/+/kA+e35AP//+ADm//gA4f/4AP/9+AD0+/gA///3APv/9wDz//cA8f/3AO3/9wD/8fcA//32AP369gDr+vYA8f/1AOv/9QD/+/UA///0APP/9ADq//QA///zAP/18wD///IA/fzyAP//8QD///AA9//wAPjw8AD//+8A8//vAP//7gD9/+4A9v/uAP/u7gD//+0A9v/tAP7/6wD/+eoA///pAP//6AD2/+gA//nnAP/45wD38eYA/fblAP/25AD29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KSsp6mvpaqosaatq7axsQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="));


// --------------- END OF SEARCH ENGINES ---------------  


function xpath(query, context) {
	context = context ? context : document;
	
	return document.evaluate(query, context, null,
		XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
}

function SearchEngine(shortname, searchurl, usesIMDBID, icon) {
	this.shortname = shortname;
	this.searchurl = searchurl;
	this.usesIMDBID = usesIMDBID;
	this.icon = icon;

	this.getHTML = function (title, id) {
		var html = "<a  target=\"_blank\" href=\"" + this.getSearchUrl(title, id) + "\"><img border=\"1\" src=\"" + this.icon + "\" title=\"" + this.shortname + "\"><\/a>&nbsp;";
		return html;
	}
	
	this.getSearchUrl = function (title, id) {
		var searchUrl = this.searchurl;
		if (this.usesIMDBID) {
			searchUrl = searchUrl.replace(/%imdb\-id/, id);
		}
		else {
			searchUrl = searchUrl.replace(/%title/, encodeURIComponent(title));
		}
		
		return searchUrl;
	}	
}

function openAllInTabs(title, id, inclIMDBID) {
	for (var i = 0; i < trackers.length; i++) {
		if (trackers[i].usesIMDBID && !inclIMDBID)
			continue;
		else
			GM_openInTab(trackers[i].getSearchUrl(title, id));
	}
}

function getTitle() {
	var title = document.title;
	title = title.match(/^(.*) \(/)[1];
	return title;
}


function getId() {
	with (location.href) {
		var id = match(/title\/tt(.*?)\//i)[1];
	}
	return id;
}


function addIconBarIcons(title, id, trackers) {
    
 var iconbar = xpath("//h1",document);
    if (!iconbar || iconbar.snapshotLength != 1) {
	    GM_log("Error! Couldn't find icon bar. Quitting!");
	    return;
  }

	iconbar = iconbar.snapshotItem(0);
	iconbar.id = "iconbar";
	var tdtab = document.createElement("div");
	iconbar.appendChild(tdtab);
	
   var tdimg;
  for (var i = 0; i < trackers.length; i++) {   
	tdimg = document.createElement("span");
    tdimg.innerHTML = trackers[i].getHTML(title, id);
    iconbar.appendChild(tdimg);
	}

	
	if (GM_openInTab) {
		var tdopenall = document.createElement("td");
		var aopenall = document.createElement("a");
		aopenall.innerHTML = "Open All";
		aopenall.href = "javascript:;";
		aopenall.setAttribute(attr);
		aopenall.setAttribute("class", "openall");	
		aopenall.addEventListener("click", function () { openAllInTabs(title, id, true); }, false);
		tdopenall.appendChild(aopenall);
		
		iconbar.appendChild(tdopenall);
	}
}


function addStyles() {
	var open_all_class = "a.openall {\n" +
	"	font-weight: bold;\n" + 
	"	font-family: Verdana, Arial, Helvetica, sans-serif;\n" +
	"	font-size: 10px\n" +
	"}";
	
	GM_addStyle(open_all_class);
}


addStyles();
var title = getTitle();
var id = getId();
addIconBarIcons(title, id, trackers);

(function()
{
    try
    {
        var tr = document.evaluate("//TR[TD/@class='lhscol'][1]/TD[last()]//TR[1]",
                document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,
                null).snapshotItem(0);
        if (tr)
        {
            tr.deleteCell(tr.cells.length - 1);
        }
    }
    catch (e)
    {
        alert("UserScript exception: " + e);
    }
}
)();