Created
September 30, 2012 14:51
-
-
Save nomeaning777/3806995 to your computer and use it in GitHub Desktop.
UserScript that works with Opera and Firefox
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 Virtual Arena Link Change | |
// @namespace http://twitter.com/k_operafan | |
// @version 1.0.0 | |
// @description Virtual Areena(AOJ)のLiveArchiveのリンクをpdfからhtmlに書きかえる。 | |
// @include http://rhodon.u-aizu.ac.jp:8080/arena/* | |
// ==/UserScript== | |
(function(){ | |
function func(){ | |
var la = 'http://livearchive.onlinejudge.org/external/'; | |
var obj = jQuery(this); | |
var link = obj.attr("href"); | |
if(link.substr(0, la.length) == la){ | |
var target = link.substr(0, link.length - 3) + 'html'; | |
var id = link.substr(la.length); | |
id = id.replace('.pdf', ''); | |
id = id.substr(id.indexOf('/') + 1); | |
// 存在確認 | |
$.getJSON("http://test.k8n.biz/tools/la_check.cgi?id=" + id + "&callback=?", | |
function(data){ | |
if(data.code == "200"){ | |
obj.attr("href", target); | |
} | |
} | |
); | |
} | |
} | |
setTimeout(function(){ | |
$('a').each(func); | |
},500); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
VirtualArenaのデザイン変更に対応