// ==UserScript== // @name MouseHunt - Gifting Buttons // @author Tran Situ (tsitu) // @namespace https://greasyfork.org/en/users/232363-tsitu // @version 1.3 // @description Adds buttons to easily ignore, accept, or return all free gifts // @match http://www.mousehuntgame.com/* // @match https://www.mousehuntgame.com/* // @downloadURL none // ==/UserScript== (function() { const observerTarget = document.querySelector("#overlayPopup"); if (observerTarget) { MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver; const observer = new MutationObserver(function() { // Callback const claimableExists = document.querySelector( ".giftSelectorView-tabContent.selectClaimableGift" ); if (claimableExists) { // Disconnect and reconnect later to prevent infinite mutation loop observer.disconnect(); // Render buttons if 'Claim Free Gifts' dialog is in DOM buildUI(); observer.observe(observerTarget, { childList: true, subtree: true }); } }); // Observe mutations in