Last active
January 15, 2020 15:58
-
-
Save simonwep/8d35f1a313bb10ebbfa5ed1f74b4c259 to your computer and use it in GitHub Desktop.
Revisions
-
simonwep renamed this gist
Jan 15, 2020 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
simonwep created this gist
Dec 22, 2019 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,45 @@ // ==UserScript== // @name GitHub auto confirm // @version 1.0 // @namespace http://tampermonkey.net/ // @description Automatically inserts your repo name in dialogs // @match https://*.github.com/* // @grant none // @run-at document-end // ==/UserScript== !async function () { const details = [...document.querySelectorAll('details')]; for (const detail of details) { detail.addEventListener('toggle', function ret() { if (detail.open) { const button = detail.querySelector('summary'); const verifyInput = detail.querySelector('[name=verify]'); const form = detail.querySelector('form'); const match = location.href.match(/([^\/]+?\/[^\/]+?)\/settings$/i); if (!verifyInput || !form || !match) { detail.removeEventListener('toggle', ret); return; } let offset = 0; const [, str] = match; const interval = setInterval(() => { verifyInput.value = str.slice(0, offset); offset++; if (offset > str.length) { form.dispatchEvent(new Event('change')); clearInterval(interval); if (button) { console.log(`[GHAC] Auto-filled form for "${button.innerText.trim()}"`); } } }, Math.random() * 25 + 10); } }); } }();