GitHub Feed Back

Bring my GitHub feed back

目前为 2023-09-07 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name GitHub Feed Back
  3. // @namespace https://github.com/Sec-ant
  4. // @version 0.0.2
  5. // @author Ze-Zheng Wu
  6. // @description Bring my GitHub feed back
  7. // @license MIT
  8. // @icon https://github.githubassets.com/favicons/favicon.svg
  9. // @homepage https://github.com/Sec-ant/github-feed-back
  10. // @homepageURL https://github.com/Sec-ant/github-feed-back
  11. // @source https://github.com/Sec-ant/github-feed-back
  12. // @supportURL https://github.com/Sec-ant/github-feed-back/issues
  13. // @match https://github.com/*
  14. // @run-at document-start
  15. // ==/UserScript==
  16.  
  17. (function () {
  18. 'use strict';
  19.  
  20. let found = 0;
  21. const observer = new MutationObserver((_, observer2) => {
  22. const includeFragment = document.querySelector(
  23. '[data-target="feed-container.content"] > include-fragment'
  24. );
  25. if (includeFragment) {
  26. includeFragment.src = "/dashboard-feed";
  27. ++found;
  28. }
  29. const filterButton = document.querySelector(
  30. '[data-target="feed-container.feedTitle"] + div'
  31. );
  32. if (filterButton) {
  33. filterButton.remove();
  34. ++found;
  35. }
  36. if (found > 1) {
  37. observer2.disconnect();
  38. }
  39. });
  40. observer.observe(document.documentElement, {
  41. childList: true,
  42. subtree: true
  43. });
  44. document.addEventListener("DOMContentLoaded", () => {
  45. observer.disconnect();
  46. });
  47.  
  48. })();