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