Browse Source

:bug:studio术语显示不出来

visuddhinanda 5 years ago
parent
commit
f1c36b07a8
6 changed files with 2422 additions and 3238 deletions
  1. 157 152
      app/palicanon/palicanon.js
  2. 0 549
      app/public/js/term-.js
  3. 210 152
      app/reader/reader.js
  4. 849 1017
      app/studio/js/render.js
  5. 499 568
      app/term/note.js
  6. 707 800
      app/term/term.js

+ 157 - 152
app/palicanon/palicanon.js

@@ -1,173 +1,178 @@
-var main_tag="";
-var list_tag=new Array();
-var currTagLevel0= new Array();
+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_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);
-
-        });
+	$.get(
+		"../term/term.php",
+		{
+			op: "my",
+		},
+		function (data) {
+			arrMyTerm = JSON.parse(data);
+		}
+	);
 }
 
-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_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 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 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 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;
+function sortNumber(a, b) {
+	return b - a;
 }

+ 0 - 549
app/public/js/term-.js

@@ -1,549 +0,0 @@
-var arrTerm = new Array();
-var arrTerm2 = new Array();
-var arrMyTerm = new Array();
-var arrAllMean = new Array();
-var arrTermAllPali = new Array();
-var arrWordIdTermId = new Array();
-
-var strTermTanslationTmp = "[%mean%](%pali% %mean2% %mymean%)";
-var strTermTanslationTmp2 = "[%mean%]";
-var termCounter = new Array();
-var noteCounter = 0; //正文内注释计数器
-
-function note(noteId, strDef = "unkow") {
-  document.write("haha");
-}
-
-function note_replace(strIn) {
-  /*
-	
-	*/
-  var output = strIn.replace("/*", "<script>");
-  output = output.replace("*/", "</script>");
-  return output;
-}
-
-//将存储状态的字符串转换为预显示字符串
-//设置状态为 0:未处理的原始状态
-function term_std_str_to_tran(strIn) {
-  return strIn
-    .replace(/\[\[/g, "<term status='0'>")
-    .replace(/\]\]/g, "</term>");
-}
-
-function term_std_str_to_edit(strIn) {
-  var arrText = strIn.split("/");
-  for (var i in arrText) {
-    //头尾是*
-    if (
-      arrText[i].substring(0, 1) == "*" &&
-      arrText[i].substring(arrText[i].length - 1) == "*"
-    ) {
-      var arrOneTermWord = arrText[i].split("@");
-      if (arrOneTermWord.length == 2) {
-        arrText[i] = "*" + arrOneTermWord[1];
-      }
-    }
-  }
-
-  return arrText.join("/");
-}
-
-function term_tran_edit_replace(strIn) {
-  var strEdit = strIn;
-  for (var x = 0; x < arrTerm2.length; x++) {
-    var strReplace =
-      "strEdit=strEdit.replace(/" +
-      arrTerm2[x].meaning +
-      '/g,"/*' +
-      arrTerm2[x].meaning +
-      '*/")';
-    eval(strReplace);
-  }
-  //strEdit=strEdit.replace(/\/*\/*/g,"\/*");
-  //strEdit=strEdit.replace(/\*\/\*\//g,"*\/");
-  return strEdit;
-}
-
-function term_edit_to_std_str(strIn) {
-  var arrText = strIn.split("/");
-  for (var i in arrText) {
-    //头尾是*
-    if (
-      arrText[i].substring(0, 1) == "*" &&
-      arrText[i].substring(arrText[i].length - 1) == "*"
-    ) {
-      var wordMeaning = arrText[i].substring(1, arrText[i].length - 1);
-      arrText[i] = "*" + term_get_std_str(wordMeaning) + "*";
-    }
-  }
-  return arrText.join("/");
-}
-function term_get_std_str(strMean) {
-  for (var x = 0; x < arrTerm2.length; x++) {
-    if (arrTerm2[x].meaning == strMean) {
-      return arrTerm2[x].guid + "@" + strMean;
-    }
-  }
-  return "unkow@" + strMean;
-}
-function term_get_my_std_str(strMean) {
-  for (var x in arrMyTerm) {
-    if (arrMyTerm[x].meaning == strMean) {
-      return arrMyTerm[x].guid + "@" + strMean;
-    }
-  }
-  return "unkow@" + strMean;
-}
-
-function note_lookup(word, showto) {
-  $("#" + showto).load("term.php?op=search&word=" + word, function (
-    responseTxt,
-    statusTxt,
-    xhr
-  ) {
-    if (statusTxt == "success") {
-      $(".term_note").each(function (index, element) {
-        $(this).html(note_init($(this).html()));
-        $(this).attr("status", 1);
-        note_refresh_new();
-      });
-    } else if (statusTxt == "error") {
-      console.error("Error: " + xhr.status + ": " + xhr.statusText);
-    }
-  });
-}
-
-function term_apply(guid) {
-  if (g_eCurrWord) {
-    setNodeText(g_eCurrWord, "note", "=term(" + guid + ")");
-    term_array_updata();
-  }
-}
-
-function term_data_copy_to_me(guid) {
-  $("#term_dict").load("term.php?op=copy&wordid=" + guid);
-}
-
-//我的术语字典进入编辑模式
-function term_edit(guid) {
-  $("#term_edit_btn1_" + guid).hide();
-  $("#term_edit_btn2_" + guid).show();
-  document.getElementById("term_dict_my_" + guid).style.display = "none";
-  document.getElementById("term_dict_my_edit_" + guid).style.display = "block";
-}
-
-//我的术语字典退出编辑模式
-function term_data_esc_edit(guid) {
-  $("#term_edit_btn1_" + guid).show();
-  $("#term_edit_btn2_" + guid).hide();
-  document.getElementById("term_dict_my_" + guid).style.display = "block";
-  document.getElementById("term_dict_my_edit_" + guid).style.display = "none";
-}
-//我的术语字典 编辑模式 保存
-
-function term_data_save(guid) {
-  if (guid == "") {
-    var strWord = $("#term_new_word").val();
-    var strMean = $("#term_new_mean").val();
-    var strMean2 = $("#term_new_mean2").val();
-    var strTag = $("#term_new_tag").val();
-    var strChannal = $("#term_new_channal").val();
-    var strLanguage = $("#term_new_language").val();
-    var strNote = $("#term_new_note").val();
-    let newTerm = new Object();
-    newTerm.guid = com_guid();
-    newTerm.word = strWord;
-    newTerm.meaning = strMean;
-    newTerm.other_meaning = strMean2;
-    newTerm.tag = strTag;
-    newTerm.channal = strChannal;
-    newTerm.language = strLanguage;
-
-    arrMyTerm.push(newTerm);
-  } else {
-    var strWord = $("#term_edit_word_" + guid).val();
-    var strMean = $("#term_edit_mean_" + guid).val();
-    var strMean2 = $("#term_edit_mean2_" + guid).val();
-    var strTag = $("#term_edit_tag_" + guid).val();
-    var strChannal = $("#term_edit_channal_" + guid).val();
-    var strLanguage = $("#term_edit_language_" + guid).val();
-    var strNote = $("#term_edit_note_" + guid).val();
-  }
-  $.get(
-    "term.php",
-    {
-      op: "save",
-      guid: guid,
-      word: strWord,
-      mean: strMean,
-      mean2: strMean2,
-      tag: strTag,
-      channal: strChannal,
-      language: strLanguage,
-      note: strNote,
-    },
-    function (data, status) {
-      try {
-        let result = JSON.parse(data);
-        if (result.status == 0) {
-          note_lookup(result.message, "term_dict");
-        } else {
-          ntf_show("term error" + result.message);
-        }
-      } catch (e) {
-        console.error("term_get_all_pali:" + e + " data:" + data);
-        ntf_show("term error");
-      }
-    }
-  );
-}
-function term_get_all_pali() {
-  $.get(
-    "term.php",
-    {
-      op: "allpali",
-    },
-    function (data, status) {
-      if (data.length > 0) {
-        try {
-          arrTermAllPali = JSON.parse(data);
-        } catch (e) {
-          console.error("term_get_all_pali:" + e + " data:" + data);
-        }
-      }
-    }
-  );
-}
-function term_lookup_all(pali) {
-  for (var x in arrTermAllPali) {
-    if (arrTermAllPali[x].word == pali) {
-      return arrTermAllPali[x];
-    }
-  }
-  return null;
-}
-
-function term_get_my() {
-  $.get(
-    "term.php",
-    {
-      op: "my",
-    },
-    function (data, status) {
-      if (data.length > 0) {
-        try {
-          arrMyTerm = JSON.parse(data);
-        } catch (e) {
-          console.error(e.error + " data:" + data);
-        }
-      }
-    }
-  );
-}
-
-//在我的术语字典里查询
-function term_lookup_my(pali) {
-  for (var x in arrMyTerm) {
-    if (arrMyTerm[x].meaning == pali) {
-      return arrMyTerm[x];
-    }
-    if (arrMyTerm[x].word == pali) {
-      return arrMyTerm[x];
-    }
-  }
-  return null;
-}
-function term_lookup_my_id(id) {
-  for (var x in arrMyTerm) {
-    if (arrMyTerm[x].guid == id) {
-      return arrMyTerm[x];
-    }
-  }
-  return null;
-}
-
-function term_get_all_meaning(word) {
-  $.get(
-    "term.php",
-    {
-      op: "allmean",
-      word: word,
-    },
-    function (data, status) {
-      $("#term_win_other_mean").html(data);
-    }
-  );
-}
-
-//刷新文档正在使用的术语数据
-function term_array_updata() {
-  arrTerm2 = new Array();
-  var arrTermDownLoadList = new Array();
-  var arrWordIdTermId = new Array();
-  var xAllWord = gXmlBookDataBody.getElementsByTagName("word");
-  for (var x = 0; x < xAllWord.length; x++) {
-    var sNote = getNodeText(xAllWord[x], "note");
-    var wid = getNodeText(xAllWord[x], "id");
-    if (sNote.substring(0, 6) == "=term(") {
-      var termId = sNote.slice(6, -1);
-      if (!arrTerm[termId]) {
-        arrTermDownLoadList.push(termId);
-      }
-      //person={wid:wid,tid:termId};
-      arrWordIdTermId.push({ wid: wid, tid: termId });
-    }
-  }
-  if (arrTermDownLoadList.length > 0) {
-    var idlist = arrTermDownLoadList.join();
-    idlist = idlist.replace(/,/g, "','");
-    idlist = "'" + idlist + "'";
-    $.get(
-      "term.php",
-      {
-        op: "extract",
-        list: idlist,
-      },
-      function (data, status) {
-        var obj = JSON.parse(data);
-        for (var x in obj) {
-          arrTerm[obj[x].guid] = obj[x];
-          arrTerm2.push(obj[x]);
-        }
-        if (g_eCurrWord) {
-          updataWordHeadById(getNodeText(g_eCurrWord, "id"));
-          refreshWordNote(g_eCurrWord.parentNode.parentNode);
-        }
-        for (var i = 0; i < arrWordIdTermId.length; i++) {
-          var wid = arrWordIdTermId[i].wid;
-          var sMean = arrTerm[arrWordIdTermId[i].tid].meaning;
-          doc_setWordDataById(wid, "mean", sMean);
-          updateWordBodyById(wid);
-        }
-      }
-    );
-  }
-}
-
-function term_updata_translation() {
-  termCounter = new Array();
-  noteCounter = 1;
-  $("term").each(function () {
-    let status = $(this).attr("status");
-    let termText = $(this).text();
-
-    if (termText.slice(0, 1) == "#") {
-      if (status == 0) {
-        $(this).attr("status", "1");
-        $(this).attr("type", "1");
-        $(this).attr("text", termText.slice(1));
-      }
-      let noteText = $(this).attr("text");
-      $(this).html(
-        "<a onclick=\"alert('" + noteText + "')\">[" + noteCounter + "]</a>"
-      );
-      noteCounter++;
-    } else {
-      if (status == 0) {
-        let myterm = term_lookup_my(termText); //我的术语字典
-        if (myterm) {
-          $(this).attr("status", "1");
-          $(this).attr("type", "0");
-          $(this).attr("guid", myterm.guid);
-          $(this).attr("pali", myterm.word);
-          $(this).attr("mean", myterm.meaning);
-          $(this).attr("mean2", myterm.other_meaning);
-          $(this).attr("replace", myterm.meaning);
-        } else {
-          $(this).attr("status", "2");
-        }
-      }
-      let guid = $(this).attr("guid");
-      let pali = $(this).attr("pali");
-      let mean = $(this).attr("mean");
-      let mean2 = $(this).attr("mean2");
-      var renderTo = $(this).attr("pos");
-      var noteText = "";
-
-      if (termCounter[guid]) {
-        termCounter[guid] = 2;
-      } else {
-        termCounter[guid] = 1;
-      }
-      var myterm = term_lookup_my(pali); //我的术语字典
-      let linkclass = "";
-      if (myterm) {
-        linkclass = "term_link";
-      } else {
-        linkclass = "term_link_new";
-      }
-      if (guid) {
-        if (renderTo == "wbw") {
-          noteText = "%note%";
-        } else {
-          if (termCounter[guid] == 1) {
-            noteText = strTermTanslationTmp;
-          } else {
-            noteText = strTermTanslationTmp2;
-          }
-        }
-
-        noteText = noteText.replace(
-          "[",
-          "<span class='" +
-            linkclass +
-            "' onclick=\"term_show_win('" +
-            guid +
-            "')\">"
-        );
-        noteText = noteText.replace("]", "</span>");
-        noteText = noteText.replace(
-          "%mean%",
-          "<span class='term_mean'>" + mean + "</span>"
-        );
-        noteText = noteText.replace(
-          "%pali%",
-          "<span class='term_pali'>" + pali + "</span>"
-        );
-        noteText = noteText.replace(
-          "%mean2%",
-          "<span class='term_mean2'>" + mean2 + "</span>"
-        );
-        noteText = noteText.replace(
-          "%note%",
-          "<span class='term_note'>" + "" + "</span>"
-        );
-        if (myterm) {
-          if (myterm.meaning != mean) {
-            noteText = noteText.replace(
-              "%mymean%",
-              "<span class='term_mean_my'>" + myterm.meaning + "</span>"
-            );
-          } else {
-            noteText = noteText.replace("%mymean%", "");
-          }
-        } else {
-          noteText = noteText.replace("%mymean%", "");
-        }
-      } else {
-        noteText =
-          "<span class='" +
-          linkclass +
-          "'  onclick=\"term_show_win('','" +
-          termText +
-          "')\">" +
-          termText +
-          "</span>";
-      }
-      $(this).html(noteText);
-    }
-  });
-}
-
-function term_show_win(guid, keyWord = "") {
-  if (guid == "") {
-    $(term_body).html(
-      "当前词条未创建。<br /><a onclick=\"term_add_new('" +
-        keyWord +
-        "')\">现在创建</a>"
-    );
-  } else {
-    let currWord = term_lookup_my_id(guid);
-    if (currWord) {
-      let termString = "";
-      let pali = currWord.word;
-      let pali_1 = pali.substring(0, 1).toUpperCase();
-      pali = pali_1 + pali.substring(1);
-      let mean = currWord.meaning;
-      let myterm = term_lookup_my(currWord.word); //我的术语字典
-      termString += "<div class='term_win_mean'>" + pali + "</div>";
-      termString +=
-        "<div class='term_win_pali'>意思:" + currWord.meaning + "</div>";
-      termString +=
-        "<div class='term_win_mean2'>其他意思:" +
-        currWord.other_meaning +
-        "</div>";
-      termString += "<div class='term_win_mymean'>我的词库:";
-      if (myterm) {
-        termString += "<b>" + myterm.meaning + "</b> ";
-      } else {
-        termString += "<input type='input'  placeholder='我的释义'>";
-      }
-      termString += "<span>其他:</span><span id='term_win_other_mean'></span>";
-      termString += "</div>";
-
-      if (currWord.note) {
-        termString += "<div class='term_win_note'>" + currWord.note + "</div>";
-      } else {
-        termString += "<div class='term_win_note'>Loading</div>";
-      }
-      $(term_body).html(termString);
-      term_get_all_meaning(currWord.word);
-
-      if (!currWord.note) {
-        $.get(
-          "term.php",
-          {
-            op: "load_id",
-            id: currWord.guid,
-          },
-          function (data, status, xhr) {
-            switch (status) {
-              case "success":
-                try {
-                  let loadWord = JSON.parse(data);
-                  $("#term_win_note").html(loadWord[0].note);
-                  //修改内存数据
-                  for (let x in arrMyTerm) {
-                    if (arrMyTerm[x].guid == loadWord[0].guid) {
-                      arrMyTerm[x].note = loadWord[0].note;
-                      return;
-                    }
-                  }
-                } catch (e) {
-                  console.error(e + " data:" + data);
-                }
-                break;
-              case "error":
-                console.error("Error: " + xhr.status + ": " + xhr.statusText);
-                break;
-            }
-          }
-        );
-      }
-    } else {
-      $(term_body).html("undefined guid");
-    }
-  }
-  document.getElementById("term_win").style.display = "flex";
-}
-
-function term_tmp(type, tmp) {
-  if (tmp == "new") {
-    switch (type) {
-      case "a":
-        strTermTanslationTmp = $("#term_my_tmp").val();
-        break;
-      case "a2":
-        strTermTanslationTmp2 = $("#term_my_tmp").val();
-        break;
-    }
-  } else {
-    switch (type) {
-      case "a":
-        strTermTanslationTmp = tmp;
-        break;
-      case "a2":
-        strTermTanslationTmp2 = tmp;
-        break;
-    }
-  }
-  term_updata_translation();
-}
-
-function term_add_new(keyword) {
-  document.getElementById("term_win").style.display = "none";
-  editor_show_right_tool_bar(true);
-  tab_click_b("term_dict", "tab_rb_dict");
-  note_lookup(keyword, "term_dict");
-}

