GitHub Hide Own Feed Meta

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

  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. // @match https://github.com/
  9. // @run-at document-idle
  10. // @grant none
  11. // @require https://gf.qytechs.cn/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. (() => {
  17. "use strict";
  18.  
  19. const feedClass = ".watch_started"; // starred; not sure about watch event
  20. // Set up user string as "/{user}/" to match the link's href
  21. const user = `/${document.querySelector('meta[name="user-login"]').getAttribute("content")}/`;
  22.  
  23. function init() {
  24. if (document.getElementById("dashboard")) {
  25. [...document.querySelectorAll(feedClass)].forEach(el => {
  26. // This is really fragile
  27. // div.border.rounded-1.p-3.my-2
  28. // > div (no class)
  29. // > span.f3.lh-condensed.text-bold.text-gray-dark
  30. // > a.link-gray-dark.text-bold.wb-break-all[data-ga-click]
  31. const link = el.querySelector("div.border a[data-ga-click]");
  32. if (link.href.indexOf(user) > 0) {
  33. link.closest("div.border").style.display = "none";
  34. }
  35. });
  36. // ghmo observer isn't set up to watch the feed... we'll work around it for now
  37. document.querySelector(".ajax-pagination-btn").addEventListener("click", () => {
  38. setTimeout(() => {
  39. init();
  40. }, 1500);
  41. });
  42. }
  43. }
  44.  
  45. document.addEventListener("ghmo:container", init);
  46. init();
  47. })();

QingJ © 2025

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