您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Display word count for the current chapter on FanFiction.net
// ==UserScript== // @name FanFiction.net Word Counter // @namespace https://github.com/erasels // @version 1.0 // @description Display word count for the current chapter on FanFiction.net // @author erasels // @match https://www.fanfiction.net/s/* // @icon https://www.fanfiction.net/favicon.ico // @grant none // @license MIT // ==/UserScript== (function() { 'use strict'; // Function to count words in the specified element function countWords(element) { var text = element.innerText || element.textContent; return text.split(/\s+/).filter(function(n) { return n != '' }).length; } // Find the element that contains the story text var storyTextElement = document.getElementById('storytext'); if (storyTextElement) { var wordCount = countWords(storyTextElement); // Create a new div to display the word count var wordCountDiv = document.createElement('div'); wordCountDiv.setAttribute('style', 'margin-top: 0px; text-align: center; color: black; font-weight: bold;'); wordCountDiv.innerText = 'Chapter Word Count: ' + wordCount; // Find the profile_top div and insert the word count div var profileTopElement = document.getElementById('profile_top'); if (profileTopElement) { // Inserts the word count div at the end of the profile_top element profileTopElement.appendChild(wordCountDiv); } } })();