Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name CF Performance
- // @namespace http://tampermonkey.net/
- // @version 0.1
- // @description Adds the performance column to the users codeforces contest list page
- // @author PikMike
- // @include *codeforces.*/contests/with/*
- // @grant none
- // ==/UserScript==
- (function() {
- 'use strict';
- var table = $("table.user-contests-table");
- $( table )
- .unbind('appendCache applyWidgetId applyWidgets sorton update updateCell')
- .find('thead th')
- .unbind('click mousedown');
- $( table ).children().first().children().each( function( index, row ){
- $('<th style="padding-right: 1.5em;" class="top header">Performance</th>').insertAfter( $( row ).children().eq(3) );
- });
- $( table ).children().last().children().each( function( index, row ){
- var newRating = parseInt( $( row ).children().eq(5).html() );
- var delta = parseInt( $( row ).children().eq(4).children().first().html() );
- var oldRating = newRating - delta;
- var performance = oldRating + 4 * delta;
- $("<td" + (index & 1 ? '' : ' class="dark"') + ">" + performance + "</td>").insertAfter( $( row ).children().eq(3) );
- });
- $( table ).tablesorter({
- headers: {
- 1: {
- sorter: false
- },
- 7: {
- sorter: false
- }
- }
- });
- })();
Add Comment
Please, Sign In to add comment