GitHub Hide Own Feed Meta

A userscript that hides your own repo metadata in the GitHub feed

目前为 2022-10-24 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name GitHub Hide Own Feed Meta
  3. // @version 0.1.9
  4. // @description A userscript that hides your own repo metadata in the GitHub feed
  5. // @license MIT
  6. // @author Rob Garrison
  7. // @namespace https://github.com/Mottie
  8. // @include https://github.com/
  9. // @run-at document-idle
  10. // @grant none
  11. // @require https://greasyfork.org/scripts/28721-mutations/code/mutations.js?version=1108163
  12. // @icon https://github.githubassets.com/pinned-octocat.svg
  13. // @supportURL https://github.com/Mottie/GitHub-userscripts/issues
  14. // ==/UserScript==
  15. (() => {
  16. "use strict";
  17.  
  18. const feedClass = ".watch_started"; // starred; not sure about watch event
  19. // Set up user string as "/{user}/" to match the link's href
  20. const user = `/${document.querySelector('meta[name="user-login"]').getAttribute("content")}/`;
  21.  
  22. function init() {
  23. if (document.getElementById("dashboard")) {
  24. [...document.querySelectorAll(feedClass)].forEach(el => {
  25. // This is really fragile
  26. // div.border.rounded-1.p-3.my-2
  27. // > div (no class)
  28. // > span.f3.lh-condensed.text-bold.text-gray-dark
  29. // > a.link-gray-dark.text-bold.wb-break-all[data-ga-click]
  30. const link = el.querySelector("div.border a[data-ga-click]");
  31. if (link.href.indexOf(user) > 0) {
  32. link.closest("div.border").style.display = "none";
  33. }
  34. });
  35. // ghmo observer isn't set up to watch the feed... we'll work around it for now
  36. document.querySelector(".ajax-pagination-btn").addEventListener("click", () => {
  37. setTimeout(() => {
  38. init();
  39. }, 1500);
  40. });
  41. }
  42. }
  43.  
  44. document.addEventListener("ghmo:container", init);
  45. init();
  46. })();