3

I've written a userscript to implement the request from Can the stack exchange league tables show percent as well as rank?.

Runs in Greasemonkey and probably others. Install Show Rep League Percentile (should allow auto-updates).

// ==UserScript==
// @name        Show Rep League Percentile
// @namespace   com.tuggy.nathan
// @description Displays percentile for the current time period when hovering over a user's rank
// @include     *://stackexchange.com/leagues/*
// @version     1.0.03
// @grant       none
// ==/UserScript==

const percentPerUnit = 100;

var all = new Number(document.querySelector(".sidebar-stats tr:last-child .count")
                     .textContent.replace(",", "").replace(".", ""));
var ranks = document.querySelectorAll(".statsWrapper > :first-child .number");
for (let rank of ranks) {
  let n = new Number(rank.textContent.replace(",", "").replace(".", "").substring(1));
  let pct = n / all, rounding = pct < 0.01 ? 1000 : 100;
  let rpct = (Math.round(pct * percentPerUnit * rounding) / rounding) + "%";
  rank.parentNode.title = rpct;
}

I'm considering extending it to add a whole additional column to the table, but I'm not sure it's worth it. (If you want that, let me know!)

0

You must log in to answer this question.

Browse other questions tagged .