Guest User

Untitled

a guest
Aug 3rd, 2020
1,358
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1. // ==UserScript==
  2. // @name CF Performance
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1
  5. // @description Adds the performance column to the users codeforces contest list page
  6. // @author PikMike
  7. // @include *codeforces.*/contests/with/*
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. (function() {
  12. 'use strict';
  13.  
  14. var table = $("table.user-contests-table");
  15.  
  16. $( table )
  17. .unbind('appendCache applyWidgetId applyWidgets sorton update updateCell')
  18. .find('thead th')
  19. .unbind('click mousedown');
  20.  
  21. $( table ).children().first().children().each( function( index, row ){
  22. $('<th style="padding-right: 1.5em;" class="top header">Performance</th>').insertAfter( $( row ).children().eq(3) );
  23. });
  24.  
  25. $( table ).children().last().children().each( function( index, row ){
  26. var newRating = parseInt( $( row ).children().eq(5).html() );
  27. var delta = parseInt( $( row ).children().eq(4).children().first().html() );
  28. var oldRating = newRating - delta;
  29. var performance = oldRating + 4 * delta;
  30. $("<td" + (index & 1 ? '' : ' class="dark"') + ">" + performance + "</td>").insertAfter( $( row ).children().eq(3) );
  31. });
  32.  
  33. $( table ).tablesorter({
  34. headers: {
  35. 1: {
  36. sorter: false
  37. },
  38. 7: {
  39. sorter: false
  40. }
  41. }
  42. });
  43. })();
Add Comment
Please, Sign In to add comment