Create Autoloader.js

This commit is contained in:
Lucas 2019-06-29 14:10:11 +01:00 committed by GitHub
parent 84577cc05b
commit 1883b32706
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 46 additions and 0 deletions

46
Autoloader.js Normal file
View File

@ -0,0 +1,46 @@
// ==UserScript==
// @name Herosaver Autoloader
// @author TeaWithLucas
// @namespace https://github.com/TeaWithLucas/Herosaver/
// @description Autoloader for the Herosaver Script
// @version 1
// @include *example.org/*
// @installURL https://raw.githubusercontent.com/TeaWithLucas/Herosaver/master/Autoloader.js
// @downloadURL https://raw.githubusercontent.com/TeaWithLucas/Herosaver/master/Autoloader.js
// @updateURL https://raw.githubusercontent.com/TeaWithLucas/Herosaver/master/Autoloader.js
// @run-at document-end
// ==/UserScript==
/*
* This file is a Greasemonkey user script. To install it, you need
* the Firefox plugin "Greasemonkey" (URL: http://greasemonkey.mozdev.org/)
* After you installed the extension, restart Firefox and revisit
* this script. Now you will see a new menu item "Install User Script"
* in your tools menu.
*
* To uninstall this script, go to your "Tools" menu and select
* "Manage User Scripts", then select this script from the list
* and click uninstall :-)
*
* Creative Commons Attribution License (--> or Public Domain)
* http://creativecommons.org/licenses/by/2.5/
*/
(function(){
//object constructor
function example(){
// run the Herosaver Script
var xhr=new XMLHttpRequest;xhr.open("get","https://raw.githubusercontent.com/TeaWithLucas/Herosaver/master/herosaver.js",true);xhr.onreadystatechange=function(){if(xhr.readyState==4){var script=document.createElement("script");script.type="text/javascript";script.text=xhr.responseText;document.body.appendChild(script)}};xhr.send(null);
};
//Wait for page load
window.addEventListener('load', function() {
//instantiate and run
var example = new example();
}, false);
})();