Last active
December 11, 2015 11:28
-
-
Save choro3/4593734 to your computer and use it in GitHub Desktop.
POJで解答済みの問題のタイトル脇にチェックをつけるgreasemonkeyスクリプト
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 POJ | |
// @namespace http://www.choro3.net/ | |
// @description poj | |
// @include http://poj.org/* | |
// ==/UserScript== | |
(function(){ | |
var user = "choro3"; | |
var fig = "http://upload.wikimedia.org/wikipedia/commons/thumb/0/03/Green_check.svg/600px-Green_check.svg.png"; | |
if(window.location.href.match(/problem\?id=\d+/i)) { | |
var pid = window.location.href.match(/\d+/); | |
GM_xmlhttpRequest({ | |
method: 'GET', | |
url: 'http://poj.org/userstatus?user_id=' + user, | |
onload : function (res) { | |
var re = new RegExp("p." + pid +".\n"); | |
if(res.responseText.match(re)) { | |
var elms = document.getElementsByTagName("div"); | |
for(var i = 0; i < elms.length; i++) { | |
if(elms[i].getAttribute("class") === "ptt") { | |
var mark = document.createElement("img"); | |
mark.src = fig; | |
mark.height = "25"; | |
mark.width = "25"; | |
elms[i].appendChild(mark); | |
break; | |
} | |
} | |
} | |
} | |
}); | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment