Wakaba Reply Links

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

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          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.7
// @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==

"use strict";

try {
    var replies = document.querySelectorAll('td[id^="reply"]');

    var mkHandler = function (anchor) {
        return function (e) {
            e.preventDefault();
            window.insert(">>" + anchor); // do as before
        };
    };

    for(var nreply = 0; nreply < replies.length; nreply++)
    {
        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);
        rlhref.addEventListener('click', mkHandler(rid));
    }
} catch(e) {
    console.log(e);
}