您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Truncate words containing '·' at the middle dot
// ==UserScript== // @name Middle dot word truncator // @namespace Violentmonkey Scripts // @match *://*/* // @grant none // @version 1.1 // @author kirinyaga // @description Truncate words containing '·' at the middle dot // @license MIT // ==/UserScript== (function() { 'use strict'; // Function to process text nodes function processTextNode(node) { const text = node.nodeValue; // Split text into words while preserving whitespace const words = text.split(/(\s+)/); // Process each word const processedWords = words.map(word => { // Skip whitespace-only segments if (/^\s+$/.test(word)) return word; // Check if word contains middle dot if (word.includes('·')) { // Split at first middle dot and take the part before it return word.split('·')[0]; } return word; }); // Reconstruct the text const newText = processedWords.join(''); // Only update if changed if (newText !== text) { node.nodeValue = newText; } } function scanTextNodes() { // Create a TreeWalker to traverse all text nodes const treeWalker = document.createTreeWalker( document.body, NodeFilter.SHOW_TEXT, { acceptNode: function(node) { // Skip text nodes in script, style, and textarea elements if (node.parentNode.nodeName === 'SCRIPT' || node.parentNode.nodeName === 'STYLE' || node.parentNode.nodeName === 'TEXTAREA') { return NodeFilter.FILTER_SKIP; } return NodeFilter.FILTER_ACCEPT; } }, false ); // Process each text node const textNodes = []; while (treeWalker.nextNode()) { textNodes.push(treeWalker.currentNode); } // Process nodes in reverse to avoid issues with DOM modification for (let i = textNodes.length - 1; i >= 0; i--) { processTextNode(textNodes[i]); } } setTimeout(scanTextNodes,3000); })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址