+ 210 - 152
app/reader/reader.js

@@ -13,175 +13,233 @@ 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;
-            $("#contents").html("");
-            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();
+	$.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;
+			$("#contents").html("");
+			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);
-                    if (tocNextMenu === "") {
-                        $("#para_path_next_level").hide();
-                    }
-                    else {
-                        $("#toc_next_menu").html(tocNextMenu);
-                        $("#para_path_next_level").show();
-                    }
+				//右侧目录
+				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);
+					if (tocNextMenu === "") {
+						$("#para_path_next_level").hide();
+					} else {
+						$("#toc_next_menu").html(tocNextMenu);
+						$("#para_path_next_level").show();
+					}
+				}
+			}
 
-                }
+			if (_sent_data.head == 1 || _sent_data.sentences.length == 0) {
+				//渲染目录
+				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_toc").html(tpl);
+			}
+		}
+	);
 
-            }
-
-
-            if (_sent_data.head == 1 || _sent_data.sentences.length == 0) {
-                //渲染目录
-                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_toc").html(tpl);
-            }
-        }
-    );
-
-    reader_get_path();
+	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_para('" + _reader_book + "','" + strPara + "')\">仅显示此段</a>";
-        }
-        html += "<a onclick=\"edit_wbw('" + _reader_book + "','" + strPara + "')\">" + gLocal.gui.edit_now + "</a>";
-        html += "<a onclick=\"copy_para_ref('" + _reader_book + "','" + strPara + "')\">" + gLocal.gui.copy_link + "</a>";
-        html += "<a onclick=\"copy_text('" + _reader_book + "','" + strPara + "')\">" + gLocal.gui.copy + "“" + gLocal.gui.pāli + "”</a>";
-        html += "<a onclick=\"add_to_list('" + _reader_book + "','" + strPara + "')\">" + gLocal.gui.add_to_edit_list + "</a>";
-        html += "</div>";
-        $(this).append(html);
-    });
-
+	$(".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_para('" + _reader_book + "','" + strPara + "')\">仅显示此段</a>";
+		}
+		html += "<a onclick=\"edit_wbw('" + _reader_book + "','" + strPara + "')\">" + gLocal.gui.edit_now + "</a>";
+		html +=
+			"<a onclick=\"copy_para_ref('" + _reader_book + "','" + strPara + "')\">" + gLocal.gui.copy_link + "</a>";
+		html +=
+			"<a onclick=\"copy_text('" +
+			_reader_book +
+			"','" +
+			strPara +
+			"')\">" +
+			gLocal.gui.copy +
+			"“" +
+			gLocal.gui.pāli +
+			"”</a>";
+		html +=
+			"<a onclick=\"add_to_list('" +
+			_reader_book +
+			"','" +
+			strPara +
+			"')\">" +
+			gLocal.gui.add_to_edit_list +
+			"</a>";
+		html += "</div>";
+		$(this).append(html);
+	});
 }
 
 function junp_to_para(book, para) {
-    let url = "../reader/?view=para&book=" + book + "&para=" + para + "&display=sent";
-    location.assign(url);
+	let url = "../reader/?view=para&book=" + book + "&para=" + para + "&display=sent";
+	location.assign(url);
 }
 
 function copy_para_ref(book, para) {
-    let output = "";
-    let currPara = para;
-    for (const iterator of _sent_data.sentences) {
-        if (iterator.book == book && iterator.paragraph == para) {
-            output += "{{" + book + "-" + para + "-" + iterator.begin + "-" + iterator.end + "}}\n";
-        }
-    }
-    output += "\n";
-    copy_to_clipboard(output)
+	let output = "";
+	let currPara = para;
+	for (const iterator of _sent_data.sentences) {
+		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();
-            }
-        }
-    );
+	$.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);
-        }
-    );
+	$.get(
+		"../term/term.php",
+		{
+			op: "my",
+		},
+		function (data) {
+			arrMyTerm = JSON.parse(data);
+		}
+	);
 }
 
-
 function set_channal(channalid) {
-    let url = "../reader/?view=" + _reader_view;
-    if (_reader_book != -1) {
-        url += "&book=" + _reader_book;
-    }
-    if (_reader_para != -1) {
-        url += "&para=" + _reader_para;
-    }
-    if (_reader_begin != -1) {
-        url += "&begin=" + _reader_begin;
-    }
-    if (_reader_end != -1) {
-        url += "&end=" + _reader_end;
-    }
-    if (channalid != "") {
-        url += "&channal=" + channalid;
-    }
-    if (_display != "") {
-        url += "&display=" + _display;
-    }
-    location.assign(url);
-}
+	let url = "../reader/?view=" + _reader_view;
+	if (_reader_book != -1) {
+		url += "&book=" + _reader_book;
+	}
+	if (_reader_para != -1) {
+		url += "&para=" + _reader_para;
+	}
+	if (_reader_begin != -1) {
+		url += "&begin=" + _reader_begin;
+	}
+	if (_reader_end != -1) {
+		url += "&end=" + _reader_end;
+	}
+	if (channalid != "") {
+		url += "&channal=" + channalid;
+	}
+	if (_display != "") {
+		url += "&display=" + _display;
+	}
+	location.assign(url);
+}

File diff suppressed because it is too large
+ 849 - 1017
app/studio/js/render.js


+ 499 - 568
app/term/note.js

@@ -31,395 +31,342 @@ var _channalData;
 
 */
 function note_create() {
-  $("#dialog").dialog({
-    autoOpen: false,
-    width: 550,
-    buttons: [
-      {
-        text: "Save",
-        click: function () {
-          note_sent_save();
-          $(this).dialog("close");
-        },
-      },
-      {
-        text: "Cancel",
-        click: function () {
-          $(this).dialog("close");
-        },
-      },
-    ],
-  });
+	$("#dialog").dialog({
+		autoOpen: false,
+		width: 550,
+		buttons: [
+			{
+				text: "Save",
+				click: function () {
+					note_sent_save();
+					$(this).dialog("close");
+				},
+			},
+			{
+				text: "Cancel",
+				click: function () {
+					$(this).dialog("close");
+				},
+			},
+		],
+	});
 }
