Last active
December 14, 2023 19:32
-
-
Save Hypfer/6f10fadbc1aacf540c39eadef7661bb3 to your computer and use it in GitHub Desktop.
This userscript hides the nagging notification boxes that remind you that you've enabled interaction limits on a repo or account
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Hide Github Interaction Limits Nagging Notifications | |
// @namespace Violentmonkey Scripts | |
// @match https://github.com/** | |
// @grant none | |
// @version 1.1 | |
// @author - | |
// @description 23/12/2022, 14:51:33 | |
// ==/UserScript== | |
let loopTimeout; | |
function loop() { | |
const alertElements = [ | |
...document.querySelectorAll('.flash.mb-3'), | |
...document.querySelectorAll('[class^="Flash"]') | |
]; | |
for (let i = 0; i < alertElements.length; i++) { | |
const alertElement = alertElements[i]; | |
if(alertElement.textContent?.includes("interaction limit")) { | |
alertElement.remove() | |
} | |
} | |
if (document.visibilityState === 'visible') { | |
loopTimeout = setTimeout(() => { | |
loop() | |
}, 1000); | |
} | |
} | |
document.addEventListener("visibilitychange", () => { | |
if (document.visibilityState === 'visible') { | |
loop(); | |
} else { | |
clearTimeout(loopTimeout); | |
} | |
}); | |
loop(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment