Add rank % greasemonkey script

This forum contains information about 3rd party applications which may be of use to those who run the FAH client and one place where you might be able to get help when using one of those apps.

Moderator: Site Moderators

Add rank % greasemonkey script

Postby wkbaran » Sat Jan 02, 2016 4:32 pm

Hi,

I wanted to see the rank % on the user stats for no particular reason so here's the following greasemonkey script to add it.
It was quicker and easier than asking for the change. :)

Code: Select all
// ==UserScript==
// @name         FaH User rank
// @namespace    http://folding.stanford.edu/
// @version      0.1
// @description  Add rank % to FaH user detail page
// @author       Bill Baran
// @match        http://fah-web.stanford.edu/cgi-bin/main.py?qtype=userpage&username=*
// @grant        none
// @require https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js
// ==/UserScript==
/* jshint -W097 */

'use strict';

// Your code here...
$(document).ready(function() {
    var fullSelector = "body > font > table > tbody > tr > td > table:nth-child(12) > tbody > tr:nth-child(4) > td:nth-child(2) > font";
    var rankSelector = fullSelector + " > b";
    var rank = $(rankSelector).html().match(/\d+/)[0];
    var ttlStr = $(fullSelector).html();
    var ttl = ttlStr.match(/\d+/g)[1]
    var prct = rank/ttl*100;
    var rank = $(rankSelector).html(rank+" (top "+prct.toFixed(4)+"%)");
});
wkbaran
 
Posts: 1
Joined: Sat Jan 02, 2016 4:18 pm

Return to 3rd party contributed software

Who is online

Users browsing this forum: No registered users and 1 guest

cron