Browse Source

阅读器调整 支持大文章目录跳转

visuddhinanda 5 years ago
parent
commit
2dcce5094b

+ 1 - 97
app/article/index.php

@@ -57,28 +57,6 @@ require_once "../pcdl/html_head.php";
 		font-weight: 700;		
 	}
 
-	note{
-		padding: 0.5em 0.8em;
-		margin-bottom: 0.4em;
-		border-radius: 5px;
-		line-height:1.3em;
-		<?php
-		if(isset($_GET["display"]) && $_GET["display"]=="para"){
-			echo "display:inline;";
-		}
-		else{
-			echo "display:block;";
-			echo "background-color: #80808014;";
-		}
-		?>
-	}
-
-
-
-	.term_block_bar {
-		display: flex;
-		justify-content: space-between;
-	}
 	#head_bar{
 		display: flex;
     justify-content: space-between;
@@ -87,22 +65,6 @@ require_once "../pcdl/html_head.php";
     border-bottom: 1px solid var(--tool-line-color);
 	padding:10px;
 	}
-	.term_block_bar_left{
-		display: flex;
-	}
-	.term_block_bar_left_icon{
-    display: inline-block;
-    width: 1.5em;
-    text-align: center;
-    height: 1.5em;
-    background-color: gray;
-    font-size: 180%;
-    color: white;
-    border-radius: 99px;
-	}
-	.term_block_bar_left_info{
-		    padding-left: 8px;
-	}
 
 	.main_view{
 		padding: 0 1em;
@@ -110,17 +72,7 @@ require_once "../pcdl/html_head.php";
 		margin-left: auto;
 		margin-right: auto;
 	}
