Created
August 25, 2018 17:53
-
-
Save return0927/2681c62d84f11e5820daa0262ca30dcc to your computer and use it in GitHub Desktop.
NYPC2018의 각 페이지에서 내 점수 총합을 보여줌.
This file contains 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 NYPC 내 총점 | |
// @version 0.1 | |
// @description try to take over the world! | |
// @author reutrn0927; R3turnDev | |
// @match https://contest.nypc.co.kr/* | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
function ready(callback){ | |
// in case the document is already rendered | |
if (document.readyState!='loading') callback(); | |
// modern browsers | |
else if (document.addEventListener) document.addEventListener('DOMContentLoaded', callback); | |
// IE <= 8 | |
else { | |
document.attachEvent('onreadystatechange', function(){ | |
if (document.readyState=='complete') callback(); | |
}); | |
} | |
} | |
ready(function(){ | |
var total=0, mine=0, mine_r=0; | |
$.post("/rpc?ProblemSolving.GetProblemList", "{}", function(data){ | |
var r = JSON.parse(data.replace("S:","")); | |
$.each(r['problemList'], function(k, v){ | |
total += v.score; | |
mine += v.myScore; | |
if(k>1) | |
mine_r += v.myScore; | |
}); | |
var doc = '<div class="row"><div class="col"><table><thead><tr><th>점수(연습포함)</th><th>점수(산출)</th><th>득점 비율</th></tr></thead><tbody><tr><td>'+mine+'</td><td>'+mine_r+'</td><td>'+Math.round(mine_r/total*100*1000)/1000+'%</td></tr></tbody></table></div></div>'; | |
setTimeout(function(){ | |
$("div.containerTable").prepend(doc); | |
$("div.problemContainer").prepend(doc); | |
}, 500); | |
}); | |
}); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment