您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
ein Script zur Anzeige der Punkteabstände im Forum
当前为
// ==UserScript== // @name HP-FC:Punkteabstand // @author Nugorra // @namespace hpfcpunkteabstand // @description ein Script zur Anzeige der Punkteabstände im Forum // @include https://www.hp-fc.de/forum/ // @version 4.0.0 // @grant none // ==/UserScript== var current,nextPoints,textSave = ""; var prefix = '.box[data-box-identifier="com.woltlab.wcf.genericBox29"] .boxContent'; var addedStyle = []; var infoBox = document.querySelector(prefix); var list = infoBox.querySelector('ol'); var currentPoints = list.querySelectorAll('li'); var output = document.createElement('ul'); for (var i = 0; i < currentPoints.length;i++) { current = currentPoints[i].dataset; if((currentPoints.length - 1) != i) { nextPoints = current.housePoints - currentPoints[i+1].dataset.housePoints; } else { nextPoints = false; } output.appendChild(buildReturn(i+1,current.houseColor,current.houseName,current.housePoints,nextPoints)); addedStyle.push({ name: current.houseName.toLowerCase(), color: current.houseColor }); } var sheet = document.createElement('style'); sheet.innerHTML = buildStyle(addedStyle); document.body.appendChild(sheet); list.remove(); infoBox.appendChild(output); function buildReturn(rank,color,name,own,distance) { var li = document.createElement('li'); li.classList.add(name.toLowerCase()); var text = rank + ". " + name + ": " + addDot(own); if(distance) { text = text + " (+ " + addDot(distance) + ")"; } var textNode = document.createTextNode(text); li.appendChild(textNode); return li; } function buildStyle(){ var style = ""; addedStyle.forEach(function(house){ style = style + " " + prefix + " li." + house.name + " { color: " + house.color + "; }"; }); return style; } function addDot(x){ return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, "."); }