-	#term_list_right{
-		width: 25em;
-	}
-	#term_list{
-		width: 100%;
-		padding: 0.5em;
-	}
-	#term_list_div{
-		display: flex;
-		justify-content: space-between;
-	}
+
 	.fun_frame {
 		border-bottom: 1px solid gray;
 		margin-right: 10px;
@@ -144,39 +96,8 @@ require_once "../pcdl/html_head.php";
 	.when_right_fixed{
 		padding-right:20em;
 	}
-	<?php
-		if(isset($_GET["display"]) && $_GET["display"]=="para"){
-
-		}
-		else{
-?>
-	.bg_color_1{
-		background-color:#ebebeb66;
-	}
-	.bg_color_2{
-		background:linear-gradient(to right, #6afdb033, #ebebeb66);
-	}
-	.bg_color_3{
-		background:linear-gradient(to right, #6a95fd26, #ebebeb66);
-	}
-	.bg_color_4{
-		background:linear-gradient(to right, #f9e7911c, #ebebeb66);
-	}
-	.bg_color_5{
-		background:linear-gradient(to right, #fe99b91c, #ebebeb66);
-	}
-<?php
-		}
-		?>
 
 
-	pre {
-		white-space: pre-line;
-		font-family: auto;
-		border-left: 3px solid var(--border-shadow);
-		margin-left: 1em;
-		padding-left: 0.5em;
-	}
 	#contents_view{
 		display:flex;
 	}
@@ -197,19 +118,6 @@ require_once "../pcdl/html_head.php";
 		height:unset;
 	}
 
-<?php
-		if(isset($_GET["display"]) && $_GET["display"]=="para"){
-?>
-	.tran>p{
-		display:inline;
-	}
-	note{
-		padding: 2px;
-		margin-bottom: unset;
-	}
-<?php
-		}
-?>
 
 #toc_content .level_2{
 	padding-left:0.5em;
@@ -245,7 +153,6 @@ require_once "../pcdl/html_head.php";
 		color: var(--btn-hover-color);
 	}
 
-
 	</style>
 
 <style media="screen and (max-width:767px)">
@@ -269,9 +176,6 @@ require_once "../pcdl/html_head.php";
 
 </style>
 
-<script>
-term_word_link_fun("wiki_goto_word");
-</script>
 
 <?php
     require_once("../pcdl/head_bar.php");

+ 13 - 150
app/palicanon/index.php

@@ -2,6 +2,8 @@
 include "../pcdl/html_head.php";
 ?>
 <body>
+<script  src="../palicanon/palicanon.js"></script>
+<script  src="../term/term.js"></script>
 
 <?php
     require_once("../pcdl/head_bar.php");
@@ -47,7 +49,15 @@ include "../pcdl/html_head.php";
     tag .icon:hover{
         background-color: silver;
     }
-    var tag_level = <?php echo file_get_contents("../public/book_tag/tag_list.json"); ?>;
+    .sutta_row {
+    display: flex;
+    padding: 10px;
+    width: 100%;
+    border-bottom: 1px solid var(--border-line-color);
+}
+.sutta_row:hover {
+    background-color:var(--drop-bg-color);;
+}
 </style>
 <script>
     var tag_level = <?php echo file_get_contents("../public/book_tag/tag_list.json"); ?>;
@@ -90,156 +100,9 @@ echo '</div>';
 </div>
 
 <script>
-    var main_tag="";
-    var list_tag=new Array();
-    var currTagLevel0= new Array();
-
-    $("span[tag]").click(function(){
-        $(this).siblings().removeClass("select");
-        $(this).addClass("select");
-        main_tag = $(this).attr("tag");
-        list_tag=new Array();
-        tag_changed();
-        render_tag_list();
-  });
-  var allTags = new Array();
-  function tag_changed(){
-    let strTags = "";
-      if(list_tag.length>0){
-        strTags = main_tag + "," + list_tag.join();
-      }
-      else{
-        strTags = main_tag;
-      }
-    console.log(strTags);
-    $.get("book_tag.php",
-            {
-                tag:strTags
-            },
-            function(data,status){
-                let arrBookList = JSON.parse(data);
-                let html="";
-                allTags = new Array();
-                for (const iterator of arrBookList) {
-                    let tag0="";
-                    let tags = iterator[0].tag.split("::");
-                    let currTag = new Array();
-                    currTag[main_tag] = 1;
-                    for (const scondTag of list_tag) {
-                        currTag[scondTag]  = 1;
-                    }
-                    for (let tag of tags) {
-                        if(tag.slice(0,1)==":"){
-                            tag = tag.slice(1);
-                        }
-                        if(tag.slice(-1)==":"){
-                            tag = tag.slice(0,-1);
-                        }
-                        if(currTagLevel0.hasOwnProperty(tag)){
-                            tag0 = tag;
-                        }
-                        if(!currTag.hasOwnProperty(tag)){
-                            if(allTags.hasOwnProperty(tag) ){
-                                allTags[tag] += 1;
-                            }
-                            else{
-                                allTags[tag] = 1;
-                            } 
-                        }
-                    }
-
-                    html += "<div style='width:25%;padding:0.5em;'>";
-                    html += "<div class='card' style='padding:10px;'>";
-                    html += "<div class='' style='position: absolute;background-color: #862002;margin-top: -10px;margin-left: 12em;color: white;padding: 0 3px;display: inline-block;'>"+tag0+"</div>";
-                    html += "<div style='font-weight:700'><a href='../pcdl/reader.php?view=chapter&book="+iterator[0].book+"&para="+iterator[0].para+"' target = '_blank'>"+iterator[0].title+"</a></div>";
-                    html += "<div style=''>book:"+iterator[0].book+" para:"+iterator[0].para+"</div>";
-                    html += "<div style='overflow-wrap: anywhere;'>tag="+ iterator[0].tag+"</div>";
-                    html += "</div>";
-                    html += "</div>";
-
-                }
-
-                let newTags = new Array();
-                for (const oneTag in allTags) {
-                    if(allTags[oneTag]<arrBookList.length){
-                        newTags[oneTag] = allTags[oneTag];
-                    }
-                    
-                }
-                allTags = newTags;
-                allTags.sort(sortNumber);
-                tag_render_others();
-                $("#book_list").html(html);
-
-            });
-  }
-
-$("#tag_input").keypress(function(){
-    tag_render_others();
+$(document).ready(function(){
+    palicanon_onload();
 });
-
-  function tag_render_others(){
-    let strOthersTag = "";
-    currTagLevel0= new Array();
-    $(".tag_others").html("");
-    for (const key in allTags) {
-        if (allTags.hasOwnProperty(key)) {
-            if($("#tag_input").val().length>0){
-                if(key.indexOf($("#tag_input").val())>=0){
-                    strOthersTag = "<button onclick =\"tag_click('"+key+"')\" >"+key+"</button>";
-                }
-            }
-            else{
-                strOthersTag = "<button onclick =\"tag_click('"+key+"')\" >"+key+"</button>";
-            }
-            let thisLevel = 100;
-            if(tag_level.hasOwnProperty(key)){
-                thisLevel = tag_level[key].level;
-                if(tag_level[key].level==0){
-                    currTagLevel0[key] = 1;
-                }
-            }
-            $(".tag_others[level='"+thisLevel+"']").html($(".tag_others[level='"+thisLevel+"']").html()+strOthersTag);
-        }
-    }
-   
-
-  }
-
-  function tag_click(tag){
-    list_tag.push(tag);
-    render_tag_list();
-    tag_changed();
-  }
-
-  function render_tag_list(){
-    let strListTag = gLocal.gui.selected+":";
-      for (const iterator of list_tag) {
-        strListTag +="<tag><span style='margin-right: 5px; font-weight: bold;'>"+iterator+"</span>";
-        strListTag +="<span style='display: contents;' onclick =\"tag_remove('"+iterator+"')\">";
-        strListTag +="<svg t= '1598638386903' class='icon' viewBox='0 0 1024 1024' version='1.1' xmlns='http://www.w3.org/2000/svg' p-id='1223' width='16' height='16'>";
-        strListTag += "<path fill='#707070' p-id='1224' d='M512 620.544l253.3376 253.3376a76.6976 76.6976 0 1 0 108.544-108.544L620.6464 512l253.2352-253.3376a76.6976 76.6976 0 1 0-108.544-108.544L512 403.3536 258.6624 150.1184a76.6976 76.6976 0 1 0-108.544 108.544L403.3536 512 150.1184 765.3376a76.6976 76.6976 0 1 0 108.544 108.544L512 620.6464z' >";
-        strListTag +="</path></svg>";
-        strListTag +="</span></tag>";
-      }
-      strListTag += "<div style='display:inline-block;width:20em;'><input id='tag_input' type='input' placeholder='tag' size='20'  /></div>";
-      $("#tag_selected").html(strListTag);
-  }
-
-  function tag_remove(tag){
-      for(let i=0; i<list_tag.length;i++){
-          if(list_tag[i]==tag){
-              list_tag.splice(i,1);
-          }
-      }
-      render_tag_list();
-      tag_changed();
-  }
-
-function sortNumber(a, b)
-{
-    return b -a;
-}
 </script>
 <?php
 include "../pcdl/html_foot.php";

+ 173 - 0
app/palicanon/palicanon.js

@@ -0,0 +1,173 @@
+var main_tag="";
+var list_tag=new Array();
+var currTagLevel0= new Array();
+var allTags = new Array();
+var arrMyTerm = new Array();
+
+palicanon_load_term();
+
+function palicanon_onload(){
+    $("span[tag]").click(function(){
+        $(this).siblings().removeClass("select");
+        $(this).addClass("select");
+        main_tag = $(this).attr("tag");
+        list_tag=new Array();
+        tag_changed();
+        render_tag_list();
+    });
+
+    $("#tag_input").keypress(function(){
+        tag_render_others();
+        });
+}
+
+function palicanon_load_term() {
+    $.get(
+        "../term/term.php",
+        {
+            op:"my"
+        },
+        function(data){
+            arrMyTerm = JSON.parse(data);
+        }
+    );
+}
+
+function tag_changed(){
+let strTags = "";
+  if(list_tag.length>0){
+    strTags = main_tag + "," + list_tag.join();
+  }
+  else{
+    strTags = main_tag;
+  }
+console.log(strTags);
+$.get("book_tag.php",
+        {
+            tag:strTags
+        },
+        function(data,status){
+            let arrBookList = JSON.parse(data);
+            let html="";
+            allTags = new Array();
+            for (const iterator of arrBookList) {
+                let tag0="";
+                let tags = iterator[0].tag.split("::");
+                let currTag = new Array();
+                currTag[main_tag] = 1;
+                for (const scondTag of list_tag) {
+                    currTag[scondTag]  = 1;
+                }
+                for (let tag of tags) {
+                    if(tag.slice(0,1)==":"){
+                        tag = tag.slice(1);
+                    }
+                    if(tag.slice(-1)==":"){
+                        tag = tag.slice(0,-1);
+                    }
+                    if(currTagLevel0.hasOwnProperty(tag)){
+                        tag0 = tag;
+                    }
+                    if(!currTag.hasOwnProperty(tag)){
+                        if(allTags.hasOwnProperty(tag) ){
+                            allTags[tag] += 1;
+                        }
+                        else{
+                            allTags[tag] = 1;
+                        } 
+                    }
+                }
+
+                //html += "<div style='width:100%;'>";
+                html += "<div class='sutta_row' >";
+                html += "<div class='' style='flex:1;padding: 0 3px;'>"+tag0+"</div>";
+                html += "<div style='flex:3;font-weight:700'><a href='../reader/?view=chapter&book="+iterator[0].book+"&para="+iterator[0].para+"' target = '_blank'>"+iterator[0].title+"</a></div>";
+                html += "<div style='flex:3;'>book:"+iterator[0].book+" para:"+iterator[0].para+"</div>";
+                html += "<div style='flex:5;overflow-wrap: anywhere;'>tag="+ iterator[0].tag+"</div>";
+                html += "</div>";
+                //html += "</div>";
+
+            }
+
+            let newTags = new Array();
+            for (const oneTag in allTags) {
+                if(allTags[oneTag]<arrBookList.length){
+                    newTags[oneTag] = allTags[oneTag];
+                }
+                
+            }
+            allTags = newTags;
+            allTags.sort(sortNumber);
+            tag_render_others();
+            $("#book_list").html(html);
+
+        });
+}
+
+function tag_render_others(){
+let strOthersTag = "";
+currTagLevel0= new Array();
+$(".tag_others").html("");
+for (const key in allTags) {
+    if (allTags.hasOwnProperty(key)) {
+        if($("#tag_input").val().length>0){
+            if(key.indexOf($("#tag_input").val())>=0){
+                strOthersTag = "<button onclick =\"tag_click('"+key+"')\" >"+key+"</button>";
+            }
+        }
+        else{
+            let termKey = term_lookup_my(key,"",getCookie("userid"),"zh-cn");
+            let keyname = key;
+            if(termKey){
+                keyname = termKey.meaning;
+            }
+            strOthersTag = "<button onclick =\"tag_click('"+key+"')\" >"+keyname+"</button>";
+        }
+        let thisLevel = 100;
+        if(tag_level.hasOwnProperty(key)){
+            thisLevel = tag_level[key].level;
+            if(tag_level[key].level==0){
+                currTagLevel0[key] = 1;
+            }
+        }
+        $(".tag_others[level='"+thisLevel+"']").html($(".tag_others[level='"+thisLevel+"']").html()+strOthersTag);
+    }
+}
+
+
+}
+
+function tag_click(tag){
+list_tag.push(tag);
+render_tag_list();
+tag_changed();
+}
+
+function render_tag_list(){
+let strListTag = gLocal.gui.selected+":";
+  for (const iterator of list_tag) {
+    strListTag +="<tag><span style='margin-right: 5px; font-weight: bold;'>"+iterator+"</span>";
+    strListTag +="<span style='display: contents;' onclick =\"tag_remove('"+iterator+"')\">";
+    strListTag +="<svg t= '1598638386903' class='icon' viewBox='0 0 1024 1024' version='1.1' xmlns='http://www.w3.org/2000/svg' p-id='1223' width='16' height='16'>";
+    strListTag += "<path fill='#707070' p-id='1224' d='M512 620.544l253.3376 253.3376a76.6976 76.6976 0 1 0 108.544-108.544L620.6464 512l253.2352-253.3376a76.6976 76.6976 0 1 0-108.544-108.544L512 403.3536 258.6624 150.1184a76.6976 76.6976 0 1 0-108.544 108.544L403.3536 512 150.1184 765.3376a76.6976 76.6976 0 1 0 108.544 108.544L512 620.6464z' >";
+    strListTag +="</path></svg>";
+    strListTag +="</span></tag>";
+  }
+  strListTag += "<div style='display:inline-block;width:20em;'><input id='tag_input' type='input' placeholder='tag' size='20'  /></div>";
+  $("#tag_selected").html(strListTag);
+}
+
+function tag_remove(tag){
+  for(let i=0; i<list_tag.length;i++){
+      if(list_tag[i]==tag){
+          list_tag.splice(i,1);
+      }
+  }
+  render_tag_list();
+  tag_changed();
+}
+
+function sortNumber(a, b)
+{
+return b -a;
+}

+ 5 - 0
app/pcdl/html_head.php

@@ -51,6 +51,11 @@ else{
 	<script src="../term/note.js"></script>
 	<script src="../term/term_popup.js"></script>
 	<link type="text/css" rel="stylesheet" href="../term/term.css"/>
+	<?php
+		if(isset($_GET["display"]) && $_GET["display"]=="para"){
+			echo '<link type="text/css" rel="stylesheet" href="../term/term_para.css"/>';
+		}
+		?>
 	<script src="../term/term_edit_dlg.js"></script>
 	<link type="text/css" rel="stylesheet" href="../term/term_edit_dlg.css"/>	
 	

+ 1 - 9
app/pcdl/js/reader.js

@@ -441,12 +441,4 @@ function sent_apply(sentId) {
   }
 }
 
-function copy_ref(obj) {
-  let pali_sent_node = obj.parentNode.parentNode.parentNode.parentNode;
-  let book = pali_sent_node.getAttributeNode("book").value;
-  let para = pali_sent_node.getAttributeNode("para").value;
-  let begin = pali_sent_node.getAttributeNode("begin").value;
-  let end = pali_sent_node.getAttributeNode("end").value;
-  let strRef = "{{" + book + "-" + para + "-" + begin + "-" + end + "}}";
-  copy_to_clipboard(strRef);
-}
+

+ 49 - 49
app/public/book_tag/en.json

@@ -2691,155 +2691,155 @@
     "book": "162",
     "para": "3",
     "level": "1",
-    "title": "Theragāthāpāḷi",
-    "tag": ":mūla::sutta::khuddaka::Theragāthā::pāḷi:"
+    "title": "theragāthāpāḷi",
+    "tag": ":mūla::sutta::khuddaka::theragāthā::pāḷi:"
   },
   {
     "book": "162",
     "para": "11",
     "level": "2",
     "title": "1. Ekakanipāto",
-    "tag": ":mūla::sutta::khuddaka::Theragāthā::pāḷi:"
+    "tag": ":mūla::sutta::khuddaka::theragāthā::pāḷi:"
   },
   {
     "book": "162",
     "para": "703",
     "level": "2",
     "title": "2. Dukanipāto",
-    "tag": ":mūla::sutta::khuddaka::Theragāthā::pāḷi:"
+    "tag": ":mūla::sutta::khuddaka::theragāthā::pāḷi:"
   },
   {
     "book": "162",
     "para": "1139",
     "level": "2",
     "title": "3. Tikanipāto",
-    "tag": ":mūla::sutta::khuddaka::Theragāthā::pāḷi:"
+    "tag": ":mūla::sutta::khuddaka::theragāthā::pāḷi:"
   },
   {
     "book": "162",
     "para": "1325",
     "level": "2",
     "title": "4. Catukanipāto",
-    "tag": ":mūla::sutta::khuddaka::Theragāthā::pāḷi:"
+    "tag": ":mūla::sutta::khuddaka::theragāthā::pāḷi:"
   },
   {
     "book": "162",
     "para": "1504",
     "level": "2",
     "title": "5. Pañcakanipāto",
-    "tag": ":mūla::sutta::khuddaka::Theragāthā::pāḷi:"
+    "tag": ":mūla::sutta::khuddaka::theragāthā::pāḷi:"
   },
   {
     "book": "162",
     "para": "1715",
     "level": "2",
     "title": "6. Chakkanipāto",
-    "tag": ":mūla::sutta::khuddaka::Theragāthā::pāḷi:"
+    "tag": ":mūla::sutta::khuddaka::theragāthā::pāḷi:"
   },
   {
     "book": "162",
     "para": "2006",
     "level": "2",
     "title": "7. sattakanipāto",
-    "tag": ":mūla::sutta::khuddaka::Theragāthā::pāḷi:"
+    "tag": ":mūla::sutta::khuddaka::theragāthā::pāḷi:"
   },
   {
     "book": "162",
     "para": "2128",
     "level": "2",
     "title": "8. Aṭṭhakanipāto",
-    "tag": ":mūla::sutta::khuddaka::Theragāthā::pāḷi:"
+    "tag": ":mūla::sutta::khuddaka::theragāthā::pāḷi:"
   },
   {
     "book": "162",
     "para": "2212",
     "level": "2",
     "title": "9. Navakanipāto",
-    "tag": ":mūla::sutta::khuddaka::Theragāthā::pāḷi:"
+    "tag": ":mūla::sutta::khuddaka::theragāthā::pāḷi:"
   },
   {
     "book": "162",
     "para": "2246",
     "level": "2",
     "title": "10. Dasakanipāto",
-    "tag": ":mūla::sutta::khuddaka::Theragāthā::pāḷi:"
+    "tag": ":mūla::sutta::khuddaka::theragāthā::pāḷi:"
   },
   {
     "book": "162",
     "para": "2478",
     "level": "2",
     "title": "11. Ekādasanipāto",
-    "tag": ":mūla::sutta::khuddaka::Theragāthā::pāḷi:"
+    "tag": ":mūla::sutta::khuddaka::theragāthā::pāḷi:"
   },
   {
     "book": "162",
     "para": "2518",
     "level": "2",
     "title": "12. Dvādasakanipāto",
-    "tag": ":mūla::sutta::khuddaka::Theragāthā::pāḷi:"
+    "tag": ":mūla::sutta::khuddaka::theragāthā::pāḷi:"
   },
   {
     "book": "162",
     "para": "2600",
     "level": "2",
     "title": "13. Terasanipāto",
-    "tag": ":mūla::sutta::khuddaka::Theragāthā::pāḷi:"
+    "tag": ":mūla::sutta::khuddaka::theragāthā::pāḷi:"
   },
   {
     "book": "162",
     "para": "2648",
     "level": "2",
     "title": "14. Cuddasakanipāto",
-    "tag": ":mūla::sutta::khuddaka::Theragāthā::pāḷi:"
+    "tag": ":mūla::sutta::khuddaka::theragāthā::pāḷi:"
   },
   {
     "book": "162",
     "para": "2740",
     "level": "2",
     "title": "15. soḷasakanipāto",
-    "tag": ":mūla::sutta::khuddaka::Theragāthā::pāḷi:"
+    "tag": ":mūla::sutta::khuddaka::theragāthā::pāḷi:"
   },
   {
     "book": "162",
     "para": "2843",
     "level": "2",
     "title": "16. Vīsatinipāto",
-    "tag": ":mūla::sutta::khuddaka::Theragāthā::pāḷi:"
+    "tag": ":mūla::sutta::khuddaka::theragāthā::pāḷi:"
   },
   {
     "book": "162",
     "para": "3597",
     "level": "2",
     "title": "17. Tiṃsanipāto",
-    "tag": ":mūla::sutta::khuddaka::Theragāthā::pāḷi:"
+    "tag": ":mūla::sutta::khuddaka::theragāthā::pāḷi:"
   },
   {
     "book": "162",
     "para": "3921",
     "level": "2",
     "title": "18. Cattālīsanipāto",
-    "tag": ":mūla::sutta::khuddaka::Theragāthā::pāḷi:"
+    "tag": ":mūla::sutta::khuddaka::theragāthā::pāḷi:"
   },
   {
     "book": "162",
     "para": "4051",
     "level": "2",
     "title": "19. Paññāsanipāto",
-    "tag": ":mūla::sutta::khuddaka::Theragāthā::pāḷi:"
+    "tag": ":mūla::sutta::khuddaka::theragāthā::pāḷi:"
   },
   {
     "book": "162",
     "para": "4223",
     "level": "2",
     "title": "20. saṭṭhinipāto",
-    "tag": ":mūla::sutta::khuddaka::Theragāthā::pāḷi:"
+    "tag": ":mūla::sutta::khuddaka::theragāthā::pāḷi:"
   },
   {
     "book": "162",
     "para": "4440",
     "level": "2",
     "title": "21. Mahānipāto",
-    "tag": ":mūla::sutta::khuddaka::Theragāthā::pāḷi:"
+    "tag": ":mūla::sutta::khuddaka::theragāthā::pāḷi:"
   },
   {
     "book": "163",
@@ -8172,169 +8172,169 @@
     "book": "128",
     "para": "3",
     "level": "1",
-    "title": "Theragāthā-aṭṭhakathā",
-    "tag": ":aṭṭhakathā::sutta::khuddaka::Theragāthā:"
+    "title": "theragāthā-aṭṭhakathā",
+    "tag": ":aṭṭhakathā::sutta::khuddaka::theragāthā:"
   },
   {
     "book": "128",
     "para": "5",
     "level": "2",
     "title": "Ganthārambhakathā",
-    "tag": ":aṭṭhakathā::sutta::khuddaka::Theragāthā:"
+    "tag": ":aṭṭhakathā::sutta::khuddaka::theragāthā:"
   },
   {
     "book": "128",
     "para": "95",
     "level": "2",
     "title": "1. Ekakanipāto",
-    "tag": ":aṭṭhakathā::sutta::khuddaka::Theragāthā:"
+    "tag": ":aṭṭhakathā::sutta::khuddaka::theragāthā:"
   },
   {
     "book": "128",
     "para": "3033",
     "level": "2",
     "title": "2. Dukanipāto",
-    "tag": ":aṭṭhakathā::sutta::khuddaka::Theragāthā:"
+    "tag": ":aṭṭhakathā::sutta::khuddaka::theragāthā:"
   },
   {
     "book": "128",
     "para": "4631",
     "level": "2",
     "title": "3. Tikanipāto",
-    "tag": ":aṭṭhakathā::sutta::khuddaka::Theragāthā:"
+    "tag": ":aṭṭhakathā::sutta::khuddaka::theragāthā:"
   },
   {
     "book": "129",
     "para": "3",
     "level": "1",
-    "title": "Theragāthā-aṭṭhakathā",
-    "tag": ":aṭṭhakathā::sutta::khuddaka::Theragāthā:"
+    "title": "theragāthā-aṭṭhakathā",
+    "tag": ":aṭṭhakathā::sutta::khuddaka::theragāthā:"
   },
   {
     "book": "129",
     "para": "5",
     "level": "2",
     "title": "4. Catukkanipāto",
-    "tag": ":aṭṭhakathā::sutta::khuddaka::Theragāthā:"
+    "tag": ":aṭṭhakathā::sutta::khuddaka::theragāthā:"
   },
   {
     "book": "129",
     "para": "396",
     "level": "2",
     "title": "5. Pañcakanipāto",
-    "tag": ":aṭṭhakathā::sutta::khuddaka::Theragāthā:"
+    "tag": ":aṭṭhakathā::sutta::khuddaka::theragāthā:"
   },
   {
     "book": "129",
     "para": "991",
     "level": "2",
     "title": "6. Chakkanipāto",
-    "tag": ":aṭṭhakathā::sutta::khuddaka::Theragāthā:"
+    "tag": ":aṭṭhakathā::sutta::khuddaka::theragāthā:"
   },
   {
     "book": "129",
     "para": "1508",
     "level": "2",
     "title": "7. sattakanipāto",
-    "tag": ":aṭṭhakathā::sutta::khuddaka::Theragāthā:"
+    "tag": ":aṭṭhakathā::sutta::khuddaka::theragāthā:"
   },
   {
     "book": "129",
     "para": "1802",
     "level": "2",
     "title": "8. Aṭṭhakanipāto",
-    "tag": ":aṭṭhakathā::sutta::khuddaka::Theragāthā:"
+    "tag": ":aṭṭhakathā::sutta::khuddaka::theragāthā:"
   },
   {
     "book": "129",
     "para": "1960",
     "level": "2",
     "title": "9. Navakanipāto",
-    "tag": ":aṭṭhakathā::sutta::khuddaka::Theragāthā:"
+    "tag": ":aṭṭhakathā::sutta::khuddaka::theragāthā:"
   },
   {
     "book": "129",
     "para": "2026",
     "level": "2",
     "title": "10. Dasakanipāto",
-    "tag": ":aṭṭhakathā::sutta::khuddaka::Theragāthā:"
+    "tag": ":aṭṭhakathā::sutta::khuddaka::theragāthā:"
   },
   {
     "book": "129",
     "para": "2566",
     "level": "2",
     "title": "11. Ekādasanipāto",
-    "tag": ":aṭṭhakathā::sutta::khuddaka::Theragāthā:"
+    "tag": ":aṭṭhakathā::sutta::khuddaka::theragāthā:"
   },
   {
     "book": "129",
     "para": "2613",
     "level": "2",
     "title": "12. Dvādasakanipāto",
-    "tag": ":aṭṭhakathā::sutta::khuddaka::Theragāthā:"
+    "tag": ":aṭṭhakathā::sutta::khuddaka::theragāthā:"
   },
   {
     "book": "129",
     "para": "2727",
     "level": "2",
     "title": "13. Terasanipāto",
-    "tag": ":aṭṭhakathā::sutta::khuddaka::Theragāthā:"
+    "tag": ":aṭṭhakathā::sutta::khuddaka::theragāthā:"
   },
   {
     "book": "129",
     "para": "2844",
     "level": "2",
     "title": "14. Cuddasakanipāto",
-    "tag": ":aṭṭhakathā::sutta::khuddaka::Theragāthā:"
+    "tag": ":aṭṭhakathā::sutta::khuddaka::theragāthā:"
   },
   {
     "book": "129",
     "para": "2964",
     "level": "2",
     "title": "15. soḷasakanipāto",
-    "tag": ":aṭṭhakathā::sutta::khuddaka::Theragāthā:"
+    "tag": ":aṭṭhakathā::sutta::khuddaka::theragāthā:"
   },
   {
     "book": "129",
     "para": "3133",
     "level": "2",
     "title": "16. Vīsatinipāto",
-    "tag": ":aṭṭhakathā::sutta::khuddaka::Theragāthā:"
+    "tag": ":aṭṭhakathā::sutta::khuddaka::theragāthā:"
   },
   {
     "book": "129",
     "para": "4364",
     "level": "2",
     "title": "17. Tiṃsanipāto",
-    "tag": ":aṭṭhakathā::sutta::khuddaka::Theragāthā:"
+    "tag": ":aṭṭhakathā::sutta::khuddaka::theragāthā:"
   },
   {
     "book": "129",
     "para": "5339",
     "level": "2",
     "title": "18. Cattālīsanipāto",
-    "tag": ":aṭṭhakathā::sutta::khuddaka::Theragāthā:"
+    "tag": ":aṭṭhakathā::sutta::khuddaka::theragāthā:"
   },
   {
     "book": "129",
     "para": "5579",
     "level": "2",
     "title": "19. Paññāsanipāto",
-    "tag": ":aṭṭhakathā::sutta::khuddaka::Theragāthā:"
+    "tag": ":aṭṭhakathā::sutta::khuddaka::theragāthā:"
   },
   {
     "book": "129",
     "para": "5809",
     "level": "2",
     "title": "20. saṭṭhinipāto",
-    "tag": ":aṭṭhakathā::sutta::khuddaka::Theragāthā:"
+    "tag": ":aṭṭhakathā::sutta::khuddaka::theragāthā:"
   },
   {
     "book": "129",
     "para": "6183",
     "level": "2",
     "title": "21. Mahānipāto",
-    "tag": ":aṭṭhakathā::sutta::khuddaka::Theragāthā:"
+    "tag": ":aṭṭhakathā::sutta::khuddaka::theragāthā:"
   },
   {
     "book": "106",

+ 3 - 1
app/public/book_tag/tag_list.json

@@ -16,5 +16,7 @@
   "mahāvaggapāḷi": { "level": 1 },
   "Cūḷavaggapāḷi": { "level": 1 },
   "vibhaṅga": { "level": 1 },
-  "Theragāthā": { "level": 2 }
+  "theragāthā": { "level": 2 },
+  "Visuddhimagga": { "level": 2 },
+  "mātikā": { "level": 2 }
 }

+ 8 - 3
app/public/function.php

@@ -81,17 +81,22 @@ function _get_para_path($book,$paragraph){
     $stmt->execute(array($book,$parent));
     $FetParent = $stmt->fetch(PDO::FETCH_ASSOC);
     
-		$toc="<chapter book='{$book}' para='{$parent}'>{$FetParent["toc"]}&gt</chapter>";
+		$toc="<chapter book='{$book}' para='{$parent}' title='{$FetParent["toc"]}'>{$FetParent["toc"]}</chapter>";
 		
 		if($path==""){
-			$path="<para book='{$book}' para='{$parent}'>{$paragraph}</para>";
+      if($FetParent["level"]<100){
+        $path=$toc;
+      }
+      else{
+        $path="<para book='{$book}' para='{$parent}' title='{$FetParent["toc"]}'>{$paragraph}</para>";
+      }
 		}
 		else{
 			$path=$toc.$path;
 		}
 		if($sFirstParentTitle==""){
 			$sFirstParentTitle = $FetParent["toc"];
-		}						
+		}	
 		$parent = $FetParent["parent"];
 		$deep++;
 		if($deep>5){

+ 80 - 0
app/reader/get_para.php

@@ -0,0 +1,80 @@
+<?php
+require_once "../public/_pdo.php";
+require_once "../path.php";
+
+define("_MAX_CHAPTER_LEN_" , 20000);
+
+$_book = $_GET["book"];
+$_para = $_GET["para"];
+if(isset($_GET["begin"])){
+    $_begin = $_GET["begin"];
+}
+if(isset($_GET["end"])){
+    $_end = $_GET["end"];
+}
+$_view = $_GET["view"];
+
+if($_view=="sent"){
+    $chapter = array(array("book"=>$_book,"paragraph"=>$_para,"begin"=>$_begin,"end"=>$_end));
+    echo json_encode($chapter,JSON_UNESCAPED_UNICODE);
+    exit;
+}
+
+$output["toc"] = array();
+$output["sentences"] = array();
+$output["head"] = 0;
+
+PDO_Connect("sqlite:"._FILE_DB_PALITEXT_);
+$query = "SELECT * FROM 'pali_text'  WHERE book= ? AND paragraph= ?";
+$FetchParInfo = PDO_FetchRow($query , array($_book,$_para));
+if($FetchParInfo){
+    switch ($_view) {
+        case 'chapter':
+            # code...
+            $paraBegin = $_para;
+			$paraEnd = $_para+$FetchParInfo["chapter_len"]-1;
+            break;
+        case 'para':
+            $paraBegin = $_para;
+			$paraEnd = $_para;
+            # code...
+            break;        
+        default:
+            # code...
+            $paraBegin = $_para;
+			$paraEnd = $_para;
+            break;
+    }
+
+    //获取下级目录
+    $query = "SELECT * FROM 'pali_text'  WHERE book= ? AND (paragraph BETWEEN ?AND ? ) AND level < 100 ";
+    $output["toc"] = PDO_FetchAll($query , array($_book,$paraBegin,$paraEnd));
+
+    if($FetchParInfo["chapter_strlen"]>_MAX_CHAPTER_LEN_ && $_view === "chapter" && count($output["toc"])>1){
+        if($output["toc"][1].paragraph-$_para>1){
+            # 中间有间隔
+            $paraBegin = $_para;
+            $paraEnd = $output["toc"][1].paragraph-1;
+            $output["head"] = 1;
+        }
+        else{
+            #中间无间隔
+            echo json_encode($output,JSON_UNESCAPED_UNICODE);
+            exit;            
+        }
+
+    }
+
+    PDO_Connect("sqlite:"._FILE_DB_PALI_SENTENCE_);
+
+    $query = "SELECT book,paragraph,begin, end FROM 'pali_sent' WHERE book= ? AND (paragraph BETWEEN ?AND ? ) ";
+    $sent_list = PDO_FetchAll($query,array($_book,$paraBegin,$paraEnd));
+    $output["sentences"] = $sent_list;
+    echo json_encode($output,JSON_UNESCAPED_UNICODE);        
+
+}
+else{
+    echo json_encode($output,JSON_UNESCAPED_UNICODE);
+
+}
+?>

+ 4 - 0
app/reader/get_path.php

@@ -0,0 +1,4 @@
+<?php
+require_once "../public/function.php";
+echo _get_para_path($_GET["book"],$_GET["para"]);
+?>

+ 407 - 0
app/reader/index.php

@@ -0,0 +1,407 @@
+<?php
+require_once "../public/load_lang.php";
+require_once "../path.php";
+require_once "../pcdl/html_head.php";
+?>
+<body style="margin: 0;padding: 0;" class="reader_body" >
+
+	<script src="../channal/channal.js"></script>
+	<script src="./reader.js"></script>
+
+	<script src="../widget/click_dropdown.js"></script>
+	<link type="text/css" rel="stylesheet" href="../widget/click_dropdown.css"/>
+
+	<script>
+	<?php
+	$_view = "";
+	$_display = "";
+	$_channal  = "";
+	$_collect = "";
+
+	if(isset($_GET["view"])){
+		echo "_reader_view='".$_GET["view"]."';";
+	}
+	if(isset($_GET["book"])){
+		echo "_reader_book='".$_GET["book"]."';";
+	}
+	if(isset($_GET["para"])){
+		echo "_reader_para='".$_GET["para"]."';";
+	}
+	if(isset($_GET["begin"])){
+		echo "_reader_begin='".$_GET["begin"]."';";
+	}
+	if(isset($_GET["end"])){
+		echo "_reader_end='".$_GET["end"]."';";
+	}
+
+	if(isset($_GET["display"])){
+		echo "_display='".$_GET["display"]."';";
+	}
+	
+	if(isset($_GET["channal"])){
+		echo "_channal='".$_GET["channal"]."';";
+	}
+	if(isset($_GET["lang"])){
+		echo "_lang='".$_GET["lang"]."';";
+	}
+	if(isset($_GET["author"])){
+		echo "_author='".$_GET["author"]."';";
+	}
+	?>
+	</script>
+	<style>
+
+
+	#search_result{
+		position: absolute;
+		background: wheat;
+		max-width: 95%;
+		width: 24em;
+	}
+
+	.icon{
+		width: 15px;
+		height: 15px;
+	}
+	.submenu_title{
+		font-size: 120%;
+		font-weight: 700;		
+	}
+
+	#head_bar{
+		display: flex;
+    justify-content: space-between;
+    height: 5em;
+    background-color: var(--tool-bg-color1);
+    border-bottom: 1px solid var(--tool-line-color);
+	padding:10px;
+	}
+
+	.main_view{
+		padding: 0 1em;
+		max-width: 1280px;
+		margin-left: auto;
+		margin-right: auto;
+	}
+
+	.fun_frame {
+		border-bottom: 1px solid gray;
+		margin-right: 10px;
+		margin-bottom: 10px;
+	}
+	.fun_frame .title{
+		padding:6px;
+		font-weight: 700;
+	}
+	.fun_frame>.content{
+		padding:6px;
+		max-height:6em;
+		overflow-y: scroll;
+	}
+	
+	.fixed{
+		position:fixed;
+		right: 0;
+    	top: 0;
+	}
+	.when_right_fixed{
+		padding-right:20em;
+	}
+
+
+	#contents_view{
+		display:flex;
+	}
+	#contents_div{
+		flex:7;
+	}
+	#contents{
+		min-height: 400px;
+	}
+	#contents li{
+		white-space: normal;
+	}
+	#right_pannal{
+		flex:3;
+		max-width:20em;
+	}
+	#head_bar{
+		height:unset;
+	}
+
+
+#toc_content .level_2{
+	padding-left:0.5em;
+}
+#toc_content .level_3{
+	padding-left:1em;
+}
+#toc_content .level_4{
+	padding-left:1.5em;
+}
+#toc_content .level_5{
+	padding-left:2em;
+}
+.ui-dialog-titlebar{
+		display: flex;
+    justify-content: space-between;
+	background-color: var(--btn-bg-color);
+    padding: 5px;
+	}
+	.ui-widget-content{
+		background-color: var(--bg-color);
+	}
+	.ui-dialog{
+		box-shadow:  8px 8px 20px var(--border-shadow);
+	}
+	.active{
+		background-color: var(--btn-hover-bg-color);
+	}
+	.icon_btn a {
+	color: var(--main-color);
+	}
+	.icon_btn:hover a {
+		color: var(--btn-hover-color);
+	}
+	chapter{
+	display:inline-block;
+}
+
+.language-para {
+    padding: 2px 8px;
+    position: absolute;
+    margin-left: -6em;
+    border-bottom: 3px solid var(--link-color);
+}
+
+.level_0{
+	margin-left:0;
+}
+.level_1{
+	margin-left:1em;
+}
+.level_2{
+	margin-left:2em;
+}
+.level_3{
+	margin-left:3em;
+}
+.level_4{
+	margin-left:4em;
+}
+.level_5{
+	margin-left:5em;
+}
+.level_6{
+	margin-left:6em;
+}
+
+
+	</style>
+
+<style media="screen and (max-width:767px)">
+#right_pannal{
+	display:none;
+}
+.when_right_fixed{
+	padding-right:0;
+}
+.index_toolbar{
+	position:unset;
+}
+#pali_pedia{
+	font-size: 200%;
+	margin-top: auto;
+	margin-bottom: auto;
+	padding-left: 0.5em;
+}
+
+
+
+</style>
+
+
+<?php
+    require_once("../pcdl/head_bar.php");
+?>
+<div id="head_bar" >
+	<div id="pali_pedia" style="display:flex;">
+		<span><?php echo $_local->gui->anthology; ?></span>
+		<span id="para_path"></span>
+		<span class="case_dropdown" id="para_path_next_level">
+		next
+		<div id="toc_next_menu" class="case_dropdown-content">
+		</div>
+		</span>
+	</div>
+
+	<div>
+		<span>
+		<?php
+		echo "<button class='icon_btn'  title='{$_local->gui->modify} {$_local->gui->composition_structure}'>";
+		echo "<a href='";
+		echo "'>{$_local->gui->modify}</a></button>";
+		
+		if(isset($_GET["display"]) && $_GET["display"]=="para"){
+			echo "<button class='icon_btn active' title='{$_local->gui->show} {$_local->gui->each_paragraph}'>";
+			echo $_local->gui->each_paragraph;
+			echo "</button>";
+		}
+		else{
+			echo "<button class='icon_btn'>";
+			echo "<a href='../reader/?view=".$_GET["view"];
+			if(isset($_GET["book"])){
+				echo "&book=".$_GET["book"];
+			}
+			if(isset($_GET["para"])){
+				echo "&para=".$_GET["para"];
+			}
+			if(isset($_GET["begin"])){
+				echo "&begin=".$_GET["begin"];
+			}
+			if(isset($_GET["channal"])){
+				echo "&channal=".$_GET["channal"];
+			}
+			if(isset($_GET["lang"])){
+				echo "&lang=".$_GET["lang"];
+			}
+			echo "&display=para'  title='{$_local->gui->show} {$_local->gui->each_paragraph}'>";		
+			echo $_local->gui->each_paragraph;
+			echo "</a>";
+			echo "</button>";
+		}
+
+		if(isset($_GET["display"]) && $_GET["display"]=="sent"){
+			echo "<button class='icon_btn active'  title='{$_local->gui->show} {$_local->gui->each_sentence}'>";
+			echo $_local->gui->each_sentence;
+			echo "</button>";
+		}
+		else{
+			echo "<button class='icon_btn'>";
+			echo "<a href='../reader/?view=".$_GET["view"];
+			if(isset($_GET["book"])){
+				echo "&book=".$_GET["book"];
+			}
+			if(isset($_GET["para"])){
+				echo "&para=".$_GET["para"];
+			}
+			if(isset($_GET["begin"])){
+				echo "&begin=".$_GET["begin"];
+			}
+			if(isset($_GET["channal"])){
+				echo "&channal=".$_GET["channal"];
+			}
+			if(isset($_GET["lang"])){
+				echo "&lang=".$_GET["lang"];
+			}
+			echo "&display=sent";
+			echo "'  title='{$_local->gui->show} {$_local->gui->each_sentence}'>{$_local->gui->each_sentence}</a></button>";
+		}
+
+		?>
+			<button class='icon_btn'><a href="#"><?php echo $_local->gui->help; ?></a></button>
+		</span>
+	</div>
+</div>
+<div id="main_view" class="main_view">
+<div id="article_head" style="border-bottom: 1px solid gray;">
+	<div id="article_title" class="term_word_head_pali"><?php echo $_local->gui->title; ?></div>
+	<div id="article_subtitle"><?php echo $_local->gui->sub_title; ?></div>
+	<div id="article_author"><?php echo $_local->gui->author; ?></div>
+</div>
+<div id="contents_view">
+	<div id="contents_div" style="padding: 0 1em;">
+		<div id="contents">
+		<?php echo $_local->gui->loading; ?>...
+		</div>
+		<div id="contents_foot">
+			<div id="contents_nav" style="display:flex;justify-content: space-between;">
+				<div id="contents_nav_left"></div>
+				<div id="contents_nav_right"></div>
+			</div>
+			<div id="contents_dicuse">
+			
+			</div>
+		</div>
+	</div>
+	<div id="right_pannal">
+		<div class="fun_frame">
+			<div id = "collect_title" class="title">Table of Content</div>
+			<div id = "toc_content" class="content" style="max-height:20em;">
+			</div>
+		</div>
+		<div class="fun_frame">
+			<div style="display:flex;justify-content: space-between;">
+				<div class="title"><?php echo $_local->gui->channels; ?></div>
+				<div class="click_dropdown_div">
+					<div class="click_dropdown_button"><?php echo $_local->gui->more; ?></div>
+					<div class="click_dropdown_content">
+						<div class="click_dropdown_content_inner" id="channal_select">
+							<?php echo $_local->gui->channels; ?>
+						</div>
+						<div>
+						<button class="icon_btn click_dropdown_ok"><?php echo $_local->gui->confirm; ?></button>
+						<button class="icon_btn click_dropdown_cancel"><?php echo $_local->gui->cancel; ?></button>
+						</div>
+					</div>	
+				</div>
+			</div>
+			<div id="channal_list" class="content" style="max-height:20em;">
+			</div>
+		</div>
+	</div>
+</div>
+</div>
+
+<!-- ui-dialog -->
+<div id="dialog" title="Dialog Title">
+	<div id="edit_dialog_content"></div>
+</div>
+
+<script>
+	$(document).ready(function(){
+	ntf_init();				
+	click_dropdown_init();
+	note_create();
+	term_edit_dlg_init();
+	reader_load();
+	});
+
+
+
+	 window.addEventListener('scroll',winScroll);
+	function winScroll(e){ 
+		if(GetPageScroll().y>220){
+
+		}
+		else{
+
+		}
+		
+	}
+ //滚动条位置
+function GetPageScroll() 
+{ 
+	var pos=new Object();
+	var x, y; 
+	if(window.pageYOffset) 
+	{	// all except IE	
+		y = window.pageYOffset;	
+		x = window.pageXOffset; 
+	} else if(document.documentElement && document.documentElement.scrollTop) 
+	{	// IE 6 Strict	
+		y = document.documentElement.scrollTop;	
+		x = document.documentElement.scrollLeft; 
+	} else if(document.body) {	// all other IE	
+		y = document.body.scrollTop;	
+		x = document.body.scrollLeft;   
+	} 
+	pos.x=x;
+	pos.y=y;
+	return(pos);
+}
+	</script>
+
+
+</body>
+</html>

