Link Guru

Adds boxes full on links to a few sites.

От 17.01.2017. Виж последната версия.

За да инсталирате този скрипт, трябва да имате инсталирано разширение като Tampermonkey, Greasemonkey или Violentmonkey.

За да инсталирате този скрипт, трябва да имате инсталирано разширение като Tampermonkey или Violentmonkey.

За да инсталирате този скрипт, трябва да имате инсталирано разширение като Tampermonkey или Violentmonkey.

За да инсталирате този скрипт, трябва да имате инсталирано разширение като Tampermonkey или Userscripts.

За да инсталирате скрипта, трябва да инсталирате разширение като Tampermonkey.

За да инсталирате този скрипт, трябва да имате инсталиран скриптов мениджър.

(Вече имам скриптов мениджър, искам да го инсталирам!)

За да инсталирате този стил, трябва да инсталирате разширение като Stylus.

За да инсталирате този стил, трябва да инсталирате разширение като Stylus.

За да инсталирате този стил, трябва да инсталирате разширение като Stylus.

За да инсталирате този стил, трябва да имате инсталиран мениджър на потребителски стилове.

За да инсталирате този стил, трябва да имате инсталиран мениджър на потребителски стилове.

За да инсталирате този стил, трябва да имате инсталиран мениджър на потребителски стилове.

(Вече имам инсталиран мениджър на стиловете, искам да го инсталирам!)

