您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Provides an API for other userscripts to add tabs to a site's settings menu.
当前为
此脚本不应直接安装,它是供其他脚本使用的外部库。如果您需要使用该库,请在脚本元属性加入:// @require https://update.gf.qytechs.cn/scripts/533630/1575656/Settings%20Tab%20Manager%20%28STM%29.js
// ==UserScript== // @name Settings Tab Manager (STM) // @namespace shared-settings-manager // @version 1.1.2 // Incremented version // @description Provides an API for other userscripts to add tabs to a site's settings menu. // @author Your Name (or AI Collaborator) // @license MIT // @match https://8chan.moe/* // @match https://8chan.se/* // @grant GM_addStyle // @run-at document-idle // ==/UserScript== (function() { 'use strict'; // ... (Constants, State, Readiness Promise, Public API Definition, Styling remain the same) ... const log = (...args) => console.log(`[${MANAGER_ID}]`, ...args); const warn = (...args) => console.warn(`[${MANAGER_ID}]`, ...args); const error = (...args) => console.error(`[${MANAGER_ID}]`, ...args); const MANAGER_ID = 'SettingsTabManager'; const SELECTORS = {/* ... */}; const ACTIVE_CLASSES = {/* ... */}; const ATTRS = {/* ... */}; // ... (findSettingsElements, deactivateCurrentTab, activateTab remain the same) ... function activateTab(scriptId) { /* ... same code ... */ } function deactivateCurrentTab() { /* ... same code ... */ } /** Handles clicks within the tab container. */ function handleTabClick(event) { // Find the closest ancestor tab element that was created by STM const clickedTab = event.target.closest(`span[${ATTRS.MANAGED}][${ATTRS.SCRIPT_ID}]`); if (clickedTab) { // REMOVED: event.stopPropagation(); - Let the event bubble up for the site's handlers const scriptId = clickedTab.getAttribute(ATTRS.SCRIPT_ID); if (scriptId) { activateTab(scriptId); // Call the internal activate function } } else { // If a non-STM tab was clicked, make sure our active tab is deactivated // Check if the actual clicked target or its ancestor is a site tab NOT managed by STM if (event.target.closest(`${SELECTORS.SITE_TAB}:not([${ATTRS.MANAGED}])`)) { deactivateCurrentTab(); } } } // ... (attachTabClickListener, createSeparator, createTabAndPanel, processPendingRegistrations remain the same) ... function createTabAndPanel(config) { /* ... same code ... */ } function attachTabClickListener() { /* ... same code ... */ } // ... (Initialization, Observer, API Implementation, Global Exposure remain the same) ... function initializeManager() { /* ... same code ... */ } const observer = new MutationObserver(/* ... */); // ... start observer ... // ... initializeManager() call ... // ... API Implementation functions (registerTabImpl etc.) ... // ... Global Exposure logic ... })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址