Open Bluscream opened 6 years ago
Hi @Bluscream!
I don't know if I'd want to actually include this kind of userscript in this repo since it may cause some accidental deletions... but, I'll add it here for prosperity:
// ==UserScript==
// @name GitHub Add Repo Name to Delete Dialog
// @version 0.1.2
// @description A userscript that adds your repo name to the delete dialog
// @license MIT
// @author Rob Garrison
// @namespace https://github.com/Mottie
// @include https://github.com/*
// @run-at document-idle
// @require https://greasyfork.org/scripts/28721-mutations/code/mutations.js?version=597950
// @icon https://assets-cdn.github.com/pinned-octocat.svg
// ==/UserScript==
(() => {
"use strict";
function addName() {
const name = document.getElementById("rename_field");
if (name) {
document.querySelector("form[action$='delete'] .input-block").value = name.value;
const btn = document.querySelector("form[action$='delete'] .btn-danger");
btn.removeAttribute("disabled");
btn.removeAttribute("data-disable-invalid");
}
}
document.addEventListener("ghmo:container", addName);
addName();
})();
Oops, I forgot to add the mutation observer... I've updated the code above.
And... one more update to re-enable the delete button... done and actually tested this time! 😸
Thanks, that one works just fine :3
Can anyone please update this to work with the new format for transfer/change visibility?
Sorry for the delay, here is the updated code:
// ==UserScript==
// @name GitHub Add Repo Name to Delete Dialog
// @version 0.2.0
// @description A userscript that adds your repo name to the delete dialog
// @license MIT
// @author Rob Garrison
// @namespace https://github.com/Mottie
// @match https://github.com/*/*/settings
// @run-at document-idle
// @require https://greasyfork.org/scripts/28721-mutations/code/mutations.js?version=1108163
// @icon https://assets-cdn.github.com/pinned-octocat.svg
// ==/UserScript==
(() => {
"use strict";
function addName() {
const dialog = document.querySelector("details-dialog[aria-label='Delete repository']");
if (dialog) {
const name = document.getElementById("rename-field");
if (name) {
dialog.querySelector("form[action$='delete'] .input-block").value = name.value;
const btn = dialog.querySelector("form[action$='delete'] .btn-danger");
btn.removeAttribute("disabled");
btn.removeAttribute("data-disable-invalid");
}
}
}
document.addEventListener("ghmo:container", addName);
addName();
})();
They updated it again :(
When having the "confirm with name of repo" dialog could you make it read and enter the name automatically?
I feel safe enough with that click on a big red button and copy pasting becomes annoying. Especially whith a huge amount of repos you want to edit