您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Filter matches in online lobby to show only cam matches.
当前为
// ==UserScript== // @name DartCounter OnlyCam // @namespace http://dartcounter.net/ // @version 1.1 // @license MIT // @description Filter matches in online lobby to show only cam matches. // @match http*://dartcounter.net/* // @icon https://dartcounter.net/favicon-32x32.png // @require https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/js/all.min.js // @grant GM_getValue // @grant GM_setValue // ==/UserScript== (function() { 'use strict'; var ShowCamOnly = GM_getValue("ShowCamOnly", 1); function isCamNode(node) { let icon = node.getElementsByTagName("mat-icon")[0]; if (icon) { let iconName = icon.getAttribute("data-mat-icon-name"); if (iconName && iconName.toLowerCase() == "videocam-outline") { return true; } } return false; } function setNodeVisible(node, visible) { if (visible) { node.style.display = 'block'; } else { node.style.display = 'none'; } } var observer = new MutationObserver(function(mutations) { for (const mutation of mutations) { for (const node of mutation.addedNodes) { if (node.nodeName.toLowerCase() == "app-global-lobby-online-game") { let mainHeader = node.getElementsByClassName("main-header")[0]; if (mainHeader) { const svg = document.createElement('svg'); Object.assign(svg, { className: "fa-2xs fa-regular fa-eye", }); const icon = document.createElement('mat-icon'); Object.assign(icon, { className: "mat-icon notranslate header-button-icon mat-icon-no-color", role: "img", }); if (!ShowCamOnly) { icon.setAttribute("disabled", "disabled"); } icon.append(svg); var button = document.createElement("button"); button.addEventListener('click', function onClick(event) { if (icon.getAttribute("disabled")) { icon.removeAttribute("disabled"); ShowCamOnly = 1; } else { icon.setAttribute("disabled", "disabled"); ShowCamOnly = 0; } let nodes = document.getElementsByTagName("app-joinable-online-game"); for (const node of nodes) { setNodeVisible(node, !ShowCamOnly || isCamNode(node)); } GM_setValue('ShowCamOnly', ShowCamOnly); }); button.append(icon); mainHeader.lastElementChild.prepend(button); } } if (node.nodeName.toLowerCase() == "app-joinable-online-game") { setNodeVisible(node, !ShowCamOnly || isCamNode(node)); } } } }); observer.observe(document, {attributes: false, childList: true, characterData: false, subtree:true}); })();