Voat Autoexpand

Autoexpand Voat

  1. // ==UserScript==
  2. // @name Voat Autoexpand
  3. // @description Autoexpand Voat
  4. // @namespace https://voat.co/user/InsistentCooperative
  5. // @match *://*.voat.co/v/*
  6. // @version 1
  7. // @grant none
  8. // @license MIT
  9. // @license WTFPL
  10. // @license Public Domain
  11. // ==/UserScript==
  12.  
  13. const MAXITERS = 100;
  14. const INTERVAL = 300;
  15. let its = 0;
  16. (function expand () {
  17. let more = document.querySelectorAll('#loadmorebutton,.inline-loadcomments-btn');
  18. let coll = document.querySelectorAll('.collapsed:not([style*="none"]) > a.expand:first-of-type');
  19. for (let _ of more) { _.onclick(); } // if js off, onclick is a string, and this will produce an error.
  20. for (let _ of coll) { _.onclick(); }
  21. if (more.length && ++its < MAXITERS) setTimeout(expand, INTERVAL);
  22. })();