Last active
August 29, 2023 11:37
-
-
Save Nilstrieb/d8ec3e604e644e9d8aa5aaf8a3954b62 to your computer and use it in GitHub Desktop.
Code 55% faster with GitHub Copilot!.user.js
This file contains 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 Code 55% faster with GitHub Copilot! | |
// @description Code 55% faster with GitHub Copilot! | |
// @version 55.6 | |
// @downloadURL https://gist.github.com/Nilstrieb/d8ec3e604e644e9d8aa5aaf8a3954b62/raw/3f4bc8aca17731ce3b51bbf309796c5f7cf05e90/Code%252055%2525%2520faster%2520with%2520GitHub%2520Copilot!.user.js | |
// @updateURL https://gist.github.com/Nilstrieb/d8ec3e604e644e9d8aa5aaf8a3954b62/raw/3f4bc8aca17731ce3b51bbf309796c5f7cf05e90/Code%252055%2525%2520faster%2520with%2520GitHub%2520Copilot!.user.js | |
// @match https://github.com/* | |
// @icon https://www.google.com/s2/favicons?sz=64&domain=github.com | |
// @grant none | |
// ==/UserScript== | |
// Based on https://gist.github.com/Nemo157/a4df65856b79d50f184974a475c7ce98/raw/Code%252055%2525%2520faster%2520with%2520GitHub%2520Copilot!.user.js | |
(function() { | |
'use strict' | |
const s = "Code 55% faster with GitHub Copilot!" | |
const s2 = "Copilot!" | |
const replace = () => { | |
const els = [] | |
for (const el of document.all) { | |
if (el.childElementCount !== 0 || !("innerText" in el)) continue; | |
const { innerText } = el; | |
if (innerText == s || innerText == s2) continue; | |
const len = innerText.trim().length; | |
if (len == 0) continue; | |
if (len > (s.length - 20) && len < (s.length + 20)) { | |
els.push([el, s]) | |
} else if (len < 20) { | |
els.push([el, s2]); | |
} | |
} | |
let [el, replacement] = els[Math.floor(Math.random() * els.length)] | |
if (!el) return; | |
console.log(`replacing '${el.innerText}'`) | |
el.innerText = replacement | |
setTimeout(replace, 1000); | |
} | |
setTimeout(replace, 1000); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment