Parcourir la source

百科词条加载后自动查字典

visuddhinanda il y a 5 ans
Parent
commit
306cc07da6
6 fichiers modifiés avec 878 ajouts et 781 suppressions
  1. 5 5
      app/public/function.php
  2. 92 72
      app/term/note.js
  3. 67 58
      app/term/note.php
  4. 642 555
      app/term/term.js
  5. 61 90
      app/wiki/wiki.js
  6. 11 1
      app/wiki/wiki.php

+ 5 - 5
app/public/function.php

@@ -79,20 +79,20 @@ function _get_para_path($book,$paragraph){
 		$query = "select * from pali_text where \"book\" = ? and \"paragraph\" = ? limit 0,1";
     $stmt = $dbh->prepare($query);
     $stmt->execute(array($book,$parent));
-    $FetParent = $stmt->fetchAll(PDO::FETCH_ASSOC);
+    $FetParent = $stmt->fetch(PDO::FETCH_ASSOC);
     
-		$toc="<chapter book=\"{$book}\" para=\"{$parent}\">{$FetParent[0]["toc"]}</chapter>";
+		$toc="<chapter book='{$book}' para='{$parent}'>{$FetParent["toc"]}</chapter>";
 		
 		if($path==""){
-			$path="({$paragraph})";
+			$path="<para book='{$book}' para='{$parent}'>{$paragraph}</para>";
 		}
 		else{
 			$path="{$toc}>{$path}";
 		}
 		if($sFirstParentTitle==""){
-			$sFirstParentTitle = $FetParent[0]["toc"];
+			$sFirstParentTitle = $FetParent["toc"];
 		}						
-		$parent = $FetParent[0]["parent"];
+		$parent = $FetParent["parent"];
 		$deep++;
 		if($deep>5){
 			break;

+ 92 - 72
app/term/note.js

@@ -21,75 +21,94 @@
 <note id="guid" book=203 para=1654 begin=23 end=45 author=11 lang=en tag=*></note>
 
 */
-function note_init(input){
-	let output="<div>";
-	let arrInput = input.split("\n");
-	for(x in arrInput){
-		if(arrInput[x].slice(0,2)=="==" && arrInput[x].slice(-2)=="=="){
-			output += "</div></div>";
-			output += "<div class=\"submenu1\">";
-			output += "<p class=\"submenu_title1\" onclick=\"submenu_show_detail(this)\">";
-			output += arrInput[x].slice(2,-2);
-			output += "<svg class=\"icon\" style=\"transform: rotate(45deg);\">";
-			output += "<use xlink:href=\"svg/icon.svg#ic_add\"></use>";
-			output += "</svg>";
-			output += "</p>";
-			output += "<div class=\"submenu_details1\" >";
-			
-		}
-		else{
-			let row=arrInput[x];
-			row = row.replace(/\{\{/g,"<note info=\"");
-			row = row.replace(/\}\}/g,"\"></note>");
-			if(row.match("{") && row.match("}")){
-				row=row.replace("{","<strong>");
-				row=row.replace("}","</strong>");
-			}
-			output+=row;
-		}
-	}
-	output += "</div>";
-	return(output);
+function note_init(input) {
+  let output = "<div>";
+  let arrInput = input.split("\n");
+  for (x in arrInput) {
+    if (arrInput[x].slice(0, 2) == "==" && arrInput[x].slice(-2) == "==") {
+      output += "</div></div>";
+      output += '<div class="submenu1">';
+      output +=
+        '<p class="submenu_title1" onclick="submenu_show_detail(this)">';
+      output += arrInput[x].slice(2, -2);
+      output += '<svg class="icon" style="transform: rotate(45deg);">';
+      output += '<use xlink:href="svg/icon.svg#ic_add"></use>';
+      output += "</svg>";
+      output += "</p>";
+      output += '<div class="submenu_details1" >';
+    } else {
+      let row = arrInput[x];
+      row = row.replace(/\{\{/g, '<note info="');
+      row = row.replace(/\}\}/g, '"></note>');
+      if (row.match("{") && row.match("}")) {
+        row = row.replace("{", "<strong>");
+        row = row.replace("}", "</strong>");
+      }
+      output += row;
+    }
+  }
+  output += "</div>";
+  return output;
 }
 
 //
-function note_refresh_new(){
-	$("note").each(function(index,element){
-		let html=$(this).html();
-		let id=$(this).attr("id");
-		if(id==null || id==""){
-
-			id=com_guid();
-			$(this).attr("id",id);
-
-			let info=$(this).attr("info");
-			if(info && info!=""){
-				$.get("../term/note.php",
-					{
-						id:id,
-						info:info,
-					},
-					function(data,status){
-						try{
-							let arrData=JSON.parse(data);
-							let id=arrData.id;
-							let strHtml = note_json_html(arrData);
-							$("#"+id).html(strHtml);
-							term_updata_translation();
-						}
-						catch(e){
-							console.error(e);
-						}
-					}
-				);				
-			}
+function note_refresh_new() {
+  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;
+      if (info && info != "") {
+        arrSentInfo.push({ id: id, data: info });
+      }
+    }
+    {
+      $.post(
+        "../term/note.php",
+        {
+          data: JSON.stringify(arrSentInfo),
+        },
+        function (data, status) {
+          if (status == "success") {
+            try {
+              let arrData = JSON.parse(data);
+              for (const iterator of arrData) {
+                let id = iterator.id;
+                let strHtml = note_json_html(iterator);
+                $("#" + id).html(strHtml);
+              }
+              note_ref_init();
+              term_get_dict();
+            } catch (e) {
+              console.error(e);
+            }
+          }
+        }
+      );
+    }
+  }
+}
+function note_ref_init() {
+  $("chapter").click(function () {
+    let bookid = $(this).attr("book");
+    let para = $(this).attr("para");
+    window.open(
+      "../pcdl/reader.php?view=chapter&book=" + bookid + "&para=" + para,
+      "_blank"
+    );
+  });
 
-		}
-		
-	});		
-	
-	
-	
+  $("para").click(function () {
+    let bookid = $(this).attr("book");
+    let para = $(this).attr("para");
+    window.open(
+      "../pcdl/reader.php?view=para&book=" + bookid + "&para=" + para,
+      "_blank"
+    );
+  });
 }
 /*
 id
@@ -97,10 +116,11 @@ palitext
 tran
 ref
 */
-function note_json_html(in_json){
-	let output="";
-	output += "<div class='palitext'>"+in_json.palitext+"</div>";
-	output += "<div class='tran'>"+term_std_str_to_tran(in_json.tran)+"</div>";
-	output += "<div class='ref'>"+in_json.ref+"</div>";
-	return(output);
-}
+function note_json_html(in_json) {
+  let output = "";
+  output += "<div class='palitext'>" + in_json.palitext + "</div>";
+  output +=
+    "<div class='tran'>" + term_std_str_to_tran(in_json.tran) + "</div>";
+  output += "<div class='ref'>" + in_json.ref + "</div>";
+  return output;
+}

+ 67 - 58
app/term/note.php

@@ -3,71 +3,80 @@ require_once "../public/_pdo.php";
 require_once "../public/function.php";
 require_once "../path.php";
 
-
-if(isset($_GET["id"])){
-	$id=$_GET["id"];
+$_data = array();
+if(isset($_POST["data"])){
+	$_data = json_decode($_POST["data"],true);
 }
 else{
-	echo "error: no id";
-	return;
-}
-if(isset($_GET["info"])){
-	$info=$_GET["info"];
-}
-else{
-	echo "error: no info";
-	return;
+	if(isset($_GET["id"])){
+		$id=$_GET["id"];
+	}
+	else{
+		echo "error: no id";
+		return;
+	}
+	if(isset($_GET["info"])){
+		$info=$_GET["info"];
+	}
+	else{
+		echo "error: no info";
+		return;
+	}
+	$_data[] = array("id"=>$id,"data"=>$info);
 }
-$arrInfo = str_getcsv($info,"@");
-$arrSent = str_getcsv($arrInfo[0],"-");
-$bookId=$arrSent[0];
-$para=$arrSent[1];
-$begin=$arrSent[2];
-$end=$arrSent[3];
-$db_file = _DIR_PALICANON_TEMPLET_."/p".$bookId."_tpl.db3";	
+$dns = "sqlite:"._FILE_DB_PALI_SENTENCE_;
+$db_pali_sent = new PDO($dns, "", "",array(PDO::ATTR_PERSISTENT=>true));
+$db_pali_sent->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);  
+
+$dns = "sqlite:"._FILE_DB_SENTENCE_;
+$db_trans_sent = new PDO($dns, "", "",array(PDO::ATTR_PERSISTENT=>true));
+$db_trans_sent->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);  
 
-PDO_Connect("sqlite:$db_file");
-$query="SELECT * FROM 'main' WHERE (\"paragraph\" = ".$PDO->quote($para)." ) ";
-$sth = $PDO->prepare($query);
-$sth->execute();
-$palitext="";
-while($result = $sth->fetch(PDO::FETCH_ASSOC))
-{
-	$index =$result["wid"];
-	if($index>=$begin && $index<=$end){
-		if($result["type"]!=".ctl."){
-			$paliword=$result["word"];
-			if($result["style"]=="bld"){
-				if(strchr($result["word"],"{")!=FALSE && strchr($result["word"],"}")!=FALSE ){
-					$paliword = str_replace("{","<strong>",$paliword);
-					$paliword = str_replace("}","</strong>",$paliword);
-				}
-				else{
-					$paliword = "<strong>{$paliword}</strong>";
-				}
-			}
-			$palitext .= $paliword." ";
+$output = array();
+
+foreach ($_data as $key => $value) {
+	# code...
+	$id = $value["id"];
+	$arrInfo = str_getcsv($value["data"],"@");
+	$arrSent = str_getcsv($arrInfo[0],"-");
+	$bookId=$arrSent[0];
+	$para=$arrSent[1];
+	$begin=$arrSent[2];
+	$end=$arrSent[3];
+
+	$query="SELECT html FROM 'pali_sent' WHERE book = ? AND paragraph = ? AND begin = ? AND end = ? ";
+	$sth = $db_pali_sent->prepare($query);
+	$sth->execute(array($bookId,$para,$begin,$end));
+	$row = $sth->fetch(PDO::FETCH_NUM);
+	if ($row) {
+		$palitext= $row[0];
+	} else {
+		$palitext="";
+	}
+
+	//find out translation
+	$tran="";
+	try{
+		$query="SELECT * FROM sentence WHERE book= ? AND paragraph= ? AND begin= ? AND end= ?  AND strlen >0 order by modify_time DESC limit 0 ,1 ";
+		$stmt = $db_trans_sent->prepare($query);
+		$stmt->execute(array($bookId,$para,$begin,$end));
+		$Fetch = $stmt->fetch(PDO::FETCH_ASSOC);
+		if($Fetch){
+			$tran = $Fetch["text"];
 		}
+		$tran_count = 1;
 	}
-}
-$para_path=_get_para_path($bookId,$para);
-//find out translation
-$tran="";
-$db_file=_FILE_DB_SENTENCE_;
-try{
-	PDO_Connect("sqlite:$db_file");
-	$query="SELECT * FROM sentence WHERE book='{$bookId}' AND paragraph='{$para}' AND begin='{$begin}' AND end='{$end}'  AND text <> '' order by modify_time DESC limit 0 ,1 ";
-	$Fetch = PDO_FetchAll($query);
-	$iFetch=count($Fetch);
-	if($iFetch>0){
-		$tran = $Fetch[0]["text"];
+	catch (Exception $e) {
+		$tran = $e->getMessage();
+		//echo 'Caught exception: ',  $e->getMessage(), "\n";
 	}
+	
+	$para_path=_get_para_path($bookId,$para);
+
+	$output[]=array("id"=>$id,"palitext"=>$palitext,"tran"=>$tran,"ref"=>$para_path,"tran_count"=>$tran_count);
+
 }
-catch (Exception $e) {
-	$tran = $e->getMessage();
-    //echo 'Caught exception: ',  $e->getMessage(), "\n";
-}
-		
 
-$output=array("id"=>$id,"palitext"=>$palitext,"tran"=>$tran,"ref"=>$para_path,"tran_count"=>$iFetch);
 echo json_encode($output, JSON_UNESCAPED_UNICODE);
+
+?>

+ 642 - 555
app/term/term.js

@@ -11,646 +11,733 @@ 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() {
-
-}
+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) {
-	return (strIn.replace(/\[\[/g, "<term status='0'>").replace(/\]\]/g, "</term>"));
+  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("/"));
+  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);
+  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 (var x in arrMyTerm) {
-		if (arrMyTerm[x].meaning == strMean) {
-			return (arrMyTerm[x].guid + "@" + strMean);
-		}
-	}
-	return ("unkow@" + 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/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);
+      }
+    }
+  );
 }
 
 function note_lookup_guid_json(guid, showto) {
-
-	$.get("../term/term.php",
-		{
-			op: "load_id",
-			id: guid,
-			format: "json"
-		},
-		function (data, status) {
-			let html = "";
-			if (status == "success") {
-				try {
-					let result = JSON.parse(data)[0];
-					html = "<div class='term_block'>";
-
-					html += "<h2>" + result.word + "</h2>";
-					html += "<div class='meaning'>" + result.meaning + "</div>";
-					html += "<div class='term_note' status='1'>" + note_init(result.note) + "</div>";
-					html += "</div>";
-					$("#" + showto).html(html);
-					note_refresh_new();
-				}
-				catch (e) {
-					console.error("note_lookup_guid_json:" + e + " data:" + data);
-				}
-
-			}
-		});
+  $.get(
+    "../term/term.php",
+    {
+      op: "load_id",
+      id: guid,
+      format: "json",
+    },
+    function (data, status) {
+      let html = "";
+      if (status == "success") {
+        try {
+          let result = JSON.parse(data)[0];
+          html = "<div class='term_block'>";
+
+          html += "<h2>" + result.word + "</h2>";
+          html += "<div class='meaning'>" + result.meaning + "</div>";
+          html +=
+            "<div class='term_note' status='1'>" +
+            note_init(result.note) +
+            "</div>";
+          html += "</div>";
+          $("#" + showto).html(html);
+          note_refresh_new();
+        } catch (e) {
+          console.error("note_lookup_guid_json:" + e + " data:" + data);
+        }
+      }
+    }
+  );
 }
 
 var term_get_word_to_div_callback = null;
 function term_get_word_to_div(strWord, div, callback) {
-	term_get_word_to_div_callback = callback;
-	$.get("../term/term.php",
-		{
-			op: "get",
-			word: strWord,
-			format: "json"
-		},
-		function (data, status) {
-			let html = "";
-			if (status == "success") {
-				try {
-					let result = JSON.parse(data);
-					let html = "";
-					if (result.length > 0) {
-
-						let type = new Array();
-						let authors = new Array();
-						for (x in result) {
-							if (result[x].tag == "") {
-								result[x].tag = "_null_";
-							}
-							if (type[result[x].tag] == null) {
-								type[result[x].tag] = new Array();
-							}
-							type[result[x].tag].push(result[x].meaning);
-							authors[result[x].owner] = 1;
-						}
-
-						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'>贡献者:";
-						for (y in authors) {
-							html += "<a onclick=\"\">" + y + "</a> "
-						}
-
-						html += "</div>";
-						html += "</div>";
-
-						for (x in 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 += result[x].owner.slice(0, 1);
-							html += "</div>";
-
-							html += "<div class='term_block_bar_left_info'>";
-							html += "<div class='term_meaning'>" + result[x].meaning;
-							if (result[x].tag != "_null_") {
-								html += "<span class='term_tag'>" + result[x].tag + "</span>";
-							}
-							html += "</div>";
-							html += "<div class='term_author'>" + result[x].owner + "</div>";
-							html += "</div>";
-
-							html += "</div>";
-							html += "<div class='term_block_bar_right'>";
-							html += "<span><a href='#'>[编辑]</a><a href='#'>[赞]</a><a href='#'>[收藏]</a></span>";
-							html += "</div>";
-							html += "</div>";
-							//html += "<div class='term_meaning2'>"+result[x].other_meaning+"</div>";
-							html += "<div class='term_note' status='1'>" + note_init(result[x].note) + "</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);
-				}
-
-			}
-		});
-}
-function term_get_guid_to_html(strGuid) {
-
+  term_get_word_to_div_callback = callback;
+  $.get(
+    "../term/term.php",
+    {
+      op: "get",
+      word: strWord,
+      format: "json",
+    },
+    function (data, status) {
+      let html = "";
+      if (status == "success") {
+        try {
+          let result = JSON.parse(data);
+          let html = "";
+          if (result.length > 0) {
+            let type = new Array();
+            let authors = new Array();
+            for (x in result) {
+              if (result[x].tag == "") {
+                result[x].tag = "_null_";
+              }
+              if (type[result[x].tag] == null) {
+                type[result[x].tag] = new Array();
+              }
+              type[result[x].tag].push(result[x].meaning);
+              authors[result[x].owner] = 1;
+            }
+
+            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'>贡献者:";
+            for (y in authors) {
+              html += '<a onclick="">' + y + "</a> ";
+            }
+
+            html += "</div>";
+            html += "</div>";
+
+            for (x in 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 += result[x].owner.slice(0, 1);
+              html += "</div>";
+
+              html += "<div class='term_block_bar_left_info'>";
+              html += "<div class='term_meaning'>" + result[x].meaning;
+              if (result[x].tag != "_null_") {
+                html += "<span class='term_tag'>" + result[x].tag + "</span>";
+              }
+              html += "</div>";
+              html += "<div class='term_author'>" + result[x].owner + "</div>";
+              html += "</div>";
+
+              html += "</div>";
+              html += "<div class='term_block_bar_right'>";
+              html +=
+                "<span><a href='#'>[编辑]</a><a href='#'>[赞]</a><a href='#'>[收藏]</a></span>";
+              html += "</div>";
+              html += "</div>";
+              //html += "<div class='term_meaning2'>"+result[x].other_meaning+"</div>";
+              html +=
+                "<div class='term_note' status='1'>" +
+                note_init(result[x].note) +
+                "</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.php?op=copy&wordid=" + 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";
+  $("#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 strNote = $("#term_new_note").val();
-		var strTag = $("#term_new_tag").val();
-		let newTerm = new Object();
-		newTerm.guid = com_guid();
-		newTerm.word = strWord;
-		newTerm.meaning = strMean;
-		newTerm.other_meaning = strMean2;
-		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 strNote = $("#term_edit_note_" + guid).val();
-	}
-	$.get("../term/term.php",
-		{
-			op: "save",
-			guid: guid,
-			word: strWord,
-			mean: strMean,
-			mean2: strMean2,
-			tag: strTag,
-			note: strNote,
-			username: getCookie("username")
-		},
-		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 strNote = $("#term_new_note").val();
+    var strTag = $("#term_new_tag").val();
+    let newTerm = new Object();
+    newTerm.guid = com_guid();
+    newTerm.word = strWord;
+    newTerm.meaning = strMean;
+    newTerm.other_meaning = strMean2;
+    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 strNote = $("#term_edit_note_" + guid).val();
+  }
+  $.get(
+    "../term/term.php",
+    {
+      op: "save",
+      guid: guid,
+      word: strWord,
+      mean: strMean,
+      mean2: strMean2,
+      tag: strTag,
+      note: strNote,
+      username: getCookie("username"),
+    },
+    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);
-				}
-			}
-		});
+  $.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);
+  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);
-				}
-			}
-		});
-
+  $.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);
+  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);
+  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);
-		});
+  $.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);
-				}
-
-			});
-
-	}
+  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 || status == 2) {
-				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");
-					$(this).attr("pali", termText);
-				}
-			}
-			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=\"" + 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);
-		}
-	});
+  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); //我的术语字典
+        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");
+      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=\"" +
+            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);
+    }
+  });
 }
 
 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";
-
+  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();
+  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";
-
-	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");
+  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");
 }
 
 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);
+    }
+  }
+
+  let wordquery = "('" + termwordlist.join("','") + "')";
+  $.post(
+    "../term/term.php",
+    {
+      op: "extract",
+      words: wordquery,
+    },
+    function (data, status) {
+      if (data.length > 0) {
+        try {
+          arrMyTerm = JSON.parse(data);
+          term_updata_translation();
+        } catch (e) {
+          console.error(e.error + " data:" + data);
+        }
+      }
+    }
+  );
+}

+ 61 - 90
app/wiki/wiki.js

@@ -14,107 +14,78 @@ function wiki_load(word){
   });
 }
 */
-function wiki_index_init(){
-}
+function wiki_index_init() {}
 
-function wiki_load_id(guid){
-	note_lookup_guid_json(guid,"wiki_contents");
+function wiki_load_id(guid) {
+  note_lookup_guid_json(guid, "wiki_contents");
 }
 
-function wiki_load_word(word){
-	term_get_word_to_div(word,"wiki_contents",wiki_word_loaded);
+function wiki_load_word(word) {
+  term_get_word_to_div(word, "wiki_contents", wiki_word_loaded);
 }
-function wiki_goto_word(guid,strWord){
-	window.open("wiki.php?word="+strWord,"_blank");
+function wiki_goto_word(guid, strWord) {
+  window.open("wiki.php?word=" + strWord, "_blank");
 }
-function wiki_word_loaded(wordlist){
-	$("#doc_title").text(wordlist[0].word+"["+wordlist[0].meaning+"]-圣典百科");
+function wiki_word_loaded(wordlist) {
+  $("#doc_title").text(
+    wordlist[0].word + "[" + wordlist[0].meaning + "]-圣典百科"
+  );
 }
 
-function run(){
-	$("chapter").click(function(){
-		let bookid = $(this).attr("book");
-		let paragraph = $(this).attr("para");
-		window.open("../pcdl/reader.php?book="+bookid+"&paragraph="+paragraph,"_blank");
-
-	});
-	
+function term_show_win(guid, word) {
+  window.location.assign("wiki.php?word=" + word);
 }
 
+function wiki_search_keyup(e, obj) {
+  var keynum;
+  var keychar;
+  var numcheck;
 
-function run2(){
-	var wordlist =  new Array();
-	$("term").each(function(index,element){
-		wordlist.push($(this).attr("pali"));
-	}
-	);
-	
-	var wordquery ="('" + wordlist.join("','")+"')";
- 	$.post("../term/term.php",
-	{
-		op:"extract",
-		words:wordquery
-	},
-	function(data,status){
-		if(data.length>0){
-			try{
-				arrMyTerm = JSON.parse(data);
-				term_updata_translation();
-			}
-			catch(e){
-				console.error(e.error+" data:"+data);
-			}
-		}
-	});	
-}
+  if ($("#wiki_search_input").val() == "") {
+    $("#search_result").html("");
+    return;
+  }
 
-function term_show_win(guid,word){
-	window.location.assign("wiki.php?word="+word);
+  if (window.event) {
+    // IE
+    keynum = e.keyCode;
+  } else if (e.which) {
+    // Netscape/Firefox/Opera
+    keynum = e.which;
+  }
+  var keychar = String.fromCharCode(keynum);
+  if (keynum == 13) {
+    //dict_search(obj.value);
+  } else {
+    wiki_pre_search(obj.value);
+  }
 }
 
-function wiki_search_keyup(e,obj){
-	var keynum
-	var keychar
-	var numcheck
-
-	if($("#wiki_search_input").val()==""){
-		$("#search_result").html("");
-		return;
-	}
-	
-	if(window.event) // IE
-	{
-	keynum = e.keyCode
-	}
-	else if(e.which) // Netscape/Firefox/Opera
-	{
-	keynum = e.which
-	}
-	var keychar = String.fromCharCode(keynum)
-	if(keynum==13){
-		//dict_search(obj.value);
-	}
-	else{
-		wiki_pre_search(obj.value);
-	}
+function wiki_pre_search(keyword) {
+  $.get(
+    "../term/term.php",
+    {
+      op: "pre",
+      word: keyword,
+      format: "json",
+    },
+    function (data, status) {
+      let result = JSON.parse(data);
+      let html = "<ul class='wiki_search_list'>";
+      if (result.length > 0) {
+        for (x in result) {
+          html +=
+            "<li><a href='wiki.php?op=get&word=" +
+            result[x].word +
+            "'>" +
+            result[x].word +
+            "[" +
+            result[x].meaning +
+            "]</a></li>";
+        }
+      }
+      html += "</ul>";
+      $("#search_result").html(html);
+    }
+  );
 }
-
-function wiki_pre_search(keyword){
-	$.get("../term/term.php",
-	{
-		op:"pre",
-		word:keyword,
-		format:"json"
-	},
-	function(data,status){
-		let result= JSON.parse(data);
-		let html="<ul class='wiki_search_list'>";
-		if(result.length>0){
-			for(x in result){
-				html += "<li><a href='wiki.php?op=get&word="+result[x].word+"'>"+result[x].word+"["+result[x].meaning+"]</a></li>";
-			}
-		}
-		html += "</ul>";
-		$("#search_result").html(html);
-	});
-}

+ 11 - 1
app/wiki/wiki.php

@@ -54,6 +54,17 @@ echo "wiki_load_word('{$_get_word}')";
 		color: blue;
 		text-decoration: underline;
 	}
+	para{
+		background-color: #959595;
+		padding: 2px 8px;
+		text-decoration: none;
+		cursor: pointer;
+		color: white;
+		border-radius: 5px;
+	}
+	para:hover{
+		text-decoration: underline;
+	}
 	.icon{
 		width: 15px;
 		height: 15px;
@@ -183,6 +194,5 @@ loading...
 </div>
 
 <button onclick="run()">run</button>
-<button onclick="run2()">run2</button>
 </body>
 </html>