您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Ignores the "Skip question" votes and re-calculates percentages.
// ==UserScript== // @name Runescape Oldschool - Correct Poll Results // @description Ignores the "Skip question" votes and re-calculates percentages. // @namespace Shaun Dreclin // @version 1.0 // @match http://services.runescape.com/m=poll/*oldschool/results.ws?id=* // @grant none // ==/UserScript== (function() { 'use strict'; document.querySelectorAll("fieldset.question").forEach(function(fieldset) { var totalVotes = 0; fieldset.querySelectorAll("tr").forEach(function(tr) { var option = tr.querySelector("td:nth-of-type(1)").innerHTML; var votes = parseInt(tr.querySelector("td:nth-of-type(3)").innerHTML.split("(")[1].split(" ")[0], 10); if(option != "Skip question") { totalVotes += votes; } }); fieldset.querySelectorAll("tr").forEach(function(tr) { var option = tr.querySelector("td:nth-of-type(1)").innerHTML; var votes = parseInt(tr.querySelector("td:nth-of-type(3)").innerHTML.split("(")[1].split(" ")[0], 10); var percent = Math.round(votes / totalVotes * 1000) / 10; if(option != "Skip question") { tr.querySelector("td:nth-of-type(2) img:nth-of-type(2)").width = Math.round(percent) * 2; tr.querySelector("td:nth-of-type(3)").innerHTML = percent + "% (" + votes.toLocaleString() + ")"; if(option == "Yes" && percent >= 75) { fieldset.style.background = "rgba(0, 100, 0, 0.2)"; } } else { tr.style.opacity = 0.25; tr.querySelector("td:nth-of-type(2)").innerHTML = ""; tr.querySelector("td:nth-of-type(3)").innerHTML = "(" + votes.toLocaleString() + ")"; } }); }); })();