+ 147 - 0
app/reader/reader.js

@@ -0,0 +1,147 @@
+var _reader_view="sent";
+var _reader_book=-1;
+var _reader_para = -1;
+var _reader_begin=-1;
+var _reader_end=-1;
+var _channal = "";
+var _lang = "";
+var _author = "";
+var _display = "para";
+var arrMyTerm = new Array();
+var _sent_data = new Array();
+
+palicanon_load_term();
+
+function reader_load(){
+    $.get(
+        "../reader/get_para.php",
+        {
+            view:_reader_view,
+            book:_reader_book,
+            para:_reader_para,
+            begin:_reader_begin,
+            end:_reader_end,
+        },
+        function(data){
+            _sent_data = JSON.parse(data);
+            let tpl = "";
+            let currPara=0;
+            if(_sent_data.sentences.length>0){
+                for (const iterator of _sent_data.sentences) {
+                    if(currPara!=iterator.paragraph){
+                        tpl +="\n";
+                        currPara=iterator.paragraph;
+                        tpl += "```para\n";
+                        tpl += currPara+"\n";
+                        tpl += "```\n";
+                    }                
+                    tpl += "{{"+iterator.book+"-"+iterator.paragraph+"-"+iterator.begin+"-"+iterator.end+"}}\n";
+                }
+                $("#contents").html(note_init(tpl));
+                note_refresh_new();      
+                reader_draw_para_menu();
+
+                //右侧目录
+                let tocHtml="";
+                let tocNextMenu="";
+                if(_sent_data.toc.length>0){
+                    let firstLevel = _sent_data.toc[0].level;
+                    for (let index = 1; index < _sent_data.toc.length; index++) {
+                        const element = _sent_data.toc[index];
+                        tocHtml+= "<div class='reader_right_toc level_"+(element.level-firstLevel)+"'><a href='#para_"+element.paragraph+"'>"+element.toc+"</a></div>";
+                        tocNextMenu +="<a href='../reader/?view=chapter&book="+_reader_book+"&para="+element.paragraph+"'>"+element.toc+"</a>";
+                    } 
+                    $("#toc_content").html(tocHtml);
+                    $("#toc_next_menu").html(tocNextMenu);
+                }
+                
+            }
+            else{
+                //仅有目录
+                tpl += "<h2>Table of Content</h2>";
+                if(_sent_data.toc.length>0){
+                    let firstLevel = _sent_data.toc[0].level;
+                    for (let index = 1; index < _sent_data.toc.length; index++) {
+                        const element = _sent_data.toc[index];
+                        if(element.level<8){
+                            tpl+= "<div class='reader_main_toc level_"+(element.level-firstLevel)+"'><a href='../reader/?view=chapter&book="+_reader_book+"&para="+element.paragraph+"&display="+_display+"'>"+element.toc+"</a></div>";
+                        }
+                    } 
+                }
+                $("#contents").html(tpl);
+            }
+            
+        }
+    );
+
+    reader_get_path();
+}
+
+function reader_draw_para_menu(){
+    $(".language-para").each(function(){
+        let strPara =  $(this).text();
+        $(this).addClass("case_dropdown");
+        let html="<a name='para_"+strPara+"'></a>";
+        html  +="<div class='case_dropdown-content para_menu'>";
+    if(typeof _reader_view !="undefined" &&  _reader_view != "para"){
+        html  +="<a onclick='junp_to('"+_reader_book+"','"+strPara+"')'>跳转至此段</a>";
+    }
+    html  +="<a onclick=\"copy_para_ref('"+_reader_book+"','"+strPara+"')\">复制引用</a>";
+    html  +="<a onclick='copy_text(this)'>复制文本</a>";
+    html  +="<a onclick='add_to_list()'>添加到选择列表</a>";
+    html  +="</div>";
+        $(this).append(html);        
+    });
+
+}
+function copy_para_ref(book,para) {
+    let output = "";
+    let currPara = para;
+    for (const iterator of _sent_data) {
+        if(iterator.book==book && iterator.paragraph==para){
+            output +="{{"+book+"-"+para+"-"+iterator.begin+"-"+iterator.end+"}}\n";
+        }
+    }
+    output +="\n";
+    copy_to_clipboard(output)
+}
+function reader_get_path(){
+    $.get(
+        "../reader/get_path.php",
+        {
+            book:_reader_book,
+            para:_reader_para,
+        },
+        function(data){
+            $("#para_path").html(data);
+            $("chapter").each(function(){
+                let title = $(this).text();
+                let strLocalTitle="";
+                if( strLocalTitle = term_lookup_my(title,_channal.split()[0],getCookie("userid"),getCookie("language"))){
+                    $(this).html(strLocalTitle.word);
+                }
+                else if( strLocalTitle = term_lookup_my_a(title,_channal.split()[0],getCookie("userid"),getCookie("language"))){
+                    let newLocal = title.replace(strLocalTitle.word,strLocalTitle.meaning);
+                    $(this).html(newLocal);
+                }
+            });
+            let suttaTitle = $("chapter").last().html();
+            $("#article_title").html(suttaTitle);
+            if(_reader_view=="chapter"){
+                //$("chapter").last().hide();
+            }
+        }
+    );
+}
+
+function palicanon_load_term() {
+    $.get(
+        "../term/term.php",
+        {
+            op:"my"
+        },
+        function(data){
+            arrMyTerm = JSON.parse(data);
+        }
+    );
+}

