Created
June 1, 2023 22:20
-
-
Save NullDev/c297e99643eeb27ea40f00a67830c929 to your computer and use it in GitHub Desktop.
Automatically write the repo name in the confirm field when deleting a repository on GitHub
This file contains hidden or 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 GitHub Repo Delete Name Copy | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description Automatically write the repo name in the confirm field | |
// @author NullDev | |
// @match https://github.com/**/**/settings | |
// @icon https://www.google.com/s2/favicons?sz=64&domain=github.com | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
"use strict"; | |
const targetNode = document.getElementById("repo-delete-proceed-button-container"); | |
if (!targetNode) return; | |
const observer = new MutationObserver((mutationsList, observer) => { | |
for (const mutation of mutationsList){ | |
if (mutation.type !== "childList") continue; | |
const verificationField = document.getElementById("verification_field"); | |
if (!verificationField) continue; | |
const name = verificationField.dataset?.repoNwo; | |
if (name){ | |
verificationField.value = name; | |
verificationField.dispatchEvent(new Event("input", { bubbles:true })); | |
document.getElementById("repo-delete-proceed-button").disabled = false; | |
break; | |
} | |
} | |
}); | |
observer.observe(targetNode, { childList: true, subtree: true }); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment