xkcd Title and Explain

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

スクリプトをインストールするには、Tampermonkey, GreasemonkeyViolentmonkey のような拡張機能のインストールが必要です。

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

スクリプトをインストールするには、TampermonkeyViolentmonkey のような拡張機能のインストールが必要です。

スクリプトをインストールするには、TampermonkeyUserscripts のような拡張機能のインストールが必要です。

このスクリプトをインストールするには、Tampermonkeyなどの拡張機能をインストールする必要があります。

このスクリプトをインストールするには、ユーザースクリプト管理ツールの拡張機能をインストールする必要があります。

(ユーザースクリプト管理ツールは設定済みなのでインストール!)

このスタイルをインストールするには、Stylusなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus などの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus tなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

(ユーザースタイル管理ツールは設定済みなのでインストール!)

このスクリプトの質問や評価の投稿はこちら通報はこちらへお寄せください
// ==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;
}