您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Highlight users in tickers.
当前为
// ==UserScript== // @name User Highlighting // @namespace http://tampermonkey.net/ // @version 0.1 // @description Highlight users in tickers. // @author Winston Smith // @license MIT // @match https://www.derstandard.at/jetzt/livebericht/* // @icon https://www.google.com/s2/favicons?domain=derstandard.at // @grant none // ==/UserScript== // Background color for highlighted users. const COLOR = "lightblue"; (function() { 'use strict'; let isDelayed = false; // Executed on DOM changes and limit the update rate. function onDomChange() { if (!isDelayed) { highlightYourself(); isDelayed = true; setTimeout(() => { isDelayed = false; }, 2500); } } const observer = new MutationObserver(onDomChange); const targetNode = document.body; const config = { childList: true, subtree: true }; observer.observe(targetNode, config); function highlightYourself() { let legacyID = JSON.parse(localStorage.userdata).value.communityIdentityId; let xpath = `//a[contains(@href, '/legacy/${legacyID}') and contains(@class, 'upost-usercontainer')]/..`; let nodes = document.evaluate(xpath, document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null); for (let i = 0; i < nodes.snapshotLength; i++) { const element = nodes.snapshotItem(i); element.style.backgroundColor = COLOR; } } })();