NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript==
// @namespace https://openuserjs.org/users/TwentyPorts
// @name Habitica Dismiss Alerts
// @description Automatically dismisses alerts.
// @author TwentyPorts
// @license MIT
// @version 1
// @include https://habitica.com/*
// ==/UserScript==
let callback = function (mutationList, observer) {
//console.log("called callback");
const dismissButton = document.querySelector("div.modal-footer > .btn-primary");
if(dismissButton !== null) {
console.log("found button");
dismissButton.click();
document.querySelector("body").style.overflow = "visible"; // enables scrollbar, otherwise you'll have to refresh after this script clicks a button
observer.disconnect();
}
}
// Setup a MutationObserver to watch the document for the nodes we need.
let targetNode = document.querySelector('body');
let observerConfig = {
childList: true,
subtree: true,
};
let observer = new MutationObserver(callback);
observer.observe(targetNode, observerConfig);