Wakaba Reply Links

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

当前为 2014-08-25 提交的版本,查看 最新版本

  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.5
  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. try {
  17. var replies = document.querySelectorAll('td[id^="reply"]');
  18. for(var nreply in replies)
  19. {
  20. var reply = replies[nreply];
  21. var rlhref = reply.querySelector('span.reflink a[href^="javascript:insert("]');
  22. var rid = reply.getAttribute('id').replace('reply', '');
  23. rlhref.setAttribute('href', "#" + rid);
  24. (function(){ // yes, JS is so mutable...
  25. var _rid = rid; // so we need this
  26. rlhref.addEventListener('click', function(e) {
  27. e.preventDefault();
  28. window.insert(">>" + _rid); // do as before
  29. });
  30. })();
  31. }
  32. } catch(e) {
  33. console.log(e);
  34. }