Show all comments on github issue

Automatically clicks the "xxx hidden items" button on Github issue pages to successively load in all the comments in the page on load.

当前为 2021-12-31 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Show all comments on github issue
  3. // @namespace https://www.taylrr.co.uk
  4. // @version 0.1
  5. // @description Automatically clicks the "xxx hidden items" button on Github issue pages to successively load in all the comments in the page on load.
  6. // @author taylor8294
  7. // @match https://github.com/*/issues/*
  8. // @icon https://icons.duckduckgo.com/ip2/github.com.ico
  9. // @grant none
  10. // @license GPLv3
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. 'use strict';
  15.  
  16. function ready(fn) {
  17. if (document.attachEvent ? document.readyState === "complete" : document.readyState !== "loading"){
  18. fn();
  19. } else {
  20. document.addEventListener('DOMContentLoaded', fn);
  21. }
  22. }
  23.  
  24. function clickButton(){
  25. let button = document.querySelector('.ajax-pagination-form button');
  26. if(button){
  27. if(!button.disabled) button.click();
  28. setTimeout(clickButton,50);
  29. } else console.log('All comments are now showing.')
  30. }
  31. ready(()=>{setTimeout(clickButton,2000)});
  32. })();