xkcd Title and Explain

Adds an explainxkcd.com link and the image title to xkcd.com comic pages.

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          xkcd Title and Explain
// @namespace     http://greasyfork.org/users/2240-doodles
// @author        Doodles
// @version       1
// @description   Adds an explainxkcd.com link and the image title to xkcd.com comic pages.
// @icon          http://i.imgur.com/tedLgiQ.png
// @icon64        http://i.imgur.com/JKCTQ6F.png
// @include       /^https?:\/\/(www\.)?xkcd\.com\/(\d*\/)?$/
// @grant         none
// @updateVersion 1
// ==/UserScript==

var uls = document.getElementById('middleContainer').getElementsByTagName("ul");
var id = document.getElementById('middleContainer').getElementsByTagName("ul")[0].getElementsByTagName("li")[1].getElementsByTagName("a")[0].href;
id = parseInt(id.split("xkcd.com")[1].split("/")[1]) + 1;
uls[0].appendChild(exLink(id));
uls[1].appendChild(exLink(id));
var dDiv = document.createElement('div');
dDiv.setAttribute('align', 'center');
dDiv.style.fontSize='11px';
dDiv.style.fontVariant='normal';
dDiv.style.margin = "10px 0 0 0";
dDiv.style.padding = "3px 0 3px 0";
dDiv.style.backgroundColor = "#EEEEEE";
var tSpan = document.createElement("span");
tSpan.appendChild(document.createTextNode("Title: "));
tSpan.style.color = "#999999";
dDiv.appendChild(tSpan);
dDiv.appendChild(document.createTextNode(document.getElementById('comic').getElementsByTagName('img')[0].title));
document.getElementById('comic').appendChild(dDiv);

function exLink(id) {
	var li = document.createElement("li");
	var link = document.createElement('a');
	link.setAttribute('href', 'http://www.explainxkcd.com/wiki/index.php/' + id);
	link.appendChild(document.createTextNode("Explanation"));
	link.setAttribute('title', 'Explanation on explainxkcd.com');
	li.appendChild(link);
	return li;
}