Skip to content

Instantly share code, notes, and snippets.

@NullDev
Created June 1, 2023 22:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NullDev/c297e99643eeb27ea40f00a67830c929 to your computer and use it in GitHub Desktop.
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
// ==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