您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Automatically dismisses alerts.
// ==UserScript== // @name Habitica Dismiss Alerts // @description Automatically dismisses alerts. // @author TwentyPorts // @license MIT // @version 1 // @include https://habitica.com/* // @namespace https://greasyfork.org/users/737264 // ==/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);