UNPKG

1.84 kBJavaScriptView Raw
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// @downloadURL https://registry.npmmirror.com/github-feed-back/latest/files/dist/github-feed-back.user.js
14// @updateURL https://registry.npmmirror.com/github-feed-back/latest/files/dist/github-feed-back.meta.js
15// @match https://github.com/
16// @match https://github.com/?*
17// @match https://github.com/dashboard*
18// @run-at document-start
19// ==/UserScript==
20
21(function () {
22 'use strict';
23
24 let isIncludeFragmentFound = false;
25 let isFilterButtonFound = false;
26 const observer = new MutationObserver((_, observer2) => {
27 const includeFragment = document.querySelector(
28 '[data-target="feed-container.content"] > include-fragment'
29 );
30 if (includeFragment) {
31 includeFragment.setAttribute("src", "/dashboard-feed");
32 isIncludeFragmentFound = true;
33 }
34 const filterButton = document.querySelector(
35 '[data-target="feed-container.feedTitle"] + div'
36 );
37 if (filterButton) {
38 filterButton.remove();
39 isFilterButtonFound = true;
40 }
41 if (isIncludeFragmentFound && isFilterButtonFound) {
42 observer2.disconnect();
43 }
44 });
45 observer.observe(document.documentElement, {
46 childList: true,
47 subtree: true
48 });
49 document.addEventListener("DOMContentLoaded", () => {
50 observer.disconnect();
51 });
52
53})();
\No newline at end of file