+ 21 - 6
app/studio/js/render.js

@@ -657,11 +657,11 @@ function renderTranslateParBlockInner(elementBlock) {
 
 function renderTranslateParBlockInnerPreview(strText) {}
 function updateTranslationPreview_a(blockId, text) {
-  var out = "";
-  var newText = text;
-  newText = newText.replace(/\n\n/g, "<br />");
-  newText = term_tran_edit_replace(newText);
-  newText = term_edit_to_std_str(newText);
+  let out = "";
+  let newText = text;
+  newText = marked(newText);
+  //newText = term_tran_edit_replace(newText);
+  //newText = term_edit_to_std_str(newText);
   newText = term_std_str_to_tran(newText);
   out += newText;
   if (out == "") {
@@ -671,7 +671,22 @@ function updateTranslationPreview_a(blockId, text) {
   term_updata_translation();
 }
 function updateTranslationPreview(blockId, obj) {
-  updateTranslationPreview_a(blockId, obj.value);
+
+  let out = "";
+  let newText = obj.value;
+  newText = marked(newText);
+  //newText = term_tran_edit_replace(newText);
+  //newText = term_edit_to_std_str(newText);
+  let channal = $(obj).attr("channal");
+  let lang = $(obj).attr("lang");
+
+  newText = term_std_str_to_tran(newText,channal,getCookie("userid"),lang);
+  out += newText;
+  if (out == "") {
+    out = "<span style='color:#ccbfbf;'>" + gLocal.gui.with_idea + "</span>";
+  }
+  $("#tran_pre_" + blockId).html(out);
+  term_updata_translation();
 }
 
 function getSuperTranslateModifyString(inString, par_num, par_guid, language) {

+ 2 - 0
app/studio/project.php

@@ -367,6 +367,7 @@ switch($op){
 				echo ' type="radio" />';
 				echo '</div>';
 				echo '<div class="title" style="flex:3;padding-bottom:5px;">'.$row["name"].'</div>';
+				echo '<div class="title" style="flex:3;padding-bottom:5px;">'.$row["lang"].'</div>';
 				echo '<div class="title" style="flex:2;padding-bottom:5px;">';
 				PDO_Connect("sqlite:"._FILE_DB_USER_WBW_);
 				$query = "select count(*) from wbw_block where channal = '{$row["id"]}' and book='{$book}' and paragraph in {$strQueryParaList}  limit 0,100";
@@ -375,6 +376,7 @@ switch($op){
 				echo '<div class="title" style="flex:2;padding-bottom:5px;">';
 				if($FetchWBW==0){
 					echo $_local->gui->blank;
+					echo "<a>快捷编辑</a>";
 				}
 				else{
 					echo $FetchWBW.$_local->gui->para;

+ 0 - 1
app/term/channal_list.php

@@ -72,7 +72,6 @@ foreach ($_data as $key => $value) {
 			else{
 				$channal[$value["channal"]] = 1;
 			}
-            
 		}
 		
 		$final[]=$pali_letter;

+ 25 - 2
app/term/note.js

@@ -193,6 +193,7 @@ function note_refresh_new() {
                 $("#" + id).html(strHtml);
               }
             }
+            /*
             $(".palitext").click(function () {
               let sentid = $(this).parent().attr("info").split("-");
               window.open(
@@ -218,6 +219,7 @@ function note_refresh_new() {
                   $(this).attr("end")
               );
             });
+            */
             note_ref_init();
             term_get_dict();
             note_channal_list();
@@ -405,7 +407,7 @@ function note_ref_init() {
     let bookid = $(this).attr("book");
     let para = $(this).attr("para");
     window.open(
-      "../pcdl/reader.php?view=chapter&book=" + bookid + "&para=" + para,
+      "../reader/?view=chapter&book=" + bookid + "&para=" + para,
       "_blank"
     );
   });
@@ -414,7 +416,7 @@ function note_ref_init() {
     let bookid = $(this).attr("book");
     let para = $(this).attr("para");
     window.open(
-      "../pcdl/reader.php?view=para&book=" + bookid + "&para=" + para,
+      "../reader/?view=para&book=" + bookid + "&para=" + para,
       "_blank"
     );
   });
@@ -427,6 +429,21 @@ ref
 */
 function note_json_html(in_json) {
   let output = "";
+  output +='<div class="note_tool_bar" style=" position: relative;">';
+  output +='<div class="case_dropdown" style="position: absolute; right: 0;width:1.5em;">';
+  output  +="<svg class='icon' >";
+  output  +="<use xlink:href='../studio/svg/icon.svg#ic_more'></use>";
+  output  +="</svg>";
+  output  +="<div class='case_dropdown-content sent_menu'>";
+  if(typeof _reader_view !="undefined" && _reader_view != "sent"){
+      output  +="<a onclick='junp_to(this)'>跳转至此句</a>";
+  }
+  output  +="<a onclick=\"copy_ref('"+in_json.book+"','"+in_json.para+"','"+in_json.begin+"','"+in_json.end+"')\">复制引用</a>";
+  output  +="<a onclick='copy_text(this)'>复制文本</a>";
+  output  +="<a onclick='add_to_list()'>添加到选择列表</a>";
+  output  +="</div>";
+  output +='</div>';
+  output +=' </div>';
   output += "<div class='palitext'>" + in_json.palitext + "</div>";
   for (const iterator of in_json.translation) {
     output += "<div class='tran' lang='" + iterator.lang + "'>";
@@ -612,3 +629,9 @@ function note_sent_save() {
     }
   );
 }
+
+
+function copy_ref(book,para,begin,end) {
+  let strRef = "{{" + book + "-" + para + "-" + begin + "-" + end + "}}";
+  copy_to_clipboard(strRef);
+}

+ 49 - 0
app/term/term.css

@@ -220,3 +220,52 @@ r {
   text-align: right;
   display: block;
 }
+
+note {
+  padding: 0.5em 0.8em;
+  margin-bottom: 0.4em;
+  border-radius: 5px;
+  line-height: 1.3em;
+  display: block;
+  background-color: #80808014;
+}
+
+.bg_color_1 {
+  background-color: #ebebeb66;
+}
+.bg_color_2 {
+  background: linear-gradient(to right, #6afdb033, #ebebeb66);
+}
+.bg_color_3 {
+  background: linear-gradient(to right, #6a95fd26, #ebebeb66);
+}
+.bg_color_4 {
+  background: linear-gradient(to right, #f9e7911c, #ebebeb66);
+}
+.bg_color_5 {
+  background: linear-gradient(to right, #fe99b91c, #ebebeb66);
+}
+
+pre {
+  white-space: pre-line;
+  font-family: auto;
+  border-left: 3px solid var(--border-shadow);
+  margin-left: 1em;
+  padding-left: 0.5em;
+}
+
+.note_tool_bar {
+  position: relative;
+  display: none;
+}
+
+note:hover .note_tool_bar {
+  display: block;
+}
+
+.sent_menu {
+  right: 0;
+}
+.para_menu {
+  left: 0;
+}

+ 89 - 2
app/term/term.js

@@ -432,8 +432,19 @@ function term_lookup_my(pali, channal = "", owner = "", lang = "") {
       }
     }
   }
-  for (const iterator of arrMyTerm) {
-    if (owner != "") {
+  //我自己的相同语言
+  if (owner != "") {
+    for (const iterator of arrMyTerm) {
+      if (
+        iterator.word == pali &&
+        owner == iterator.owner &&
+        iterator.language == lang
+      ) {
+        return iterator;
+      }
+    }
+
+    for (const iterator of arrMyTerm) {
       if (
         iterator.word == pali &&
         owner == iterator.owner &&
@@ -441,8 +452,84 @@ function term_lookup_my(pali, channal = "", owner = "", lang = "") {
       ) {
         return iterator;
       }
+    }  
+
+    //别人的相同语言
+    for (const iterator of arrMyTerm) {
+      if (
+        iterator.word == pali &&
+        iterator.language == lang
+      ) {
+        return iterator;
+      }
+    }  
+
+    for (const iterator of arrMyTerm) {
+      if (
+        iterator.word == pali &&
+        iterator.language.indexOf(lang) >= 0
+      ) {
+        return iterator;
+      }
+    } 
+  }
+  //找自己的相似语言
+  return false;
+}
+
+//在我的术语字典里查询
+function term_lookup_my_a(pali, channal = "", owner = "", lang = "") {
+  for (const iterator of arrMyTerm) {
+    if (channal != "") {
+      if (channal == iterator.channal ){
+        if( iterator.word.indexOf(pali)!=-1) {
+        return iterator;
+        }
+      }
+    }
+  }
+  //我自己的相同语言
+  if (owner != "") {
+    for (const iterator of arrMyTerm) {
+      if (
+        pali.indexOf(iterator.word)>=0 &&
+        owner == iterator.owner &&
+        iterator.language == lang
+      ) {
+        return iterator;
+      }
     }
+
+    for (const iterator of arrMyTerm) {
+      if (
+        pali.indexOf(iterator.word)>=0 &&
+        owner == iterator.owner &&
+        iterator.language.indexOf(lang) >= 0
+      ) {
+        return iterator;
+      }
+    }  
+
+    //别人的相同语言
+    for (const iterator of arrMyTerm) {
+      if (
+        pali.indexOf(iterator.word)>=0 &&
+        iterator.language == lang
+      ) {
+        return iterator;
+      }
+    }  
+
+    for (const iterator of arrMyTerm) {
+      if (
+        pali.indexOf(iterator.word)>=0 &&
+        iterator.language.indexOf(lang) >= 0
+      ) {
+        return iterator;
+      }
+    } 
   }
+  //找自己的相似语言
   return false;
 }
 

+ 5 - 2
app/term/term.php

@@ -96,12 +96,15 @@ switch($op){
 	}
 	case "my":
 	{
-		$query = "select guid,word,meaning,other_meaning from term  where owner= ".$PDO->quote($username);
-		$Fetch = PDO_FetchAll($query);
+		$query = "select guid,word,meaning,other_meaning,language from term  where owner= ? ";
+		$Fetch = PDO_FetchAll($query,array($_COOKIE["userid"]));
 		$iFetch=count($Fetch);
 		if($iFetch>0){
 			echo json_encode($Fetch, JSON_UNESCAPED_UNICODE);
 		}
+		else{
+			echo json_encode(array(), JSON_UNESCAPED_UNICODE);
+		}
 		break;
 	}
 	case "allpali":

+ 31 - 0
app/term/term_para.css

@@ -0,0 +1,31 @@
+note {
+  display: inline;
+  background-color: unset;
+}
+.tran > p {
+  display: inline;
+}
+note {
+  padding: 2px;
+  margin-bottom: unset;
+}
+.bg_color_1 {
+  background-color: unset;
+  background: none;
+}
+.bg_color_2 {
+  background-color: unset;
+  background: none;
+}
+.bg_color_3 {
+  background: none;
+  background-color: unset;
+}
+.bg_color_4 {
+  background: none;
+  background-color: unset;
+}
+.bg_color_5 {
+  background: none;
+  background-color: unset;
+}