Filmtipset Custom Search Links

Adds custom search links on each movie page. Edit the code to add and remove links.

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

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

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

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

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name           Filmtipset Custom Search Links
// @namespace      none
// @description    Adds custom search links on each movie page. Edit the code to add and remove links.
// @version        0.1.1
// @include        http://www.filmtipset.se/film/*
// ==/UserScript==


//Some setup
var menuTitle = "Mina anpassade";

var urlList = [
    {title: 'Yahoo Movies', url: 'http://movies.yahoo.com/mv/search?&p=%s'},       //%s is replace by the movie title
    {title: 'Youtube',      url: 'http://www.youtube.com/results?search_query=%s'},
    {title: 'Google',       url: 'https://www.google.com/search?q=%s'}                  //Last row no comma
];

//End Setup

var xpath = '//b[contains(.,"Originaltitel")]/../../td[2]';
var title = document.evaluate(xpath, document, null, XPathResult.STRING_TYPE, null);
var t     = encodeURIComponent(title.stringValue.trim());
var elMenuItem   = document.querySelector("td > div.rightlinkheader");
var elMenu       = elMenuItem.parentNode;
var elHeading    = document.createElement("div");
elHeading.innerHTML = menuTitle;
elHeading.className = "rightlinkheader";
elMenu.insertBefore(elHeading, elMenuItem);
for(var i in urlList) {
    var a       = document.createElement('a');
    a.href      = urlList[i].url.replace('%s',t);
    a.innerHTML = ' - ' + urlList[i].title;
    var d       = document.createElement('div');
    d.className = 'rightlink';
    d.appendChild(a);
    elMenu.insertBefore(d, elMenuItem);
}