ニコ動画Gifアニメビューア

直リンでニコ動画のタイトル脇Gif画像一覧を作るHTML+Javascript。自己責任で。

<html><head><title>ニコニコ動画GIFViewer</title>
<style>
table{margin:auto;border-collapse:collapse;border:solid 1px #000;}
caption{margin:auto;}
td{background-color:#00C;text-align:center;}
a{font-weight:bolder;cursor:pointer;}
span.no{color:white;}
div{text-align:center;}
img{width:48px;height:48px;}
</style>
<script>
var mx=10;var my=10;var pref="http://www.nicovideo.jp/img/tpl/head/illust/";
var index=0;
function init() {
var HTML="<table><caption><a onclick=\"prev();\">←</a><span id=\"no\" onclick=\"ip();\">0</span><a onclick=\"next();\">→</a></caption>";
for (var i=0; i<my; i++) {
	HTML+="<tr>";
	for (var j=0; j<mx ; j++)
		HTML+="<td><span class=\"no\" id=\"n_" + i + "_"+j + "\">0</span><br><img id=\"i_" + i + "_"+j + "\"></td>";
	HTML+="</tr>";
}
document.getElementById("canvas").innerHTML = HTML+"</table>";
show();
}
function prev(){index-=(mx*my);if(index<0) index=0;show();}
function next(){index+=(mx*my);	show();}
function ip(){index=parseInt(prompt("no","100"));show();}
function show() {
document.getElementById("no").innerHTML = index + "〜"+(index+mx*my-1);
for (var i=0; i<my; i++) {
	for (var j=0; j<mx ; j++) {
		var img = document.getElementById("i_"+i+"_"+j);
		var no = "000" + (index + i*mx + j);
		no = no.substr(no.length-3);
		img.src = pref+ no+".gif";
		document.getElementById("n_"+i+"_"+j).innerHTML = no;
}}}
</script>
</head>
<body onload="init();">
<div id="canvas"></div>
直リンですが何か。
</body>
</html>