您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Adds a button to alert the current page term statuses
当前为
// ==UserScript== // @name Lute: Current Page Statuses Alert Button // @version 20240507 // @description Adds a button to alert the current page term statuses // @author jamesdeluk // @match http://localhost:500*/read/* // @grant none // @homepageURL https://greasyfork.org/en/scripts/493338-lute-current-page-statuses-alert-button // @supportURL https://greasyfork.org/en/scripts/493338-lute-current-page-statuses-alert-button/feedback // @namespace https://greasyfork.org/users/242246 // ==/UserScript== (function() { 'use strict'; window.addEventListener('load', function() { const btn_statuses = document.createElement('button'); btn_statuses.textContent = "%"; btn_statuses.style.position = "fixed"; btn_statuses.style.left = "0"; btn_statuses.style.top = "50%"; btn_statuses.style.transform = "translateY(-50%)"; btn_statuses.style.margin = "0.1em"; btn_statuses.style.padding = "0.1em 0.1em"; btn_statuses.style.zIndex = "1000"; btn_statuses.onclick = function() { const statusNames = { 'status0': '?', 'status1': '1', 'status2': '2', 'status3': '3', 'status4': '4', 'status5': '5', 'status99': '✓', 'status98': 'X' }; let totalStatusCount = 0; let statusCounts = Object.keys(statusNames).map(status => { let count = document.getElementsByClassName(status).length; totalStatusCount += count; return {status: statusNames[status], count}; }); let results = 'Status Counts:\n'; let bars = 'Visual Representation:\n'; statusCounts.forEach(({status, count}) => { let percentage = (count / totalStatusCount) * 100; let barLength = Math.round(percentage / 5); let bar = new Array(barLength + 1).join('+'); results += `${status.padEnd(2)} : ${String(count).padEnd(2)} (${percentage.toFixed(1)}%)\n`; bars += `${status.padEnd(2)} : ${bar}\n`; }); alert(results + '\n' + bars); }; document.body.appendChild(btn_statuses); }); })();