// ==UserScript==
// @name          Link Guru
// @namespace     http://greasyfork.org/users/2240-doodles
// @author        Doodles
// @version       2
// @description   Adds boxes full on links to a few sites.
// @include       *://*.wikipedia.org/*
// @include       *://www.google.*/search?*
// @include       *://*.wiktionary.org/wiki/*
// @include       *://www.imdb.com/*
// @include       *://www.rottentomatoes.com/*
// @run-at        document-end
// @require       https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js
// @require       https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js
// @grant         GM_getValue
// @grant         GM_setValue
// @updateVersion 2
// ==/UserScript==
this.$ = this.jQuery = jQuery.noConflict(true);
$(document).ready(function () {
	'use strict';
	// =======================================================================================================================
	String.prototype.lgReplaceAll = function(f, r) {
		return this.split(f).join(r);
	}
	function UrlContains(urlfragment) {
		return document.URL.indexOf(urlfragment) != -1;
	}
	function SelectiveFire(functionToFire, delay){
		delay = delay || 2500;
		document.body.addEventListener("DOMSubtreeModified", function(){
			setTimeout(function() {
				functionToFire();
			}, delay);
		});
		functionToFire();
	}
	function CreateLink(givenLink, urlfragment, linkStyle) {
		var linkElement = $('<a></a>');
		$(linkElement).attr('title', givenLink[0]);
		$(linkElement).attr('href', givenLink[1] + urlfragment + givenLink[2]);
		if(linkStyle != 1){
			$('<img />').attr('src', givenLink[3]).attr('alt', givenLink[0]).appendTo(linkElement);
		}
		if(linkStyle != 0){
			$('<span></span>').text(givenLink[0]).appendTo(linkElement);
		}
		return linkElement;
	}
	function CreateLinkContainer(linkList, urlfragment, linkStyle, newTab) {
		var linkContainter = $('<div id="lgLinkContainer"></div>');
		for(var i = 0; i < linkList.length; i++){
			var linkData = linkList[i];
			var linkElement = $('<a></a>').attr('title', linkData[1].replace("{{PARAM}}", urlfragment)).attr('href', linkData[2].replace("{{PARAM}}", urlfragment));
			if(linkStyle != 1){ $('<img />').attr('src', 'http://i.imgur.com/' + linkData[3]).attr('alt', linkData[0]).appendTo(linkElement); }
			if(linkStyle != 0){ $('<span></span>').text(linkData[0]).appendTo(linkElement); }
			if(newTab){
				$(linkElement).attr('target', '_blank');
			}
			$(linkContainter).append(linkElement);
			if(i + 1 < linkList.length){ $(linkContainter).append(document.createTextNode((linkStyle != 1 ? " " : " | "))); }
		}
		return linkContainter;
	}
	// =======================================================================================================================
	$('<style></style>').prop('type', 'text/css').html('' +
		'div#lgSettingsContainer {padding:2px 2px 0 0;float:left;display:block;z-index:1000;}div#lgLinkContainer {padding:0 0 3px 0;margin:0 0 10px 0;line-heig' +
		'ht:16px;font-size:12px;}div#lgLinkContainer a img {display:inline-block;vertical-align:middle;width:16px;height:16px;}div#lgLinkContainer a {display:i' +
		'nline-block;}div#lgLinkContainer a span {vertical-align:middle;display:inline-block;margin:0 7px 0 3px;}.ui-corner-all {border-radius:0 !important;}.u' +
		'i-dialog {z-index:403 !important;background-color:#CCC;background:#CCC;color:#333;font-size:14px;border:1px solid #FFF;box-shadow:5px 5px 5px rgba(0, ' +
		'0, 0, 0.5);font-family:Arial, Helvetica, Verdana, sans-serif !important;outline:1px solid #000;}.ui-widget-content {background-color:#AAAAAA;backgroun' +
		'd:#AAAAAA;border:none !important;}.ui-dialog-titlebar {font-size:16px;background-color:#AAAAAA;background:#AAAAAA;padding:4px 4px 4px 7px;text-shadow:' +
		'1px 1px 2px #000000;color:#daf0ff;font-weight:bold;border:none !important;}.ui-dialog-titlebar-close {float:right !important;height:19px !important;ba' +
		'ckground-color:#3498db !important;border:1px solid #222222 !important;background-image:none !important;text-shadow:1px 1px 1px #000000 !important;font' +
		'-size:11px !important;font-weight:bold !important;color:#FFF !important;}.ui-dialog-titlebar-close:after {content:"Close";}.ui-dialog-titlebar-close:h' +
		'over {background-color:#3cb0fd !important;}.ui-dialog-titlebar-close span {display:none;}.ui-dialog-content {background-color:#CCC;padding:5px;border:' +
		'none !important;color:#000;}.ui-dialog-buttonpane {padding:2px 7px 7px 7px;background-color:none !important;background:none !important;border:none;}.u' +
		'i-dialog-buttonset {text-align:right;}.ui-dialog-buttonset button {background-color:#3498db !important;border:1px solid #222222 !important;background-' +
		'image:none !important;text-shadow:1px 1px 1px #000000;font-size:16px;font-weight:bold;color:#FFF;font-family:Arial, Helvetica, Verdana, sans-serif !im' +
		'portant;padding:2px 12px 3px 12px;margin-left:3px;}.ui-dialog-buttonset button:hover {background-color:#3cb0fd !important;}.ui-widget-overlay {positio' +
		'n:absolute;top:0;left:0;width:100%;height:100%;background-color:#000000;opacity:.60;filter:Alpha(Opacity=60);background-image:none !important;}.ui-tab' +
		's .ui-tabs-nav {display:block;margin:0;padding:0;border: none;background-color:#AAAAAA;background:#AAAAAA;}.ui-tabs .ui-tabs-nav li {list-style:none;f' +
		'loat:left;margin:0 6px 1px 0;border: none;border-radius:0 !important;}a.ui-tabs-anchor:link {list-style:none;display:inline-block;margin:0 0 0 0;}a.ui' +
		'-tabs-anchor:link, a.ui-tabs-anchor:visited {display:inline-block;padding:2px 12px 3px 12px;background-color:#446382;color:#FFF;font-weight:bold;text-' +
		'decoration:none;}a.ui-tabs-anchor:hover, a.ui-tabs-anchor:active, a.ui-tabs-anchor:focus {background-color:#F5F5F5;color:#000;}.ui-tabs-active a.ui-ta' +
		'bs-anchor:link, .ui-tabs-active a.ui-tabs-anchor:visited {background-color:#F5F5F5;color:#000;}.ui-tabs-active a.ui-tabs-anchor:hover, .ui-tabs-active' +
		' a.ui-tabs-anchor:active, .ui-tabs-active a.ui-tabs-anchor:focus {background-color:#F5F5F5;color:#000;}.ui-tabs .ui-tabs-panel {clear:left;background-' +
		'color:#F5F5F5;height:251px;padding:5px;border-radius:0 !important;}.ui-tabs .ui-tabs-panel p {padding:0 5px 3px 5px;margin:0 0 0 0;}div#lgSettingsTabs' +
		' hr {margin:2px 0 2px 0;border: none;height: 1px;background-color:#AAAAAA;}div.lgSettingsPadder {padding:0 25px 0 25px;}label.lgSetCheckbox {padding:2' +
		'px;display:block;line-height:16px;}label.lgSetCheckbox input[type="checkbox"] {margin-right:5px;line-height:16px;}div.lgSetRadioHeader {padding:2px 5p' +
		'x 2px 5px;line-height:16px;}label.lgSetRadio {padding:2px;display:inline-block;line-height:16px;}label.lgSetRadio input[type="radio"] {margin-right:5p' +
		'x;line-height:16px;}div.lgSettingsFooter {padding:3px;margin:0 0 0 0;font-size:10px;}' +
	'').appendTo('head');
	$('body').append('' +
		'<div id="lgSettingsDialog" title="Link Guru - Settings"><div id="lgSettingsTabs"><ul><li><a href="#tabs-1">Wikipedia</a></li><li><a href="#tabs-2">Wik' +
		'tionary</a></li><li><a href="#tabs-3">IMDb</a></li><li><a href="#tabs-4">Rotten Tomatoes</a></li><li><a href="#tabs-5">Google</a></li></ul><div id="ta' +
		'bs-1"><p>Add links to Wikipedia articles. The links are searches using the article&#39;s title as the search parameter.</p><hr /><label class="lgSetCh' +
		'eckbox"><input type="checkbox" name="lgSetWikipediaEnabled" id="lgSetWikipediaEnabled"><strong>Enabled</strong> - Enable/Disable Link Guru on Wikipedi' +
		'a</label><hr /><label class="lgSetCheckbox"><input type="checkbox" name="lgSetWikipediaNewtab" id="lgSetWikipediaNewtab"><strong>New Tab</strong> - Li' +
		'nks will automatically open in a new tab.</label><hr /><div class="lgSetRadioHeader"><strong>Display Style</strong> - How the links are displayed.</di' +
		'v><div class="lgSettingsPadder"><label class="lgSetRadio"><input type="radio" name="lgSetWikipediaStyle" value="0"><strong>Icon</strong></label><label' +
		' class="lgSetRadio"><input type="radio" name="lgSetWikipediaStyle" value="1"><strong>Text</strong></label><label class="lgSetRadio"><input type="radio' +
		'" name="lgSetWikipediaStyle" value="2"><strong>Icon and Text</strong></label></div></div><div id="tabs-2"><p>Add links to Wiktionary word pages. The l' +
		'inks are other dictionaries and word related services.</p><hr /><label class="lgSetCheckbox"><input type="checkbox" name="lgSetWiktionaryEnabled" id="' +
		'lgSetWiktionaryEnabled"><strong>Enabled</strong> - Enable/Disable Link Guru on Wiktionary</label><hr /><label class="lgSetCheckbox"><input type="check' +
		'box" name="lgSetWiktionaryNewtab" id="lgSetWiktionaryNewtab"><strong>New Tab</strong> - Links will automatically open in a new tab.</label><hr /><div ' +
		'class="lgSetRadioHeader"><strong>Display Style</strong> - How the links are displayed.</div><div class="lgSettingsPadder"><label class="lgSetRadio"><i' +
		'nput type="radio" name="lgSetWiktionaryStyle" value="0"><strong>Icon</strong></label><label class="lgSetRadio"><input type="radio" name="lgSetWiktiona' +
		'ryStyle" value="1"><strong>Text</strong></label><label class="lgSetRadio"><input type="radio" name="lgSetWiktionaryStyle" value="2"><strong>Icon and T' +
		'ext</strong></label></div></div><div id="tabs-3"><p>Add search links to Movie, TV Series, Person, and Character pages.</p><hr /><label class="lgSetChe' +
		'ckbox"><input type="checkbox" name="lgSetImdbEnabled" id="lgSetImdbEnabled"><strong>Enabled</strong> - Enable/Disable Link Guru on IMDb</label><hr /><' +
		'label class="lgSetCheckbox"><input type="checkbox" name="lgSetImdbNewtab" id="lgSetImdbNewtab"><strong>New Tab</strong> - Links will automatically ope' +
		'n in a new tab.</label><hr /><div class="lgSetRadioHeader"><strong>Display Style</strong> - How the links are displayed.</div><div class="lgSettingsPa' +
		'dder"><label class="lgSetRadio"><input type="radio" name="lgSetImdbStyle" value="0"><strong>Icon</strong></label><label class="lgSetRadio"><input type' +
		'="radio" name="lgSetImdbStyle" value="1"><strong>Text</strong></label><label class="lgSetRadio"><input type="radio" name="lgSetImdbStyle" value="2"><s' +
		'trong>Icon and Text</strong></label></div></div><div id="tabs-4"><p>Add search links to Movie and Person pages.</p><hr /><label class="lgSetCheckbox">' +
		'<input type="checkbox" name="lgSetRottenEnabled" id="lgSetRottenEnabled"><strong>Enabled</strong> - Enable/Disable Link Guru on Rotten Tomatoes</label' +
		'><hr /><label class="lgSetCheckbox"><input type="checkbox" name="lgSetRottenNewtab" id="lgSetRottenNewtab"><strong>New Tab</strong> - Links will autom' +
		'atically open in a new tab.</label><hr /><div class="lgSetRadioHeader"><strong>Display Style</strong> - How the links are displayed.</div><div class="' +
		'lgSettingsPadder"><label class="lgSetRadio"><input type="radio" name="lgSetRottenStyle" value="0"><strong>Icon</strong></label><label class="lgSetRadi' +
		'o"><input type="radio" name="lgSetRottenStyle" value="1"><strong>Text</strong></label><label class="lgSetRadio"><input type="radio" name="lgSetRottenS' +
		'tyle" value="2"><strong>Icon and Text</strong></label></div></div><div id="tabs-5"><p>Replaces the "Videos" tab on Google searches with a link to a Yo' +
		'uTube search with the same search parameter.</p><hr /><label class="lgSetCheckbox"><input type="checkbox" name="lgSetGoogleEnabled" id="lgSetGoogleEna' +
		'bled"><strong>Enabled</strong> - Enable/Disable Link Guru on Google</label><hr /><label class="lgSetCheckbox"><input type="checkbox" name="lgSetGoogle' +
		'Definition" id="lgSetGoogleDefinition"><strong>Defintion Links</strong> - Add word related links to Google definition boxes.</label></div></div><div c' +
		'lass="lgSettingsFooter">Settings changes do not immediately take effect. A refresh is required.</div></div>' +
	'');
    $("#lgSettingsTabs").tabs();
	$('#lgSettingsDialog').dialog({ modal:true, resizable: false, autoOpen: false, width: 634, position: { my: "center top", at: "center top+120", of: window } });
	var settingsLink = $('<a href="#" id="lgSettingsLink">Link Guru Settings</a>');
	$(settingsLink).click(function() {$('#lgSettingsDialog').dialog('open');});
	// =======================================================================================================================
	// Stored Data Variables
	function SetupBoolVariable(_variableIndex, _defaultValue) {
		lgSettings[_variableIndex] = GM_getValue(_variableIndex, _defaultValue);
		$("#lgSet" + _variableIndex).prop('checked', lgSettings[_variableIndex]).change(function() {
			lgSettings[_variableIndex] = this.checked ? true : false;
			GM_setValue(_variableIndex, lgSettings[_variableIndex]);
		});
	}
	function SetupRadioVariable(_variableIndex, _variableMax) {
		lgSettings[_variableIndex] = GM_getValue(_variableIndex, 0);
		$("input[name='lgSet" + _variableIndex + "'][value='"+lgSettings[_variableIndex]+"']").prop('checked', true);
		$("input[name='lgSet" + _variableIndex + "']").change(function() {
			lgSettings[_variableIndex] = $(this).filter(':checked').val();
			GM_setValue(_variableIndex, lgSettings[_variableIndex]);
		});
	}
	var lgSettings = [];
	SetupBoolVariable('WikipediaEnabled', true);
	SetupBoolVariable('WiktionaryEnabled', true);
	SetupBoolVariable('RottenEnabled', true);
	SetupBoolVariable('ImdbEnabled', true);
	SetupBoolVariable('GoogleEnabled', true);
	SetupBoolVariable('WikipediaNewtab', false);
	SetupBoolVariable('WiktionaryNewtab', false);
	SetupBoolVariable('RottenNewtab', false);
	SetupBoolVariable('ImdbNewtab', false);
	SetupRadioVariable('WikipediaStyle', 2);
	SetupRadioVariable('WiktionaryStyle', 2);
	SetupRadioVariable('RottenStyle', 2);
	SetupRadioVariable('ImdbStyle', 2);
	SetupBoolVariable('GoogleDefinition', true);
	var links = [];
	// =======================================================================================================================
	// WIKIPEDIA
	if (UrlContains('wikipedia.org') && window.top == window.self) {
		links.push(["Google", "Google search for {{PARAM}}", "http://www.google.com/search?output=search&q={{PARAM}}", "Ocn9d7X.png"]);
		links.push(["Google Image", "Google Image search for {{PARAM}}", "http://www.google.com/search?tbm=isch&q={{PARAM}}", "FFntMod.png"]);
		links.push(["YouTube", "YouTube search for {{PARAM}}", "https://www.youtube.com/results?search_query={{PARAM}}", "Oi6BUxD.png"]);
		if($("ul > li > a.external[href*='www.imdb.com']").length){
			links.push(["IMDb", "IMDb page for {{PARAM}}", $("ul > li > a.external[href*='www.imdb.com']").attr('href'), "At43y4m.png"]);
		}else{
			links.push(["IMDb", "IMDb search for {{PARAM}}", "http://www.imdb.com/find?s=all&q={{PARAM}}", "At43y4m.png"]);
		}
		if($("a[href='/wiki/Portal:Anime_and_Manga']").length){
			links.push(["MyAnimeList", "MyAnimeList search for {{PARAM}}", "https://myanimelist.net/search/all?q={{PARAM}}", "dm777Ul.png"]);
		}
		links.push(["Pirate Bay", "The Pirate Bay search for {{PARAM}}", "https://thepiratebay.se/search/{{PARAM}}/0/99/0", "cnc2XKT.png"]);
		links.push(["Imgur", "Imgur search for {{PARAM}}", "http://imgur.com/search?q={{PARAM}}", "bMdIHrQ.png"]);
		links.push(["Last.fm", "Last.fm search for {{PARAM}}", "http://www.last.fm/search?q={{PARAM}}&type=track", "ntoVbxe.png"]);
		$('#p-navigation > div.body > ul').append($('<li></li>').append(settingsLink));
		if (lgSettings['WikipediaEnabled'] && !UrlContains('/wiki/Main_Page') && !UrlContains('/wiki/Portal:') && !UrlContains('/wiki/Talk:') && $('h1#firstHeading') && $('li#ca-nstab-main.selected')) {
			var pageTitle = $('h1#firstHeading').text();
			pageTitle = pageTitle.lgReplaceAll("<i>", "").lgReplaceAll("</i>", "");
			pageTitle = pageTitle.lgReplaceAll("&equals;", "%3D").lgReplaceAll("&#61;", "%3D").lgReplaceAll("=", "%3D");
			pageTitle = pageTitle.lgReplaceAll("&amp;", "%26").lgReplaceAll("&#38;", "%26").lgReplaceAll("&", "%26");
			pageTitle = pageTitle.replace(" (film)","").replace("(film)","").replace(" film)",")");
			$(CreateLinkContainer(links, pageTitle, lgSettings['WikipediaStyle'], lgSettings['WikipediaNewtab'])).insertBefore('h1#firstHeading');
			$('div#lgLinkContainer').css({'float':'right', 'padding':'10px 0 10px 0'});
			if ($('div.mw-indicators').children().length > 0) {
				$('div.mw-indicators').css({'padding-left':'25px'});
			}
		}
	}
	// =======================================================================================================================
	// WIKTIONARY
	if (UrlContains('wiktionary.org') && window.top == window.self) {
		links.push(["Merriam-Webster", "Merriam-Webster Dictionary and Thesaurus", "http://www.merriam-webster.com/dictionary/{{PARAM}}", "3IkK6gI.png"]);
		links.push(["Thesaurus.com", "Thesaurus.com", "http://thesaurus.com/browse/{{PARAM}}", "Ngxbqzc.png"]);
		links.push(["Google", "Google search for define:{{PARAM}}", "http://www.google.com/search?output=search&q=define:{{PARAM}}", "Ocn9d7X.png"]);
		links.push(["Synonym.com", "Synonym.com", "http://www.synonym.com/synonyms/{{PARAM}}/", "5zx9OP9.png"]);
		links.push(["Wikisaurus", "Wikisaurus", "http://wiktionary.org/wiki/Wikisaurus:{{PARAM}}", "2wDa3Kq.png"]);
		links.push(["One Look", "One Look", "http://www.onelook.com/?w={{PARAM}}&ls=a", "GjvfCVA.png"]);
		links.push(["Wolfram|Alpha", "Wolfram|Alpha", "http://www.wolframalpha.com/input/?i={{PARAM}}", "z5p7oL7.png"]);
		links.push(["Urban Dictionary", "Urban Dictionary", "http://www.urbandictionary.com/define.php?term={{PARAM}}", "oRspJNs.png"]);
		links.push(["iTools", "iTools", "http://itools.com/language/dictionary?q={{PARAM}}&submit=English+Dictionary", "caWzb02.png"]);
		links.push(["Vocabulary.com", "Vocabulary.com Dictionary", "http://www.vocabulary.com/dictionary/{{PARAM}}", "8MNsoze.png"]);
		links.push(["Cambridge", "Cambridge Dictionary", "http://dictionary.cambridge.org/dictionary/english/{{PARAM}}", "MtWE6Yt.png"]);
		links.push(["RhymeZone", "RhymeZone", "http://www.rhymezone.com/r/rhyme.cgi?Word={{PARAM}}&typeofrhyme=perfect&org1=syl&org2=l&org3=y", "d9giQh4.png"]);
		links.push(["Online Etymology", "Online Etymology Dictionary", "http://www.etymonline.com/index.php?search={{PARAM}}", "uUiJWbY.png"]);
		links.push(["howjsay", "howjsay: Online Dictionary of English Pronunciation", "http://howjsay.com/pronunciation-of-{{PARAM}}", "lrHhN0J.png"]);
		$('#p-navigation > div.body > ul').append($('<li></li>').append(settingsLink));
		if (lgSettings['WiktionaryEnabled'] && !UrlContains('/wiki/Wiktionary:Main_Page') && !UrlContains('/wiki/Index:') && !UrlContains('/wiki/Talk:') && !UrlContains('/wiki/Special:') &&
			!UrlContains('/wiki/Category:') && $('h1#firstHeading') && $('li#ca-nstab-main.selected')) {
			var pageTitle = $('h1#firstHeading').text().lgReplaceAll("<i>", "").lgReplaceAll("</i>", "");
			$(CreateLinkContainer(links, pageTitle, lgSettings['WiktionaryStyle'], lgSettings['WiktionaryNewtab'])).insertBefore('h1#firstHeading');
			$('div#lgLinkContainer').css({'float':'right', 'padding':'10px 0 10px 0'});
		}
	}
	// =======================================================================================================================
	// Rotten Tomatoes
	if (UrlContains('www.rottentomatoes.com') && window.top == window.self) {
		$('div.header_links').prepend(settingsLink);
		if (lgSettings['RottenEnabled']) {
			if(UrlContains("rottentomatoes.com/m/")){
				links.push(["YouTube", "YouTube search for {{PARAM}} trailer", "http://www.youtube.com/results?search_query={{PARAM}} trailer", "Oi6BUxD.png"]);
				links.push(["Google Image", "Google Image search for {{PARAM}}", "http://www.google.com/search?tbm=isch&q={{PARAM}}", "FFntMod.png"]);
				links.push(["Google", "Google search for {{PARAM}}", "http://www.google.com/search?output=search&q={{PARAM}}", "Ocn9d7X.png"]);
				links.push(["Wikipedia", "Wikipedia search for {{PARAM}}", "http://en.wikipedia.org/w/index.php?title=Special:Search&search={{PARAM}}", "8GnE9TT.png"]);
				links.push(["IMDb", "IMDb search for {{PARAM}}", "http://www.imdb.com/find?s=all&q={{PARAM}}", "At43y4m.png"]);
				links.push(["MetaCritic", "MetaCritic search for {{PARAM}}", "http://www.metacritic.com/search/all/{{PARAM}}/results", "j84MuyF.png"]);
				links.push(["AllMovie", "AllMovie search for {{PARAM}}", "http://www.allmovie.com/search/movies/{{PARAM}}", "893QQhS.png"]);
				links.push(["Box Office Mojo", "Box Office Mojo search for {{PARAM}}", "http://www.boxofficemojo.com/search/?q={{PARAM}}", "GLa3QlT.png"]);
				links.push(["Movie Mistakes", "Movie Mistakes search for {{PARAM}}", "http://www.moviemistakes.com/search.php?text={{PARAM}}", "DNn1W4y.png"]);
				links.push(["Letterboxd", "Letterboxd search for {{PARAM}}", "http://letterboxd.com/search/{{PARAM}}/", "BnJx4gH.png"]);
				links.push(["Pirate Bay", "The Pirate Bay search for {{PARAM}}", "http://thepiratebay.org/search/{{PARAM}}/0/99/200", "cnc2XKT.png"]);
				links.push(["YIFY Subtitles", "YIFY Subtitles search for {{PARAM}}", "http://www.yifysubtitles.com/search?q={{PARAM}}", "VyMFcXf.png"]);
				links.push(["Imgur", "Imgur search for {{PARAM}}", "http://imgur.com/search?q={{PARAM}}", "bMdIHrQ.png"]);
				var titleText = $('h1.title.hidden-xs').html().split("<span")[0].trim();
				titleText = titleText.lgReplaceAll("/", " ").lgReplaceAll("\\", " ");
				$(CreateLinkContainer(links, titleText, lgSettings['RottenStyle'], lgSettings['RottenNewtab'])).insertBefore('div#topSection');
				$('div#lgLinkContainer').css({'padding':'8px 0 8px 0', 'margin-bottom':'0'});
				$('div#topSection').css({'margin-top':'0'});
			}else if(UrlContains("rottentomatoes.com/tv/")){
				links.push(["YouTube", "YouTube search for {{PARAM}} trailer", "http://www.youtube.com/results?search_query={{PARAM}} trailer", "Oi6BUxD.png"]);
				links.push(["Google Image", "Google Image search for {{PARAM}}", "http://www.google.com/search?tbm=isch&q={{PARAM}}", "FFntMod.png"]);
				links.push(["Google", "Google search for {{PARAM}}", "http://www.google.com/search?output=search&q={{PARAM}}", "Ocn9d7X.png"]);
				links.push(["Wikipedia", "Wikipedia search for {{PARAM}}", "http://en.wikipedia.org/w/index.php?title=Special:Search&search={{PARAM}}", "8GnE9TT.png"]);
				links.push(["IMDb", "IMDb search for {{PARAM}}", "http://www.imdb.com/find?s=all&q={{PARAM}}", "At43y4m.png"]);
				links.push(["MetaCritic", "MetaCritic search for {{PARAM}}", "http://www.metacritic.com/search/all/{{PARAM}}/results", "j84MuyF.png"]);
				links.push(["AllMovie", "AllMovie search for {{PARAM}}", "http://www.allmovie.com/search/movies/{{PARAM}}", "893QQhS.png"]);
				links.push(["Box Office Mojo", "Box Office Mojo search for {{PARAM}}", "http://www.boxofficemojo.com/search/?q={{PARAM}}", "GLa3QlT.png"]);
				links.push(["Movie Mistakes", "Movie Mistakes search for {{PARAM}}", "http://www.moviemistakes.com/search.php?text={{PARAM}}", "DNn1W4y.png"]);
				links.push(["Letterboxd", "Letterboxd search for {{PARAM}}", "http://letterboxd.com/search/{{PARAM}}/", "BnJx4gH.png"]);
				links.push(["Episode Calendar", "Episode Calendar search for {{PARAM}}", "http://episodecalendar.com/en/shows?q[name_cont]={{PARAM}}", "5IeiE6p.png"]);
				links.push(["Pirate Bay", "The Pirate Bay search for {{PARAM}}", "http://thepiratebay.org/search/{{PARAM}}/0/99/200", "cnc2XKT.png"]);
				links.push(["YIFY Subtitles", "YIFY Subtitles search for {{PARAM}}", "http://www.yifysubtitles.com/search?q={{PARAM}}", "VyMFcXf.png"]);
				links.push(["Imgur", "Imgur search for {{PARAM}}", "http://imgur.com/search?q={{PARAM}}", "bMdIHrQ.png"]);
				if(document.URL.split("/tv/")[1].split("/").length > 1){
					var titleText = $('h1.movie_title').html().split("<span")[0].split(": Season")[0].split(": season")[0].trim();
					titleText = titleText.lgReplaceAll("/", " ").lgReplaceAll("\\", " ");
					$(CreateLinkContainer(links, titleText, lgSettings['RottenStyle'], lgSettings['RottenNewtab'])).insertAfter('div#season_score_panel');
					$('div#lgLinkContainer').css({'padding':'8px 0 8px 0', 'margin-bottom':'0', 'float':'left', 'width':'70%'});
				}else{
					var titleText = $('h1.title').html().split("<span")[0].trim();
					titleText = titleText.lgReplaceAll("/", " ").lgReplaceAll("\\", " ");
					$(CreateLinkContainer(links, titleText, lgSettings['RottenStyle'], lgSettings['RottenNewtab'])).insertBefore('div#series_info');
					$('div#lgLinkContainer').css({'padding':'8px 0 8px 0', 'margin-bottom':'0', 'float':'left', 'width':'70%'});
				}
			}else if(UrlContains("rottentomatoes.com/celebrity/")){
				links.push(["YouTube", "YouTube search for {{PARAM}} interview", "http://www.youtube.com/results?search_query={{PARAM}} interview", "Oi6BUxD.png"]);
				links.push(["Google Image", "Google Image search for {{PARAM}}", "http://www.google.com/search?tbm=isch&q={{PARAM}}", "FFntMod.png"]);
				links.push(["Google", "Google search for {{PARAM}}", "http://www.google.com/search?output=search&q={{PARAM}}", "Ocn9d7X.png"]);
				links.push(["Wikipedia", "Wikipedia search for {{PARAM}}", "http://en.wikipedia.org/w/index.php?title=Special:Search&search={{PARAM}}", "8GnE9TT.png"]);
				links.push(["IMDb", "IMDb search for {{PARAM}}", "http://www.imdb.com/find?s=nm&q={{PARAM}}", "At43y4m.png"]);
				links.push(["MetaCritic", "MetaCritic search for {{PARAM}}", "http://www.metacritic.com/search/person/{{PARAM}}/results", "j84MuyF.png"]);
				links.push(["AllMovie", "AllMovie search for {{PARAM}}", "http://www.allmovie.com/search/people/{{PARAM}}", "893QQhS.png"]);
				links.push(["Box Office Mojo", "Box Office Mojo search for {{PARAM}}", "http://www.boxofficemojo.com/search/?q={{PARAM}}", "GLa3QlT.png"]);
				links.push(["Letterboxd", "Letterboxd search for {{PARAM}}", "http://letterboxd.com/search/{{PARAM}}/", "BnJx4gH.png"]);
				links.push(["Imgur", "Imgur search for {{PARAM}}", "http://imgur.com/search?q={{PARAM}}", "bMdIHrQ.png"]);
				var titleText = $('div.celeb_name > h1').text();
				$(CreateLinkContainer(links, titleText, lgSettings['RottenStyle'], lgSettings['RottenNewtab'])).appendTo('div.celeb_name');
				$('div.celeb_name > h1').css({'border-bottom':'none', 'margin-bottom':'0', 'padding-bottom':'0'});
			}
		}
	}
	// =======================================================================================================================
	// IMDb
	if (UrlContains('www.imdb.com') && window.top == window.self) {
		$(settingsLink).css({'color':'white'});
		$('<div></div>').css({'font-size':'10px', 'height':'15px', 'line-height':'15px', 'padding-left':'3px' }).append(settingsLink).prependTo('div#nb20');
		$('div#navbar').css({'margin-top':'0'});
		if (lgSettings['ImdbEnabled']) {
			if(UrlContains("/title/")){
				links.push(["YouTube", "YouTube search for {{PARAM}} tralier", "http://www.youtube.com/results?search_query={{PARAM}} trailer", "Oi6BUxD.png"]);
				links.push(["Google Image", "Google Image search for {{PARAM}}", "http://www.google.com/search?tbm=isch&q={{PARAM}}", "FFntMod.png"]);
				links.push(["Google", "Google search for {{PARAM}}", "http://www.google.com/search?output=search&q={{PARAM}}", "Ocn9d7X.png"]);
				links.push(["Wikipedia", "Wikipedia search for {{PARAM}}", "http://en.wikipedia.org/w/index.php?title=Special:Search&search={{PARAM}}", "8GnE9TT.png"]);
				links.push(["Rotten Tomatoes", "Rotten Tomatoes search for {{PARAM}}", "http://www.rottentomatoes.com/search/?search={{PARAM}}&sitesearch=rt", "KdEB9NR.png"]);
				links.push(["MetaCritic", "MetaCritic search for {{PARAM}}", "http://www.metacritic.com/search/all/{{PARAM}}/results", "j84MuyF.png"]);
				links.push(["AllMovie", "AllMovie search for {{PARAM}}", "http://www.allmovie.com/search/movies/{{PARAM}}", "893QQhS.png"]);
				links.push(["Box Office Mojo", "Box Office Mojo search for {{PARAM}}", "http://www.boxofficemojo.com/search/?q={{PARAM}}", "GLa3QlT.png"]);
				links.push(["Movie Mistakes", "Movie Mistakes search for {{PARAM}}", "http://www.moviemistakes.com/search.php?text={{PARAM}}", "DNn1W4y.png"]);
				links.push(["Letterboxd", "Letterboxd search for {{PARAM}}", "http://letterboxd.com/search/{{PARAM}}/", "BnJx4gH.png"]);
				links.push(["Episode Calendar", "Episode Calendar search for {{PARAM}}", "http://episodecalendar.com/en/shows?q[name_cont]={{PARAM}}", "5IeiE6p.png"]);
				links.push(["Pirate Bay", "The Pirate Bay search for {{PARAM}}", "http://thepiratebay.org/search/{{PARAM}}/0/99/200", "cnc2XKT.png"]);
				links.push(["YIFY Subtitles", "YIFY Subtitles search for {PARAM}}", "http://www.yifysubtitles.com/search?q={{PARAM}}", "VyMFcXf.png"]);
				links.push(["Imgur", "Imgur search for {{PARAM}}", "http://imgur.com/search?q={{PARAM}}", "bMdIHrQ.png"]);
				var titleText = $('div.title_wrapper > h1').html().split("&nbsp;<span")[0].trim();
				titleText = titleText.lgReplaceAll("/", " ").lgReplaceAll("\\", " ");
				titleText = titleText.lgReplaceAll("&nbsp;", " ").trim();
				$(CreateLinkContainer(links, titleText, lgSettings['ImdbStyle'], lgSettings['ImdbNewtab'])).insertAfter('div.titleBar');
				$('div#lgLinkContainer').css({'padding':'5px 0 0 20px'});
			}else if(UrlContains("/name/")){
				links.push(["YouTube", "YouTube search for {{PARAM}} interview", "http://www.youtube.com/results?search_query={{PARAM}} interview", "Oi6BUxD.png"]);
				links.push(["Google Image", "Google Image search for {{PARAM}}", "http://www.google.com/search?tbm=isch&q={{PARAM}}", "FFntMod.png"]);
				links.push(["Google", "Google search for {{PARAM}}", "http://www.google.com/search?output=search&q={{PARAM}}", "Ocn9d7X.png"]);
				links.push(["Wikipedia", "Wikipedia search for {{PARAM}}", "http://en.wikipedia.org/w/index.php?title=Special:Search&search={{PARAM}}", "8GnE9TT.png"]);
				links.push(["Rotten Tomatoes", "Rotten Tomatoes search for {{PARAM}}", "http://www.rottentomatoes.com/search/?search={{PARAM}}&sitesearch=rt", "KdEB9NR.png"]);
				links.push(["MetaCritic", "MetaCritic search for {{PARAM}}", "http://www.metacritic.com/search/person/{{PARAM}}/results", "j84MuyF.png"]);
				links.push(["AllMovie", "AllMovie search for {{PARAM}}", "http://www.allmovie.com/search/people/{{PARAM}}", "893QQhS.png"]);
				links.push(["Box Office Mojo", "Box Office Mojo search for {{PARAM}}", "http://www.boxofficemojo.com/search/?q={{PARAM}}", "GLa3QlT.png"]);
				links.push(["Letterboxd", "Letterboxd search for {{PARAM}}", "http://letterboxd.com/search/{{PARAM}}/", "BnJx4gH.png"]);
				links.push(["Imgur", "Imgur search for {{PARAM}}", "http://imgur.com/search?q={{PARAM}}", "bMdIHrQ.png"]);
				var titleText = $('h1.header > span.itemprop').text();
				$(CreateLinkContainer(links, titleText, lgSettings['ImdbStyle'], lgSettings['ImdbNewtab'])).insertAfter('div.infobar');
				$('div#name-job-categories').css({'margin-bottom':'4px'});
			}else if(UrlContains("/character/")){
				links.push(["YouTube", "YouTube search for {{PARAM}}", "http://www.youtube.com/results?search_query={{PARAM}}", "Oi6BUxD.png"]);
				links.push(["Google Image", "Google Image search for {{PARAM}}", "http://www.google.com/search?tbm=isch&q={{PARAM}}", "FFntMod.png"]);
				links.push(["Google", "Google search for {{PARAM}}", "http://www.google.com/search?output=search&q={{PARAM}}", "Ocn9d7X.png"]);
				links.push(["Wikipedia", "Wikipedia search for {{PARAM}}", "http://en.wikipedia.org/w/index.php?title=Special:Search&search={{PARAM}}", "8GnE9TT.png"]);
				links.push(["Rotten Tomatoes", "Rotten Tomatoes search for {{PARAM}}", "http://www.rottentomatoes.com/search/?search={{PARAM}}&sitesearch=rt", "KdEB9NR.png"]);
				links.push(["MetaCritic", "MetaCritic search for {{PARAM}}", "http://www.metacritic.com/search/all/{{PARAM}}/results", "j84MuyF.png"]);
				links.push(["AllMovie", "AllMovie search for {{PARAM}}", "http://www.allmovie.com/search/all/{{PARAM}}", "893QQhS.png"]);
				links.push(["Box Office Mojo", "Box Office Mojo search for {{PARAM}}", "http://www.boxofficemojo.com/search/?q={{PARAM}}", "GLa3QlT.png"]);
				links.push(["Imgur", "Imgur search for {{PARAM}}", "http://imgur.com/search?q={{PARAM}}", "bMdIHrQ.png"]);
				var titleText = document.getElementById("tn15title").getElementsByTagName("h1")[0].innerHTML.split("<span>")[0].trim();
				$(CreateLinkContainer(links, titleText, lgSettings['ImdbStyle'], lgSettings['ImdbNewtab'])).insertBefore('div#tn15title');
				$('div#lgLinkContainer').css({'float':'right'});
			}
		}
	}
	// =======================================================================================================================
	// GOOGLE
	if (lgSettings['GoogleEnabled'] && UrlContains('www.google.') && window.top == window.self) {
		SelectiveFire(function(){
			var xs = document.URL.split('?')[1];
			if(xs.indexOf('#q=') != -1){
				xs = xs.split('#')[1];
			}
			xs = xs.split('q=')[1].split('&')[0].split('#')[0];
			$('a.q.qs').filter(function(index) {
				return $(this).text() == 'Videos' || $(this).text() == 'Video\'s';
			}).text('YouTube').attr('href', 'http://www.youtube.com/results?search_query=' + xs);
			$('div._sxc > a._UXb._Jhd').filter(function(index) {
				return $(this).text() == 'Videos' || $(this).text() == 'Video\'s';
			}).text('YouTube').attr('href', 'http://www.youtube.com/results?search_query=' + xs);
						
			if(lgSettings['GoogleDefinition'] && $("div.lr_dct_ent").length && !$('div#lgLinkContainer').length){
				var word = $("div.lr_dct_ent > div.vk_ans > span").first().text();
				links.push(["Wiktionary", "Wiktionary page on {{PARAM}}", "https://en.wiktionary.org/wiki/{{PARAM}}", "2wDa3Kq.png"]);
				links.push(["Merriam-Webster", "Merriam-Webster Dictionary and Thesaurus", "http://www.merriam-webster.com/dictionary/{{PARAM}}", "3IkK6gI.png"]);
				links.push(["Thesaurus.com", "Thesaurus.com", "http://thesaurus.com/browse/{{PARAM}}", "Ngxbqzc.png"]);
				links.push(["Google", "Google search for define:{{PARAM}}", "http://www.google.com/search?output=search&q=define:{{PARAM}}", "Ocn9d7X.png"]);
				links.push(["Synonym.com", "Synonym.com", "http://www.synonym.com/synonyms/{{PARAM}}/", "5zx9OP9.png"]);
				links.push(["Wikisaurus", "Wikisaurus", "http://wiktionary.org/wiki/Wikisaurus:{{PARAM}}", "2wDa3Kq.png"]);
				links.push(["One Look", "One Look", "http://www.onelook.com/?w={{PARAM}}&ls=a", "GjvfCVA.png"]);
				links.push(["Wolfram|Alpha", "Wolfram|Alpha", "http://www.wolframalpha.com/input/?i={{PARAM}}", "z5p7oL7.png"]);
				links.push(["Urban Dictionary", "Urban Dictionary", "http://www.urbandictionary.com/define.php?term={{PARAM}}", "oRspJNs.png"]);
				links.push(["iTools", "iTools", "http://itools.com/language/dictionary?q={{PARAM}}&submit=English+Dictionary", "caWzb02.png"]);
				links.push(["Vocabulary.com", "Vocabulary.com Dictionary", "http://www.vocabulary.com/dictionary/{{PARAM}}", "8MNsoze.png"]);
				links.push(["Cambridge", "Cambridge Dictionary", "http://dictionary.cambridge.org/dictionary/english/{{PARAM}}", "MtWE6Yt.png"]);
				links.push(["RhymeZone", "RhymeZone", "http://www.rhymezone.com/r/rhyme.cgi?Word={{PARAM}}&typeofrhyme=perfect&org1=syl&org2=l&org3=y", "d9giQh4.png"]);
				links.push(["Online Etymology", "Online Etymology Dictionary", "http://www.etymonline.com/index.php?search={{PARAM}}", "uUiJWbY.png"]);
				links.push(["howjsay", "howjsay: Online Dictionary of English Pronunciation", "http://howjsay.com/pronunciation-of-{{PARAM}}", "lrHhN0J.png"]);
			
				$(CreateLinkContainer(links, word, 0, false)).insertAfter('div.lr_dct_ent > div.vk_ans');
				$('div#lgLinkContainer').css({'margin-bottom':'0'});
			}
			
		}, 500);
	}
	// =======================================================================================================================
	// End Brace for document.ready function
});