auto-expand-github-issues

cleanup noisy timeline items and auto expand

  1. // ==UserScript==
  2. // @name auto-expand-github-issues
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1.2
  5. // @description cleanup noisy timeline items and auto expand
  6. // @author pengx17
  7. // @match https://github.com/*/issues/*
  8. // @match https://github.com/*/pull/*
  9. // @icon https://www.google.com/s2/favicons?sz=64&domain=github.com
  10. // @require https://cdn.jsdelivr.net/npm/@holoflows/kit@0.9.0/umd/index.cjs
  11. // @grant none
  12. // @license MIT
  13. // ==/UserScript==
  14.  
  15. (function () {
  16. "use strict";
  17.  
  18. // Your code here...
  19. async function main() {
  20. const { LiveSelector, MutationObserverWatcher } = HoloflowsKit;
  21. autoLoadMore();
  22. hideGitHubActionItems();
  23.  
  24. ////
  25. function autoLoadMore() {
  26. const loadMoreButton = new LiveSelector().querySelector(
  27. "button.ajax-pagination-btn"
  28. );
  29. // auto expand github timeline
  30. new MutationObserverWatcher(
  31. loadMoreButton,
  32. document.querySelector("#repo-content-turbo-frame")
  33. )
  34. .useForeach((node, key, meta) => {
  35. node.click();
  36. })
  37. .startWatch({ attributes: true, childList: true, subtree: true });
  38. }
  39.  
  40. function hideGitHubActionItems() {
  41. const items = new LiveSelector().querySelectorAll(
  42. ".js-timeline-item .js-updatable-content"
  43. );
  44. // auto expand github timeline
  45. new MutationObserverWatcher(
  46. items,
  47. document.querySelector("#repo-content-turbo-frame")
  48. )
  49. .useForeach((node, key, meta) => {
  50. const hideNode = () => {
  51. if (node.innerText.includes("with GitHub Actions") || node.innerText.includes('View deployment')) {
  52. node.style.display = "none";
  53. } else {
  54. node.style.display = "block";
  55. }
  56. };
  57. hideNode();
  58. return {
  59. onNodeMutation: hideNode,
  60. };
  61. })
  62. .startWatch({ attributes: true, childList: true, subtree: true });
  63. }
  64. }
  65.  
  66. main();
  67. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址