HKG Toast Message Fixer

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

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

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

(function() {
	'use strict';

	// 監聽DOM變化
	const observer = new MutationObserver(mutations => {
		mutations.forEach(mutation => {
			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';
				}
			}
		});
	});

	// 開始監聽 <body> 嘅子節點變化
	observer.observe(document.body, { childList: true, subtree: true });
})();