+
 function note_init(input) {
-  let output = "<div>";
-  let newString = input.replace(/\{\{/g, '<note info="');
-  newString = newString.replace(/\}\}/g, '"></note>');
-  output = marked(newString);
-  output += "</div>";
-  return output;
+	let output = "<div>";
+	let newString = input.replace(/\{\{/g, '<note info="');
+	newString = newString.replace(/\}\}/g, '"></note>');
+	output = marked(newString);
+	output += "</div>";
+	return output;
 }
 
 function note_update_background_style() {
-  var mSentsBook = new Array();
-  var mBgIndex = 1;
-  $("note").each(function () {
-    let info = $(this).attr("info").split("-");
-    if (info.length >= 2) {
-      let book = info[0];
-      $(this).attr("book", book);
-      if (!mSentsBook[book]) {
-        mSentsBook[book] = mBgIndex;
-        mBgIndex++;
-      }
-      $(this).addClass("bg_color_" + mSentsBook[book]);
-    }
-  });
+	var mSentsBook = new Array();
+	var mBgIndex = 1;
+	$("note").each(function () {
+		let info = $(this).attr("info").split("-");
+		if (info.length >= 2) {
+			let book = info[0];
+			$(this).attr("book", book);
+			if (!mSentsBook[book]) {
+				mSentsBook[book] = mBgIndex;
+				mBgIndex++;
+			}
+			$(this).addClass("bg_color_" + mSentsBook[book]);
+		}
+	});
 }
 //
 function note_refresh_new() {
-  note_update_background_style();
-  let objNotes = document.querySelectorAll("note");
-  let arrSentInfo = new Array();
-  for (const iterator of objNotes) {
-    let id = iterator.id;
-    if (id == null || id == "") {
-      id = com_guid();
-      iterator.id = id;
-      let info = iterator.getAttributeNode("info").value;
-      let arrInfo = info.split("-");
-
-      if (arrInfo.length >= 2) {
-        let book = arrInfo[0];
-        let para = arrInfo[1];
-      }
-
-      if (info && info != "") {
-        arrSentInfo.push({ id: id, data: info });
-      }
-    }
-  }
-  if (arrSentInfo.length > 0) {
-    let setting = new Object();
-    setting.lang = "";
-    setting.channal = _channal;
-    $.post(
-      "../term/note.php",
-      {
-        setting: JSON.stringify(setting),
-        data: JSON.stringify(arrSentInfo),
-      },
-      function (data, status) {
-        if (status == "success") {
-          try {
-            _arrData = JSON.parse(data);
-            for (const iterator of _arrData) {
-              let id = iterator.id;
-              let strHtml = "<a name='" + id + "'></a>";
-              if (_display && _display == "para") {
-                //段落模式
-                let strPalitext =
-                  "<pali book='" +
-                  iterator.book +
-                  "' para='" +
-                  iterator.para +
-                  "' begin='" +
-                  iterator.begin +
-                  "' end='" +
-                  iterator.end +
-                  "' >" +
-                  iterator.palitext +
-                  "</pali>";
-                let divPali = $("#" + id)
-                  .parent()
-                  .children(".palitext");
-                if (divPali.length == 0) {
-                  if (_channal != "") {
-                    let arrChannal = _channal.split(",");
-                    for (
-                      let index = arrChannal.length - 1;
-                      index >= 0;
-                      index--
-                    ) {
-                      const iChannal = arrChannal[index];
-                      $("#" + id)
-                        .parent()
-                        .prepend(
-                          "<div class='tran_div'  channal='" +
-                          iChannal +
-                          "'></div>"
-                        );
-                    }
-                  }
-
-                  $("#" + id)
-                    .parent()
-                    .prepend("<div class='palitext'></div>");
-                }
-                $("#" + id)
-                  .parent()
-                  .children(".palitext")
-                  .first()
-                  .append(strPalitext);
-                let htmlTran = "";
-                for (const oneTran of iterator.translation) {
-                  let html =
-                    "<span class='tran' lang='" +
-                    oneTran.lang +
-                    "' channal='" +
-                    oneTran.channal +
-                    "'>" +
-                    marked(
-                      term_std_str_to_tran(
-                        oneTran.text,
-                        oneTran.channal,
-                        oneTran.editor,
-                        oneTran.lang
-                      )
-                    ) +
-                    "</span>";
-                  if (_channal == "") {
-                    htmlTran += html;
-                  } else {
-                    $("#" + id)
-                      .siblings(".tran_div[channal='" + oneTran.channal + "']")
-                      .append(html);
-                  }
-                }
-                $("#" + id).html(htmlTran);
-              } else {
-                //句子模式
-                strHtml += note_json_html(iterator);
-                $("#" + id).html(strHtml);
-              }
-            }
-            /*
-            $(".palitext").click(function () {
-              let sentid = $(this).parent().attr("info").split("-");
-              window.open(
-                "../reader/?view=sent&book=" +
-                  sentid[0] +
-                  "&para=" +
-                  sentid[1] +
-                  "&begin=" +
-                  sentid[2] +
-                  "&end=" +
-                  sentid[3]
-              );
-            });
-            $("pali").click(function () {
-              window.open(
-                "../reader/?view=sent&book=" +
-                  $(this).attr("book") +
-                  "&para=" +
-                  $(this).attr("para") +
-                  "&begin=" +
-                  $(this).attr("begin") +
-                  "&end=" +
-                  $(this).attr("end")
-              );
-            });
-            */
-            note_ref_init();
-            term_get_dict();
-            note_channal_list();
-          } catch (e) {
-            console.error(e);
-          }
-        }
-      }
-    );
-  }
+	note_update_background_style();
+	let objNotes = document.querySelectorAll("note");
+	let arrSentInfo = new Array();
+	for (const iterator of objNotes) {
+		let id = iterator.id;
+		if (id == null || id == "") {
+			id = com_guid();
+			iterator.id = id;
+			let info = iterator.getAttributeNode("info").value;
+			let arrInfo = info.split("-");
+
+			if (arrInfo.length >= 2) {
+				let book = arrInfo[0];
+				let para = arrInfo[1];
+			}
+
+			if (info && info != "") {
+				arrSentInfo.push({ id: id, data: info });
+			}
+		}
+	}
+	if (arrSentInfo.length > 0) {
+		let setting = new Object();
+		setting.lang = "";
+		setting.channal = _channal;
+		$.post(
+			"../term/note.php",
+			{
+				setting: JSON.stringify(setting),
+				data: JSON.stringify(arrSentInfo),
+			},
+			function (data, status) {
+				if (status == "success") {
+					try {
+						_arrData = JSON.parse(data);
+						for (const iterator of _arrData) {
+							let id = iterator.id;
+							let strHtml = "<a name='" + id + "'></a>";
+							if (_display && _display == "para") {
+								//段落模式
+								let strPalitext =
+									"<pali book='" +
+									iterator.book +
+									"' para='" +
+									iterator.para +
+									"' begin='" +
+									iterator.begin +
+									"' end='" +
+									iterator.end +
+									"' >" +
+									iterator.palitext +
+									"</pali>";
+								let divPali = $("#" + id)
+									.parent()
+									.children(".palitext");
+								if (divPali.length == 0) {
+									if (_channal != "") {
+										let arrChannal = _channal.split(",");
+										for (let index = arrChannal.length - 1; index >= 0; index--) {
+											const iChannal = arrChannal[index];
+											$("#" + id)
+												.parent()
+												.prepend("<div class='tran_div'  channal='" + iChannal + "'></div>");
+										}
+									}
+
+									$("#" + id)
+										.parent()
+										.prepend("<div class='palitext'></div>");
+								}
+								$("#" + id)
+									.parent()
+									.children(".palitext")
+									.first()
+									.append(strPalitext);
+								let htmlTran = "";
+								for (const oneTran of iterator.translation) {
+									let html =
+										"<span class='tran' lang='" +
+										oneTran.lang +
+										"' channal='" +
+										oneTran.channal +
+										"'>";
+									html += marked(
+										term_std_str_to_tran(
+											oneTran.text,
+											oneTran.channal,
+											oneTran.editor,
+											oneTran.lang
+										)
+									);
+									html += "</span>";
+									if (_channal == "") {
+										htmlTran += html;
+									} else {
+										$("#" + id)
+											.siblings(".tran_div[channal='" + oneTran.channal + "']")
+											.append(html);
+									}
+								}
+								$("#" + id).html(htmlTran);
+							} else {
+								//句子模式
+								strHtml += note_json_html(iterator);
+								$("#" + id).html(strHtml);
+							}
+						}
+						note_ref_init();
+						term_get_dict();
+						note_channal_list();
+					} catch (e) {
+						console.error(e);
+					}
+				}
+			}
+		);
+	} else {
+		//term_get_dict();
+	}
 }
 
 function note_channal_list() {
-  console.log("note_channal_list start");
-  let arrSentInfo = new Array();
-  $("note").each(function () {
-    let info = $(this).attr("info");
-    if (info && info != "") {
-      arrSentInfo.push({ id: "", data: info });
-    }
-  });
-
-  if (arrSentInfo.length > 0) {
-    $.post(
-      "../term/channal_list.php",
-      {
-        setting: "",
-        data: JSON.stringify(arrSentInfo),
-      },
-      function (data, status) {
-        if (status == "success") {
-          try {
-            let active = JSON.parse(data);
-            _channalData = active;
-            for (const iterator of _my_channal) {
-              let found = false;
-              for (const one of active) {
-                if (iterator.id == one.id) {
-                  found = true;
-                  break;
-                }
-              }
-              if (found == false) {
-                _channalData.push(iterator);
-              }
-            }
-            let strHtml = "";
-            for (const iterator of _channalData) {
-              if (_channal.indexOf(iterator.id) >= 0) {
-                strHtml += render_channal_list(iterator);
-              }
-            }
-            for (const iterator of _channalData) {
-              if (_channal.indexOf(iterator.id) == -1) {
-                strHtml += render_channal_list(iterator);
-              }
-            }
-
-            $("#channal_list").html(strHtml);
-            $("[channal_id]").change(function () {
-              let channal_list = new Array();
-              $("[channal_id]").each(function () {
-                if (this.checked) {
-                  channal_list.push($(this).attr("channal_id"));
-                }
-              });
-              set_channal(channal_list.join());
-            });
-          } catch (e) {
-            console.error(e);
-          }
-        }
-      }
-    );
-  }
+	console.log("note_channal_list start");
+	let arrSentInfo = new Array();
+	$("note").each(function () {
+		let info = $(this).attr("info");
+		if (info && info != "") {
+			arrSentInfo.push({ id: "", data: info });
+		}
+	});
+
+	if (arrSentInfo.length > 0) {
+		$.post(
+			"../term/channal_list.php",
+			{
+				setting: "",
+				data: JSON.stringify(arrSentInfo),
+			},
+			function (data, status) {
+				if (status == "success") {
+					try {
+						let active = JSON.parse(data);
+						_channalData = active;
+						for (const iterator of _my_channal) {
+							let found = false;
+							for (const one of active) {
+								if (iterator.id == one.id) {
+									found = true;
+									break;
+								}
+							}
+							if (found == false) {
+								_channalData.push(iterator);
+							}
+						}
+						let strHtml = "";
+						for (const iterator of _channalData) {
+							if (_channal.indexOf(iterator.id) >= 0) {
+								strHtml += render_channal_list(iterator);
+							}
+						}
+						for (const iterator of _channalData) {
+							if (_channal.indexOf(iterator.id) == -1) {
+								strHtml += render_channal_list(iterator);
+							}
+						}
+
+						$("#channal_list").html(strHtml);
+						$("[channal_id]").change(function () {
+							let channal_list = new Array();
+							$("[channal_id]").each(function () {
+								if (this.checked) {
+									channal_list.push($(this).attr("channal_id"));
+								}
+							});
+							set_channal(channal_list.join());
+						});
+					} catch (e) {
+						console.error(e);
+					}
+				}
+			}
+		);
+	}
 }
 
 function find_channal(id) {
-  for (const iterator of _channalData) {
-    if (id == iterator.id) {
-      return iterator;
-    }
-  }
-  return false;
+	for (const iterator of _channalData) {
+		if (id == iterator.id) {
+			return iterator;
+		}
+	}
+	return false;
 }
 function render_channal_list(channalinfo) {
-  let output = "";
-  output += "<div class='list_with_head'>";
-  let checked = "";
-  if (_channal.indexOf(channalinfo.id) >= 0) {
-    checked = "checked";
-  }
-  output +=
-    '<div><input type="checkbox" ' +
-    checked +
-    " channal_id='" +
-    channalinfo.id +
-    "'></div>";
-  output += "<div class='head'>";
-  output += "<span class='head_img'>";
-  output += channalinfo.nickname.slice(0, 2);
-  output += "</span>";
-  output += "</div>";
-
-  output += "<div style='width: 100%;overflow-x: hidden;'>";
-
-  output += "<div>";
-
-  //  output += "<a href='../wiki/wiki.php?word=" + _word;
-  //  output += "&channal=" + channalinfo.id + "' >";
-  output += "<a onclick=\"set_channal('" + channalinfo.id + "')\">";
-
-  output += channalinfo["name"];
-
-  output += "</a>";
-  output += "</div>";
-
-  output += "<div>";
-  output += channalinfo["nickname"] + "/";
-  output += "@" + channalinfo["username"];
-  output += "</div>";
-
-  if (channalinfo["final"]) {
-    //进度
-    output += "<div>";
-    let article_len = channalinfo["article_len"];
-    let svg_width = article_len;
-    let svg_height = parseInt(article_len / 10);
-    output +=
-      '<svg viewBox="0 0 ' + svg_width + " " + svg_height + '" width="100%" >';
-
-    let curr_x = 0;
-    let allFinal = 0;
-    for (const iterator of channalinfo["final"]) {
-      let stroke_width = parseInt(iterator.len);
-      output += "<rect ";
-      output += ' x="' + curr_x + '"';
-      output += ' y="0"';
-      output += ' height="' + svg_height + '"';
-      output += ' width="' + stroke_width + '"';
-
-      if (iterator.final == true) {
-        allFinal += stroke_width;
-        output += ' class="progress_bar_done" ';
-      } else {
-        output += ' class="progress_bar_undone" ';
-      }
-      output += "/>";
-
-      curr_x += stroke_width;
-    }
-    output +=
-      "<rect  x='0' y='0'  width='" +
-      svg_width +
-      "' height='" +
-      svg_height / 5 +
-      "' class='progress_bar_bg' />";
-    output +=
-      "<rect  x='0' y='0'  width='" +
-      allFinal +
-      "' height='" +
-      svg_height / 5 +
-      "' class='progress_bar_percent' style='stroke-width: 0; fill: rgb(100, 228, 100);'/>";
-    output +=
-      '<text x="0" y="' +
-      svg_height +
-      '" font-size="' +
-      svg_height * 0.8 +
-      '">';
-    output += channalinfo["count"] + "/" + channalinfo["all"];
-    output += "</text>";
-    output += "<svg>";
-    output += "</div>";
-    //进度结束
-  }
-
-  output += "</div>";
-  output += "</div>";
-  return output;
+	let output = "";
+	output += "<div class='list_with_head'>";
+	let checked = "";
+	if (_channal.indexOf(channalinfo.id) >= 0) {
+		checked = "checked";
+	}
+	output += '<div><input type="checkbox" ' + checked + " channal_id='" + channalinfo.id + "'></div>";
+	output += "<div class='head'>";
+	output += "<span class='head_img'>";
+	output += channalinfo.nickname.slice(0, 2);
+	output += "</span>";
+	output += "</div>";
+
+	output += "<div style='width: 100%;overflow-x: hidden;'>";
+
+	output += "<div>";
+
+	//  output += "<a href='../wiki/wiki.php?word=" + _word;
+	//  output += "&channal=" + channalinfo.id + "' >";
+	output += "<a onclick=\"set_channal('" + channalinfo.id + "')\">";
+
+	output += channalinfo["name"];
+
+	output += "</a>";
+	output += "</div>";
+
+	output += "<div>";
+	output += channalinfo["nickname"] + "/";
+	output += "@" + channalinfo["username"];
+	output += "</div>";
+
+	if (channalinfo["final"]) {
+		//进度
+		output += "<div>";
+		let article_len = channalinfo["article_len"];
+		let svg_width = article_len;
+		let svg_height = parseInt(article_len / 10);
+		output += '<svg viewBox="0 0 ' + svg_width + " " + svg_height + '" width="100%" >';
+
+		let curr_x = 0;
+		let allFinal = 0;
+		for (const iterator of channalinfo["final"]) {
+			let stroke_width = parseInt(iterator.len);
+			output += "<rect ";
+			output += ' x="' + curr_x + '"';
+			output += ' y="0"';
+			output += ' height="' + svg_height + '"';
+			output += ' width="' + stroke_width + '"';
+
+			if (iterator.final == true) {
+				allFinal += stroke_width;
+				output += ' class="progress_bar_done" ';
+			} else {
+				output += ' class="progress_bar_undone" ';
+			}
+			output += "/>";
+
+			curr_x += stroke_width;
+		}
+		output +=
+			"<rect  x='0' y='0'  width='" + svg_width + "' height='" + svg_height / 5 + "' class='progress_bar_bg' />";
+		output +=
+			"<rect  x='0' y='0'  width='" +
+			allFinal +
+			"' height='" +
+			svg_height / 5 +
+			"' class='progress_bar_percent' style='stroke-width: 0; fill: rgb(100, 228, 100);'/>";
+		output += '<text x="0" y="' + svg_height + '" font-size="' + svg_height * 0.8 + '">';
+		output += channalinfo["count"] + "/" + channalinfo["all"];
+		output += "</text>";
+		output += "<svg>";
+		output += "</div>";
+		//进度结束
+	}
+
+	output += "</div>";
+	output += "</div>";
+	return output;
 }
 
 //点击引用 需要响应的事件
 function note_ref_init() {
-  $("chapter").click(function () {
-    let bookid = $(this).attr("book");
-    let para = $(this).attr("para");
-    window.open(
-      "../reader/?view=chapter&book=" + bookid + "&para=" + para,
-      "_blank"
-    );
-  });
-
-  $("para").click(function () {
-    let bookid = $(this).attr("book");
-    let para = $(this).attr("para");
-    window.open(
-      "../reader/?view=para&book=" + bookid + "&para=" + para,
-      "_blank"
-    );
-  });
+	$("chapter").click(function () {
+		let bookid = $(this).attr("book");
+		let para = $(this).attr("para");
+		window.open("../reader/?view=chapter&book=" + bookid + "&para=" + para, "_blank");
+	});
+
+	$("para").click(function () {
+		let bookid = $(this).attr("book");
+		let para = $(this).attr("para");
+		window.open("../reader/?view=para&book=" + bookid + "&para=" + para, "_blank");
+	});
 }
 /*
 id
@@ -428,211 +375,195 @@ tran
 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 + "')\">" + gLocal.gui.copy_link + "</a>";
-  output += "<a onclick='copy_text(this)'>" + gLocal.gui.copy + "“" + gLocal.gui.pāli + "”</a>";
-  output += "<a onclick='add_to_list()'>" + gLocal.gui.add_to_edit_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 + "'";
-    output +=
-      " onclick=\"note_edit_sentence('" +
-      in_json.book +
-      "' ,'" +
-      in_json.para +
-      "' ,'" +
-      in_json.begin +
-      "' ,'" +
-      in_json.end +
-      "' ,'" +
-      iterator.channal +
-      "')\">";
-    output += "<span class='edit_button'></span>";
-
-    output +=
-      "<div class='text' id='tran_text_" +
-      in_json.book +
-      "_" +
-      in_json.para +
-      "_" +
-      in_json.begin +
-      "_" +
-      in_json.end +
-      "_" +
-      iterator.channal +
-      "'>";
-    if (iterator.text == "") {
-      //let channal = find_channal(iterator.channal);
-      output += "<span style='color:var(--border-line-color);'></span>";
-      output +=
-        "<span style='color:var(--border-line-color);'>" +
-        iterator.channalinfo.name +
-        "-" +
-        iterator.channalinfo.lang +
-        "</span>";
-    } else {
-      output += marked(
-        term_std_str_to_tran(
-          iterator.text,
-          iterator.channal,
-          iterator.editor,
-          iterator.lang
-        )
-      );
-    }
-    output += "</div>";
-
-    output += "</div>";
-  }
-
-  output += "<div class='ref'>" + in_json.ref;
-  output +=
-    "<span class='sent_no'>" +
-    in_json.book +
-    "-" +
-    in_json.para +
-    "-" +
-    in_json.begin +
-    "-" +
-    in_json.end +
-    "<span>" +
-    "</div>";
-  return output;
+	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 +
+		"')\">" +
+		gLocal.gui.copy_link +
+		"</a>";
+	output += "<a onclick='copy_text(this)'>" + gLocal.gui.copy + "“" + gLocal.gui.pāli + "”</a>";
+	output += "<a onclick='add_to_list()'>" + gLocal.gui.add_to_edit_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 + "'";
+		output +=
+			" onclick=\"note_edit_sentence('" +
+			in_json.book +
+			"' ,'" +
+			in_json.para +
+			"' ,'" +
+			in_json.begin +
+			"' ,'" +
+			in_json.end +
+			"' ,'" +
+			iterator.channal +
+			"')\">";
+		output += "<span class='edit_button'></span>";
+
+		output +=
+			"<div class='text' id='tran_text_" +
+			in_json.book +
+			"_" +
+			in_json.para +
+			"_" +
+			in_json.begin +
+			"_" +
+			in_json.end +
+			"_" +
+			iterator.channal +
+			"'>";
+		if (iterator.text == "") {
+			//let channal = find_channal(iterator.channal);
+			output += "<span style='color:var(--border-line-color);'></span>";
+			output +=
+				"<span style='color:var(--border-line-color);'>" +
+				iterator.channalinfo.name +
+				"-" +
+				iterator.channalinfo.lang +
+				"</span>";
+		} else {
+			output += marked(term_std_str_to_tran(iterator.text, iterator.channal, iterator.editor, iterator.lang));
+		}
+		output += "</div>";
+
+		output += "</div>";
+	}
+
+	output += "<div class='ref'>" + in_json.ref;
+	output +=
+		"<span class='sent_no'>" +
+		in_json.book +
+		"-" +
+		in_json.para +
+		"-" +
+		in_json.begin +
+		"-" +
+		in_json.end +
+		"<span>" +
+		"</div>";
+	return output;
 }
 
 function note_edit_sentence(book, para, begin, end, channal) {
-  let channalInfo;
-  for (const iterator of _channalData) {
-    if (iterator.id == channal) {
-      channalInfo = iterator;
-      break;
-    }
-  }
-  for (const iterator of _arrData) {
-    if (
-      iterator.book == book &&
-      iterator.para == para &&
-      iterator.begin == begin &&
-      iterator.end == end
-    ) {
-      for (const tran of iterator.translation) {
-        if (tran.channal == channal) {
-          let html = "";
-          html +=
-            "<div style='color:blue;'>" +
-            channalInfo.nickname +
-            "/" +
-            channalInfo.name +
-            "</div>";
-          html +=
-            "<textarea id='edit_dialog_text' sent_id='" +
-            tran.id +
-            "' book='" +
-            iterator.book +
-            "' para='" +
-            iterator.para +
-            "' begin='" +
-            iterator.begin +
-            "' end='" +
-            iterator.end +
-            "' channal='" +
-            tran.channal +
-            "' style='width:100%;min-height:260px;'>" +
-            tran.text +
-            "</textarea>";
-          $("#edit_dialog_content").html(html);
-          break;
-        }
-      }
-    }
-  }
-
-  $("#dialog").dialog("open");
+	let channalInfo;
+	for (const iterator of _channalData) {
+		if (iterator.id == channal) {
+			channalInfo = iterator;
+			break;
+		}
+	}
+	for (const iterator of _arrData) {
+		if (iterator.book == book && iterator.para == para && iterator.begin == begin && iterator.end == end) {
+			for (const tran of iterator.translation) {
+				if (tran.channal == channal) {
+					let html = "";
+					html += "<div style='color:blue;'>" + channalInfo.nickname + "/" + channalInfo.name + "</div>";
+					html +=
+						"<textarea id='edit_dialog_text' sent_id='" +
+						tran.id +
+						"' book='" +
+						iterator.book +
+						"' para='" +
+						iterator.para +
+						"' begin='" +
+						iterator.begin +
+						"' end='" +
+						iterator.end +
+						"' channal='" +
+						tran.channal +
+						"' style='width:100%;min-height:260px;'>" +
+						tran.text +
+						"</textarea>";
+					$("#edit_dialog_content").html(html);
+					break;
+				}
+			}
+		}
+	}
+
+	$("#dialog").dialog("open");
 }
 
 function note_sent_save() {
-  let id = $("#edit_dialog_text").attr("sent_id");
-  let book = $("#edit_dialog_text").attr("book");
-  let para = $("#edit_dialog_text").attr("para");
-  let begin = $("#edit_dialog_text").attr("begin");
-  let end = $("#edit_dialog_text").attr("end");
-  let channal = $("#edit_dialog_text").attr("channal");
-  let text = $("#edit_dialog_text").val();
-
-  $.post(
-    "../usent/sent_post.php",
-    {
-      id: id,
-      book: book,
-      para: para,
-      begin: begin,
-      end: end,
-      channal: channal,
-      text: text,
-      lang: "zh",
-    },
-    function (data) {
-      let result = JSON.parse(data);
-      if (result.status > 0) {
-        alert("error" + result.message);
-      } else {
-        ntf_show("success");
-        $(
-          "#tran_text_" +
-          result.book +
-          "_" +
-          result.para +
-          "_" +
-          result.begin +
-          "_" +
-          result.end +
-          "_" +
-          result.channal
-        ).html(
-          marked(
-            term_std_str_to_tran(
-              result.text,
-              result.channal,
-              result.editor,
-              result.lang
-            )
-          )
-        );
-        term_updata_translation();
-        for (const iterator of _arrData) {
-          if (
-            iterator.book == result.book &&
-            iterator.para == result.para &&
-            iterator.begin == result.begin &&
-            iterator.end == result.end
-          ) {
-            for (const tran of iterator.translation) {
-              if (tran.channal == result.channal) {
-                tran.text = result.text;
-                break;
-              }
-            }
-          }
-        }
-      }
-    }
-  );
+	let id = $("#edit_dialog_text").attr("sent_id");
+	let book = $("#edit_dialog_text").attr("book");
+	let para = $("#edit_dialog_text").attr("para");
+	let begin = $("#edit_dialog_text").attr("begin");
+	let end = $("#edit_dialog_text").attr("end");
+	let channal = $("#edit_dialog_text").attr("channal");
+	let text = $("#edit_dialog_text").val();
+
+	$.post(
+		"../usent/sent_post.php",
+		{
+			id: id,
+			book: book,
+			para: para,
+			begin: begin,
+			end: end,
+			channal: channal,
+			text: text,
+			lang: "zh",
+		},
+		function (data) {
+			let result = JSON.parse(data);
+			if (result.status > 0) {
+				alert("error" + result.message);
+			} else {
+				ntf_show("success");
+				$(
+					"#tran_text_" +
+						result.book +
+						"_" +
+						result.para +
+						"_" +
+						result.begin +
+						"_" +
+						result.end +
+						"_" +
+						result.channal
+				).html(marked(term_std_str_to_tran(result.text, result.channal, result.editor, result.lang)));
+				term_updata_translation();
+				for (const iterator of _arrData) {
+					if (
+						iterator.book == result.book &&
+						iterator.para == result.para &&
+						iterator.begin == result.begin &&
+						iterator.end == result.end
+					) {
+						for (const tran of iterator.translation) {
+							if (tran.channal == result.channal) {
+								tran.text = result.text;
+								break;
+							}
+						}
+					}
+				}
+			}
+		}
+	);
 }
 
-
 function copy_ref(book, para, begin, end) {
-  let strRef = "{{" + book + "-" + para + "-" + begin + "-" + end + "}}";
-  copy_to_clipboard(strRef);
-}
+	let strRef = "{{" + book + "-" + para + "-" + begin + "-" + end + "}}";
+	copy_to_clipboard(strRef);
+}

+ 707 - 800
app/term/term.js

@@ -13,900 +13,807 @@ var termCounter = new Array();
 var noteCounter = 0; //正文内注释计数器
 
 function note(noteId, strDef = "unkow") {
-  document.write("haha");
+	document.write("haha");
 }
 
 function note_replace(strIn) {
-  /*
+	/*
 	
 	*/
