Commit e07b02ea authored by Koichi Yasuoka's avatar Koichi Yasuoka
Browse files

initial release

parent 9a684762
Loading
Loading
Loading
Loading

conllusvg/Chuci.html

0 → 100644
+281 −0
Original line number Diff line number Diff line
<!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 Chuci=new Object();
Chuci.url="/gitlab/api/v4/projects/Kanbun%2Fud-kanbun/repository/";
Chuci.init=function(){
  var t=document.getElementById("top").cloneNode(true);
  t.style.position="static";
  t.style.visibility="hidden";
  document.body.appendChild(t);
  Chuci.svg=new Array();
  Chuci.pre=new Array();
  Chuci.timer=setTimeout("clearTimeout(Chuci.timer);Chuci.checkview()",200);
  Chuci.volchange();
}
Chuci.checkview=function(){
  var t,r,b,i,x;
  Chuci.timer=setTimeout("clearTimeout(Chuci.timer);Chuci.checkview()",200);
  if(Chuci.curr==null)
    return;
  if(Chuci.svg[Chuci.curr]==null||Chuci.pre[Chuci.curr]==null){
    Chuci.buildup(Chuci.curr);
    Chuci.lastTop=null;
    return;
  }
  if(Chuci.svg[Chuci.curr].style.position=="absolute"){
    Chuci.svg[Chuci.curr].style.position="static";
    Chuci.svg[Chuci.curr].style.visibility="visible";
  }
  conllusvg.rewrite("pre"+Chuci.curr);
  r=Chuci.svg[Chuci.curr].getBoundingClientRect();
  t=r.top;
  b=r.bottom;
  r=document.getElementById("top").getBoundingClientRect().bottom;
  x=Chuci.curr;
  if(t-r>20){
    while(t-r>0){
      i=Chuci.svg[Chuci.curr-1];
      if(i==null)
	break;
      if(i.style.position=="absolute")
	break;
      Chuci.curr--;
      if(Chuci.curr==0)
	break;
      t=i.getBoundingClientRect().top;
    }
  }
  else if(b<r){
    while(b<r){
      i=Chuci.svg[Chuci.curr+1];
      if(i==null)
	break;
      if(i.style.position=="absolute")
        break;
      Chuci.curr++;
      if(Chuci.curr==Chuci.currmax)
	break;
      b=i.getBoundingClientRect().bottom;
    }
  }
  if(Chuci.curr!=x){
    if(Chuci.retrytimes>0){
      Chuci.retrytimes--;
      Chuci.curr=parseInt(document.getElementById("count").value,10);
      t=Chuci.svg[Chuci.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=Chuci.curr;
  }
  else if(Chuci.retrytimes>0)
    Chuci.retrytimes--;
  Chuci.lastTop=Chuci.svg[Chuci.curr].getBoundingClientRect().top;
  for(i=Chuci.curr+1;i<=Chuci.currmax;i++){
    if(Chuci.svg[i]==null||Chuci.pre[i]==null){
      Chuci.buildup(i);
      break;
    }
    if(Chuci.svg[i].style.position=="absolute"){
      Chuci.svg[i].style.position="static";
      Chuci.svg[i].style.visibility="visible";
    }
    conllusvg.rewrite("pre"+i);
    r=Chuci.svg[i].getBoundingClientRect();
    if(r.top-window.innerHeight-1000>0)
      break;
  }
  for(i=Chuci.curr-1;i>=0;i--){
    if(Chuci.svg[i]==null||Chuci.pre[i]==null){
      Chuci.buildup(i);
      break;
    }
    if(Chuci.svg[i].style.position=="absolute"){
      if(Chuci.pre[i].textContent>""){
	Chuci.svg[i].style.position="static";
	Chuci.svg[i].style.visibility="visible";
      }
      else
	break;
    }
    conllusvg.rewrite("pre"+i);
    r=Chuci.svg[Chuci.curr].getBoundingClientRect().top;
    if(Math.abs(r-Chuci.lastTop)>5){
      if(document.scrollingElement==null)
        document.documentElement.scrollTop+=r-Chuci.lastTop;
      else
        document.scrollingElement.scrollTop+=r-Chuci.lastTop;
      Chuci.lastTop=r;
    }
    r=Chuci.svg[i].getBoundingClientRect();
    if(parseInt(r.bottom,10)<-300)
      break;
  }
}
Chuci.buildup=function(x){
  var t,i;
  if(Chuci.svg[x]==null){
    t=document.createElementNS("http://www.w3.org/2000/svg","svg");
    for(i=parseInt(x,10)+1;i<=Chuci.currmax;i++){
      if(Chuci.svg[i]!=null)
	break;
    }
    t.style.position="absolute";
    t.style.visibility="hidden";
    if(i>Chuci.currmax)
      document.body.appendChild(t);
    else
      document.body.insertBefore(t,Chuci.svg[i]);
    Chuci.svg[x]=t;
    t.addEventListener("mousedown",Chuci.onmousedown);
    t.addEventListener("touchstart",Chuci.onmousedown);
  }
  if(Chuci.pre[x]==null){
    t=document.createElement("pre");
    t.style.display="none";
    t.setAttribute("id","pre"+x);
    document.body.appendChild(t);
    Chuci.pre[x]=t;
    if(conllusvg.main["pre"+x]==null)
      conllusvg.view(Chuci.svg[x],"pre"+x);
    i=Chuci.volpath+"/"+("000"+x).slice(-3)+".txt";
    conllusvg.loadRemote("pre"+x,Chuci.url+"files/"+encodeURIComponent(i)+"/raw?ref=master");
  }
}
Chuci.volchange=function(){
  var s,x;
  Chuci.clearSVG();
  for(s in Chuci.pre){
    if(Chuci.pre[s]!=null){
      document.body.removeChild(Chuci.pre[s]);
    }
    Chuci.pre[s]=null;
  }
  s=document.getElementById("vol");
  Chuci.volpath=s.options[s.selectedIndex].value;
  if(Chuci.tail==null)
    Chuci.tail=new Array();
  if(Chuci.tail[Chuci.volpath]==null)
    Chuci.gettree();
  else
    Chuci.writeSVG();
}
Chuci.gettree=function(){
  var p;
  if(Chuci.request==null){
    Chuci.request=new XMLHttpRequest();
    Chuci.request.onload=Chuci.ongettree;
  }
  if(Chuci.tail[Chuci.volpath]==null)
    p=1;
  else
    p=Math.floor(parseInt(Chuci.tail[Chuci.volpath],10)/100)+2;
  Chuci.request.open("GET",Chuci.url+"tree?per_page=100&path="+Chuci.volpath+"&page="+p);
  Chuci.request.send();
}
Chuci.ongettree=function(e){
  var i,s;
  if(Chuci.request.status==200){
    s=Chuci.request.responseText;
    i=s.lastIndexOf('.txt"');
    if(i<0)
      Chuci.writeSVG();
    else{
      Chuci.tail[Chuci.volpath]=s.substring(i-3,i);
      Chuci.gettree();
    }
  }
}
Chuci.goto=function(){
  Chuci.retrytimes=3;
  Chuci.writeSVG();
}
Chuci.writeSVG=function(){
  var c=document.getElementById("count");
  Chuci.clearSVG();
  Chuci.currmax=parseInt(Chuci.tail[Chuci.volpath],10);
  Chuci.curr=parseInt(c.value,10);
  if(Chuci.curr<0)
    Chuci.curr=0;
  if(Chuci.curr>Chuci.currmax)
    Chuci.curr=Chuci.currmax;
  c.value=Chuci.curr;
  Chuci.lastTop=null;
}
Chuci.clearSVG=function(){
  var x;
  Chuci.curr=Chuci.lastTop=null;
  if(Chuci.svg!=null){
    for(x in Chuci.svg){
      if(Chuci.svg[x]!=null){
	Chuci.svg[x].style.position="absolute";
	Chuci.svg[x].style.visibility="hidden";
      }
    }
  }
  if(document.scrollingElement==null)
    document.documentElement.scrollTop=0;
  else
    document.scrollingElement.scrollTop=0;
}
Chuci.onmousedown=function(e){
  var x,y;
  if(Chuci.lastX==null){
    Chuci.lastX=e.clientX;
    Chuci.lastY=e.clientY;
    return;
  }
  x=e.clientX-Chuci.lastX;
  y=e.clientY-Chuci.lastY;
  if(x*x+y*y>9){
    Chuci.lastX=e.clientX;
    Chuci.lastY=e.clientY;
    return;
  }
  Chuci.lastX=null;
  x=e.currentTarget;
  for(y in Chuci.svg){
    if(Chuci.svg[y]==x){
      x=Chuci.volpath+"/"+("000"+y).slice(-3)+".txt";
      window.open("editor-kanbun.html#"+Chuci.url+"files/"+encodeURIComponent(x)+"/raw?ref=master");
      break;
    }
  }
}
Chuci.reload=function(){
  var i,r;
  for(i=Chuci.curr;i<=Chuci.currmax;i++){
    if(Chuci.svg[i]==null||Chuci.pre[i]==null)
      return;
    r=Chuci.svg[i].getBoundingClientRect();
    if(r.top>window.innerHeight||r.bottom<0)
      return;
    r=Chuci.volpath+"/"+("000"+i).slice(-3)+".txt";
    conllusvg.loadRemote("pre"+i,Chuci.url+"files/"+encodeURIComponent(r)+"/raw?ref=master");
  }
}
Chuci.gitlab=function(){
  var r=Chuci.volpath+"/"+("000"+Chuci.curr).slice(-3)+".txt";
  window.open("/gitlab/Kanbun/ud-kanbun/blob/master/"+r);
}
</script>
<body onload="Chuci.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="Chuci.volchange()">
<option value="kanripo/kR4a0001/001">離騷</option>
</select>
<input type="text" id="count" size=3 value=0 style="text-align:right" onchange="Chuci.goto()" />
<input type="button" value="GitLab" onclick="Chuci.gitlab()" />
<input type="button" value="Reload" onclick="Chuci.reload()" />
</div>
</body>
+4 −0
Original line number Diff line number Diff line
# text = 離騷
1	離	離	VERB	v,動詞,行為,移動	_	_	_	_	Gloss=leave|SpaceAfter=No|Translit=离
2	騷	騷	VERB	v,動詞,描写,態度	Degree=Pos	1	flat:vv	_	SpaceAfter=No|Translit=骚
+31 −0
Original line number Diff line number Diff line
# text = 帝高陽之苗裔兮
1	帝	帝	NOUN	n,名詞,人,役割	_	2	nmod	_	Gloss=emperor|SpaceAfter=No
2	高陽	高陽	PROPN	n,名詞,固定物,地名	Case=Loc|NameType=Geo	5	nmod	_	Gloss=[place-name]|SpaceAfter=No|Translit=高阳
3	之	之	SCONJ	p,助詞,接続,属格	_	2	case	_	Gloss='s|SpaceAfter=No
4	苗	苗	NOUN	n,名詞,固定物,樹木	_	5	nmod	_	Gloss=seedling|SpaceAfter=No
5	裔	裔	NOUN	n,名詞,人,関係	_	_	_	_	SpaceAfter=No
6	兮	兮	PART	p,助詞,句末,*	_	5	discourse:sp	_	Gloss=[filler-character]|SpaceAfter=No

# text = 朕皇考曰伯庸
1	朕	朕	PRON	n,代名詞,人称,他	Person=1|PronType=Prs	3	det	_	Gloss=[1PRON]|SpaceAfter=No
2	皇	皇	VERB	v,動詞,描写,態度	Degree=Pos	3	amod	_	Gloss=great|SpaceAfter=No
3	考	考	VERB	v,動詞,行為,動作	_	4	nsubj	_	Gloss=examine|SpaceAfter=No
4	曰	曰	VERB	v,動詞,行為,伝達	_	_	_	_	Gloss=say|SpaceAfter=No
5	伯	伯	NOUN	n,名詞,人,役割	_	4	obj	_	Gloss=earl|SpaceAfter=No
6	庸	庸	NOUN	n,名詞,描写,形質	_	5	flat	_	Gloss=ordinary|SpaceAfter=No

# text = 攝提貞于孟陬兮
1	攝提	攝提	NOUN	n,名詞,天象,天文	_	2	nsubj	_	Gloss=[name-of-star]|SpaceAfter=No|Translit=摄提
2	貞	貞	VERB	v,動詞,描写,態度	Degree=Pos	_	_	_	Gloss=chaste|SpaceAfter=No|Translit=贞
3	于	于	ADP	v,前置詞,基盤,*	_	4	case	_	Gloss=at|SpaceAfter=No
4	孟	孟	PROPN	n,名詞,人,姓氏	NameType=Sur	2	obl:lmod	_	Gloss=[surname]|SpaceAfter=No
5	陬	陬	NOUN	n,名詞,固定物,関係	Case=Loc	4	flat	_	Gloss=corner|SpaceAfter=No
6	兮	兮	PART	p,助詞,句末,*	_	2	discourse:sp	_	Gloss=[filler-character]|SpaceAfter=No

# text = 惟庚寅吾以降
1	惟	惟	ADV	v,副詞,範囲,限定	_	2	advmod	_	Gloss=only|SpaceAfter=No
2	庚寅	庚寅	NUM	n,数詞,干支,*	NumType=Ord	4	nsubj	_	Gloss=[27th-sexagenary]|SpaceAfter=No
3	吾	吾	PRON	n,代名詞,人称,起格	Person=1|PronType=Prs	5	nsubj	_	Gloss=[1PRON]|SpaceAfter=No
4	以	以	VERB	v,動詞,行為,動作	_	_	_	_	Gloss=use|SpaceAfter=No
5	降	降	VERB	v,動詞,行為,移動	_	4	obj	_	Gloss=go-down|SpaceAfter=No
+32 −0
Original line number Diff line number Diff line
# text = 皇覽揆余初度兮
1	皇	皇	VERB	v,動詞,描写,態度	Degree=Pos	2	nsubj	_	Gloss=great|SpaceAfter=No
2	覽	覽	VERB	v,動詞,行為,動作	_	_	_	_	Gloss=scan|SpaceAfter=No|Translit=览
3	揆	揆	NOUN	n,名詞,制度,儀礼	_	2	parataxis	_	Gloss=standard|SpaceAfter=No
4	余	余	PRON	n,代名詞,人称,他	Person=1|PronType=Prs	6	nsubj	_	Gloss=[1PRON]|SpaceAfter=No
5	初	初	NOUN	n,名詞,時,*	Case=Tem	6	nmod	_	Gloss=at-the-beginning|SpaceAfter=No
6	度	度	VERB	v,動詞,行為,態度	_	3	obj	_	Gloss=measure|SpaceAfter=No
7	兮	兮	PART	p,助詞,句末,*	_	6	discourse:sp	_	Gloss=[filler-character]|SpaceAfter=No

# text = 肇錫余以嘉名
1	肇	肇	VERB	v,動詞,行為,動作	_	2	nsubj	_	Gloss=initiate|SpaceAfter=No
2	錫	錫	VERB	v,動詞,行為,得失	_	4	csubj	_	Gloss=give|SpaceAfter=No|Translit=锡
3	余	余	PRON	n,代名詞,人称,他	Person=1|PronType=Prs	2	obj	_	Gloss=[1PRON]|SpaceAfter=No
4	以	以	VERB	v,動詞,行為,動作	_	_	_	_	Gloss=use|SpaceAfter=No
5	嘉	嘉	PROPN	n,名詞,人,名	NameType=Giv	6	amod	_	Gloss=[given-name]|SpaceAfter=No
6	名	名	NOUN	n,名詞,不可譲,属性	_	4	obj	_	Gloss=name|SpaceAfter=No

# text = 名余曰正則兮
1	名	名	VERB	v,動詞,行為,伝達	_	3	csubj	_	Gloss=name|SpaceAfter=No
2	余	余	PRON	n,代名詞,人称,他	Person=1|PronType=Prs	1	obj	_	Gloss=[1PRON]|SpaceAfter=No
3	曰	曰	VERB	v,動詞,行為,伝達	_	_	_	_	Gloss=say|SpaceAfter=No
4	正	正	VERB	v,動詞,描写,形質	Degree=Pos	5	amod	_	Gloss=correct|SpaceAfter=No
5	則	則	ADV	v,副詞,時相,緊接	AdvType=Tim	3	obj	_	Gloss=then|SpaceAfter=No|Translit=则
6	兮	兮	PART	p,助詞,句末,*	_	3	discourse:sp	_	Gloss=[filler-character]|SpaceAfter=No

# text = 字余曰靈均
1	字	字	PROPN	n,名詞,人,名	NameType=Giv	3	nsubj	_	Gloss=[given-name]|SpaceAfter=No
2	余	余	PRON	n,代名詞,人称,他	Person=1|PronType=Prs	1	conj	_	Gloss=[1PRON]|SpaceAfter=No
3	曰	曰	VERB	v,動詞,行為,伝達	_	_	_	_	Gloss=say|SpaceAfter=No
4	靈	靈	VERB	v,動詞,描写,形質	Degree=Pos	3	obj	_	Gloss=numinous|SpaceAfter=No|Translit=灵
5	均	均	VERB	v,動詞,描写,形質	Degree=Pos	4	conj	_	Gloss=equal|SpaceAfter=No
+35 −0
Original line number Diff line number Diff line
# text = 紛吾既有此內美兮
1	紛	紛	VERB	v,動詞,描写,形質	Degree=Pos	4	dislocated	_	Gloss=mixed|SpaceAfter=No|Translit=纷
2	吾	吾	PRON	n,代名詞,人称,起格	Person=1|PronType=Prs	4	nsubj	_	Gloss=[1PRON]|SpaceAfter=No
3	既	既	ADV	v,副詞,時相,完了	AdvType=Tim|Aspect=Perf	4	advmod	_	Gloss=already|SpaceAfter=No
4	有	有	VERB	v,動詞,存在,存在	_	_	_	_	Gloss=have|SpaceAfter=No
5	此	此	PRON	n,代名詞,指示,*	PronType=Dem	7	det	_	Gloss=this|SpaceAfter=No
6	內	內	NOUN	n,名詞,固定物,関係	Case=Loc	7	nmod	_	Gloss=inside|SpaceAfter=No|Translit=内
7	美	美	NOUN	n,名詞,描写,形質	_	4	obj	_	Gloss=beauty|SpaceAfter=No
8	兮	兮	PART	p,助詞,句末,*	_	4	discourse:sp	_	Gloss=[filler-character]|SpaceAfter=No

# text = 又重之以脩能
1	又	又	ADV	v,副詞,頻度,重複	_	2	advmod	_	Gloss=also|SpaceAfter=No
2	重	重	VERB	v,動詞,描写,量	Degree=Pos	5	advcl	_	Gloss=heavy|SpaceAfter=No
3	之	之	PRON	n,代名詞,人称,止格	Person=3|PronType=Prs	2	obj	_	Gloss=[3PRON]|SpaceAfter=No
4	以	以	VERB	v,動詞,行為,動作	_	5	advmod	_	Gloss=use|SpaceAfter=No
5	脩	脩	VERB	v,動詞,行為,動作	_	_	_	_	Gloss=improve|SpaceAfter=No|Translit=修
6	能	能	NOUN	n,名詞,不可譲,属性	_	5	obj	_	Gloss=ability|SpaceAfter=No

# text = 扈江離與辟芷兮
1	扈	扈	VERB	v,動詞,描写,量	Degree=Pos	_	_	_	SpaceAfter=No
2	江	江	NOUN	n,名詞,固定物,地形	Case=Loc	1	obj	_	Gloss=river|SpaceAfter=No
3	離	離	VERB	v,動詞,行為,移動	_	2	conj	_	Gloss=leave|SpaceAfter=No|Translit=离
4	與	與	ADP	v,前置詞,関係,*	_	5	cc	_	Gloss=associate-with|SpaceAfter=No|Translit=与
5	辟	辟	VERB	v,動詞,行為,動作	_	3	conj	_	Gloss=give-an-analogy|SpaceAfter=No
6	芷	芷	NOUN	n,名詞,*,*	_	2	conj	_	SpaceAfter=No
7	兮	兮	PART	p,助詞,句末,*	_	1	discourse:sp	_	Gloss=[filler-character]|SpaceAfter=No

# text = 紉秋蘭以為佩
1	紉	紉	VERB	v,動詞,行為,動作	_	_	_	_	SpaceAfter=No|Translit=纫
2	秋	秋	NOUN	n,名詞,時,*	Case=Tem	1	obj	_	Gloss=autumn|SpaceAfter=No
3	蘭	蘭	NOUN	n,名詞,固定物,樹木	_	1	obj	_	Gloss=orchid|SpaceAfter=No|Translit=兰
4	以	以	VERB	v,動詞,行為,動作	_	5	advmod	_	Gloss=use|SpaceAfter=No
5	為	爲	VERB	v,動詞,行為,生産	_	1	parataxis	_	Gloss=make|SpaceAfter=No|Translit=为
6	佩	佩	NOUN	n,名詞,可搬,道具	_	5	obj	_	Gloss=girdle-ornament|SpaceAfter=No
Loading