Skip to content
Snippets Groups Projects
Commit 47119119 authored by Koichi Yasuoka's avatar Koichi Yasuoka
Browse files

initial release

parent 8e1b43b4
No related branches found
No related tags found
No related merge requests found
<!DOCTYPE html><head><meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>Universal Dependencies on 唐詩三百首卷一</title>
<script src="conllusvgview.js"></script>
<script src="conllusvgload.js"></script>
<script>
var Tangshi=new Object();
Tangshi.url="/gitlab/api/v4/projects/Kanbun%2Fud-kanbun/repository/";
Tangshi.init=function(){
var t=document.getElementById("top").cloneNode(true);
t.style.position="static";
t.style.visibility="hidden";
document.body.appendChild(t);
Tangshi.svg=new Array();
Tangshi.pre=new Array();
Tangshi.timer=setTimeout("clearTimeout(Tangshi.timer);Tangshi.checkview()",200);
Tangshi.volchange();
}
Tangshi.checkview=function(){
var t,r,b,i,x;
Tangshi.timer=setTimeout("clearTimeout(Tangshi.timer);Tangshi.checkview()",200);
if(Tangshi.curr==null)
return;
if(Tangshi.svg[Tangshi.curr]==null||Tangshi.pre[Tangshi.curr]==null){
Tangshi.buildup(Tangshi.curr);
Tangshi.lastTop=null;
return;
}
if(Tangshi.svg[Tangshi.curr].style.position=="absolute"){
Tangshi.svg[Tangshi.curr].style.position="static";
Tangshi.svg[Tangshi.curr].style.visibility="visible";
}
conllusvg.rewrite("pre"+Tangshi.curr);
r=Tangshi.svg[Tangshi.curr].getBoundingClientRect();
t=r.top;
b=r.bottom;
r=document.getElementById("top").getBoundingClientRect().bottom;
x=Tangshi.curr;
if(t-r>20){
while(t-r>0){
i=Tangshi.svg[Tangshi.curr-1];
if(i==null)
break;
if(i.style.position=="absolute")
break;
Tangshi.curr--;
if(Tangshi.curr==0)
break;
t=i.getBoundingClientRect().top;
}
}
else if(b<r){
while(b<r){
i=Tangshi.svg[Tangshi.curr+1];
if(i==null)
break;
if(i.style.position=="absolute")
break;
Tangshi.curr++;
if(Tangshi.curr==Tangshi.currmax)
break;
b=i.getBoundingClientRect().bottom;
}
}
if(Tangshi.curr!=x){
if(Tangshi.retrytimes>0){
Tangshi.retrytimes--;
Tangshi.curr=parseInt(document.getElementById("count").value,10);
t=Tangshi.svg[Tangshi.curr].getBoundingClientRect().top;
if(Math.abs(t-r)>5){
if(document.scrollingElement==null)
document.documentElement.scrollTop+=t-r;
else
document.scrollingElement.scrollTop+=t-r;
}
}
else
document.getElementById("count").value=Tangshi.curr;
}
else if(Tangshi.retrytimes>0)
Tangshi.retrytimes--;
Tangshi.lastTop=Tangshi.svg[Tangshi.curr].getBoundingClientRect().top;
for(i=Tangshi.curr+1;i<=Tangshi.currmax;i++){
if(Tangshi.svg[i]==null||Tangshi.pre[i]==null){
Tangshi.buildup(i);
break;
}
if(Tangshi.svg[i].style.position=="absolute"){
Tangshi.svg[i].style.position="static";
Tangshi.svg[i].style.visibility="visible";
}
conllusvg.rewrite("pre"+i);
r=Tangshi.svg[i].getBoundingClientRect();
if(r.top-window.innerHeight-1000>0)
break;
}
for(i=Tangshi.curr-1;i>=0;i--){
if(Tangshi.svg[i]==null||Tangshi.pre[i]==null){
Tangshi.buildup(i);
break;
}
if(Tangshi.svg[i].style.position=="absolute"){
if(Tangshi.pre[i].textContent>""){
Tangshi.svg[i].style.position="static";
Tangshi.svg[i].style.visibility="visible";
}
else
break;
}
conllusvg.rewrite("pre"+i);
r=Tangshi.svg[Tangshi.curr].getBoundingClientRect().top;
if(Math.abs(r-Tangshi.lastTop)>5){
if(document.scrollingElement==null)
document.documentElement.scrollTop+=r-Tangshi.lastTop;
else
document.scrollingElement.scrollTop+=r-Tangshi.lastTop;
Tangshi.lastTop=r;
}
r=Tangshi.svg[i].getBoundingClientRect();
if(parseInt(r.bottom,10)<-300)
break;
}
}
Tangshi.buildup=function(x){
var t,i;
if(Tangshi.svg[x]==null){
t=document.createElementNS("http://www.w3.org/2000/svg","svg");
for(i=parseInt(x,10)+1;i<=Tangshi.currmax;i++){
if(Tangshi.svg[i]!=null)
break;
}
t.style.position="absolute";
t.style.visibility="hidden";
if(i>Tangshi.currmax)
document.body.appendChild(t);
else
document.body.insertBefore(t,Tangshi.svg[i]);
Tangshi.svg[x]=t;
t.addEventListener("mousedown",Tangshi.onmousedown);
t.addEventListener("touchstart",Tangshi.onmousedown);
}
if(Tangshi.pre[x]==null){
t=document.createElement("pre");
t.style.display="none";
t.setAttribute("id","pre"+x);
document.body.appendChild(t);
Tangshi.pre[x]=t;
if(conllusvg.main["pre"+x]==null)
conllusvg.view(Tangshi.svg[x],"pre"+x);
i=Tangshi.volpath+"/"+("000"+x).slice(-3)+".txt";
conllusvg.loadRemote("pre"+x,Tangshi.url+"files/"+encodeURIComponent(i)+"/raw?ref=master");
}
}
Tangshi.volchange=function(){
var s,x;
Tangshi.clearSVG();
for(s in Tangshi.pre){
if(Tangshi.pre[s]!=null){
document.body.removeChild(Tangshi.pre[s]);
}
Tangshi.pre[s]=null;
}
s=document.getElementById("vol");
Tangshi.volpath=s.options[s.selectedIndex].value;
if(Tangshi.tail==null)
Tangshi.tail=new Array();
if(Tangshi.tail[Tangshi.volpath]==null)
Tangshi.gettree();
else
Tangshi.writeSVG();
}
Tangshi.gettree=function(){
var p;
if(Tangshi.request==null){
Tangshi.request=new XMLHttpRequest();
Tangshi.request.onload=Tangshi.ongettree;
}
if(Tangshi.tail[Tangshi.volpath]==null)
p=1;
else
p=Math.floor(parseInt(Tangshi.tail[Tangshi.volpath],10)/100)+2;
Tangshi.request.open("GET",Tangshi.url+"tree?per_page=100&path="+Tangshi.volpath+"&page="+p);
Tangshi.request.send();
}
Tangshi.ongettree=function(e){
var i,s;
if(Tangshi.request.status==200){
s=Tangshi.request.responseText;
i=s.lastIndexOf('.txt"');
if(i<0)
Tangshi.writeSVG();
else{
Tangshi.tail[Tangshi.volpath]=s.substring(i-3,i);
Tangshi.gettree();
}
}
}
Tangshi.goto=function(){
Tangshi.retrytimes=3;
Tangshi.writeSVG();
}
Tangshi.writeSVG=function(){
var c=document.getElementById("count");
Tangshi.clearSVG();
Tangshi.currmax=parseInt(Tangshi.tail[Tangshi.volpath],10);
Tangshi.curr=parseInt(c.value,10);
if(Tangshi.curr<0)
Tangshi.curr=0;
if(Tangshi.curr>Tangshi.currmax)
Tangshi.curr=Tangshi.currmax;
c.value=Tangshi.curr;
Tangshi.lastTop=null;
}
Tangshi.clearSVG=function(){
var x;
Tangshi.curr=Tangshi.lastTop=null;
if(Tangshi.svg!=null){
for(x in Tangshi.svg){
if(Tangshi.svg[x]!=null){
Tangshi.svg[x].style.position="absolute";
Tangshi.svg[x].style.visibility="hidden";
}
}
}
if(document.scrollingElement==null)
document.documentElement.scrollTop=0;
else
document.scrollingElement.scrollTop=0;
}
Tangshi.onmousedown=function(e){
var x,y;
if(Tangshi.lastX==null){
Tangshi.lastX=e.clientX;
Tangshi.lastY=e.clientY;
return;
}
x=e.clientX-Tangshi.lastX;
y=e.clientY-Tangshi.lastY;
if(x*x+y*y>9){
Tangshi.lastX=e.clientX;
Tangshi.lastY=e.clientY;
return;
}
Tangshi.lastX=null;
x=e.currentTarget;
for(y in Tangshi.svg){
if(Tangshi.svg[y]==x){
x=Tangshi.volpath+"/"+("000"+y).slice(-3)+".txt";
window.open("editor-kanbun.html#"+Tangshi.url+"files/"+encodeURIComponent(x)+"/raw?ref=master");
break;
}
}
}
Tangshi.reload=function(){
var i,r;
for(i=Tangshi.curr;i<=Tangshi.currmax;i++){
if(Tangshi.svg[i]==null||Tangshi.pre[i]==null)
return;
r=Tangshi.svg[i].getBoundingClientRect();
if(r.top>window.innerHeight||r.bottom<0)
return;
r=Tangshi.volpath+"/"+("000"+i).slice(-3)+".txt";
conllusvg.loadRemote("pre"+i,Tangshi.url+"files/"+encodeURIComponent(r)+"/raw?ref=master");
}
}
Tangshi.gitlab=function(){
var r=Tangshi.volpath+"/"+("000"+Tangshi.curr).slice(-3)+".txt";
window.open("/gitlab/Kanbun/ud-kanbun/blob/master/"+r);
}
</script>
<body onload="Tangshi.init()">
<div id="top" style="position:fixed; top:0px; left:0px; padding:10px; width:100%; background:white">
<font size="+3"><b>唐詩三百首卷一</b></font>
<select id="vol" onchange="Tangshi.volchange()">
<option value="kanripo/kR4h0169/001" selected>張九齡 感遇四首之一</option>
<option value="kanripo/kR4h0169/002">張九齡 感遇四首之二</option>
<option value="kanripo/kR4h0169/003">張九齡 感遇四首之三</option>
<option value="kanripo/kR4h0169/004">張九齡 感遇四首之四</option>
<option value="kanripo/kR4h0169/005">李白 下終南山過斛斯山人宿置酒</option>
<option value="kanripo/kR4h0169/006">李白 月下獨酌</option>
<option value="kanripo/kR4h0169/007">李白 春思</option>
<option value="kanripo/kR4h0169/008">杜甫 望嶽</option>
<option value="kanripo/kR4h0169/009">杜甫 贈衛八處士</option>
<option value="kanripo/kR4h0169/010">杜甫 佳人</option>
<option value="kanripo/kR4h0169/011">杜甫 夢李白二首之一</option>
<option value="kanripo/kR4h0169/012">杜甫 夢李白二首之二</option>
<option value="kanripo/kR4h0169/013">王維 送別</option>
<option value="kanripo/kR4h0169/014">王維 送綦毋潛落第還鄉</option>
<option value="kanripo/kR4h0169/015">王維 青谿</option>
<option value="kanripo/kR4h0169/016">王維 渭川田家</option>
<option value="kanripo/kR4h0169/017">王維 西施詠</option>
<option value="kanripo/kR4h0169/018">孟浩然 秋登蘭山寄張五</option>
<option value="kanripo/kR4h0169/019">孟浩然 夏日南亭懷辛大</option>
<option value="kanripo/kR4h0169/020">孟浩然 宿業師山房待丁大不至</option>
<option value="kanripo/kR4h0169/021">王昌齡 同從弟南齋翫月憶山陰崔少府</option>
<option value="kanripo/kR4h0169/022">邱為 尋西山隱者不遇</option>
<option value="kanripo/kR4h0169/023">綦毋潛 春泛若耶溪</option>
<option value="kanripo/kR4h0169/024">常建 宿王昌齡隱居</option>
<option value="kanripo/kR4h0169/025">岑參 與高適薛據登慈恩寺浮圖</option>
<option value="kanripo/kR4h0169/026">元結 賊退示官吏</option>
<option value="kanripo/kR4h0169/027">韋應物 郡齋雨中與諸文士燕集</option>
<option value="kanripo/kR4h0169/028">韋應物 初發揚子寄元大校書</option>
<option value="kanripo/kR4h0169/029">韋應物 寄全椒山中道士</option>
<option value="kanripo/kR4h0169/030">韋應物 長安遇馮著</option>
<option value="kanripo/kR4h0169/031">韋應物 夕次盱眙縣</option>
<option value="kanripo/kR4h0169/032">韋應物 東郊</option>
<option value="kanripo/kR4h0169/033">韋應物 送楊氏女</option>
<option value="kanripo/kR4h0169/034">柳宗元 晨詣超師院讀禪經</option>
<option value="kanripo/kR4h0169/035">柳宗元 溪居</option>
<option value="kanripo/kR4h0169/036">王昌齡 塞上曲</option>
<option value="kanripo/kR4h0169/037">王昌齡 塞下曲</option>
<option value="kanripo/kR4h0169/038">李白 關山月</option>
<option value="kanripo/kR4h0169/039">李白 子夜四時歌 春歌</option>
<option value="kanripo/kR4h0169/040">李白 子夜四時歌 夏歌</option>
<option value="kanripo/kR4h0169/041">李白 子夜四時歌 秋歌</option>
<option value="kanripo/kR4h0169/042">李白 子夜四時歌 冬歌</option>
<option value="kanripo/kR4h0169/043">李白 長干行</option>
<option value="kanripo/kR4h0169/044">孟郊 烈女操</option>
<option value="kanripo/kR4h0169/045">孟郊 遊子吟</option>
</select>
<input type="text" id="count" size=3 value=0 style="text-align:right" onchange="Tangshi.goto()" />
<input type="button" value="GitLab" onclick="Tangshi.gitlab()" />
<input type="button" value="Reload" onclick="Tangshi.reload()" />
</div>
</body>
<!DOCTYPE html><head><meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>Universal Dependencies on 唐詩三百首卷二</title>
<script src="conllusvgview.js"></script>
<script src="conllusvgload.js"></script>
<script>
var Tangshi=new Object();
Tangshi.url="/gitlab/api/v4/projects/Kanbun%2Fud-kanbun/repository/";
Tangshi.init=function(){
var t=document.getElementById("top").cloneNode(true);
t.style.position="static";
t.style.visibility="hidden";
document.body.appendChild(t);
Tangshi.svg=new Array();
Tangshi.pre=new Array();
Tangshi.timer=setTimeout("clearTimeout(Tangshi.timer);Tangshi.checkview()",200);
Tangshi.volchange();
}
Tangshi.checkview=function(){
var t,r,b,i,x;
Tangshi.timer=setTimeout("clearTimeout(Tangshi.timer);Tangshi.checkview()",200);
if(Tangshi.curr==null)
return;
if(Tangshi.svg[Tangshi.curr]==null||Tangshi.pre[Tangshi.curr]==null){
Tangshi.buildup(Tangshi.curr);
Tangshi.lastTop=null;
return;
}
if(Tangshi.svg[Tangshi.curr].style.position=="absolute"){
Tangshi.svg[Tangshi.curr].style.position="static";
Tangshi.svg[Tangshi.curr].style.visibility="visible";
}
conllusvg.rewrite("pre"+Tangshi.curr);
r=Tangshi.svg[Tangshi.curr].getBoundingClientRect();
t=r.top;
b=r.bottom;
r=document.getElementById("top").getBoundingClientRect().bottom;
x=Tangshi.curr;
if(t-r>20){
while(t-r>0){
i=Tangshi.svg[Tangshi.curr-1];
if(i==null)
break;
if(i.style.position=="absolute")
break;
Tangshi.curr--;
if(Tangshi.curr==0)
break;
t=i.getBoundingClientRect().top;
}
}
else if(b<r){
while(b<r){
i=Tangshi.svg[Tangshi.curr+1];
if(i==null)
break;
if(i.style.position=="absolute")
break;
Tangshi.curr++;
if(Tangshi.curr==Tangshi.currmax)
break;
b=i.getBoundingClientRect().bottom;
}
}
if(Tangshi.curr!=x){
if(Tangshi.retrytimes>0){
Tangshi.retrytimes--;
Tangshi.curr=parseInt(document.getElementById("count").value,10);
t=Tangshi.svg[Tangshi.curr].getBoundingClientRect().top;
if(Math.abs(t-r)>5){
if(document.scrollingElement==null)
document.documentElement.scrollTop+=t-r;
else
document.scrollingElement.scrollTop+=t-r;
}
}
else
document.getElementById("count").value=Tangshi.curr;
}
else if(Tangshi.retrytimes>0)
Tangshi.retrytimes--;
Tangshi.lastTop=Tangshi.svg[Tangshi.curr].getBoundingClientRect().top;
for(i=Tangshi.curr+1;i<=Tangshi.currmax;i++){
if(Tangshi.svg[i]==null||Tangshi.pre[i]==null){
Tangshi.buildup(i);
break;
}
if(Tangshi.svg[i].style.position=="absolute"){
Tangshi.svg[i].style.position="static";
Tangshi.svg[i].style.visibility="visible";
}
conllusvg.rewrite("pre"+i);
r=Tangshi.svg[i].getBoundingClientRect();
if(r.top-window.innerHeight-1000>0)
break;
}
for(i=Tangshi.curr-1;i>=0;i--){
if(Tangshi.svg[i]==null||Tangshi.pre[i]==null){
Tangshi.buildup(i);
break;
}
if(Tangshi.svg[i].style.position=="absolute"){
if(Tangshi.pre[i].textContent>""){
Tangshi.svg[i].style.position="static";
Tangshi.svg[i].style.visibility="visible";
}
else
break;
}
conllusvg.rewrite("pre"+i);
r=Tangshi.svg[Tangshi.curr].getBoundingClientRect().top;
if(Math.abs(r-Tangshi.lastTop)>5){
if(document.scrollingElement==null)
document.documentElement.scrollTop+=r-Tangshi.lastTop;
else
document.scrollingElement.scrollTop+=r-Tangshi.lastTop;
Tangshi.lastTop=r;
}
r=Tangshi.svg[i].getBoundingClientRect();
if(parseInt(r.bottom,10)<-300)
break;
}
}
Tangshi.buildup=function(x){
var t,i;
if(Tangshi.svg[x]==null){
t=document.createElementNS("http://www.w3.org/2000/svg","svg");
for(i=parseInt(x,10)+1;i<=Tangshi.currmax;i++){
if(Tangshi.svg[i]!=null)
break;
}
t.style.position="absolute";
t.style.visibility="hidden";
if(i>Tangshi.currmax)
document.body.appendChild(t);
else
document.body.insertBefore(t,Tangshi.svg[i]);
Tangshi.svg[x]=t;
t.addEventListener("mousedown",Tangshi.onmousedown);
t.addEventListener("touchstart",Tangshi.onmousedown);
}
if(Tangshi.pre[x]==null){
t=document.createElement("pre");
t.style.display="none";
t.setAttribute("id","pre"+x);
document.body.appendChild(t);
Tangshi.pre[x]=t;
if(conllusvg.main["pre"+x]==null)
conllusvg.view(Tangshi.svg[x],"pre"+x);
i=Tangshi.volpath+"/"+("000"+x).slice(-3)+".txt";
conllusvg.loadRemote("pre"+x,Tangshi.url+"files/"+encodeURIComponent(i)+"/raw?ref=master");
}
}
Tangshi.volchange=function(){
var s,x;
Tangshi.clearSVG();
for(s in Tangshi.pre){
if(Tangshi.pre[s]!=null){
document.body.removeChild(Tangshi.pre[s]);
}
Tangshi.pre[s]=null;
}
s=document.getElementById("vol");
Tangshi.volpath=s.options[s.selectedIndex].value;
if(Tangshi.tail==null)
Tangshi.tail=new Array();
if(Tangshi.tail[Tangshi.volpath]==null)
Tangshi.gettree();
else
Tangshi.writeSVG();
}
Tangshi.gettree=function(){
var p;
if(Tangshi.request==null){
Tangshi.request=new XMLHttpRequest();
Tangshi.request.onload=Tangshi.ongettree;
}
if(Tangshi.tail[Tangshi.volpath]==null)
p=1;
else
p=Math.floor(parseInt(Tangshi.tail[Tangshi.volpath],10)/100)+2;
Tangshi.request.open("GET",Tangshi.url+"tree?per_page=100&path="+Tangshi.volpath+"&page="+p);
Tangshi.request.send();
}
Tangshi.ongettree=function(e){
var i,s;
if(Tangshi.request.status==200){
s=Tangshi.request.responseText;
i=s.lastIndexOf('.txt"');
if(i<0)
Tangshi.writeSVG();
else{
Tangshi.tail[Tangshi.volpath]=s.substring(i-3,i);
Tangshi.gettree();
}
}
}
Tangshi.goto=function(){
Tangshi.retrytimes=3;
Tangshi.writeSVG();
}
Tangshi.writeSVG=function(){
var c=document.getElementById("count");
Tangshi.clearSVG();
Tangshi.currmax=parseInt(Tangshi.tail[Tangshi.volpath],10);
Tangshi.curr=parseInt(c.value,10);
if(Tangshi.curr<0)
Tangshi.curr=0;
if(Tangshi.curr>Tangshi.currmax)
Tangshi.curr=Tangshi.currmax;
c.value=Tangshi.curr;
Tangshi.lastTop=null;
}
Tangshi.clearSVG=function(){
var x;
Tangshi.curr=Tangshi.lastTop=null;
if(Tangshi.svg!=null){
for(x in Tangshi.svg){
if(Tangshi.svg[x]!=null){
Tangshi.svg[x].style.position="absolute";
Tangshi.svg[x].style.visibility="hidden";
}
}
}
if(document.scrollingElement==null)
document.documentElement.scrollTop=0;
else
document.scrollingElement.scrollTop=0;
}
Tangshi.onmousedown=function(e){
var x,y;
if(Tangshi.lastX==null){
Tangshi.lastX=e.clientX;
Tangshi.lastY=e.clientY;
return;
}
x=e.clientX-Tangshi.lastX;
y=e.clientY-Tangshi.lastY;
if(x*x+y*y>9){
Tangshi.lastX=e.clientX;
Tangshi.lastY=e.clientY;
return;
}
Tangshi.lastX=null;
x=e.currentTarget;
for(y in Tangshi.svg){
if(Tangshi.svg[y]==x){
x=Tangshi.volpath+"/"+("000"+y).slice(-3)+".txt";
window.open("editor-kanbun.html#"+Tangshi.url+"files/"+encodeURIComponent(x)+"/raw?ref=master");
break;
}
}
}
Tangshi.reload=function(){
var i,r;
for(i=Tangshi.curr;i<=Tangshi.currmax;i++){
if(Tangshi.svg[i]==null||Tangshi.pre[i]==null)
return;
r=Tangshi.svg[i].getBoundingClientRect();
if(r.top>window.innerHeight||r.bottom<0)
return;
r=Tangshi.volpath+"/"+("000"+i).slice(-3)+".txt";
conllusvg.loadRemote("pre"+i,Tangshi.url+"files/"+encodeURIComponent(r)+"/raw?ref=master");
}
}
Tangshi.gitlab=function(){
var r=Tangshi.volpath+"/"+("000"+Tangshi.curr).slice(-3)+".txt";
window.open("/gitlab/Kanbun/ud-kanbun/blob/master/"+r);
}
</script>
<body onload="Tangshi.init()">
<div id="top" style="position:fixed; top:0px; left:0px; padding:10px; width:100%; background:white">
<font size="+3"><b>唐詩三百首卷二</b></font>
<select id="vol" onchange="Tangshi.volchange()">
<option value="kanripo/kR4h0169/046" selected>陳子昂 登幽州臺歌</option>
<option value="kanripo/kR4h0169/047">李頎 古意</option>
<option value="kanripo/kR4h0169/048">李頎 送陳章甫</option>
<option value="kanripo/kR4h0169/049">李頎 琴歌</option>
<option value="kanripo/kR4h0169/050">李頎 聽董大彈胡笳聲兼寄語弄房給事</option>
<option value="kanripo/kR4h0169/051">李頎 聽安萬善吹觱篥歌</option>
<option value="kanripo/kR4h0169/052">孟浩然 夜歸鹿門山歌</option>
<option value="kanripo/kR4h0169/053">李白 廬山謠寄盧侍御虛舟</option>
<option value="kanripo/kR4h0169/054">李白 夢遊天姥吟留別</option>
<option value="kanripo/kR4h0169/055">李白 金陵酒肆留別</option>
<option value="kanripo/kR4h0169/056">李白 宣州謝朓樓餞別校書叔雲</option>
<option value="kanripo/kR4h0169/057">岑參 走馬川行奉送封大夫出師西征</option>
<option value="kanripo/kR4h0169/058">岑參 輪臺歌奉送封大夫出師西征</option>
<option value="kanripo/kR4h0169/059">岑參 白雪歌送武判官歸京</option>
<option value="kanripo/kR4h0169/060">杜甫 韋諷錄事宅觀曹將軍畫馬圖</option>
<option value="kanripo/kR4h0169/061">杜甫 丹青引贈曹霸將軍</option>
<option value="kanripo/kR4h0169/062">杜甫 寄韓諫議</option>
<option value="kanripo/kR4h0169/063">杜甫 古柏行</option>
<option value="kanripo/kR4h0169/064">杜甫 觀公孫大娘弟子舞劍器行</option>
<option value="kanripo/kR4h0169/065">元結 石魚湖上醉歌</option>
<option value="kanripo/kR4h0169/066">韓愈 山石</option>
<option value="kanripo/kR4h0169/067">韓愈 八月十五夜贈張功曹</option>
<option value="kanripo/kR4h0169/068">韓愈 謁衡嶽廟遂宿嶽寺題門樓</option>
<option value="kanripo/kR4h0169/069">韓愈 石鼓歌</option>
<option value="kanripo/kR4h0169/070">柳宗元 漁翁</option>
<option value="kanripo/kR4h0169/071">白居易 長恨歌</option>
<option value="kanripo/kR4h0169/072">白居易 琵琶行</option>
<option value="kanripo/kR4h0169/073">李商隱 韓碑</option>
<option value="kanripo/kR4h0169/074">高適 燕歌行</option>
<option value="kanripo/kR4h0169/075">李頎 古從軍行</option>
<option value="kanripo/kR4h0169/076">王維 洛陽女兒行</option>
<option value="kanripo/kR4h0169/077">王維 老將行</option>
<option value="kanripo/kR4h0169/078">王維 桃源行</option>
<option value="kanripo/kR4h0169/079">李白 蜀道難</option>
<option value="kanripo/kR4h0169/080">李白 長相思二首之一</option>
<option value="kanripo/kR4h0169/081">李白 長相思二首之二</option>
<option value="kanripo/kR4h0169/082">李白 行路難三首之一</option>
<option value="kanripo/kR4h0169/083">李白 行路難三首之二</option>
<option value="kanripo/kR4h0169/084">李白 行路難三首之三</option>
<option value="kanripo/kR4h0169/085">李白 將進酒</option>
<option value="kanripo/kR4h0169/086">杜甫 兵車行</option>
<option value="kanripo/kR4h0169/087">杜甫 麗人行</option>
<option value="kanripo/kR4h0169/088">杜甫 哀江頭</option>
<option value="kanripo/kR4h0169/089">杜甫 哀王孫</option>
</select>
<input type="text" id="count" size=3 value=0 style="text-align:right" onchange="Tangshi.goto()" />
<input type="button" value="GitLab" onclick="Tangshi.gitlab()" />
<input type="button" value="Reload" onclick="Tangshi.reload()" />
</div>
</body>
<!DOCTYPE html><head><meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>Universal Dependencies on 唐詩三百首卷三</title>
<script src="conllusvgview.js"></script>
<script src="conllusvgload.js"></script>
<script>
var Tangshi=new Object();
Tangshi.url="/gitlab/api/v4/projects/Kanbun%2Fud-kanbun/repository/";
Tangshi.init=function(){
var t=document.getElementById("top").cloneNode(true);
t.style.position="static";
t.style.visibility="hidden";
document.body.appendChild(t);
Tangshi.svg=new Array();
Tangshi.pre=new Array();
Tangshi.timer=setTimeout("clearTimeout(Tangshi.timer);Tangshi.checkview()",200);
Tangshi.volchange();
}
Tangshi.checkview=function(){
var t,r,b,i,x;
Tangshi.timer=setTimeout("clearTimeout(Tangshi.timer);Tangshi.checkview()",200);
if(Tangshi.curr==null)
return;
if(Tangshi.svg[Tangshi.curr]==null||Tangshi.pre[Tangshi.curr]==null){
Tangshi.buildup(Tangshi.curr);
Tangshi.lastTop=null;
return;
}
if(Tangshi.svg[Tangshi.curr].style.position=="absolute"){
Tangshi.svg[Tangshi.curr].style.position="static";
Tangshi.svg[Tangshi.curr].style.visibility="visible";
}
conllusvg.rewrite("pre"+Tangshi.curr);
r=Tangshi.svg[Tangshi.curr].getBoundingClientRect();
t=r.top;
b=r.bottom;
r=document.getElementById("top").getBoundingClientRect().bottom;
x=Tangshi.curr;
if(t-r>20){
while(t-r>0){
i=Tangshi.svg[Tangshi.curr-1];
if(i==null)
break;
if(i.style.position=="absolute")
break;
Tangshi.curr--;
if(Tangshi.curr==0)
break;
t=i.getBoundingClientRect().top;
}
}
else if(b<r){
while(b<r){
i=Tangshi.svg[Tangshi.curr+1];
if(i==null)
break;
if(i.style.position=="absolute")
break;
Tangshi.curr++;
if(Tangshi.curr==Tangshi.currmax)
break;
b=i.getBoundingClientRect().bottom;
}
}
if(Tangshi.curr!=x){
if(Tangshi.retrytimes>0){
Tangshi.retrytimes--;
Tangshi.curr=parseInt(document.getElementById("count").value,10);
t=Tangshi.svg[Tangshi.curr].getBoundingClientRect().top;
if(Math.abs(t-r)>5){
if(document.scrollingElement==null)
document.documentElement.scrollTop+=t-r;
else
document.scrollingElement.scrollTop+=t-r;
}
}
else
document.getElementById("count").value=Tangshi.curr;
}
else if(Tangshi.retrytimes>0)
Tangshi.retrytimes--;
Tangshi.lastTop=Tangshi.svg[Tangshi.curr].getBoundingClientRect().top;
for(i=Tangshi.curr+1;i<=Tangshi.currmax;i++){
if(Tangshi.svg[i]==null||Tangshi.pre[i]==null){
Tangshi.buildup(i);
break;
}
if(Tangshi.svg[i].style.position=="absolute"){
Tangshi.svg[i].style.position="static";
Tangshi.svg[i].style.visibility="visible";
}
conllusvg.rewrite("pre"+i);
r=Tangshi.svg[i].getBoundingClientRect();
if(r.top-window.innerHeight-1000>0)
break;
}
for(i=Tangshi.curr-1;i>=0;i--){
if(Tangshi.svg[i]==null||Tangshi.pre[i]==null){
Tangshi.buildup(i);
break;
}
if(Tangshi.svg[i].style.position=="absolute"){
if(Tangshi.pre[i].textContent>""){
Tangshi.svg[i].style.position="static";
Tangshi.svg[i].style.visibility="visible";
}
else
break;
}
conllusvg.rewrite("pre"+i);
r=Tangshi.svg[Tangshi.curr].getBoundingClientRect().top;
if(Math.abs(r-Tangshi.lastTop)>5){
if(document.scrollingElement==null)
document.documentElement.scrollTop+=r-Tangshi.lastTop;
else
document.scrollingElement.scrollTop+=r-Tangshi.lastTop;
Tangshi.lastTop=r;
}
r=Tangshi.svg[i].getBoundingClientRect();
if(parseInt(r.bottom,10)<-300)
break;
}
}
Tangshi.buildup=function(x){
var t,i;
if(Tangshi.svg[x]==null){
t=document.createElementNS("http://www.w3.org/2000/svg","svg");
for(i=parseInt(x,10)+1;i<=Tangshi.currmax;i++){
if(Tangshi.svg[i]!=null)
break;
}
t.style.position="absolute";
t.style.visibility="hidden";
if(i>Tangshi.currmax)
document.body.appendChild(t);
else
document.body.insertBefore(t,Tangshi.svg[i]);
Tangshi.svg[x]=t;
t.addEventListener("mousedown",Tangshi.onmousedown);
t.addEventListener("touchstart",Tangshi.onmousedown);
}
if(Tangshi.pre[x]==null){
t=document.createElement("pre");
t.style.display="none";
t.setAttribute("id","pre"+x);
document.body.appendChild(t);
Tangshi.pre[x]=t;
if(conllusvg.main["pre"+x]==null)
conllusvg.view(Tangshi.svg[x],"pre"+x);
i=Tangshi.volpath+"/"+("000"+x).slice(-3)+".txt";
conllusvg.loadRemote("pre"+x,Tangshi.url+"files/"+encodeURIComponent(i)+"/raw?ref=master");
}
}
Tangshi.volchange=function(){
var s,x;
Tangshi.clearSVG();
for(s in Tangshi.pre){
if(Tangshi.pre[s]!=null){
document.body.removeChild(Tangshi.pre[s]);
}
Tangshi.pre[s]=null;
}
s=document.getElementById("vol");
Tangshi.volpath=s.options[s.selectedIndex].value;
if(Tangshi.tail==null)
Tangshi.tail=new Array();
if(Tangshi.tail[Tangshi.volpath]==null)
Tangshi.gettree();
else
Tangshi.writeSVG();
}
Tangshi.gettree=function(){
var p;
if(Tangshi.request==null){
Tangshi.request=new XMLHttpRequest();
Tangshi.request.onload=Tangshi.ongettree;
}
if(Tangshi.tail[Tangshi.volpath]==null)
p=1;
else
p=Math.floor(parseInt(Tangshi.tail[Tangshi.volpath],10)/100)+2;
Tangshi.request.open("GET",Tangshi.url+"tree?per_page=100&path="+Tangshi.volpath+"&page="+p);
Tangshi.request.send();
}
Tangshi.ongettree=function(e){
var i,s;
if(Tangshi.request.status==200){
s=Tangshi.request.responseText;
i=s.lastIndexOf('.txt"');
if(i<0)
Tangshi.writeSVG();
else{
Tangshi.tail[Tangshi.volpath]=s.substring(i-3,i);
Tangshi.gettree();
}
}
}
Tangshi.goto=function(){
Tangshi.retrytimes=3;
Tangshi.writeSVG();
}
Tangshi.writeSVG=function(){
var c=document.getElementById("count");
Tangshi.clearSVG();
Tangshi.currmax=parseInt(Tangshi.tail[Tangshi.volpath],10);
Tangshi.curr=parseInt(c.value,10);
if(Tangshi.curr<0)
Tangshi.curr=0;
if(Tangshi.curr>Tangshi.currmax)
Tangshi.curr=Tangshi.currmax;
c.value=Tangshi.curr;
Tangshi.lastTop=null;
}
Tangshi.clearSVG=function(){
var x;
Tangshi.curr=Tangshi.lastTop=null;
if(Tangshi.svg!=null){
for(x in Tangshi.svg){
if(Tangshi.svg[x]!=null){
Tangshi.svg[x].style.position="absolute";
Tangshi.svg[x].style.visibility="hidden";
}
}
}
if(document.scrollingElement==null)
document.documentElement.scrollTop=0;
else
document.scrollingElement.scrollTop=0;
}
Tangshi.onmousedown=function(e){
var x,y;
if(Tangshi.lastX==null){
Tangshi.lastX=e.clientX;
Tangshi.lastY=e.clientY;
return;
}
x=e.clientX-Tangshi.lastX;
y=e.clientY-Tangshi.lastY;
if(x*x+y*y>9){
Tangshi.lastX=e.clientX;
Tangshi.lastY=e.clientY;
return;
}
Tangshi.lastX=null;
x=e.currentTarget;
for(y in Tangshi.svg){
if(Tangshi.svg[y]==x){
x=Tangshi.volpath+"/"+("000"+y).slice(-3)+".txt";
window.open("editor-kanbun.html#"+Tangshi.url+"files/"+encodeURIComponent(x)+"/raw?ref=master");
break;
}
}
}
Tangshi.reload=function(){
var i,r;
for(i=Tangshi.curr;i<=Tangshi.currmax;i++){
if(Tangshi.svg[i]==null||Tangshi.pre[i]==null)
return;
r=Tangshi.svg[i].getBoundingClientRect();
if(r.top>window.innerHeight||r.bottom<0)
return;
r=Tangshi.volpath+"/"+("000"+i).slice(-3)+".txt";
conllusvg.loadRemote("pre"+i,Tangshi.url+"files/"+encodeURIComponent(r)+"/raw?ref=master");
}
}
Tangshi.gitlab=function(){
var r=Tangshi.volpath+"/"+("000"+Tangshi.curr).slice(-3)+".txt";
window.open("/gitlab/Kanbun/ud-kanbun/blob/master/"+r);
}
</script>
<body onload="Tangshi.init()">
<div id="top" style="position:fixed; top:0px; left:0px; padding:10px; width:100%; background:white">
<font size="+3"><b>唐詩三百首卷三</b></font>
<select id="vol" onchange="Tangshi.volchange()">
<option value="kanripo/kR4h0169/090" selected>唐玄宗 經鄒魯祭孔子而歎之</option>
<option value="kanripo/kR4h0169/091">張九齡 望月懷遠</option>
<option value="kanripo/kR4h0169/092">王勃 送杜少府之任蜀州</option>
<option value="kanripo/kR4h0169/093">駱賓王 在獄詠蟬</option>
<option value="kanripo/kR4h0169/094">杜審言 和晉陵路丞早春遊望</option>
<option value="kanripo/kR4h0169/095">沈佺期 雜詩</option>
<option value="kanripo/kR4h0169/096">宋之問 題大庾嶺北驛</option>
<option value="kanripo/kR4h0169/097">王灣 次北固山下</option>
<option value="kanripo/kR4h0169/098">常建 題破山寺後禪院</option>
<option value="kanripo/kR4h0169/099">岑參 寄左省杜拾遺</option>
<option value="kanripo/kR4h0169/100">李白 贈孟浩然</option>
<option value="kanripo/kR4h0169/101">李白 渡荊門送別</option>
<option value="kanripo/kR4h0169/102">李白 送友人</option>
<option value="kanripo/kR4h0169/103">李白 聽蜀僧濬彈琴</option>
<option value="kanripo/kR4h0169/104">李白 夜泊牛渚懷古</option>
<option value="kanripo/kR4h0169/105">杜甫 月夜</option>
<option value="kanripo/kR4h0169/106">杜甫 春望</option>
<option value="kanripo/kR4h0169/107">杜甫 春宿左省</option>
<option value="kanripo/kR4h0169/108">杜甫 至德二載甫自京金光門出問道歸鳳翔乾元初從左拾遺移華州掾與親故別因出此門有悲往事</option>
<option value="kanripo/kR4h0169/109">杜甫 月夜憶舍弟</option>
<option value="kanripo/kR4h0169/110">杜甫 天末懷李白</option>
<option value="kanripo/kR4h0169/111">杜甫 奉濟驛重送嚴公四韻</option>
<option value="kanripo/kR4h0169/112">杜甫 別房太尉墓</option>
<option value="kanripo/kR4h0169/113">杜甫 旅夜書懷</option>
<option value="kanripo/kR4h0169/114">杜甫 登岳陽樓</option>
<option value="kanripo/kR4h0169/115">王維 輞川閑居贈裴秀才迪</option>
<option value="kanripo/kR4h0169/116">王維 山居秋暝</option>
<option value="kanripo/kR4h0169/117">王維 歸嵩山作</option>
<option value="kanripo/kR4h0169/118">王維 終南山</option>
<option value="kanripo/kR4h0169/119">王維 酬張少府</option>
<option value="kanripo/kR4h0169/120">王維 過香積寺</option>
<option value="kanripo/kR4h0169/121">王維 送梓州李使君</option>
<option value="kanripo/kR4h0169/122">王維 漢江臨眺</option>
<option value="kanripo/kR4h0169/123">王維 終南別業</option>
<option value="kanripo/kR4h0169/124">孟浩然 望洞庭湖贈張丞相</option>
<option value="kanripo/kR4h0169/125">孟浩然 與諸子登峴山</option>
<option value="kanripo/kR4h0169/126">孟浩然 清明日宴梅道士房</option>
<option value="kanripo/kR4h0169/127">孟浩然 歲暮歸南山</option>
<option value="kanripo/kR4h0169/128">孟浩然 過故人莊</option>
<option value="kanripo/kR4h0169/129">孟浩然 秦中感秋寄遠上人</option>
<option value="kanripo/kR4h0169/130">孟浩然 宿桐廬江寄廣陵舊遊</option>
<option value="kanripo/kR4h0169/131">孟浩然 留別王侍御維</option>
<option value="kanripo/kR4h0169/132">孟浩然 早寒江上有懷</option>
<option value="kanripo/kR4h0169/133">劉長卿 秋日登吳公臺上寺遠眺</option>
<option value="kanripo/kR4h0169/134">劉常卿 送李中丞歸漢陽別業</option>
<option value="kanripo/kR4h0169/135">劉長卿 餞別王十一南遊</option>
<option value="kanripo/kR4h0169/136">劉長卿 尋南溪常山道人隱居</option>
<option value="kanripo/kR4h0169/137">劉長卿 新年作</option>
<option value="kanripo/kR4h0169/138">錢起 送僧歸日本</option>
<option value="kanripo/kR4h0169/139">錢起 谷口書齋寄楊補闕</option>
<option value="kanripo/kR4h0169/140">韋應物 淮上喜會梁川故人</option>
<option value="kanripo/kR4h0169/141">韋應物 賦得暮雨送李冑</option>
<option value="kanripo/kR4h0169/142">韓翃 酬程延秋夜即事見贈</option>
<option value="kanripo/kR4h0169/143">劉脊虛 闕題</option>
<option value="kanripo/kR4h0169/144">戴叔倫 江鄉故人偶集客舍</option>
<option value="kanripo/kR4h0169/145">盧綸 李端公</option>
<option value="kanripo/kR4h0169/146">李益 喜見外弟又言別</option>
<option value="kanripo/kR4h0169/147">司空曙 雲陽館與韓紳宿別</option>
<option value="kanripo/kR4h0169/148">司空曙 喜外弟盧綸見宿</option>
<option value="kanripo/kR4h0169/149">司空曙 賊平後送人北歸</option>
<option value="kanripo/kR4h0169/150">劉禹錫 蜀先主廟</option>
<option value="kanripo/kR4h0169/151">張籍 沒蕃故人</option>
<option value="kanripo/kR4h0169/152">白居易 賦得古原草送別</option>
<option value="kanripo/kR4h0169/153">杜牧 旅宿</option>
<option value="kanripo/kR4h0169/154">許渾 秋日赴闕題潼關驛樓</option>
<option value="kanripo/kR4h0169/155">許渾 早秋</option>
<option value="kanripo/kR4h0169/156">李商隱 蟬</option>
<option value="kanripo/kR4h0169/157">李商隱 風雨</option>
<option value="kanripo/kR4h0169/158">李商隱 落花</option>
<option value="kanripo/kR4h0169/159">李商隱 涼思</option>
<option value="kanripo/kR4h0169/160">李商隱 北青蘿</option>
<option value="kanripo/kR4h0169/161">溫庭筠 送人東遊</option>
<option value="kanripo/kR4h0169/162">馬戴 灞上秋居</option>
<option value="kanripo/kR4h0169/163">馬戴 楚江懷古</option>
<option value="kanripo/kR4h0169/164">張喬 書邊事</option>
<option value="kanripo/kR4h0169/165">崔塗 巴山道中除夜有懷</option>
<option value="kanripo/kR4h0169/166">崔塗 孤雁</option>
<option value="kanripo/kR4h0169/167">杜荀鶴 春宮怨</option>
<option value="kanripo/kR4h0169/168">韋莊 章臺夜思</option>
<option value="kanripo/kR4h0169/169">僧皎然 尋陸鴻漸不遇</option>
</select>
<input type="text" id="count" size=3 value=0 style="text-align:right" onchange="Tangshi.goto()" />
<input type="button" value="GitLab" onclick="Tangshi.gitlab()" />
<input type="button" value="Reload" onclick="Tangshi.reload()" />
</div>
</body>
<!DOCTYPE html><head><meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>Universal Dependencies on 唐詩三百首卷四</title>
<script src="conllusvgview.js"></script>
<script src="conllusvgload.js"></script>
<script>
var Tangshi=new Object();
Tangshi.url="/gitlab/api/v4/projects/Kanbun%2Fud-kanbun/repository/";
Tangshi.init=function(){
var t=document.getElementById("top").cloneNode(true);
t.style.position="static";
t.style.visibility="hidden";
document.body.appendChild(t);
Tangshi.svg=new Array();
Tangshi.pre=new Array();
Tangshi.timer=setTimeout("clearTimeout(Tangshi.timer);Tangshi.checkview()",200);
Tangshi.volchange();
}
Tangshi.checkview=function(){
var t,r,b,i,x;
Tangshi.timer=setTimeout("clearTimeout(Tangshi.timer);Tangshi.checkview()",200);
if(Tangshi.curr==null)
return;
if(Tangshi.svg[Tangshi.curr]==null||Tangshi.pre[Tangshi.curr]==null){
Tangshi.buildup(Tangshi.curr);
Tangshi.lastTop=null;
return;
}
if(Tangshi.svg[Tangshi.curr].style.position=="absolute"){
Tangshi.svg[Tangshi.curr].style.position="static";
Tangshi.svg[Tangshi.curr].style.visibility="visible";
}
conllusvg.rewrite("pre"+Tangshi.curr);
r=Tangshi.svg[Tangshi.curr].getBoundingClientRect();
t=r.top;
b=r.bottom;
r=document.getElementById("top").getBoundingClientRect().bottom;
x=Tangshi.curr;
if(t-r>20){
while(t-r>0){
i=Tangshi.svg[Tangshi.curr-1];
if(i==null)
break;
if(i.style.position=="absolute")
break;
Tangshi.curr--;
if(Tangshi.curr==0)
break;
t=i.getBoundingClientRect().top;
}
}
else if(b<r){
while(b<r){
i=Tangshi.svg[Tangshi.curr+1];
if(i==null)
break;
if(i.style.position=="absolute")
break;
Tangshi.curr++;
if(Tangshi.curr==Tangshi.currmax)
break;
b=i.getBoundingClientRect().bottom;
}
}
if(Tangshi.curr!=x){
if(Tangshi.retrytimes>0){
Tangshi.retrytimes--;
Tangshi.curr=parseInt(document.getElementById("count").value,10);
t=Tangshi.svg[Tangshi.curr].getBoundingClientRect().top;
if(Math.abs(t-r)>5){
if(document.scrollingElement==null)
document.documentElement.scrollTop+=t-r;
else
document.scrollingElement.scrollTop+=t-r;
}
}
else
document.getElementById("count").value=Tangshi.curr;
}
else if(Tangshi.retrytimes>0)
Tangshi.retrytimes--;
Tangshi.lastTop=Tangshi.svg[Tangshi.curr].getBoundingClientRect().top;
for(i=Tangshi.curr+1;i<=Tangshi.currmax;i++){
if(Tangshi.svg[i]==null||Tangshi.pre[i]==null){
Tangshi.buildup(i);
break;
}
if(Tangshi.svg[i].style.position=="absolute"){
Tangshi.svg[i].style.position="static";
Tangshi.svg[i].style.visibility="visible";
}
conllusvg.rewrite("pre"+i);
r=Tangshi.svg[i].getBoundingClientRect();
if(r.top-window.innerHeight-1000>0)
break;
}
for(i=Tangshi.curr-1;i>=0;i--){
if(Tangshi.svg[i]==null||Tangshi.pre[i]==null){
Tangshi.buildup(i);
break;
}
if(Tangshi.svg[i].style.position=="absolute"){
if(Tangshi.pre[i].textContent>""){
Tangshi.svg[i].style.position="static";
Tangshi.svg[i].style.visibility="visible";
}
else
break;
}
conllusvg.rewrite("pre"+i);
r=Tangshi.svg[Tangshi.curr].getBoundingClientRect().top;
if(Math.abs(r-Tangshi.lastTop)>5){
if(document.scrollingElement==null)
document.documentElement.scrollTop+=r-Tangshi.lastTop;
else
document.scrollingElement.scrollTop+=r-Tangshi.lastTop;
Tangshi.lastTop=r;
}
r=Tangshi.svg[i].getBoundingClientRect();
if(parseInt(r.bottom,10)<-300)
break;
}
}
Tangshi.buildup=function(x){
var t,i;
if(Tangshi.svg[x]==null){
t=document.createElementNS("http://www.w3.org/2000/svg","svg");
for(i=parseInt(x,10)+1;i<=Tangshi.currmax;i++){
if(Tangshi.svg[i]!=null)
break;
}
t.style.position="absolute";
t.style.visibility="hidden";
if(i>Tangshi.currmax)
document.body.appendChild(t);
else
document.body.insertBefore(t,Tangshi.svg[i]);
Tangshi.svg[x]=t;
t.addEventListener("mousedown",Tangshi.onmousedown);
t.addEventListener("touchstart",Tangshi.onmousedown);
}
if(Tangshi.pre[x]==null){
t=document.createElement("pre");
t.style.display="none";
t.setAttribute("id","pre"+x);
document.body.appendChild(t);
Tangshi.pre[x]=t;
if(conllusvg.main["pre"+x]==null)
conllusvg.view(Tangshi.svg[x],"pre"+x);
i=Tangshi.volpath+"/"+("000"+x).slice(-3)+".txt";
conllusvg.loadRemote("pre"+x,Tangshi.url+"files/"+encodeURIComponent(i)+"/raw?ref=master");
}
}
Tangshi.volchange=function(){
var s,x;
Tangshi.clearSVG();
for(s in Tangshi.pre){
if(Tangshi.pre[s]!=null){
document.body.removeChild(Tangshi.pre[s]);
}
Tangshi.pre[s]=null;
}
s=document.getElementById("vol");
Tangshi.volpath=s.options[s.selectedIndex].value;
if(Tangshi.tail==null)
Tangshi.tail=new Array();
if(Tangshi.tail[Tangshi.volpath]==null)
Tangshi.gettree();
else
Tangshi.writeSVG();
}
Tangshi.gettree=function(){
var p;
if(Tangshi.request==null){
Tangshi.request=new XMLHttpRequest();
Tangshi.request.onload=Tangshi.ongettree;
}
if(Tangshi.tail[Tangshi.volpath]==null)
p=1;
else
p=Math.floor(parseInt(Tangshi.tail[Tangshi.volpath],10)/100)+2;
Tangshi.request.open("GET",Tangshi.url+"tree?per_page=100&path="+Tangshi.volpath+"&page="+p);
Tangshi.request.send();
}
Tangshi.ongettree=function(e){
var i,s;
if(Tangshi.request.status==200){
s=Tangshi.request.responseText;
i=s.lastIndexOf('.txt"');
if(i<0)
Tangshi.writeSVG();
else{
Tangshi.tail[Tangshi.volpath]=s.substring(i-3,i);
Tangshi.gettree();
}
}
}
Tangshi.goto=function(){
Tangshi.retrytimes=3;
Tangshi.writeSVG();
}
Tangshi.writeSVG=function(){
var c=document.getElementById("count");
Tangshi.clearSVG();
Tangshi.currmax=parseInt(Tangshi.tail[Tangshi.volpath],10);
Tangshi.curr=parseInt(c.value,10);
if(Tangshi.curr<0)
Tangshi.curr=0;
if(Tangshi.curr>Tangshi.currmax)
Tangshi.curr=Tangshi.currmax;
c.value=Tangshi.curr;
Tangshi.lastTop=null;
}
Tangshi.clearSVG=function(){
var x;
Tangshi.curr=Tangshi.lastTop=null;
if(Tangshi.svg!=null){
for(x in Tangshi.svg){
if(Tangshi.svg[x]!=null){
Tangshi.svg[x].style.position="absolute";
Tangshi.svg[x].style.visibility="hidden";
}
}
}
if(document.scrollingElement==null)
document.documentElement.scrollTop=0;
else
document.scrollingElement.scrollTop=0;
}
Tangshi.onmousedown=function(e){
var x,y;
if(Tangshi.lastX==null){
Tangshi.lastX=e.clientX;
Tangshi.lastY=e.clientY;
return;
}
x=e.clientX-Tangshi.lastX;
y=e.clientY-Tangshi.lastY;
if(x*x+y*y>9){
Tangshi.lastX=e.clientX;
Tangshi.lastY=e.clientY;
return;
}
Tangshi.lastX=null;
x=e.currentTarget;
for(y in Tangshi.svg){
if(Tangshi.svg[y]==x){
x=Tangshi.volpath+"/"+("000"+y).slice(-3)+".txt";
window.open("editor-kanbun.html#"+Tangshi.url+"files/"+encodeURIComponent(x)+"/raw?ref=master");
break;
}
}
}
Tangshi.reload=function(){
var i,r;
for(i=Tangshi.curr;i<=Tangshi.currmax;i++){
if(Tangshi.svg[i]==null||Tangshi.pre[i]==null)
return;
r=Tangshi.svg[i].getBoundingClientRect();
if(r.top>window.innerHeight||r.bottom<0)
return;
r=Tangshi.volpath+"/"+("000"+i).slice(-3)+".txt";
conllusvg.loadRemote("pre"+i,Tangshi.url+"files/"+encodeURIComponent(r)+"/raw?ref=master");
}
}
Tangshi.gitlab=function(){
var r=Tangshi.volpath+"/"+("000"+Tangshi.curr).slice(-3)+".txt";
window.open("/gitlab/Kanbun/ud-kanbun/blob/master/"+r);
}
</script>
<body onload="Tangshi.init()">
<div id="top" style="position:fixed; top:0px; left:0px; padding:10px; width:100%; background:white">
<font size="+3"><b>唐詩三百首卷四</b></font>
<select id="vol" onchange="Tangshi.volchange()">
<option value="kanripo/kR4h0169/170" selected>崔顥 黃鶴樓</option>
<option value="kanripo/kR4h0169/171">崔顥 行經華陰</option>
<option value="kanripo/kR4h0169/172">祖詠 望薊門</option>
<option value="kanripo/kR4h0169/173">李頎 送魏萬之京</option>
<option value="kanripo/kR4h0169/174">崔曙 九日登望仙臺呈劉明府</option>
<option value="kanripo/kR4h0169/175">李白 登金陵鳳凰臺</option>
<option value="kanripo/kR4h0169/176">高適 送李少府貶峽中王少府貶長沙</option>
<option value="kanripo/kR4h0169/177">岑參 奉和中書舍人賈至早朝大明宮</option>
<option value="kanripo/kR4h0169/178">王維 和賈舍人早朝大明宮之作</option>
<option value="kanripo/kR4h0169/179">王維 奉和聖製從蓬萊向興慶閣道中留春雨中春望之作應制</option>
<option value="kanripo/kR4h0169/180">王維 積雨輞川莊作</option>
<option value="kanripo/kR4h0169/181">王維 酬郭給事</option>
<option value="kanripo/kR4h0169/182">杜甫 蜀相</option>
<option value="kanripo/kR4h0169/183">杜甫 客至</option>
<option value="kanripo/kR4h0169/184">杜甫 野望</option>
<option value="kanripo/kR4h0169/185">杜甫 聞官軍收河南河北</option>
<option value="kanripo/kR4h0169/186">杜甫 登高</option>
<option value="kanripo/kR4h0169/187">杜甫 登樓</option>
<option value="kanripo/kR4h0169/188">杜甫 宿府</option>
<option value="kanripo/kR4h0169/189">杜甫 閣夜</option>
<option value="kanripo/kR4h0169/190">杜甫 詠懷古跡五首之一</option>
<option value="kanripo/kR4h0169/191">杜甫 詠懷古跡五首之二</option>
<option value="kanripo/kR4h0169/192">杜甫 詠懷古跡五首之三</option>
<option value="kanripo/kR4h0169/193">杜甫 詠懷古跡五首之四</option>
<option value="kanripo/kR4h0169/194">杜甫 詠懷古跡五首之五</option>
<option value="kanripo/kR4h0169/195">劉長卿 江州重別薛六柳八二員外</option>
<option value="kanripo/kR4h0169/196">劉長卿 長沙過賈誼宅</option>
<option value="kanripo/kR4h0169/197">劉長卿 自夏口至鸚洲夕望岳陽寄源中丞</option>
<option value="kanripo/kR4h0169/198">錢起 贈闕下裴舍人</option>
<option value="kanripo/kR4h0169/199">韋應物 寄李儋元錫</option>
<option value="kanripo/kR4h0169/200">韓翃 同題仙游觀</option>
<option value="kanripo/kR4h0169/201">皇甫冉 春思</option>
<option value="kanripo/kR4h0169/202">盧綸 晚次鄂州</option>
<option value="kanripo/kR4h0169/203">柳宗元 登柳州城樓寄漳汀封連四州刺史</option>
<option value="kanripo/kR4h0169/204">劉禹錫 西塞山懷古</option>
<option value="kanripo/kR4h0169/205">元稹 遣悲懷三首之一</option>
<option value="kanripo/kR4h0169/206">元稹 遣悲懷三首之二</option>
<option value="kanripo/kR4h0169/207">元稹 遣悲懷三首之三</option>
<option value="kanripo/kR4h0169/208">白居易 自河南經亂關內阻饑兄弟離散各在一處因望月有感聊書所懷寄上浮梁大兄於潛七兄烏江十五兄兼示符離及下邽弟妹</option>
<option value="kanripo/kR4h0169/209">李商隱 錦瑟</option>
<option value="kanripo/kR4h0169/210">李商隱 無題</option>
<option value="kanripo/kR4h0169/211">李商隱 隋宮</option>
<option value="kanripo/kR4h0169/212">李商隱 無題二首之一</option>
<option value="kanripo/kR4h0169/213">李商隱 無題二首之二</option>
<option value="kanripo/kR4h0169/214">李商隱 籌筆驛</option>
<option value="kanripo/kR4h0169/215">李商隱 無題</option>
<option value="kanripo/kR4h0169/216">李商隱 春雨</option>
<option value="kanripo/kR4h0169/217">李商隱 無題二首之一</option>
<option value="kanripo/kR4h0169/218">李商隱 無題二首之二</option>
<option value="kanripo/kR4h0169/219">溫庭筠 利洲南渡</option>
<option value="kanripo/kR4h0169/220">溫庭筠 蘇武廟</option>
<option value="kanripo/kR4h0169/221">薛逢 宮詞</option>
<option value="kanripo/kR4h0169/222">秦韜玉 貧女</option>
<option value="kanripo/kR4h0169/223">沈佺期 古意呈補闕喬知之</option>
</select>
<input type="text" id="count" size=3 value=0 style="text-align:right" onchange="Tangshi.goto()" />
<input type="button" value="GitLab" onclick="Tangshi.gitlab()" />
<input type="button" value="Reload" onclick="Tangshi.reload()" />
</div>
</body>
<!DOCTYPE html><head><meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>Universal Dependencies on 唐詩三百首卷五</title>
<script src="conllusvgview.js"></script>
<script src="conllusvgload.js"></script>
<script>
var Tangshi=new Object();
Tangshi.url="/gitlab/api/v4/projects/Kanbun%2Fud-kanbun/repository/";
Tangshi.init=function(){
var t=document.getElementById("top").cloneNode(true);
t.style.position="static";
t.style.visibility="hidden";
document.body.appendChild(t);
Tangshi.svg=new Array();
Tangshi.pre=new Array();
Tangshi.timer=setTimeout("clearTimeout(Tangshi.timer);Tangshi.checkview()",200);
Tangshi.volchange();
}
Tangshi.checkview=function(){
var t,r,b,i,x;
Tangshi.timer=setTimeout("clearTimeout(Tangshi.timer);Tangshi.checkview()",200);
if(Tangshi.curr==null)
return;
if(Tangshi.svg[Tangshi.curr]==null||Tangshi.pre[Tangshi.curr]==null){
Tangshi.buildup(Tangshi.curr);
Tangshi.lastTop=null;
return;
}
if(Tangshi.svg[Tangshi.curr].style.position=="absolute"){
Tangshi.svg[Tangshi.curr].style.position="static";
Tangshi.svg[Tangshi.curr].style.visibility="visible";
}
conllusvg.rewrite("pre"+Tangshi.curr);
r=Tangshi.svg[Tangshi.curr].getBoundingClientRect();
t=r.top;
b=r.bottom;
r=document.getElementById("top").getBoundingClientRect().bottom;
x=Tangshi.curr;
if(t-r>20){
while(t-r>0){
i=Tangshi.svg[Tangshi.curr-1];
if(i==null)
break;
if(i.style.position=="absolute")
break;
Tangshi.curr--;
if(Tangshi.curr==0)
break;
t=i.getBoundingClientRect().top;
}
}
else if(b<r){
while(b<r){
i=Tangshi.svg[Tangshi.curr+1];
if(i==null)
break;
if(i.style.position=="absolute")
break;
Tangshi.curr++;
if(Tangshi.curr==Tangshi.currmax)
break;
b=i.getBoundingClientRect().bottom;
}
}
if(Tangshi.curr!=x){
if(Tangshi.retrytimes>0){
Tangshi.retrytimes--;
Tangshi.curr=parseInt(document.getElementById("count").value,10);
t=Tangshi.svg[Tangshi.curr].getBoundingClientRect().top;
if(Math.abs(t-r)>5){
if(document.scrollingElement==null)
document.documentElement.scrollTop+=t-r;
else
document.scrollingElement.scrollTop+=t-r;
}
}
else
document.getElementById("count").value=Tangshi.curr;
}
else if(Tangshi.retrytimes>0)
Tangshi.retrytimes--;
Tangshi.lastTop=Tangshi.svg[Tangshi.curr].getBoundingClientRect().top;
for(i=Tangshi.curr+1;i<=Tangshi.currmax;i++){
if(Tangshi.svg[i]==null||Tangshi.pre[i]==null){
Tangshi.buildup(i);
break;
}
if(Tangshi.svg[i].style.position=="absolute"){
Tangshi.svg[i].style.position="static";
Tangshi.svg[i].style.visibility="visible";
}
conllusvg.rewrite("pre"+i);
r=Tangshi.svg[i].getBoundingClientRect();
if(r.top-window.innerHeight-1000>0)
break;
}
for(i=Tangshi.curr-1;i>=0;i--){
if(Tangshi.svg[i]==null||Tangshi.pre[i]==null){
Tangshi.buildup(i);
break;
}
if(Tangshi.svg[i].style.position=="absolute"){
if(Tangshi.pre[i].textContent>""){
Tangshi.svg[i].style.position="static";
Tangshi.svg[i].style.visibility="visible";
}
else
break;
}
conllusvg.rewrite("pre"+i);
r=Tangshi.svg[Tangshi.curr].getBoundingClientRect().top;
if(Math.abs(r-Tangshi.lastTop)>5){
if(document.scrollingElement==null)
document.documentElement.scrollTop+=r-Tangshi.lastTop;
else
document.scrollingElement.scrollTop+=r-Tangshi.lastTop;
Tangshi.lastTop=r;
}
r=Tangshi.svg[i].getBoundingClientRect();
if(parseInt(r.bottom,10)<-300)
break;
}
}
Tangshi.buildup=function(x){
var t,i;
if(Tangshi.svg[x]==null){
t=document.createElementNS("http://www.w3.org/2000/svg","svg");
for(i=parseInt(x,10)+1;i<=Tangshi.currmax;i++){
if(Tangshi.svg[i]!=null)
break;
}
t.style.position="absolute";
t.style.visibility="hidden";
if(i>Tangshi.currmax)
document.body.appendChild(t);
else
document.body.insertBefore(t,Tangshi.svg[i]);
Tangshi.svg[x]=t;
t.addEventListener("mousedown",Tangshi.onmousedown);
t.addEventListener("touchstart",Tangshi.onmousedown);
}
if(Tangshi.pre[x]==null){
t=document.createElement("pre");
t.style.display="none";
t.setAttribute("id","pre"+x);
document.body.appendChild(t);
Tangshi.pre[x]=t;
if(conllusvg.main["pre"+x]==null)
conllusvg.view(Tangshi.svg[x],"pre"+x);
i=Tangshi.volpath+"/"+("000"+x).slice(-3)+".txt";
conllusvg.loadRemote("pre"+x,Tangshi.url+"files/"+encodeURIComponent(i)+"/raw?ref=master");
}
}
Tangshi.volchange=function(){
var s,x;
Tangshi.clearSVG();
for(s in Tangshi.pre){
if(Tangshi.pre[s]!=null){
document.body.removeChild(Tangshi.pre[s]);
}
Tangshi.pre[s]=null;
}
s=document.getElementById("vol");
Tangshi.volpath=s.options[s.selectedIndex].value;
if(Tangshi.tail==null)
Tangshi.tail=new Array();
if(Tangshi.tail[Tangshi.volpath]==null)
Tangshi.gettree();
else
Tangshi.writeSVG();
}
Tangshi.gettree=function(){
var p;
if(Tangshi.request==null){
Tangshi.request=new XMLHttpRequest();
Tangshi.request.onload=Tangshi.ongettree;
}
if(Tangshi.tail[Tangshi.volpath]==null)
p=1;
else
p=Math.floor(parseInt(Tangshi.tail[Tangshi.volpath],10)/100)+2;
Tangshi.request.open("GET",Tangshi.url+"tree?per_page=100&path="+Tangshi.volpath+"&page="+p);
Tangshi.request.send();
}
Tangshi.ongettree=function(e){
var i,s;
if(Tangshi.request.status==200){
s=Tangshi.request.responseText;
i=s.lastIndexOf('.txt"');
if(i<0)
Tangshi.writeSVG();
else{
Tangshi.tail[Tangshi.volpath]=s.substring(i-3,i);
Tangshi.gettree();
}
}
}
Tangshi.goto=function(){
Tangshi.retrytimes=3;
Tangshi.writeSVG();
}
Tangshi.writeSVG=function(){
var c=document.getElementById("count");
Tangshi.clearSVG();
Tangshi.currmax=parseInt(Tangshi.tail[Tangshi.volpath],10);
Tangshi.curr=parseInt(c.value,10);
if(Tangshi.curr<0)
Tangshi.curr=0;
if(Tangshi.curr>Tangshi.currmax)
Tangshi.curr=Tangshi.currmax;
c.value=Tangshi.curr;
Tangshi.lastTop=null;
}
Tangshi.clearSVG=function(){
var x;
Tangshi.curr=Tangshi.lastTop=null;
if(Tangshi.svg!=null){
for(x in Tangshi.svg){
if(Tangshi.svg[x]!=null){
Tangshi.svg[x].style.position="absolute";
Tangshi.svg[x].style.visibility="hidden";
}
}
}
if(document.scrollingElement==null)
document.documentElement.scrollTop=0;
else
document.scrollingElement.scrollTop=0;
}
Tangshi.onmousedown=function(e){
var x,y;
if(Tangshi.lastX==null){
Tangshi.lastX=e.clientX;
Tangshi.lastY=e.clientY;
return;
}
x=e.clientX-Tangshi.lastX;
y=e.clientY-Tangshi.lastY;
if(x*x+y*y>9){
Tangshi.lastX=e.clientX;
Tangshi.lastY=e.clientY;
return;
}
Tangshi.lastX=null;
x=e.currentTarget;
for(y in Tangshi.svg){
if(Tangshi.svg[y]==x){
x=Tangshi.volpath+"/"+("000"+y).slice(-3)+".txt";
window.open("editor-kanbun.html#"+Tangshi.url+"files/"+encodeURIComponent(x)+"/raw?ref=master");
break;
}
}
}
Tangshi.reload=function(){
var i,r;
for(i=Tangshi.curr;i<=Tangshi.currmax;i++){
if(Tangshi.svg[i]==null||Tangshi.pre[i]==null)
return;
r=Tangshi.svg[i].getBoundingClientRect();
if(r.top>window.innerHeight||r.bottom<0)
return;
r=Tangshi.volpath+"/"+("000"+i).slice(-3)+".txt";
conllusvg.loadRemote("pre"+i,Tangshi.url+"files/"+encodeURIComponent(r)+"/raw?ref=master");
}
}
Tangshi.gitlab=function(){
var r=Tangshi.volpath+"/"+("000"+Tangshi.curr).slice(-3)+".txt";
window.open("/gitlab/Kanbun/ud-kanbun/blob/master/"+r);
}
</script>
<body onload="Tangshi.init()">
<div id="top" style="position:fixed; top:0px; left:0px; padding:10px; width:100%; background:white">
<font size="+3"><b>唐詩三百首卷五</b></font>
<select id="vol" onchange="Tangshi.volchange()">
<option value="kanripo/kR4h0169/224" selected>王維 鹿柴</option>
<option value="kanripo/kR4h0169/225">王維 竹里館</option>
<option value="kanripo/kR4h0169/226">王維 送別</option>
<option value="kanripo/kR4h0169/227">王維 相思</option>
<option value="kanripo/kR4h0169/228">王維 雜詩</option>
<option value="kanripo/kR4h0169/229">裴迪 送崔九</option>
<option value="kanripo/kR4h0169/230">祖詠 終南望餘雪</option>
<option value="kanripo/kR4h0169/231">孟浩然 宿建德江</option>
<option value="kanripo/kR4h0169/232">孟浩然 春曉</option>
<option value="kanripo/kR4h0169/233">李白 夜思</option>
<option value="kanripo/kR4h0169/234">李白 怨情</option>
<option value="kanripo/kR4h0169/235">杜甫 八陣圖</option>
<option value="kanripo/kR4h0169/236">王之渙 登鸛雀樓</option>
<option value="kanripo/kR4h0169/237">劉長卿 送靈澈</option>
<option value="kanripo/kR4h0169/238">劉長卿 彈琴</option>
<option value="kanripo/kR4h0169/239">劉長卿 送上人</option>
<option value="kanripo/kR4h0169/240">韋應物 秋夜寄邱員外</option>
<option value="kanripo/kR4h0169/241">李端 聽箏</option>
<option value="kanripo/kR4h0169/242">王建 新嫁娘</option>
<option value="kanripo/kR4h0169/243">權德輿 玉臺體</option>
<option value="kanripo/kR4h0169/244">柳宗元 江雪</option>
<option value="kanripo/kR4h0169/245">元稹 行宮</option>
<option value="kanripo/kR4h0169/246">白居易 問劉十九</option>
<option value="kanripo/kR4h0169/247">張祜 何滿子</option>
<option value="kanripo/kR4h0169/248">李商隱 登樂遊原</option>
<option value="kanripo/kR4h0169/249">賈島 尋隱者不遇</option>
<option value="kanripo/kR4h0169/250">李頻 渡漢江</option>
<option value="kanripo/kR4h0169/251">金昌緒 春怨</option>
<option value="kanripo/kR4h0169/252">西鄙人 哥舒歌</option>
<option value="kanripo/kR4h0169/253">崔顥 長干行二首之一</option>
<option value="kanripo/kR4h0169/254">崔顥 長干行二首之二</option>
<option value="kanripo/kR4h0169/255">李白 玉階怨</option>
<option value="kanripo/kR4h0169/256">盧綸 塞下曲四首之一</option>
<option value="kanripo/kR4h0169/257">盧綸 塞下曲四首之二</option>
<option value="kanripo/kR4h0169/258">盧綸 塞下曲四首之三</option>
<option value="kanripo/kR4h0169/259">盧綸 塞下曲四首之四</option>
<option value="kanripo/kR4h0169/260">李益 江南曲</option>
</select>
<input type="text" id="count" size=3 value=0 style="text-align:right" onchange="Tangshi.goto()" />
<input type="button" value="GitLab" onclick="Tangshi.gitlab()" />
<input type="button" value="Reload" onclick="Tangshi.reload()" />
</div>
</body>
<!DOCTYPE html><head><meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>Universal Dependencies on 唐詩三百首卷六</title>
<script src="conllusvgview.js"></script>
<script src="conllusvgload.js"></script>
<script>
var Tangshi=new Object();
Tangshi.url="/gitlab/api/v4/projects/Kanbun%2Fud-kanbun/repository/";
Tangshi.init=function(){
var t=document.getElementById("top").cloneNode(true);
t.style.position="static";
t.style.visibility="hidden";
document.body.appendChild(t);
Tangshi.svg=new Array();
Tangshi.pre=new Array();
Tangshi.timer=setTimeout("clearTimeout(Tangshi.timer);Tangshi.checkview()",200);
Tangshi.volchange();
}
Tangshi.checkview=function(){
var t,r,b,i,x;
Tangshi.timer=setTimeout("clearTimeout(Tangshi.timer);Tangshi.checkview()",200);
if(Tangshi.curr==null)
return;
if(Tangshi.svg[Tangshi.curr]==null||Tangshi.pre[Tangshi.curr]==null){
Tangshi.buildup(Tangshi.curr);
Tangshi.lastTop=null;
return;
}
if(Tangshi.svg[Tangshi.curr].style.position=="absolute"){
Tangshi.svg[Tangshi.curr].style.position="static";
Tangshi.svg[Tangshi.curr].style.visibility="visible";
}
conllusvg.rewrite("pre"+Tangshi.curr);
r=Tangshi.svg[Tangshi.curr].getBoundingClientRect();
t=r.top;
b=r.bottom;
r=document.getElementById("top").getBoundingClientRect().bottom;
x=Tangshi.curr;
if(t-r>20){
while(t-r>0){
i=Tangshi.svg[Tangshi.curr-1];
if(i==null)
break;
if(i.style.position=="absolute")
break;
Tangshi.curr--;
if(Tangshi.curr==0)
break;
t=i.getBoundingClientRect().top;
}
}
else if(b<r){
while(b<r){
i=Tangshi.svg[Tangshi.curr+1];
if(i==null)
break;
if(i.style.position=="absolute")
break;
Tangshi.curr++;
if(Tangshi.curr==Tangshi.currmax)
break;
b=i.getBoundingClientRect().bottom;
}
}
if(Tangshi.curr!=x){
if(Tangshi.retrytimes>0){
Tangshi.retrytimes--;
Tangshi.curr=parseInt(document.getElementById("count").value,10);
t=Tangshi.svg[Tangshi.curr].getBoundingClientRect().top;
if(Math.abs(t-r)>5){
if(document.scrollingElement==null)
document.documentElement.scrollTop+=t-r;
else
document.scrollingElement.scrollTop+=t-r;
}
}
else
document.getElementById("count").value=Tangshi.curr;
}
else if(Tangshi.retrytimes>0)
Tangshi.retrytimes--;
Tangshi.lastTop=Tangshi.svg[Tangshi.curr].getBoundingClientRect().top;
for(i=Tangshi.curr+1;i<=Tangshi.currmax;i++){
if(Tangshi.svg[i]==null||Tangshi.pre[i]==null){
Tangshi.buildup(i);
break;
}
if(Tangshi.svg[i].style.position=="absolute"){
Tangshi.svg[i].style.position="static";
Tangshi.svg[i].style.visibility="visible";
}
conllusvg.rewrite("pre"+i);
r=Tangshi.svg[i].getBoundingClientRect();
if(r.top-window.innerHeight-1000>0)
break;
}
for(i=Tangshi.curr-1;i>=0;i--){
if(Tangshi.svg[i]==null||Tangshi.pre[i]==null){
Tangshi.buildup(i);
break;
}
if(Tangshi.svg[i].style.position=="absolute"){
if(Tangshi.pre[i].textContent>""){
Tangshi.svg[i].style.position="static";
Tangshi.svg[i].style.visibility="visible";
}
else
break;
}
conllusvg.rewrite("pre"+i);
r=Tangshi.svg[Tangshi.curr].getBoundingClientRect().top;
if(Math.abs(r-Tangshi.lastTop)>5){
if(document.scrollingElement==null)
document.documentElement.scrollTop+=r-Tangshi.lastTop;
else
document.scrollingElement.scrollTop+=r-Tangshi.lastTop;
Tangshi.lastTop=r;
}
r=Tangshi.svg[i].getBoundingClientRect();
if(parseInt(r.bottom,10)<-300)
break;
}
}
Tangshi.buildup=function(x){
var t,i;
if(Tangshi.svg[x]==null){
t=document.createElementNS("http://www.w3.org/2000/svg","svg");
for(i=parseInt(x,10)+1;i<=Tangshi.currmax;i++){
if(Tangshi.svg[i]!=null)
break;
}
t.style.position="absolute";
t.style.visibility="hidden";
if(i>Tangshi.currmax)
document.body.appendChild(t);
else
document.body.insertBefore(t,Tangshi.svg[i]);
Tangshi.svg[x]=t;
t.addEventListener("mousedown",Tangshi.onmousedown);
t.addEventListener("touchstart",Tangshi.onmousedown);
}
if(Tangshi.pre[x]==null){
t=document.createElement("pre");
t.style.display="none";
t.setAttribute("id","pre"+x);
document.body.appendChild(t);
Tangshi.pre[x]=t;
if(conllusvg.main["pre"+x]==null)
conllusvg.view(Tangshi.svg[x],"pre"+x);
i=Tangshi.volpath+"/"+("000"+x).slice(-3)+".txt";
conllusvg.loadRemote("pre"+x,Tangshi.url+"files/"+encodeURIComponent(i)+"/raw?ref=master");
}
}
Tangshi.volchange=function(){
var s,x;
Tangshi.clearSVG();
for(s in Tangshi.pre){
if(Tangshi.pre[s]!=null){
document.body.removeChild(Tangshi.pre[s]);
}
Tangshi.pre[s]=null;
}
s=document.getElementById("vol");
Tangshi.volpath=s.options[s.selectedIndex].value;
if(Tangshi.tail==null)
Tangshi.tail=new Array();
if(Tangshi.tail[Tangshi.volpath]==null)
Tangshi.gettree();
else
Tangshi.writeSVG();
}
Tangshi.gettree=function(){
var p;
if(Tangshi.request==null){
Tangshi.request=new XMLHttpRequest();
Tangshi.request.onload=Tangshi.ongettree;
}
if(Tangshi.tail[Tangshi.volpath]==null)
p=1;
else
p=Math.floor(parseInt(Tangshi.tail[Tangshi.volpath],10)/100)+2;
Tangshi.request.open("GET",Tangshi.url+"tree?per_page=100&path="+Tangshi.volpath+"&page="+p);
Tangshi.request.send();
}
Tangshi.ongettree=function(e){
var i,s;
if(Tangshi.request.status==200){
s=Tangshi.request.responseText;
i=s.lastIndexOf('.txt"');
if(i<0)
Tangshi.writeSVG();
else{
Tangshi.tail[Tangshi.volpath]=s.substring(i-3,i);
Tangshi.gettree();
}
}
}
Tangshi.goto=function(){
Tangshi.retrytimes=3;
Tangshi.writeSVG();
}
Tangshi.writeSVG=function(){
var c=document.getElementById("count");
Tangshi.clearSVG();
Tangshi.currmax=parseInt(Tangshi.tail[Tangshi.volpath],10);
Tangshi.curr=parseInt(c.value,10);
if(Tangshi.curr<0)
Tangshi.curr=0;
if(Tangshi.curr>Tangshi.currmax)
Tangshi.curr=Tangshi.currmax;
c.value=Tangshi.curr;
Tangshi.lastTop=null;
}
Tangshi.clearSVG=function(){
var x;
Tangshi.curr=Tangshi.lastTop=null;
if(Tangshi.svg!=null){
for(x in Tangshi.svg){
if(Tangshi.svg[x]!=null){
Tangshi.svg[x].style.position="absolute";
Tangshi.svg[x].style.visibility="hidden";
}
}
}
if(document.scrollingElement==null)
document.documentElement.scrollTop=0;
else
document.scrollingElement.scrollTop=0;
}
Tangshi.onmousedown=function(e){
var x,y;
if(Tangshi.lastX==null){
Tangshi.lastX=e.clientX;
Tangshi.lastY=e.clientY;
return;
}
x=e.clientX-Tangshi.lastX;
y=e.clientY-Tangshi.lastY;
if(x*x+y*y>9){
Tangshi.lastX=e.clientX;
Tangshi.lastY=e.clientY;
return;
}
Tangshi.lastX=null;
x=e.currentTarget;
for(y in Tangshi.svg){
if(Tangshi.svg[y]==x){
x=Tangshi.volpath+"/"+("000"+y).slice(-3)+".txt";
window.open("editor-kanbun.html#"+Tangshi.url+"files/"+encodeURIComponent(x)+"/raw?ref=master");
break;
}
}
}
Tangshi.reload=function(){
var i,r;
for(i=Tangshi.curr;i<=Tangshi.currmax;i++){
if(Tangshi.svg[i]==null||Tangshi.pre[i]==null)
return;
r=Tangshi.svg[i].getBoundingClientRect();
if(r.top>window.innerHeight||r.bottom<0)
return;
r=Tangshi.volpath+"/"+("000"+i).slice(-3)+".txt";
conllusvg.loadRemote("pre"+i,Tangshi.url+"files/"+encodeURIComponent(r)+"/raw?ref=master");
}
}
Tangshi.gitlab=function(){
var r=Tangshi.volpath+"/"+("000"+Tangshi.curr).slice(-3)+".txt";
window.open("/gitlab/Kanbun/ud-kanbun/blob/master/"+r);
}
</script>
<body onload="Tangshi.init()">
<div id="top" style="position:fixed; top:0px; left:0px; padding:10px; width:100%; background:white">
<font size="+3"><b>唐詩三百首卷六</b></font>
<select id="vol" onchange="Tangshi.volchange()">
<option value="kanripo/kR4h0169/261" selected>賀知章 回鄉偶書</option>
<option value="kanripo/kR4h0169/262">張旭 桃花谿</option>
<option value="kanripo/kR4h0169/263">王維 九月九日憶山東兄弟</option>
<option value="kanripo/kR4h0169/264">王昌齡 芙蓉樓送辛漸</option>
<option value="kanripo/kR4h0169/265">王昌齡 閨怨</option>
<option value="kanripo/kR4h0169/266">王昌齡 春宮曲</option>
<option value="kanripo/kR4h0169/267">王翰 涼州詞</option>
<option value="kanripo/kR4h0169/268">李白 送孟浩然之廣陵</option>
<option value="kanripo/kR4h0169/269">李白 下江陵</option>
<option value="kanripo/kR4h0169/270">岑參 逢入京使</option>
<option value="kanripo/kR4h0169/271">杜甫 江南逢李龜年</option>
<option value="kanripo/kR4h0169/272">韋應物 滁州西澗</option>
<option value="kanripo/kR4h0169/273">張繼 楓橋夜泊</option>
<option value="kanripo/kR4h0169/274">韓翃 寒食</option>
<option value="kanripo/kR4h0169/275">劉方平 月夜</option>
<option value="kanripo/kR4h0169/276">劉方平 春怨</option>
<option value="kanripo/kR4h0169/277">柳中庸 征人怨</option>
<option value="kanripo/kR4h0169/278">顧況 宮詞</option>
<option value="kanripo/kR4h0169/279">李益 夜上受降城聞笛</option>
<option value="kanripo/kR4h0169/280">劉禹錫 烏衣巷</option>
<option value="kanripo/kR4h0169/281">劉禹錫 春詞</option>
<option value="kanripo/kR4h0169/282">白居易 後宮詞</option>
<option value="kanripo/kR4h0169/283">張祜 贈內人</option>
<option value="kanripo/kR4h0169/284">張祜 集靈臺二首之一</option>
<option value="kanripo/kR4h0169/285">張祜 集靈臺二首之二</option>
<option value="kanripo/kR4h0169/286">張祜 題金陵渡</option>
<option value="kanripo/kR4h0169/287">朱慶餘 宮詞</option>
<option value="kanripo/kR4h0169/288">朱慶餘 近試上張水部</option>
<option value="kanripo/kR4h0169/289">杜牧 將赴吳興登樂遊原</option>
<option value="kanripo/kR4h0169/290">杜牧 赤壁</option>
<option value="kanripo/kR4h0169/291">杜牧 泊秦淮</option>
<option value="kanripo/kR4h0169/292">杜牧 寄揚州韓綽判官</option>
<option value="kanripo/kR4h0169/293">杜牧 遣懷</option>
<option value="kanripo/kR4h0169/294">杜牧 秋夕</option>
<option value="kanripo/kR4h0169/295">杜牧 贈別二首之一</option>
<option value="kanripo/kR4h0169/296">杜牧 贈別二首之二</option>
<option value="kanripo/kR4h0169/297">杜牧 金谷園</option>
<option value="kanripo/kR4h0169/298">李商隱 夜雨寄北</option>
<option value="kanripo/kR4h0169/299">李商隱 寄令狐郎中</option>
<option value="kanripo/kR4h0169/300">李商隱 為有</option>
<option value="kanripo/kR4h0169/301">李商隱 隋宮</option>
<option value="kanripo/kR4h0169/302">李商隱 瑤池</option>
<option value="kanripo/kR4h0169/303">李商隱 嫦娥</option>
<option value="kanripo/kR4h0169/304">李商隱 賈生</option>
<option value="kanripo/kR4h0169/305">溫庭筠 瑤瑟怨</option>
<option value="kanripo/kR4h0169/306">鄭畋 馬嵬坡</option>
<option value="kanripo/kR4h0169/307">韓偓 已涼</option>
<option value="kanripo/kR4h0169/308">韋莊 金陵圖</option>
<option value="kanripo/kR4h0169/309">陳陶 隴西行</option>
<option value="kanripo/kR4h0169/310">張泌 寄人</option>
<option value="kanripo/kR4h0169/311">無名氏 雜詩</option>
<option value="kanripo/kR4h0169/312">王維 渭城曲</option>
<option value="kanripo/kR4h0169/313">王維 秋夜曲</option>
<option value="kanripo/kR4h0169/314">王昌齡 長信怨</option>
<option value="kanripo/kR4h0169/315">王昌齡 出塞</option>
<option value="kanripo/kR4h0169/316">王之渙 出塞</option>
<option value="kanripo/kR4h0169/317">李白 清平調三首之一</option>
<option value="kanripo/kR4h0169/318">李白 清平調三首之二</option>
<option value="kanripo/kR4h0169/319">李白 清平調三首之三</option>
<option value="kanripo/kR4h0169/320">杜秋娘 金縷衣</option>
</select>
<input type="text" id="count" size=3 value=0 style="text-align:right" onchange="Tangshi.goto()" />
<input type="button" value="GitLab" onclick="Tangshi.gitlab()" />
<input type="button" value="Reload" onclick="Tangshi.reload()" />
</div>
</body>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment