Code Monkey home page Code Monkey logo

Comments (7)

Mottie avatar Mottie commented on May 23, 2024 2

And... one more update to re-enable the delete button... done and actually tested this time! 😸

from github-userscripts.

Mottie avatar Mottie commented on May 23, 2024 1

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();
})();

from github-userscripts.

Mottie avatar Mottie commented on May 23, 2024

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();
})();

from github-userscripts.

Mottie avatar Mottie commented on May 23, 2024

Oops, I forgot to add the mutation observer... I've updated the code above.

from github-userscripts.

Bluscream avatar Bluscream commented on May 23, 2024

Thanks, that one works just fine :3

from github-userscripts.

Bluscream avatar Bluscream commented on May 23, 2024

Can anyone please update this to work with the new format for transfer/change visibility?

from github-userscripts.

Bluscream avatar Bluscream commented on May 23, 2024

They updated it again :(

from github-userscripts.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.