LiveJournal Comments expander

Allows you to automatically expand all comments on the page

当前为 2023-03-12 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name LiveJournal Comments expander
  3. // @namespace Whiletruedoend
  4. // @original-script https://gist.github.com/Whiletruedoend
  5. // @original-script https://greasyfork.org/ru/scripts/461690-livejournal-comments-expander
  6. // @version 1.0
  7. // @description Allows you to automatically expand all comments on the page
  8. // @author Whiletruedoend
  9. // @match *.livejournal.com/*
  10. // @match livejournal.com/*
  11. // @icon https://www.google.com/s2/favicons?sz=64&domain=livejournal.com
  12. // @grant none
  13. // @license GNU GPLv3
  14. // ==/UserScript==
  15.  
  16. function expandComments(doc){
  17. var compactedComments = doc.querySelectorAll('[id^="expand_"], [class^=" mdspost-comment-actions__item mdspost-comment-actions__item--expandchilds "]');
  18.  
  19. for (var i in compactedComments) {
  20. var elem = compactedComments[i]
  21. if (elem && elem.lastChild && elem.lastChild.nodeName!="#text"){
  22. elem.lastChild.click();
  23. }
  24. }
  25. }
  26.  
  27. expandComments(document);