Wakaba Reply Links

Wakaba Reply Links. Click pastes >>... link to reply form, context menu allows to copy URL with #... reply reference

目前為 2014-08-25 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name          Wakaba Reply Links
// @namespace     http://dluciv.name/
// @description   Wakaba Reply Links. Click pastes >>... link to reply form, context menu allows to copy URL with #... reply reference
// @namespace     http://dluciv.name/
// @copyright     2014+, Dmitry V. Luciv
// @license       WTFPLv2; http://wtfpl.net
// @license       MIT; http://opensource.org/licenses/MIT
// @version       0.0.0.5
// @homepage      https://github.com/dluciv/UserScripts/tree/master/wakaba-links
// @icon          https://raw.githubusercontent.com/dluciv/UserScripts/master/wakaba-links/unyl-chan.png
// @grant         none
// @include       http://iichan.hk/*
// ==/UserScript==

try {
    var replies = document.querySelectorAll('td[id^="reply"]');
    for(var nreply in replies)
    {
	var reply = replies[nreply];
	var rlhref = reply.querySelector('span.reflink a[href^="javascript:insert("]');
	var rid = reply.getAttribute('id').replace('reply', '');
	rlhref.setAttribute('href', "#" + rid);
	(function(){ // yes, JS is so mutable...
	    var _rid = rid; // so we need this
	    rlhref.addEventListener('click', function(e) {
		e.preventDefault();
		window.insert(">>" + _rid); // do as before
	    });
	})();
    }
} catch(e) {
    console.log(e);
}