Improved greasemonkey script by adding scope
This commit is contained in:
parent
e7e8269cbf
commit
6509400f8e
|
@ -1,16 +1,21 @@
|
|||
// ==UserScript==
|
||||
// @name HeroSaver for HeroForge
|
||||
// @version 1
|
||||
// @description Automatically load HeroSaver when visiting HeroForge
|
||||
// @namespace https://github.com/christofsteel/herosaver
|
||||
// @match https://www.heroforge.com/
|
||||
// @grant none
|
||||
// ==/UserScript==
|
||||
|
||||
var observerOptions = {
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
var observerOptions = {
|
||||
childList: true,
|
||||
subtree: true
|
||||
}
|
||||
}
|
||||
|
||||
var observer = new MutationObserver(function(mutationList, observer) {
|
||||
var observer = new MutationObserver(function(mutationList, observer) {
|
||||
mutationList.forEach((mutation) => {
|
||||
if (Array.from(mutation.removedNodes).some((element) => {
|
||||
return element.className === "loadingScreen";
|
||||
|
@ -29,5 +34,6 @@ var observer = new MutationObserver(function(mutationList, observer) {
|
|||
xhr.send(null);
|
||||
}
|
||||
});
|
||||
});
|
||||
observer.observe(document.querySelector("body"), observerOptions);
|
||||
});
|
||||
observer.observe(document.querySelector("body"), observerOptions);
|
||||
})();
|
||||
|
|
Loading…
Reference in New Issue