返回首頁 

Greasy Fork is available in English.

FanFiction.net Word Counter

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 elementfunction 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 textvar storyTextElement = document.getElementById('storytext');if (storyTextElement) {var wordCount = countWords(storyTextElement);// Create a new div to display the word countvar 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 divvar profileTopElement = document.getElementById('profile_top');if (profileTopElement) {// Inserts the word count div at the end of the profile_top elementprofileTopElement.appendChild(wordCountDiv);}}})();