Wakaba Reply Links

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

  1. // ==UserScript==
  2. // @name Wakaba Reply Links
  3. // @namespace http://dluciv.name/
  4. // @description Wakaba Reply Links. Click pastes >>... link to reply form, context menu allows to copy URL with #... reply reference
  5. // @namespace http://dluciv.name/
  6. // @copyright 2014+, Dmitry V. Luciv
  7. // @license WTFPLv2; http://wtfpl.net
  8. // @license MIT; http://opensource.org/licenses/MIT
  9. // @version 0.0.0.7
  10. // @homepage https://github.com/dluciv/UserScripts/tree/master/wakaba-links
  11. // @icon https://raw.githubusercontent.com/dluciv/UserScripts/master/wakaba-links/unyl-chan.png
  12. // @grant none
  13. // @include http://iichan.hk/*
  14. // ==/UserScript==
  15.  
  16. "use strict";
  17.  
  18. try {
  19. var replies = document.querySelectorAll('td[id^="reply"]');
  20.  
  21. var mkHandler = function (anchor) {
  22. return function (e) {
  23. e.preventDefault();
  24. window.insert(">>" + anchor); // do as before
  25. };
  26. };
  27.  
  28. for(var nreply = 0; nreply < replies.length; nreply++)
  29. {
  30. var reply = replies[nreply];
  31. var rlhref = reply.querySelector(
  32. 'span.reflink a[href^="javascript:insert("]'
  33. );
  34. var rid = reply.getAttribute('id').replace('reply', '');
  35. rlhref.setAttribute('href', "#" + rid);
  36. rlhref.addEventListener('click', mkHandler(rid));
  37. }
  38. } catch(e) {
  39. console.log(e);
  40. }