Last active
September 9, 2019 16:22
-
-
Save djmill0326/3e3a6d012ccd2567aa3a53eff865b595 to your computer and use it in GitHub Desktop.
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
var scripts = { | |
"guesser": "https://gist.githubusercontent.com/djmill0326/3f09d644e0c30657100d1fdcf5e739be/raw/7e0ffdef8bb7087bc8ce194e37dc12cdcbc6842f/thing.js", | |
"searchbuttons": "https://greasyfork.org/scripts/7543-google-search-extra-buttons/code/Google%20Search%20Extra%20Buttons.user.js", | |
"translatetooltip": "https://openuserjs.org/install/trespassersW/translate.google_tooltip.min.user.js" | |
}; | |
function fetchAndRunScript(url){ | |
fetch(url, {mode: 'cors'}).then( | |
function(response){ | |
response.text().then( | |
function(script){ | |
eval(script); | |
} | |
); | |
} | |
); | |
} | |
function runScript() { | |
var scriptListString = ""; | |
for (var k in scripts) { | |
if (scriptListString.length > 0) { | |
scriptListString += ", "; | |
} | |
scriptListString += '"' + k + '"'; | |
} | |
var script = prompt("What script do you want to run? Current options include: " + scriptListString); | |
var scriptUrl = scripts[script.toLowerCase()]; | |
if(!scriptUrl) { | |
alert("Script name is invalid. Try again."); | |
runScript(); | |
return; | |
} | |
fetchAndRunScript(scriptUrl); | |
} | |
runScript(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment