Last active
December 24, 2015 01:39
-
-
Save scturtle/6725106 to your computer and use it in GitHub Desktop.
display "last solved days algo" directly in Project Euler
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ==UserScript== | |
| // @name PE days | |
| // @namespace scturtle | |
| // @include http://projecteuler.net/* | |
| // @include https://projecteuler.net/* | |
| // @version 1 | |
| // @require https://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js | |
| // @grant none | |
| // ==/UserScript== | |
| (function () { | |
| if ('Username' == $('table.grid > tbody > tr > th:nth-child(2)').html()) { | |
| $('th').first().after('<th>days ago</th>'); | |
| $('div.info, a.info').each(function () { | |
| var days = $(this).children('span').html().match(/\s(\w+)\sday/)[1]; | |
| if (days == 'past') days = 0; | |
| var color = days <= 60 ? "#D00" : "gray"; | |
| $(this).parent().parent().parent().parent().parent().after( | |
| '<td style="color:' + color + ';text-align:center;"> ' + days + '</td>' | |
| ) | |
| }) | |
| } | |
| })(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment