HKG Toast Message Fixer

移除高登隱藏嘅toast bar,避免阻擋後面嘅內容點擊。

目前为 2024-09-25 提交的版本。查看 最新版本

// ==UserScript==
// @name         HKG Toast Message Fixer
// @namespace    http://tampermonkey.net/
// @version      1
// @description  移除高登隱藏嘅toast bar,避免阻擋後面嘅內容點擊。
// @author       居理夫人
// @match        *://forum.hkgolden.com/*
// @icon
// @grant        none
// @license GNU GPLv3
// ==/UserScript==

(function() {
	'use strict';


// 觀察器配置(限制觀察範圍
const config = { childList: true, subtree: true };

// 當觀察到變化時,執行檢查
const callback = function(mutationsList, observer) {
    // Use traditional 'for loops' for IE 11
    for(let mutation of mutationsList) {
            const toast = document.querySelector('.MuiSnackbarContent-root');

			if (toast) {
				const style = getComputedStyle(toast);
				// 檢查 toast 是否已經隱藏,且 opacity 為 0
				if (style.visibility === 'hidden' && style.opacity === '0') {
					// 當 toast 被隱藏時,將其完全從佈局中移除
					toast.style.display = 'none';
				}
			}
    }
};

// 建立一個觀察器
const observer = new MutationObserver(callback);

// 用上面嘅配置去觀察
observer.observe(document.body, config);


})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址