-  var output = strIn.replace("/*", "<script>");
-  output = output.replace("*/", "</script>");
-  return output;
+	var output = strIn.replace("/*", "<script>");
+	output = output.replace("*/", "</script>");
+	return output;
 }
 
 function term_init() {}
 var str_term_fun_word_link = "term_show_win";
 function term_word_link_fun(fun_name) {
-  str_term_fun_word_link = fun_name;
+	str_term_fun_word_link = fun_name;
 }
 //将存储状态的字符串转换为预显示字符串
 //设置状态为 0:未处理的原始状态
 function term_std_str_to_tran(strIn, channal = "", editor = "", lang = "") {
-  return strIn
-    .replace(
-      /\[\[/g,
-      "<term status='0' channal='" +
-        channal +
-        "' editor='" +
-        editor +
-        "' lang='" +
-        lang +
-        "'>"
-    )
-    .replace(/\]\]/g, "</term>");
+	return strIn
+		.replace(/\[\[/g, "<term status='0' channal='" + channal + "' editor='" + editor + "' lang='" + lang + "'>")
+		.replace(/\]\]/g, "</term>");
 }
 
 function term_std_str_to_edit(strIn) {
-  var arrText = strIn.split("/");
-  for (var i in arrText) {
-    //头尾是*
-    if (
-      arrText[i].substring(0, 1) == "*" &&
-      arrText[i].substring(arrText[i].length - 1) == "*"
-    ) {
-      var arrOneTermWord = arrText[i].split("@");
-      if (arrOneTermWord.length == 2) {
-        arrText[i] = "*" + arrOneTermWord[1];
-      }
-    }
-  }
+	var arrText = strIn.split("/");
+	for (var i in arrText) {
+		//头尾是*
+		if (arrText[i].substring(0, 1) == "*" && arrText[i].substring(arrText[i].length - 1) == "*") {
+			var arrOneTermWord = arrText[i].split("@");
+			if (arrOneTermWord.length == 2) {
+				arrText[i] = "*" + arrOneTermWord[1];
+			}
+		}
+	}
 
-  return arrText.join("/");
+	return arrText.join("/");
 }
 
 function term_tran_edit_replace(strIn) {
-  var strEdit = strIn;
-  for (var x = 0; x < arrTerm2.length; x++) {
-    var strReplace =
-      "strEdit=strEdit.replace(/" +
-      arrTerm2[x].meaning +
-      '/g,"/*' +
-      arrTerm2[x].meaning +
-      '*/")';
-    eval(strReplace);
-  }
-  //strEdit=strEdit.replace(/\/*\/*/g,"\/*");
-  //strEdit=strEdit.replace(/\*\/\*\//g,"*\/");
-  return strEdit;
+	var strEdit = strIn;
+	for (var x = 0; x < arrTerm2.length; x++) {
+		var strReplace = "strEdit=strEdit.replace(/" + arrTerm2[x].meaning + '/g,"/*' + arrTerm2[x].meaning + '*/")';
+		eval(strReplace);
+	}
+	//strEdit=strEdit.replace(/\/*\/*/g,"\/*");
+	//strEdit=strEdit.replace(/\*\/\*\//g,"*\/");
+	return strEdit;
 }
 
 function term_edit_to_std_str(strIn) {
-  var arrText = strIn.split("/");
-  for (var i in arrText) {
-    //头尾是*
-    if (
-      arrText[i].substring(0, 1) == "*" &&
-      arrText[i].substring(arrText[i].length - 1) == "*"
-    ) {
-      var wordMeaning = arrText[i].substring(1, arrText[i].length - 1);
-      arrText[i] = "*" + term_get_std_str(wordMeaning) + "*";
-    }
-  }
-  return arrText.join("/");
+	var arrText = strIn.split("/");
+	for (var i in arrText) {
+		//头尾是*
+		if (arrText[i].substring(0, 1) == "*" && arrText[i].substring(arrText[i].length - 1) == "*") {
+			var wordMeaning = arrText[i].substring(1, arrText[i].length - 1);
+			arrText[i] = "*" + term_get_std_str(wordMeaning) + "*";
+		}
+	}
+	return arrText.join("/");
 }
 function term_get_std_str(strMean) {
-  for (var x = 0; x < arrTerm2.length; x++) {
-    if (arrTerm2[x].meaning == strMean) {
-      return arrTerm2[x].guid + "@" + strMean;
-    }
-  }
-  return "unkow@" + strMean;
+	for (var x = 0; x < arrTerm2.length; x++) {
+		if (arrTerm2[x].meaning == strMean) {
+			return arrTerm2[x].guid + "@" + strMean;
+		}
+	}
+	return "unkow@" + strMean;
 }
 function term_get_my_std_str(strMean) {
-  for (const iterator of arrMyTerm) {
-    if (iterator.meaning == strMean) {
-      return iterator.guid + "@" + strMean;
-    }
-  }
-  return "unkow@" + strMean;
+	for (const iterator of arrMyTerm) {
+		if (iterator.meaning == strMean) {
+			return iterator.guid + "@" + strMean;
+		}
+	}
+	return "unkow@" + strMean;
 }
 
 function note_lookup(word, showto) {
-  $("#" + showto).load(
-    "../term/term.php?op=search&word=" +
-      word +
-      "&username=" +
-      getCookie("username"),
-    function (responseTxt, statusTxt, xhr) {
-      if (statusTxt == "success") {
-        $(".term_note").each(function (index, element) {
-          $(this).html(note_init($(this).html()));
-          $(this).attr("status", 1);
-          note_refresh_new();
-        });
-      } else if (statusTxt == "error") {
-        console.error("Error: " + xhr.status + ": " + xhr.statusText);
-      }
-    }
-  );
+	$("#" + showto).load("../term/term.php?op=search&word=" + word + "&username=" + getCookie("username"), function (
+		responseTxt,
+		statusTxt,
+		xhr
+	) {
+		if (statusTxt == "success") {
+			$(".term_note").each(function (index, element) {
+				$(this).html(note_init($(this).html()));
+				$(this).attr("status", 1);
+				note_refresh_new();
+			});
+		} else if (statusTxt == "error") {
+			console.error("Error: " + xhr.status + ": " + xhr.statusText);
+		}
+	});
 }
 
 var term_get_word_to_div_callback = null;
 function term_get_word_to_div(strWord, div, callback) {
-  term_get_word_to_div_callback = callback;
-  let word = [{ pali: strWord, channal: "", editor: "", lang: "" }];
-
-  $.post(
-    "../term/term_get.php",
-    {
-      words: JSON.stringify(word),
-    },
-    function (data, status) {
-      if (status == "success") {
-        try {
-          let result = JSON.parse(data);
-          let html = "";
-          if (result.length > 0) {
-            let type = new Array();
-            let authors = new Array();
-            for (const iterator of result) {
-              if (iterator.tag == "") {
-                iterator.tag = "_null_";
-              }
-              if (type[iterator.tag] == null) {
-                type[iterator.tag] = new Array();
-              }
-              type[iterator.tag].push(iterator.meaning);
-              authors[iterator.owner] = iterator.user;
-            }
-
-            html += "<div class='term_word_head'>";
-            html += "<div class='term_word_head_pali'>";
-            html += result[0].word;
-            html += "</div>";
-            for (y in type) {
-              html += "<div class='term_word_head_mean'>";
-              if (y != "_null_") {
-                html += y + ":";
-              }
-              for (k in type[y]) {
-                html += type[y][k];
-              }
-              html += "</div>";
-            }
-            html +=
-              "<div class='term_word_head_authors'>" +
-              gLocal.gui.contributor +
-              ":";
-            for (y in authors) {
-              if (authors[y].nickname != "") {
-                html += '<a onclick="">' + authors[y].nickname + "</a> ";
-              } else {
-                html += '<a onclick="">' + y + "</a> ";
-              }
-            }
-
-            html += "</div>";
-            html += "</div>";
-            // end of term_word_head
-
-            html += "<div id='term_list_div' style='display:flex;'>";
-            html += "<div id='term_list'>";
-
-            for (const iterator of result) {
-              html += "<div class='term_block'>";
-              html += "<div class='term_block_bar'>";
-
-              html += "<div class='term_block_bar_left'>";
-
-              html += "<div class='term_block_bar_left_icon'>";
-              html += iterator.owner.slice(0, 1);
-              html += "</div>";
-
-              html += "<div class='term_block_bar_left_info'>";
-              html += "<div class='term_meaning'>" + iterator.meaning;
-              if (iterator.tag != "_null_") {
-                html += "<span class='term_tag'>" + iterator.tag + "</span>";
-              }
-              html += "</div>";
-              html += "<div class='term_author'>" + iterator.owner + "</div>";
-              html += "</div>";
-
-              html += "</div>";
-
-              html += "<div class='term_block_bar_right'>";
-              html +=
-                "<span><button class='icon_btn'><a href='#'>" +
-                gLocal.gui.edit +
-                "</a></button>";
-              html +=
-                "<button class='icon_btn'><a href='#'>" +
-                gLocal.gui.like +
-                "</a></button>";
-              html +=
-                "<button class='icon_btn'><a href='#'>" +
-                gLocal.gui.favorite +
-                "</a></button></span>";
-              html += "</div>";
-
-              html += "</div>";
-              //term_block_bar 结束
-              html +=
-                "<div class='term_note' status='1'>" +
-                note_init(iterator.note) +
-                "</div>";
-              //html += "</div>";
-            }
-            html += "</div>";
-
-            html += "<div id='term_list_right' >";
-
-            html += '<div class="fun_frame">';
-            html += '<div class="title">' + gLocal.gui.language + "</div>";
-            html += '<div class="content" style="max-height:10em;">';
-            html += '<div><a href="">' + gLocal.gui.all + "</a></div>";
-            html += "</div>";
-            html += "</div>";
-
-            html += '<div class="fun_frame">';
-            html += '<div class="title">' + gLocal.gui.translation + "</div>";
-            html +=
-              '<div id="channal_list"  class="content" style="max-height:10em;">';
-            html += '<div><a href="">' + gLocal.gui.all + "</a></div>";
-            html += "</div>";
-            html += "</div>";
-
-            html += "</div>";
-            //end of right
-
-            html += "</div>";
-            // end of term_list_div
-            //html += "</div>";
-          } else {
-            html += "<div >词条尚未创建</div>";
-            html +=
-              '<div ><input type="input" value="" placeholder="pali"/></div>';
-            html +=
-              '<div ><input type="input" value="" placeholder="meaning"/></div>';
-            html +=
-              '<div ><input type="input" value="" placeholder="other meaning"/></div>';
-            html +=
-              '<div ><input type="input" value="" placeholder="category"/></div>';
-            html +=
-              '<div ><input type="input" value="" placeholder="language"/></div>';
-            html += "<div ><textarea></textarea></div>";
-          }
-
-          $("#" + div).html(html);
-
-          note_refresh_new();
-
-          if (term_get_word_to_div_callback != null) {
-            term_get_word_to_div_callback(result);
-          }
-        } catch (e) {
-          console.error("term_get_word_to_div:" + e + " data:" + data);
-        }
-      } else {
-        console.error("term error:" + data);
-      }
-    }
-  );
+	term_get_word_to_div_callback = callback;
+	let word = [{ pali: strWord, channal: "", editor: "", lang: "" }];
+
+	$.post(
+		"../term/term_get.php",
+		{
+			words: JSON.stringify(word),
+		},
+		function (data, status) {
+			if (status == "success") {
+				try {
+					let result = JSON.parse(data);
+					let html = "";
+					if (result.length > 0) {
+						let type = new Array();
+						let authors = new Array();
+						for (const iterator of result) {
+							if (iterator.tag == "") {
+								iterator.tag = "_null_";
+							}
+							if (type[iterator.tag] == null) {
+								type[iterator.tag] = new Array();
+							}
+							type[iterator.tag].push(iterator.meaning);
+							authors[iterator.owner] = iterator.user;
+						}
+
+						html += "<div class='term_word_head'>";
+						html += "<div class='term_word_head_pali'>";
+						html += result[0].word;
+						html += "</div>";
+						for (y in type) {
+							html += "<div class='term_word_head_mean'>";
+							if (y != "_null_") {
+								html += y + ":";
+							}
+							for (k in type[y]) {
+								html += type[y][k];
+							}
+							html += "</div>";
+						}
+						html += "<div class='term_word_head_authors'>" + gLocal.gui.contributor + ":";
+						for (y in authors) {
+							if (authors[y].nickname != "") {
+								html += '<a onclick="">' + authors[y].nickname + "</a> ";
+							} else {
+								html += '<a onclick="">' + y + "</a> ";
+							}
+						}
+
+						html += "</div>";
+						html += "</div>";
+						// end of term_word_head
+
+						html += "<div id='term_list_div' style='display:flex;'>";
+						html += "<div id='term_list'>";
+
+						for (const iterator of result) {
+							html += "<div class='term_block'>";
+							html += "<div class='term_block_bar'>";
+
+							html += "<div class='term_block_bar_left'>";
+
+							html += "<div class='term_block_bar_left_icon'>";
+							html += iterator.owner.slice(0, 1);
+							html += "</div>";
+
+							html += "<div class='term_block_bar_left_info'>";
+							html += "<div class='term_meaning'>" + iterator.meaning;
+							if (iterator.tag != "_null_") {
+								html += "<span class='term_tag'>" + iterator.tag + "</span>";
+							}
+							html += "</div>";
+							html += "<div class='term_author'>" + iterator.owner + "</div>";
+							html += "</div>";
+
+							html += "</div>";
+
+							html += "<div class='term_block_bar_right'>";
+							html += "<span><button class='icon_btn'><a href='#'>" + gLocal.gui.edit + "</a></button>";
+							html += "<button class='icon_btn'><a href='#'>" + gLocal.gui.like + "</a></button>";
+							html +=
+								"<button class='icon_btn'><a href='#'>" + gLocal.gui.favorite + "</a></button></span>";
+							html += "</div>";
+
+							html += "</div>";
+							//term_block_bar 结束
+							html += "<div class='term_note' status='1'>" + note_init(iterator.note) + "</div>";
+							//html += "</div>";
+						}
+						html += "</div>";
+
+						html += "<div id='term_list_right' >";
+
+						html += '<div class="fun_frame">';
+						html += '<div class="title">' + gLocal.gui.language + "</div>";
+						html += '<div class="content" style="max-height:10em;">';
+						html += '<div><a href="">' + gLocal.gui.all + "</a></div>";
+						html += "</div>";
+						html += "</div>";
+
+						html += '<div class="fun_frame">';
+						html += '<div class="title">' + gLocal.gui.translation + "</div>";
+						html += '<div id="channal_list"  class="content" style="max-height:10em;">';
+						html += '<div><a href="">' + gLocal.gui.all + "</a></div>";
+						html += "</div>";
+						html += "</div>";
+
+						html += "</div>";
+						//end of right
+
+						html += "</div>";
+						// end of term_list_div
+						//html += "</div>";
+					} else {
+						html += "<div >词条尚未创建</div>";
+						html += '<div ><input type="input" value="" placeholder="pali"/></div>';
+						html += '<div ><input type="input" value="" placeholder="meaning"/></div>';
+						html += '<div ><input type="input" value="" placeholder="other meaning"/></div>';
+						html += '<div ><input type="input" value="" placeholder="category"/></div>';
+						html += '<div ><input type="input" value="" placeholder="language"/></div>';
+						html += "<div ><textarea></textarea></div>";
+					}
+
+					$("#" + div).html(html);
+
+					note_refresh_new();
+
+					if (term_get_word_to_div_callback != null) {
+						term_get_word_to_div_callback(result);
+					}
+				} catch (e) {
+					console.error("term_get_word_to_div:" + e + " data:" + data);
+				}
+			} else {
+				console.error("term error:" + data);
+			}
+		}
+	);
 }
 function term_get_guid_to_html(strGuid) {}
 function term_apply(guid) {
-  if (g_eCurrWord) {
-    setNodeText(g_eCurrWord, "note", "=term(" + guid + ")");
-    term_array_updata();
-  }
+	if (g_eCurrWord) {
+		setNodeText(g_eCurrWord, "note", "=term(" + guid + ")");
+		term_array_updata();
+	}
 }
 
 function term_data_copy_to_me(guid) {
-  $("#term_dict").load("../term/term.php?op=copy&wordid=" + guid);
+	$("#term_dict").load("../term/term.php?op=copy&wordid=" + guid);
 }
 
 //我的术语字典进入编辑模式
 function term_edit(guid) {
-  $("#term_edit_btn1_" + guid).hide();
-  $("#term_edit_btn2_" + guid).show();
-  document.getElementById("term_dict_my_" + guid).style.display = "none";
-  document.getElementById("term_dict_my_edit_" + guid).style.display = "block";
+	$("#term_edit_btn1_" + guid).hide();
+	$("#term_edit_btn2_" + guid).show();
+	document.getElementById("term_dict_my_" + guid).style.display = "none";
+	document.getElementById("term_dict_my_edit_" + guid).style.display = "block";
 }
 
 //我的术语字典退出编辑模式
 function term_data_esc_edit(guid) {
-  $("#term_edit_btn1_" + guid).show();
-  $("#term_edit_btn2_" + guid).hide();
-  document.getElementById("term_dict_my_" + guid).style.display = "block";
-  document.getElementById("term_dict_my_edit_" + guid).style.display = "none";
+	$("#term_edit_btn1_" + guid).show();
+	$("#term_edit_btn2_" + guid).hide();
+	document.getElementById("term_dict_my_" + guid).style.display = "block";
+	document.getElementById("term_dict_my_edit_" + guid).style.display = "none";
 }
 //我的术语字典 编辑模式 保存
 
 function term_data_save(guid) {
-  if (guid == "") {
-    var strWord = $("#term_new_word").val();
-    var strMean = $("#term_new_mean").val();
-    var strMean2 = $("#term_new_mean2").val();
-    var strTag = $("#term_new_tag").val();
-    var strChannal = $("#term_new_channal").val();
-    var strLanguage = $("#term_new_language").val();
-    var strNote = $("#term_new_note").val();
-    let newTerm = new Object();
-    newTerm.guid = com_guid();
-    newTerm.word = strWord;
-    newTerm.meaning = strMean;
-    newTerm.other_meaning = strMean2;
-    newTerm.tag = strTag;
-    newTerm.channal = strChannal;
-    newTerm.language = strLanguage;
-
-    arrMyTerm.push(newTerm);
-  } else {
-    var strWord = $("#term_edit_word_" + guid).val();
-    var strMean = $("#term_edit_mean_" + guid).val();
-    var strMean2 = $("#term_edit_mean2_" + guid).val();
-    var strTag = $("#term_edit_tag_" + guid).val();
-    var strChannal = $("#term_edit_channal_" + guid).val();
-    var strLanguage = $("#term_edit_language_" + guid).val();
-    var strNote = $("#term_edit_note_" + guid).val();
-  }
-  $.get(
-    "../term/term.php",
-    {
-      op: "save",
-      guid: guid,
-      word: strWord,
-      mean: strMean,
-      mean2: strMean2,
-      tag: strTag,
-      channal: strChannal,
-      language: strLanguage,
-      note: strNote,
-    },
-    function (data, status) {
-      try {
-        let result = JSON.parse(data);
-        if (result.status == 0) {
-          note_lookup(result.message, "term_dict");
-        } else {
-          ntf_show("term error" + result.message);
-        }
-      } catch (e) {
-        console.error("term_get_all_pali:" + e + " data:" + data);
-        ntf_show("term error");
-      }
-    }
-  );
+	if (guid == "") {
+		var strWord = $("#term_new_word").val();
+		var strMean = $("#term_new_mean").val();
+		var strMean2 = $("#term_new_mean2").val();
+		var strTag = $("#term_new_tag").val();
+		var strChannal = $("#term_new_channal").val();
+		var strLanguage = $("#term_new_language").val();
+		var strNote = $("#term_new_note").val();
+		let newTerm = new Object();
+		newTerm.guid = com_guid();
+		newTerm.word = strWord;
+		newTerm.meaning = strMean;
+		newTerm.other_meaning = strMean2;
+		newTerm.tag = strTag;
+		newTerm.channal = strChannal;
+		newTerm.language = strLanguage;
+
+		arrMyTerm.push(newTerm);
+	} else {
+		var strWord = $("#term_edit_word_" + guid).val();
+		var strMean = $("#term_edit_mean_" + guid).val();
+		var strMean2 = $("#term_edit_mean2_" + guid).val();
+		var strTag = $("#term_edit_tag_" + guid).val();
+		var strChannal = $("#term_edit_channal_" + guid).val();
+		var strLanguage = $("#term_edit_language_" + guid).val();
+		var strNote = $("#term_edit_note_" + guid).val();
+	}
+	$.get(
+		"../term/term.php",
+		{
+			op: "save",
+			guid: guid,
+			word: strWord,
+			mean: strMean,
+			mean2: strMean2,
+			tag: strTag,
+			channal: strChannal,
+			language: strLanguage,
+			note: strNote,
+		},
+		function (data, status) {
+			try {
+				let result = JSON.parse(data);
+				if (result.status == 0) {
+					note_lookup(result.message, "term_dict");
+				} else {
+					ntf_show("term error" + result.message);
+				}
+			} catch (e) {
+				console.error("term_get_all_pali:" + e + " data:" + data);
+				ntf_show("term error");
+			}
+		}
+	);
 }
 function term_get_all_pali() {
-  $.get(
-    "../term/term.php",
-    {
-      op: "allpali",
-    },
-    function (data, status) {
-      if (data.length > 0) {
-        try {
-          arrTermAllPali = JSON.parse(data);
-        } catch (e) {
-          console.error("term_get_all_pali:" + e + " data:" + data);
-        }
-      }
-    }
-  );
+	$.get(
+		"../term/term.php",
+		{
+			op: "allpali",
+		},
+		function (data, status) {
+			if (data.length > 0) {
+				try {
+					arrTermAllPali = JSON.parse(data);
+				} catch (e) {
+					console.error("term_get_all_pali:" + e + " data:" + data);
+				}
+			}
+		}
+	);
 }
 function term_lookup_all(pali) {
-  for (var x in arrTermAllPali) {
-    if (arrTermAllPali[x].word == pali) {
-      return arrTermAllPali[x];
-    }
-  }
-  return null;
+	for (var x in arrTermAllPali) {
+		if (arrTermAllPali[x].word == pali) {
+			return arrTermAllPali[x];
+		}
+	}
+	return null;
 }
 
 function term_get_my() {
-  $.get(
-    "../term/term.php",
-    {
-      op: "my",
-    },
-    function (data, status) {
-      if (data.length > 0) {
-        try {
-          arrMyTerm = JSON.parse(data);
-        } catch (e) {
-          console.error(e.error + " data:" + data);
-        }
-      }
-    }
-  );
+	$.get(
+		"../term/term.php",
+		{
+			op: "my",
+		},
+		function (data, status) {
+			if (data.length > 0) {
+				try {
+					arrMyTerm = JSON.parse(data);
+				} catch (e) {
+					console.error(e.error + " data:" + data);
+				}
+			}
+		}
+	);
 }
 
 //在我的术语字典里查询
 function term_lookup_my(pali, channal = "", owner = "", lang = "") {
-  for (const iterator of arrMyTerm) {
-    if (channal != "") {
-      if (channal == iterator.channal && iterator.word == pali) {
-        return iterator;
-      }
-    }
-  }
-  //我自己的相同语言
-  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 &&
-        iterator.language.indexOf(lang) >= 0
-      ) {
-        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;
-}
-
-//在我的术语字典里查询
+	let langFamily = lang.split("-")[0];
+	//相同的channel
+	for (const iterator of arrMyTerm) {
+		if (channal != "") {
+			if (channal == iterator.channal && iterator.word == pali) {
+				return iterator;
+			}
+		}
+	}
+	//我自己的相同语言
+	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 (pali == iterator.word && owner == iterator.owner) {
+				let thisLangFamily = iterator.language.split("-")[0];
+				if (thisLangFamily == langFamily) {
+					return iterator;
+				}
+			}
+		}
+
+		//别人的相同语言
+		for (const iterator of arrMyTerm) {
+			if (iterator.word == pali && iterator.language == lang) {
+				return iterator;
+			}
+		}
+
+		//找别人的相似语言
+		for (const iterator of arrMyTerm) {
+			if (pali == iterator.word) {
+				let thisLangFamily = iterator.language.split("-")[0];
+				if (thisLangFamily == langFamily) {
+					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;
+	let langFamily = lang.split("-")[0];
+	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 == iterator.word && owner == iterator.owner && iterator.language == lang) {
+				return iterator;
+			}
+		}
+		//自己相似的语言
+		for (const iterator of arrMyTerm) {
+			if (pali == iterator.word && owner == iterator.owner) {
+				let thisLangFamily = iterator.language.split("-")[0];
+				if (thisLangFamily == langFamily) {
+					return iterator;
+				}
+			}
+		}
+
+		//别人的相同语言
+		for (const iterator of arrMyTerm) {
+			if (pali == iterator.word && iterator.language == lang) {
+				return iterator;
+			}
+		}
+		//找别人的相似语言
+		for (const iterator of arrMyTerm) {
+			if (pali == iterator.word) {
+				let thisLangFamily = iterator.language.split("-")[0];
+				if (thisLangFamily == langFamily) {
+					return iterator;
+				}
+			}
+		}
+	}
+	return false;
 }
 
 function term_lookup_my_id(id) {
-  for (var x in arrMyTerm) {
-    if (arrMyTerm[x].guid == id) {
-      return arrMyTerm[x];
-    }
-  }
-  return null;
+	for (const iterator of arrMyTerm) {
+		if (iterator.guid == id) {
+			return iterator;
+		}
+	}
+	return null;
 }
 
 function term_get_all_meaning(word) {
-  $.get(
-    "../term/term.php",
-    {
-      op: "allmean",
-      word: word,
-    },
-    function (data, status) {
-      $("#term_win_other_mean").html(data);
-    }
-  );
+	$.get(
+		"../term/term.php",
+		{
+			op: "allmean",
+			word: word,
+		},
+		function (data, status) {
+			$("#term_win_other_mean").html(data);
+		}
+	);
 }
 
 //刷新文档正在使用的术语数据
 function term_array_updata() {
-  arrTerm2 = new Array();
-  var arrTermDownLoadList = new Array();
-  var arrWordIdTermId = new Array();
-  var xAllWord = gXmlBookDataBody.getElementsByTagName("word");
-  for (var x = 0; x < xAllWord.length; x++) {
-    var sNote = getNodeText(xAllWord[x], "note");
-    var wid = getNodeText(xAllWord[x], "id");
-    if (sNote.substring(0, 6) == "=term(") {
-      var termId = sNote.slice(6, -1);
-      if (!arrTerm[termId]) {
-        arrTermDownLoadList.push(termId);
-      }
-      //person={wid:wid,tid:termId};
-      arrWordIdTermId.push({ wid: wid, tid: termId });
-    }
-  }
-  if (arrTermDownLoadList.length > 0) {
-    var idlist = arrTermDownLoadList.join();
-    idlist = idlist.replace(/,/g, "','");
-    idlist = "'" + idlist + "'";
-    $.get(
-      "../term/term.php",
-      {
-        op: "extract",
-        list: idlist,
-      },
-      function (data, status) {
-        var obj = JSON.parse(data);
-        for (var x in obj) {
-          arrTerm[obj[x].guid] = obj[x];
-          arrTerm2.push(obj[x]);
-        }
-        if (g_eCurrWord) {
-          updataWordHeadById(getNodeText(g_eCurrWord, "id"));
-          refreshWordNote(g_eCurrWord.parentNode.parentNode);
-        }
-        for (var i = 0; i < arrWordIdTermId.length; i++) {
-          var wid = arrWordIdTermId[i].wid;
-          var sMean = arrTerm[arrWordIdTermId[i].tid].meaning;
-          doc_setWordDataById(wid, "mean", sMean);
-          updateWordBodyById(wid);
-        }
-      }
-    );
-  }
+	arrTerm2 = new Array();
+	var arrTermDownLoadList = new Array();
+	var arrWordIdTermId = new Array();
+	var xAllWord = gXmlBookDataBody.getElementsByTagName("word");
+	for (var x = 0; x < xAllWord.length; x++) {
+		var sNote = getNodeText(xAllWord[x], "note");
+		var wid = getNodeText(xAllWord[x], "id");
+		if (sNote.substring(0, 6) == "=term(") {
+			var termId = sNote.slice(6, -1);
+			if (!arrTerm[termId]) {
+				arrTermDownLoadList.push(termId);
+			}
+			//person={wid:wid,tid:termId};
+			arrWordIdTermId.push({ wid: wid, tid: termId });
+		}
+	}
+	if (arrTermDownLoadList.length > 0) {
+		var idlist = arrTermDownLoadList.join();
+		idlist = idlist.replace(/,/g, "','");
+		idlist = "'" + idlist + "'";
+		$.get(
+			"../term/term.php",
+			{
+				op: "extract",
+				list: idlist,
+			},
+			function (data, status) {
+				var obj = JSON.parse(data);
+				for (var x in obj) {
+					arrTerm[obj[x].guid] = obj[x];
+					arrTerm2.push(obj[x]);
+				}
+				if (g_eCurrWord) {
+					updataWordHeadById(getNodeText(g_eCurrWord, "id"));
+					refreshWordNote(g_eCurrWord.parentNode.parentNode);
+				}
+				for (var i = 0; i < arrWordIdTermId.length; i++) {
+					var wid = arrWordIdTermId[i].wid;
+					var sMean = arrTerm[arrWordIdTermId[i].tid].meaning;
+					doc_setWordDataById(wid, "mean", sMean);
+					updateWordBodyById(wid);
+				}
+			}
+		);
+	}
 }
 
 function term_updata_translation() {
-  termCounter = new Array();
-  noteCounter = 1;
-  $("term").each(function () {
-    let status = $(this).attr("status");
-    let termText = $(this).text();
-
-    if (termText.slice(0, 1) == "#") {
-      if (status == 0) {
-        $(this).attr("status", "1");
-        $(this).attr("type", "1");
-        $(this).attr("text", termText.slice(1));
-      }
-      let noteText = $(this).attr("text");
-      $(this).html(
-        "<a onclick=\"alert('" + noteText + "')\">[" + noteCounter + "]</a>"
-      );
-      noteCounter++;
-    } else {
-      if (status == 0 || status == 2) {
-        let myterm = term_lookup_my(
-          termText,
-          $(this).attr("channal"),
-          $(this).attr("editor"),
-          $(this).attr("lang")
-        ); //我的术语字典
-        if (myterm) {
-          $(this).attr("status", "1");
-          $(this).attr("type", "0");
-          $(this).attr("guid", myterm.guid);
-          $(this).attr("pali", myterm.word);
-          $(this).attr("mean", myterm.meaning);
-          $(this).attr("mean2", myterm.other_meaning);
-          $(this).attr("replace", myterm.meaning);
-        } else {
-          $(this).attr("status", "2");
-          $(this).attr("pali", termText);
-        }
-      }
-      let guid = $(this).attr("guid");
-      let pali = $(this).attr("pali");
-      let mean = $(this).attr("mean");
-      let mean2 = $(this).attr("mean2");
-      let renderTo = $(this).attr("pos");
-      let noteText = "";
-
-      if (termCounter[guid]) {
-        termCounter[guid] = 2;
-      } else {
-        termCounter[guid] = 1;
-      }
-      myterm = term_lookup_my(
-        pali,
-        $(this).attr("channal"),
-        $(this).attr("editor"),
-        $(this).attr("lang")
-      ); //我的术语字典
-      let linkclass = "";
-      if (myterm) {
-        linkclass = "term_link";
-      } else {
-        linkclass = "term_link_new";
-      }
-      if (guid) {
-        if (renderTo == "wbw") {
-          noteText = "%note%";
-        } else {
-          if (termCounter[guid] == 1) {
-            noteText = strTermTanslationTmp;
-          } else {
-            noteText = strTermTanslationTmp2;
-          }
-        }
-
-        noteText = noteText.replace(
-          "[",
-          "<span class='" +
-            linkclass +
-            "' id='term_link_" +
-            guid +
-            "' gid='" +
-            guid +
-            "' onclick=\"" +
-            str_term_fun_word_link +
-            "('" +
-            guid +
-            "','" +
-            pali +
-            "')\">"
-        );
-        noteText = noteText.replace("]", "</span>");
-        noteText = noteText.replace(
-          "%mean%",
-          "<span class='term_mean'>" + mean + "</span>"
-        );
-        noteText = noteText.replace(
-          "%pali%",
-          "<span class='term_pali'>" + pali + "</span>"
-        );
-        noteText = noteText.replace(
-          "%mean2%",
-          "<span class='term_mean2'>" + mean2 + "</span>"
-        );
-        noteText = noteText.replace(
-          "%note%",
-          "<span class='term_note'>" + "" + "</span>"
-        );
-        if (myterm) {
-          if (myterm.meaning != mean) {
-            noteText = noteText.replace(
-              "%mymean%",
-              "<span class='term_mean_my'>" + myterm.meaning + "</span>"
-            );
-          } else {
-            noteText = noteText.replace("%mymean%", "");
-          }
-        } else {
-          noteText = noteText.replace("%mymean%", "");
-        }
-      } else {
-        noteText =
-          "<span class='" +
-          linkclass +
-          "'  onclick=\"" +
-          str_term_fun_word_link +
-          "('','" +
-          termText +
-          "')\">" +
-          termText +
-          "</span>";
-      }
-      $(this).html(noteText);
-    }
-  });
-  term_popup_init();
+	termCounter = new Array();
+	noteCounter = 1;
+	$("term").each(function () {
+		let status = $(this).attr("status");
+		let termText = $(this).text();
+
+		if (termText.slice(0, 1) == "#") {
+			if (status == 0) {
+				$(this).attr("status", "1");
+				$(this).attr("type", "1");
+				$(this).attr("text", termText.slice(1));
+			}
+			let noteText = $(this).attr("text");
+			$(this).html("<a onclick=\"alert('" + noteText + "')\">[" + noteCounter + "]</a>");
+			noteCounter++;
+		} else {
+			if (status == 0 || status == 2) {
+				let myterm = term_lookup_my(
+					termText,
+					$(this).attr("channal"),
+					$(this).attr("editor"),
+					$(this).attr("lang")
+				); //我的术语字典
+				if (myterm) {
+					$(this).attr("status", "1");
+					$(this).attr("type", "0");
+					$(this).attr("guid", myterm.guid);
+					$(this).attr("pali", myterm.word);
+					$(this).attr("mean", myterm.meaning);
+					$(this).attr("mean2", myterm.other_meaning);
+					$(this).attr("replace", myterm.meaning);
+				} else {
+					$(this).attr("status", "2");
+					$(this).attr("pali", termText);
+				}
+			}
+			let guid = $(this).attr("guid");
+			let pali = $(this).attr("pali");
+			let mean = $(this).attr("mean");
+			let mean2 = $(this).attr("mean2");
+			let renderTo = $(this).attr("pos");
+			let noteText = "";
+
+			if (termCounter[guid]) {
+				termCounter[guid] = 2;
+			} else {
+				termCounter[guid] = 1;
+			}
+			myterm = term_lookup_my(pali, $(this).attr("channal"), $(this).attr("editor"), $(this).attr("lang")); //我的术语字典
+			let linkclass = "";
+			if (myterm) {
+				linkclass = "term_link";
+			} else {
+				linkclass = "term_link_new";
+			}
+			if (guid) {
+				if (renderTo == "wbw") {
+					noteText = "%note%";
+				} else {
+					if (termCounter[guid] == 1) {
+						noteText = strTermTanslationTmp;
+					} else {
+						noteText = strTermTanslationTmp2;
+					}
+				}
+
+				noteText = noteText.replace(
+					"[",
+					"<span class='" +
+						linkclass +
+						"' id='term_link_" +
+						guid +
+						"' gid='" +
+						guid +
+						"' onclick=\"" +
+						str_term_fun_word_link +
+						"('" +
+						guid +
+						"','" +
+						pali +
+						"')\">"
+				);
+				noteText = noteText.replace("]", "</span>");
+				noteText = noteText.replace("%mean%", "<span class='term_mean'>" + mean + "</span>");
+				noteText = noteText.replace("%pali%", "<span class='term_pali'>" + pali + "</span>");
+				noteText = noteText.replace("%mean2%", "<span class='term_mean2'>" + mean2 + "</span>");
+				noteText = noteText.replace("%note%", "<span class='term_note'>" + "" + "</span>");
+				if (myterm) {
+					if (myterm.meaning != mean) {
+						noteText = noteText.replace(
+							"%mymean%",
+							"<span class='term_mean_my'>" + myterm.meaning + "</span>"
+						);
+					} else {
+						noteText = noteText.replace("%mymean%", "");
+					}
+				} else {
+					noteText = noteText.replace("%mymean%", "");
+				}
+			} else {
+				noteText =
+					"<span class='" +
+					linkclass +
+					"'  onclick=\"" +
+					str_term_fun_word_link +
+					"('','" +
+					termText +
+					"')\">" +
+					termText +
+					"</span>";
+			}
+			$(this).html(noteText);
+		}
+	});
+	term_popup_init();
 }
 
 function term_show_win(guid, keyWord = "") {
-  if (guid == "") {
-    $(term_body).html(
-      "当前词条未创建。<br /><a onclick=\"term_add_new('" +
-        keyWord +
-        "')\">现在创建</a>"
-    );
-  } else {
-    let currWord = term_lookup_my_id(guid);
-    if (currWord) {
-      let termString = "";
-      let pali = currWord.word;
-      let pali_1 = pali.substring(0, 1).toUpperCase();
-      pali = pali_1 + pali.substring(1);
-      let mean = currWord.meaning;
-      let myterm = term_lookup_my(currWord.word); //我的术语字典
-      termString += "<div class='term_win_mean'>" + pali + "</div>";
-      termString +=
-        "<div class='term_win_pali'>意思:" + currWord.meaning + "</div>";
-      termString +=
-        "<div class='term_win_mean2'>其他意思:" +
-        currWord.other_meaning +
-        "</div>";
-      termString += "<div class='term_win_mymean'>我的词库:";
-      if (myterm) {
-        termString += "<b>" + myterm.meaning + "</b> ";
-      } else {
-        termString += "<input type='input'  placeholder='我的释义'>";
-      }
-      termString += "<span>其他:</span><span id='term_win_other_mean'></span>";
-      termString += "</div>";
-
-      if (currWord.note) {
-        termString += "<div class='term_win_note'>" + currWord.note + "</div>";
-      } else {
-        termString += "<div class='term_win_note'>Loading</div>";
-      }
-      $(term_body).html(termString);
-      term_get_all_meaning(currWord.word);
-
-      if (!currWord.note) {
-        $.get(
-          "../term/term.php",
-          {
-            op: "load_id",
-            id: currWord.guid,
-          },
-          function (data, status, xhr) {
-            switch (status) {
-              case "success":
-                try {
-                  let loadWord = JSON.parse(data);
-                  $("#term_win_note").html(loadWord[0].note);
-                  //修改内存数据
-                  for (let x in arrMyTerm) {
-                    if (arrMyTerm[x].guid == loadWord[0].guid) {
-                      arrMyTerm[x].note = loadWord[0].note;
-                      return;
-                    }
-                  }
-                } catch (e) {
-                  console.error(e + " data:" + data);
-                }
-                break;
-              case "error":
-                console.error("Error: " + xhr.status + ": " + xhr.statusText);
-                break;
-            }
-          }
-        );
-      }
-    } else {
-      $(term_body).html("undefined guid");
-    }
-  }
-  document.getElementById("term_win").style.display = "flex";
+	if (guid == "") {
+		$(term_body).html("当前词条未创建。<br /><a onclick=\"term_add_new('" + keyWord + "')\">现在创建</a>");
+	} else {
+		let currWord = term_lookup_my_id(guid);
+		if (currWord) {
+			let termString = "";
+			let pali = currWord.word;
+			let pali_1 = pali.substring(0, 1).toUpperCase();
+			pali = pali_1 + pali.substring(1);
+			let mean = currWord.meaning;
+			let myterm = term_lookup_my(currWord.word); //我的术语字典
+			termString += "<div class='term_win_mean'>" + pali + "</div>";
+			termString += "<div class='term_win_pali'>意思:" + currWord.meaning + "</div>";
+			termString += "<div class='term_win_mean2'>其他意思:" + currWord.other_meaning + "</div>";
+			termString += "<div class='term_win_mymean'>我的词库:";
+			if (myterm) {
+				termString += "<b>" + myterm.meaning + "</b> ";
+			} else {
+				termString += "<input type='input'  placeholder='我的释义'>";
+			}
+			termString += "<span>其他:</span><span id='term_win_other_mean'></span>";
+			termString += "</div>";
+
+			if (currWord.note) {
+				termString += "<div class='term_win_note'>" + currWord.note + "</div>";
+			} else {
+				termString += "<div class='term_win_note'>Loading</div>";
+			}
+			$(term_body).html(termString);
+			term_get_all_meaning(currWord.word);
+
+			if (!currWord.note) {
+				$.get(
+					"../term/term.php",
+					{
+						op: "load_id",
+						id: currWord.guid,
+					},
+					function (data, status, xhr) {
+						switch (status) {
+							case "success":
+								try {
+									let loadWord = JSON.parse(data);
+									$("#term_win_note").html(loadWord[0].note);
+									//修改内存数据
+									for (let index = 0; index < arrMyTerm.length; index++) {
+										if (arrMyTerm[index].guid == loadWord[0].guid) {
+											arrMyTerm[index].note = loadWord[0].note;
+											return;
+										}
+									}
+								} catch (e) {
+									console.error(e + " data:" + data);
+								}
+								break;
+							case "error":
+								console.error("Error: " + xhr.status + ": " + xhr.statusText);
+								break;
+						}
+					}
+				);
+			}
+		} else {
+			$(term_body).html("undefined guid");
+		}
+	}
+	document.getElementById("term_win").style.display = "flex";
 }
 
 function term_tmp(type, tmp) {
-  if (tmp == "new") {
-    switch (type) {
-      case "a":
-        strTermTanslationTmp = $("#term_my_tmp").val();
-        break;
-      case "a2":
-        strTermTanslationTmp2 = $("#term_my_tmp").val();
-        break;
-    }
-  } else {
-    switch (type) {
-      case "a":
-        strTermTanslationTmp = tmp;
-        break;
-      case "a2":
-        strTermTanslationTmp2 = tmp;
-        break;
-    }
-  }
-  term_updata_translation();
+	if (tmp == "new") {
+		switch (type) {
+			case "a":
+				strTermTanslationTmp = $("#term_my_tmp").val();
+				break;
+			case "a2":
+				strTermTanslationTmp2 = $("#term_my_tmp").val();
+				break;
+		}
+	} else {
+		switch (type) {
+			case "a":
+				strTermTanslationTmp = tmp;
+				break;
+			case "a2":
+				strTermTanslationTmp2 = tmp;
+				break;
+		}
+	}
+	term_updata_translation();
 }
 
 function term_add_new(keyword) {
-  document.getElementById("term_win").style.display = "none";
+	document.getElementById("term_win").style.display = "none";
 
-  tab_click_b(
-    "sys_term",
-    "tab_rb_sys_term",
-    right_panal_slide_toggle,
-    "tab_rb_sys_term"
-  );
-  editor_show_right_tool_bar(true);
-  note_lookup(keyword, "term_dict");
+	tab_click_b("sys_term", "tab_rb_sys_term", right_panal_slide_toggle, "tab_rb_sys_term");
+	editor_show_right_tool_bar(true);
+	note_lookup(keyword, "term_dict");
 }
 
 function term_show_new() {
-  $("#term_new_recorder").slideToggle();
-  $("#new_term_button").hide();
-  guide_init();
+	$("#term_new_recorder").slideToggle();
+	$("#new_term_button").hide();
+	guide_init();
 }
 
 function term_get_dict() {
-  let termwordlist = new Array();
-  /*
-  let objTerm = document.querySelectorAll("term");
-  for (const iterator of objTerm) {
-    if (iterator.getAttributeNode("status").value == 0) {
-      termwordlist.push(iterator.innerHTML);
-    } else {
-      termwordlist.push(iterator.getAttributeNode("pali").value);
-    }
-  }
-*/
-  $("term").each(function () {
-    if ($(this).attr("status") == 0) {
-      $(this).attr("pali", $(this).text());
-    }
-    let termword = new Object();
-    termword.pali = $(this).attr("pali");
-    termword.channal = $(this).attr("channal");
-    termword.editor = $(this).attr("editor");
-    termword.lang = $(this).attr("lang");
-    termwordlist.push(termword);
-  });
-
-  let readonly = true;
-  if (_display == "sent") {
-    readonly = false;
-  }
-  $.post(
-    "../term/term_get.php",
-    {
-      words: JSON.stringify(termwordlist),
-      channal: _channal,
-      readonly: readonly,
-    },
-    function (data, status) {
-      if (data.length > 0) {
-        try {
-          arrMyTerm = JSON.parse(data);
-          term_updata_translation();
-        } catch (e) {
-          console.error(e.error + " data:" + data);
-        }
-      }
-    }
-  );
+	if (arrMyTerm.length > 0) {
+		return;
+	}
+	let termwordlist = new Array();
+	$("term").each(function () {
+		if ($(this).attr("status") == 0) {
+			$(this).attr("pali", $(this).text());
+		}
+		let termword = new Object();
+		termword.pali = $(this).attr("pali");
+		termword.channal = $(this).attr("channal");
+		termword.editor = $(this).attr("editor");
+		termword.lang = $(this).attr("lang");
+		termwordlist.push(termword);
+	});
+
+	let readonly = true;
+	if (_display == "sent") {
+		readonly = false;
+	}
+	$.post(
+		"../term/term_get.php",
+		{
+			words: JSON.stringify(termwordlist),
+			channal: _channal,
+			readonly: readonly,
+		},
+		function (data, status) {
+			if (data.length > 0) {
+				try {
+					arrMyTerm = JSON.parse(data);
+					term_updata_translation();
+				} catch (e) {
+					console.error(e.error + " data:" + data);
+				}
+			}
+		}
+	);
 }
 
 /*

Some files were not shown because too many files changed in this diff