🏠 Home 

GitHub Feed Back

Bring my GitHub feed back

  1. // ==UserScript==
  2. // @name GitHub Feed Back
  3. // @namespace https://github.com/Sec-ant
  4. // @version 0.1.5
  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.git
  12. // @supportURL https://github.com/Sec-ant/github-feed-back/issues
  13. // @match https://github.com/
  14. // @match https://github.com/?*
  15. // @match https://github.com/dashboard*
  16. // @run-at document-start
  17. // ==/UserScript==
  18. (function () {
  19. 'use strict';
  20. let isIncludeFragmentFound = false;
  21. let isFilterButtonFound = false;
  22. const observer = new MutationObserver((_, observer2) => {
  23. const includeFragment = document.querySelector(
  24. '[data-target="feed-container.content"] > include-fragment'
  25. );
  26. if (includeFragment) {
  27. includeFragment.setAttribute("src", "/dashboard-feed");
  28. isIncludeFragmentFound = true;
  29. }
  30. const filterButton = document.querySelector(
  31. '[data-target="feed-container.feedTitle"] + div'
  32. );
  33. if (filterButton) {
  34. filterButton.remove();
  35. isFilterButtonFound = true;
  36. }
  37. if (isIncludeFragmentFound && isFilterButtonFound) {
  38. observer2.disconnect();
  39. }
  40. });
  41. observer.observe(document.documentElement, {
  42. childList: true,
  43. subtree: true
  44. });
  45. document.addEventListener("DOMContentLoaded", () => {
  46. observer.disconnect();
  47. });
  48. })();