您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Display weighted score (i.e. Re+½Im) at the leaderboard.
当前为
// ==UserScript== // @name Graphomata Leaderboard Weighted Score Display // @description Display weighted score (i.e. Re+½Im) at the leaderboard. // @namespace http://tampermonkey.net/ // @version 2024-02-27 // @author WYXkk // @match https://graphomata.com/game/leaderboards.html // @icon https://www.google.com/s2/favicons?sz=64&domain=graphomata.com // @grant none // @license MIT // ==/UserScript== function fromHTML(html, trim = true) { html = trim ? html.trim() : html; if (!html) return null; const template = document.createElement('template'); template.innerHTML = html; const result = template.content.children; if (result.length === 1) return result[0]; return result; } // from https://stackoverflow.com/questions/494143/creating-a-new-dom-element-from-an-html-string-using-built-in-dom-methods-or-pro async function untilGet(id) { var u=undefined; while(u==undefined) { u=document.querySelectorAll(id)[0]; await new Promise(resolve => setTimeout(resolve, 100)); } return u; } (async function() { 'use strict'; var a=await untilGet('#leaderboardsTable > tbody'); let top=a.children[0]; top.insertBefore(fromHTML('<th>Weighted</th>'),top.children[2]); for(let i=1;i<a.childElementCount;i++){ let x=a.children[i]; let score=x.children[1].innerText; let parsedScore=score.replaceAll('i','').replaceAll(',','').split('+').map(t=>parseInt(t)); let value=parsedScore[0]+(parsedScore[1]?parsedScore[1]:0)/2; x.insertBefore(fromHTML(`<td style="white-space: nowrap">${value.toLocaleString()}</td>`),x.children[2]); } document.body.style['maxWidth']='950px'; })();