Browse Source

初步完成阅读器改版。逐段,逐句显示

visuddhinanda 5 years ago
parent
commit
0222c757ab
5 changed files with 802 additions and 570 deletions
  1. 28 3
      app/pcdl/css/reader.css
  2. 24 0
      app/pcdl/css/reader_mob.css
  3. 276 93
      app/pcdl/reader.php
  4. 0 0
      app/pcdl/res.db3
  5. 474 474
      app/term/term.js

+ 28 - 3
app/pcdl/css/reader.css

@@ -50,6 +50,7 @@
 }
 
 #main_text_view{
+    padding-left: 21em;
     padding-top:2.5em;
     font-family: 'Noto Sans', 'Noto Sans SC', 'Noto Sans TC', Arial, Verdana;
 }
@@ -274,6 +275,7 @@ input[type="submit"]:disabled {
     z-index: 15;
     -webkit-transition-duration: 0.4s;
     transition-duration: 0.4s;
+    border-right: 1px solid gray;
 }
 .viewswitch_on {
     -webkit-transform:translateX(0em);
@@ -282,9 +284,10 @@ input[type="submit"]:disabled {
     box-shadow: 5px 0 20px 5px var(--shadow-color);
 }
 .viewswitch_off {
--webkit-transform:translateX(-82em);
--moz-transform:translateX(-82em);
-transform:translateX(-82em);
+    -webkit-transform:translateX(0em);
+    -moz-transform:translateX:(0em);
+    transform:translateX:(0em);
+    box-shadow: 5px 0 20px 5px var(--shadow-color);
 }
 
 .common-tab {
@@ -419,4 +422,26 @@ color:red;
 
 #tool_bar_fix{
 	display:none;
+}
+
+#left_menu_hide{
+    display:none;
+}
+
+#toc_content>div{
+    padding: 4px 8px;
+}
+#toc_content>div>a{
+    width: 100%;
+    display: inline-block;
+    color: black;
+    text-decoration: none;
+}
+
+#toc_content>div:hover{
+	background-color:#f1f1f1
+}
+
+#para_nav_next_a , #para_nav_prev_a{
+    display:none;
 }

+ 24 - 0
app/pcdl/css/reader_mob.css

@@ -0,0 +1,24 @@
+.viewswitch_on {
+    -webkit-transform:translateX(0em);
+    -moz-transform:translateX:(0em);
+    transform:translateX:(0em);
+    box-shadow: 5px 0 20px 5px var(--shadow-color);
+}
+.viewswitch_off {
+-webkit-transform:translateX(-82em);
+-moz-transform:translateX(-82em);
+transform:translateX(-82em);
+}
+
+#main_text_view{
+    padding-left: 1em;
+    padding-top:2.5em;
+    font-family: 'Noto Sans', 'Noto Sans SC', 'Noto Sans TC', Arial, Verdana;
+}
+
+#para_nav_prev , #para_nav_next{
+    display:none;
+}
+#para_nav_next_a , #para_nav_prev_a{
+    display:inline-block;
+}

+ 276 - 93
app/pcdl/reader.php

@@ -1,58 +1,18 @@
-<?php
-require_once "../public/_pdo.php";
-require_once "../path.php";
-?>
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
 <html>
 <head>
 	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
 	<meta name="viewport" content="width=device-width, initial-scale=1.0">
 	<link type="text/css" rel="stylesheet" href="css/reader.css"/>
-	<title>PCD Reader</title>
-	<style>
-	.word{
-		display:inline-block;
-		padding: 1px 3px;
-	}
-	.mean{
-		font-size: 65%;
-	}
-		/* 下拉内容 (默认隐藏) */
-	#mean_menu {
-		margin: 0.3em;
-		position: absolute;
-		background-color: white;
-		min-width: 8em;
-		max-width: 30em;
-		margin: -1px 0px;
-		box-shadow: 0px 3px 13px 0px black;
-		color: var(--main-color);
-		z-index: 200;
-	}
+	<link type="text/css" rel="stylesheet" href="css/reader_mob.css" media="screen and (max-width:767px)">
+	<title id="page_title">PCD Reader</title>
 
-	/* 下拉菜单的链接 */
-	#mean_menu a {
-		/*padding: 0.3em 0.4em;*/
-		line-height: 160%;
-		text-decoration: none;
-		display: block;
-		cursor: pointer;
-		text-align: left;
-		font-size:80%;
-	}
-
-	/* 鼠标移上去后修改下拉菜单链接颜色 */
-	.mean_menu a:hover {
-		background-color: blue;
-		color: white;
-	}
-
-	</style>
 	<script src="js/jquery-3.3.1.min.js"></script>
 	<script src="js/fixedsticky.js"></script>
 	<script src="js/reader.js"></script>
+	<script src="../term/term.js"></script>
+	<script src="../term/note.js"></script>
 	
-
 	<script>
 		var curr_tool="";
 		var dighest_count=0;//书摘段落数量
@@ -376,8 +336,58 @@ require_once "../path.php";
 
 		}
 	</script>
-<body class="reader_body" onload="">
+<body class="reader_body" >
+
+<?php
+require_once "../public/_pdo.php";
+require_once "../path.php";
+?>
+
 <style>
+		#para_nav {
+			display: flex;
+			justify-content: space-between;
+			padding: 5px 1em;
+			border-top: 1px solid gray;
+		}
+
+	.word{
+		display:inline-block;
+		padding: 1px 3px;
+	}
+	.mean{
+		font-size: 65%;
+	}
+		/* 下拉内容 (默认隐藏) */
+	#mean_menu {
+		margin: 0.3em;
+		position: absolute;
+		background-color: white;
+		min-width: 8em;
+		max-width: 30em;
+		margin: -1px 0px;
+		box-shadow: 0px 3px 13px 0px black;
+		color: var(--main-color);
+		z-index: 200;
+	}
+
+	/* 下拉菜单的链接 */
+	#mean_menu a {
+		/*padding: 0.3em 0.4em;*/
+		line-height: 160%;
+		text-decoration: none;
+		display: block;
+		cursor: pointer;
+		text-align: left;
+		font-size:80%;
+	}
+
+	/* 鼠标移上去后修改下拉菜单链接颜色 */
+	.mean_menu a:hover {
+		background-color: blue;
+		color: white;
+	}
+
 .par_pali_div{
 	margin-top:1em;
 }
@@ -390,12 +400,33 @@ sent{
 	line-height: 150%;
 }
 sent:hover{
-	background-color:yellow;
+	background-color:#fefec1;
 }
 para{
-	color:blue;
+    color: white;
+    background-color: #b76f03a3;
+    min-width: 2em;
+    display: inline-block;
+    text-align: center;
+    padding: 2px 10px;
+    border-radius: 99px;
+	margin-right: 5px;
+	cursor:pointer;
 }
 para:hover{
+
+}
+
+.sent_count{
+	font-size:80%;
+    color: white;
+    background-color: #1cb70985;
+    min-width: 2em;
+    display: inline-block;
+    text-align: center;
+    padding: 2px 0;
+    border-radius: 99px;
+	margin-left: 5px;	
 	cursor:pointer;
 }
 </style>
@@ -408,17 +439,16 @@ para:hover{
 				<span id="tool_bar_title">Title</span>
 			</div>
 			<div>
-				<a>☆★</a>
 				<div class="case_dropdown">
 					<p class="case_dropbtn"><button>A</button></p>
-					<div class="case_dropdown-content" style="width:25em;">
+					<div class="case_dropdown-content" style="right: 0;width:10em;">
 						<div ><button>A+</button><button>A-</button></div>
 						<div ><button>白</button><button>棕</button><button>夜s</button></div>
 					</div>
 				</div>
 				<div class="case_dropdown">
 					<p class="case_dropbtn"><button>┇</button></p>
-					<div class="case_dropdown-content">
+					<div class="case_dropdown-content" style="right: 2em;min-width:6em;">
 						<a onclick="tool_changed('dighest')">书摘</a>
 						<a onclick="tool_changed('comments')">批注</a>
 						<a onclick="tool_changed('target')">标签</a>
@@ -475,6 +505,8 @@ para:hover{
 		<div id="main_text_view" style="padding-bottom: 10em;">
 		
 <?php
+$tocHtml="";
+
 if(isset($_GET["album"])){
 	$album=$_GET["album"];
 }
@@ -510,14 +542,14 @@ else{
 		$_display = $_GET["display"];
 	}
 	else{
-		if($_view=="para"){
+		if($_view=="para" || $_view=="sent"){
 			$_display = "sent";//默认值
 		}
 		else{
 			$_display = "para";
 		}
 	}
-	if($_view=="chapter" || $_view=="para" ){
+	if($_view=="chapter" || $_view=="para" || $_view=="sent" ){
 		PDO_Connect("sqlite:"._FILE_DB_PALITEXT_);
 		//获取段落信息 如 父段落 下一个段落等
 		$query = "select * from 'pali_text' where book='$book' and paragraph='$paragraph'";
@@ -533,7 +565,9 @@ else{
 		else{
 			$par_end=$par_begin+$FetchParInfo[0]["chapter_len"]-1;	
 		}
+		
 		$par_next=$FetchParInfo[0]["next_chapter"];	
+		$par_prev=$FetchParInfo[0]["prev_chapter"];	
 		$par_parent=$FetchParInfo[0]["parent"];	
 		if($par_parent >= 0){
 			$query = "select toc from 'pali_text' where book='$book' and paragraph='$par_parent'";
@@ -542,8 +576,60 @@ else{
 				$_parent_title = $FetchToc[0]["toc"];
 			}
 		}
-	}
+		$query = "select paragraph,toc from 'pali_text' where book='$book' and parent='$paragraph' and level < '8'";
+		$FetchParent = PDO_FetchAll($query);
+		foreach ($FetchParent as $key => $value) {
+			$tocHtml .= "<div><a href='reader.php?view=chapter&book={$book}&para={$value["paragraph"]}'>{$value["toc"]}</a></div>";
+		}
+
+		//查询标题
+		if($_view=="chapter"){
+			$par_title = $FetchParInfo[0]["toc"];
+		}
+		else{
+			$par_title = $_parent_title;
+		}
+		//导航按钮		
+		if($_view=="sent"){
+			$next_para_link = "";
+			$prev_para_link = "";
+		}
+		else{
+			if($par_next != -1){
+				$query = "select paragraph , toc from 'pali_text' where book='$book' and paragraph='$par_next' ";
+				$FetchPara = PDO_FetchAll($query);
+				if(count($FetchPara)>0){
+					$next_para_link = "<a href='reader.php?view={$_view}&book={$book}&para={$par_next}'><span id='para_nav_next'>{$FetchPara[0]["toc"]}</span><span  id='para_nav_next_a'>下一个</span></a>〉";
+				}
+				else{
+					$next_para_link = "没有查询到标题";
+				}
+			}
+			else{
+				$next_para_link = "没了";
+			}
+
+			if($par_prev != -1){
+				$query = "select paragraph , toc from 'pali_text' where book='$book' and paragraph='$par_prev' ";
+				$FetchPara = PDO_FetchAll($query);
+				if(count($FetchPara)>0){
+					$prev_para_link = "〈<a href='reader.php?view={$_view}&book={$book}&para={$par_prev}'><span id='para_nav_prev_a'>前一个</span><span id='para_nav_prev'>{$FetchPara[0]["toc"]}</span></a>";
+				}
+				else{
+					$prev_para_link = "没有查询到标题";
+				}
+			}
+			else{
+				$prev_para_link = "没了";
+			}			
+		}
+
 
+	}
+		//设置标题栏的经文名称
+		echo "<script>";
+		echo "document.getElementById('tool_bar_title').innerHTML='".$par_title."'";
+		echo "</script>";
 
 	//上一级
 	echo "<div>";
@@ -564,15 +650,16 @@ else{
 		break;
 		case "chapter":
 			if($par_parent >= 0){
-				echo "上一级<a href='reader.php?view={$_view}&book={$book}&paragraph={$par_parent}'>{$_parent_title}</a>";
+				echo "<a href='reader.php?view={$_view}&book={$book}&paragraph={$par_parent}'>{$_parent_title}</a>";
 			}
 		break;
 		case "para":
 			if($par_parent >= 0){
-				echo "上一级<a href='reader.php?view=chapter&book={$book}&paragraph={$par_parent}'>{$_parent_title}</a>";
+				echo "<a href='reader.php?view=chapter&book={$book}&paragraph={$par_parent}'>{$_parent_title}</a>";
 			}
 		break;
-		case 9:
+		case "sent":
+				echo "<a href='reader.php?view=para&book={$book}&paragraph={$paragraph}'>▲{$paragraph}</a>";
 		break;
 		case 10:
 		break;
@@ -580,21 +667,25 @@ else{
 	echo "</div>";
 	//生成一个段落空壳 等会儿查询数据,按照不同数据类型填充进去
 	PDO_Connect("sqlite:"._FILE_DB_PALI_SENTENCE_);
-	if($_view=="sent"){
-		$query = "select text, begin, end from 'pali_sent' where book='$book' and paragraph='$paragraph' and begin='{$_GET["begin"]}' and end ='{$_GET["end"]}'";
-			$FetchSent = PDO_FetchAll($query);
-			echo "<div>".$FetchSent[0]["text"]."</div>";
-	}
+
 	if($_display=="sent"){
 		//逐句显示
 		for($iPar=$par_begin;$iPar<=$par_end;$iPar++){
-			$query = "select text, begin, end from 'pali_sent' where book='$book' and paragraph='$iPar'";
+			if($_view=="sent"){
+				$query = "select text, begin, end from 'pali_sent' where book='$book' and paragraph='$paragraph' and begin='{$_GET["begin"]}' and end ='{$_GET["end"]}'";
+			}
+			else{
+				$query = "select text, begin, end from 'pali_sent' where book='$book' and paragraph='$iPar'";
+			}
+			
 			$FetchSent = PDO_FetchAll($query);
 			echo "<div id='par-b$book-$iPar' class='par_div'>";
 			echo "<para book='$book' para='$iPar'>$iPar</para>";
 			foreach ($FetchSent as $key => $value) {
 				echo "<div id='sent-pali-b$book-$iPar-{$value["begin"]}' class='par_pali_div'>";
-				echo "<sent book='{$book}' para='{$iPar}' begin='{$value["begin"]}' end='{$value["end"]}' >".$value["text"]."</sent>";
+				$pali_sent = str_replace("{","<b>",$value["text"]);
+				$pali_sent = str_replace("}","</b>",$pali_sent);
+				echo "<sent book='{$book}' para='{$iPar}' begin='{$value["begin"]}' end='{$value["end"]}' >".$pali_sent."</sent>";
 				echo "</div>";
 				echo "<div id='sent-wbwdiv-b$book-$iPar-{$value["begin"]}' class='par_translate_div'>";
 				echo "</div>";
@@ -634,37 +725,70 @@ else{
 	}
 
 	PDO_Connect("sqlite:"._FILE_DB_SENTENCE_);
+	$dbh = new PDO("sqlite:"._FILE_DB_PALI_SENTENCE_, "", "");
+    $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
 	for($iPar=$par_begin;$iPar<=$par_end;$iPar++){
-		
-	}
-		//查询句子译文内容
-		if($par_begin==-1){
-			$query="SELECT * FROM \"sentence\" WHERE book = '{$book}' ";
+		if($_view=="sent"){
+			$FetchPaliSent = array(array("begin" => $_GET["begin"] , "end" => $_GET["end"]));
 		}
 		else{
-			$query="SELECT * FROM \"sentence\" WHERE book = '{$book}' and  (\"paragraph\" BETWEEN ".$PDO->quote($par_begin)." AND ".$PDO->quote($par_end)." and length(text)>0)  order by paragraph,begin ";
+			$query = "select begin, end from 'pali_sent' where book='$book' and paragraph='$iPar'";
+			$stmt = $dbh->query($query);
+			$FetchPaliSent = $stmt->fetchAll(PDO::FETCH_ASSOC);			
 		}
-		$FetchText = PDO_FetchAll($query);
-		$iFetchText=count($FetchText);
-		if($iFetchText>0){
-			for($i=0;$i<$iFetchText;$i++){
-				$currParNo=$FetchText[$i]["paragraph"];
-				$currParLevel=$FetchText[$i]["level"];
-				$par_level["$currParNo"]=$currParLevel;
-				echo "<sent_trans id='sent-tran-b{$book}-{$currParNo}-{$FetchText[$i]["begin"]}-{$i}' class='sent_trans text_level_{$currParLevel}' book='$book' para='$currParNo' begin='{$FetchText[$i]["begin"]}'>".$FetchText[$i]["text"]."</sent_trans>";
-				echo "<script>";
-				
-				if($_display=="sent"){
-					echo "document.getElementById('sent-translate-b{$book}-{$currParNo}-{$FetchText[$i]["begin"]}').appendChild(document.getElementById('sent-tran-b{$book}-{$currParNo}-{$FetchText[$i]["begin"]}-{$i}'));";
-				}
-				else{
-					echo "document.getElementById('par-translate-b{$book}-{$currParNo}').appendChild(document.getElementById('sent-tran-b{$book}-{$currParNo}-{$FetchText[$i]["begin"]}-{$i}'));";
+
+		foreach ($FetchPaliSent as $key => $value) {
+			$begin = $value["begin"];
+			$end = $value["end"];
+			if($_view=="sent"){
+				$query="SELECT * FROM \"sentence\" WHERE (book = '{$book}' AND  \"paragraph\" = ".$PDO->quote($iPar)." AND begin = '$begin' AND end = '$end' AND length(text)>0 )  order by modify_time  DESC";
+			}
+			else{
+				$query = "SELECT * FROM \"sentence\" WHERE book = '{$book}' AND  \"paragraph\" = ".$PDO->quote($iPar)." AND begin = '$begin' AND end = '$end' AND length(text)>0  order by modify_time DESC  limit 0, 1";
+			}
+
+			$query_count = "SELECT count(book) FROM \"sentence\" WHERE book = '{$book}' AND  \"paragraph\" = ".$PDO->quote($iPar)." AND begin = '$begin' AND end = '$end' AND length(text)>0  ";
+			$sent_count = PDO_FetchOne($query_count);
+			if($sent_count>9){
+				$sent_count = "9+";
+			}
+			$FetchText = PDO_FetchAll($query);
+			$iFetchText=count($FetchText);
+			if($iFetchText>0){
+				for($i=0;$i<$iFetchText;$i++){
+					$currParNo=$iPar;
+					if($_display=="sent"){
+						$sent_style = "display:block";
+					}
+					else{
+						$sent_style = "";
+					}
+					$tran_text = str_replace("[[","<term status='0'>",$FetchText[$i]["text"]);
+					$tran_text = str_replace("]]","</term>",$tran_text);
+					echo "<sent_trans style='{$sent_style}' id='sent-tran-b{$book}-{$currParNo}-{$FetchText[$i]["begin"]}-{$i}' class='sent_trans ' book='$book' para='$currParNo' begin='{$FetchText[$i]["begin"]}'>".$tran_text;
+					if($_view!="sent" && $_display=="sent"){
+						echo "<span class='sent_count'>$sent_count</span>";
+					}
+					echo "</sent_trans>";
+					echo "<script>";
+					if($_display=="sent"){
+						echo "document.getElementById('sent-translate-b{$book}-{$currParNo}-{$FetchText[$i]["begin"]}').appendChild(document.getElementById('sent-tran-b{$book}-{$currParNo}-{$FetchText[$i]["begin"]}-{$i}'));";
+					}
+					else{
+						echo "document.getElementById('par-translate-b{$book}-{$currParNo}').appendChild(document.getElementById('sent-tran-b{$book}-{$currParNo}-{$FetchText[$i]["begin"]}-{$i}'));";
+					}
+					echo "</script>";
 				}
-				echo "</script>";
 			}
+	
 		}
+	}
+		//查询句子译文内容
+
 		//查询句子译文内容结束
 
+	echo "<div id='para_nav'><div>$prev_para_link</div><div>$next_para_link</div></div>";
+
 	if(isset($album)){
 
 		/*
@@ -697,6 +821,7 @@ else{
 		*/
 		
 		
+
 		PDO_Connect("sqlite:"._FILE_DB_RESRES_INDEX_);
 		$query = "select * from 'album' where id='$album'";
 		$Fetch = PDO_FetchAll($query);
@@ -859,12 +984,13 @@ else{
 			</div>
 		</div>
 	</div>
-	
+	<!-- 全屏 黑色背景 -->	
+	<div id="BV" class="blackscreen" onclick="setNaviVisibility()"></div>
 		<!-- nav begin--> 
 
 		<div id="leftmenuinner" class="viewswitch_off">
 			<div class="win_caption">
-				<div><button onclick="setNaviVisibility()">返回</button></div>
+				<div><button id="left_menu_hide" onclick="setNaviVisibility()">返回</button></div>
 				<div id="menubartoolbar_New">
 					<ul class="common-tab">
 						<li id="content_menu_li" class="common-tab_li_act" onclick="menuSelected_2(menu_toc,'content_menu_li')">目录</li>
@@ -879,7 +1005,7 @@ else{
 			<!-- toc begin -->
 			<div class="menu" id="menu_toc">
 				<a name="_Content" ></a>
-				<select name="menu" onchange="show_toc_level(this)">
+				<select name="menu" onchange="show_toc_level(this)" style="display:none;">
 					<option value="1">1</option>
 					<option value="2">2</option>
 					<option value="3">3</option>
@@ -888,7 +1014,7 @@ else{
 					<option value="6">6</option>
 					<option value="7">7</option>
 				</select>
-				<div class="tocitems" id="content"><?php echo $tocHtml; ?></div>
+				<div  id="toc_content"><?php echo $tocHtml; ?></div>
 			</div>
 			<!-- toc end -->
 			<!-- comments begin -->
@@ -913,12 +1039,12 @@ else{
 			</div>
 			<!-- book mark end -->
 			
-						
 			</div>
 		
 		</div>
 		<!-- nav end -->	
-		<div id="BV" class="blackscreen" onclick="setNaviVisibility()"></div>
+
+
 		<div id="mean_menu" ></div>
 		<script>
 		//lookup();
@@ -950,19 +1076,76 @@ else{
 			let book = $(this).attr("book");
 			let para = $(this).attr("para");
 			let begin = $(this).attr("begin");
-			$("sent_trans[book='"+book+"'][para='"+para+"'][begin='"+begin+"']").css("color","blue");
+			$(this).css("background-color","#fefec1");
+			$("sent_trans[book='"+book+"'][para='"+para+"'][begin='"+begin+"']").css("background-color","#fefec1");
 		});
 		$("sent").mouseleave(function(e){
 			let book = $(this).attr("book");
 			let para = $(this).attr("para");
 			let begin = $(this).attr("begin");
-			$("sent_trans[book='"+book+"'][para='"+para+"'][begin='"+begin+"']").css("color","unset");
+			$(this).css("background-color","unset");
+			$("sent_trans[book='"+book+"'][para='"+para+"'][begin='"+begin+"']").css("background-color","unset");
 		});
+
+		$("para").mouseenter(function(e){
+			let book = $(this).attr("book");
+			let para = $(this).attr("para");
+			$("sent[book='"+book+"'][para='"+para+"']").css("background-color","#fefec1");
+		});
+		$("para").mouseleave(function(e){
+			let book = $(this).attr("book");
+			let para = $(this).attr("para");
+			$("sent[book='"+book+"'][para='"+para+"']").css("background-color","unset");
+		});
+
+		$("sent_trans").mouseenter(function(e){
+			let book = $(this).attr("book");
+			let para = $(this).attr("para");
+			let begin = $(this).attr("begin");
+			$(this).css("background-color","#fefec1");
+			$("sent[book='"+book+"'][para='"+para+"'][begin='"+begin+"']").css("background-color","#fefec1");
+		});
+		$("sent_trans").mouseleave(function(e){
+			let book = $(this).attr("book");
+			let para = $(this).attr("para");
+			let begin = $(this).attr("begin");
+			$(this).css("background-color","unset");
+			$("sent[book='"+book+"'][para='"+para+"'][begin='"+begin+"']").css("background-color","unset");
+		});
+
 		$("para").click(function(e){
 			let book = $(this).attr("book");
 			let para = $(this).attr("para");
 			window.location.assign("reader.php?view=para&book="+book+"&para="+para);
 		});
+
+		term_updata_translation();
+		var wordlist =  new Array();
+	$("term").each(function(index,element){
+		wordlist.push($(this).attr("pali"));
+	}
+	);
+	
+	function haha(){
+		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);
+				}
+			}
+		});			
+	}
+
 		</script>
 	
 </body>

+ 0 - 0
app/pcdl/res.db3


+ 474 - 474
app/term/term.js

@@ -5,650 +5,650 @@ 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; //正文内注释计数器
+var strTermTanslationTmp = "[%mean%](%pali% %mean2% %mymean%)";
+var strTermTanslationTmp2 = "[%mean%]";
+var termCounter = new Array();
+var noteCounter = 0; //正文内注释计数器
 
-function note(noteId,strDef="unkow"){
+function note(noteId, strDef = "unkow") {
 	document.write("haha");
 }
 
-function note_replace(strIn){
+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){
+var str_term_fun_word_link = "term_show_win";
+function term_word_link_fun(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>"));	
+function term_std_str_to_tran(strIn) {
+	return (strIn.replace(/\[\[/g, "<term status='0'>").replace(/\]\]/g, "</term>"));
 }
 
-function term_std_str_to_edit(strIn){
+function term_std_str_to_edit(strIn) {
 	var arrText = strIn.split("/");
-	for(var i in arrText){
+	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];
+		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+"*/\")";
+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);
+	return (strEdit);
 }
 
-function term_edit_to_std_str(strIn){
+function term_edit_to_std_str(strIn) {
 	var arrText = strIn.split("/");
-	for(var i in arrText){
+	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)+"*";
+		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("/"));
+	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);
+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);
+	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);
+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);
+	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);
-	}
-  });
-}
-
-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);
+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();
-			}
-			catch(e){
-				console.error("note_lookup_guid_json:"+e+" data:"+data);
-			}
-		
+			});
+		}
+		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;
-  	$.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;
+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>";
-					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];
+					$("#" + 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>";
-					}
-					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>";
+						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 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>";
+
+						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);
 					}
 				}
-				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);
 				}
-			}
-			catch(e){
-				console.error("term_get_word_to_div:"+e+" data:"+data);
-			}
 
-		}
-	});	
+			}
+		});
 }
-function term_get_guid_to_html(strGuid){
-	
+function term_get_guid_to_html(strGuid) {
+
 }
-function term_apply(guid){
-	if(g_eCurrWord){
-		setNodeText(g_eCurrWord,"note","=term("+guid+")");
+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_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_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_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 strNote=$("#term_new_note").val();
-		var strTag=$("#term_new_tag").val();
+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.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();
+	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");
+		{
+			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);
+				}
 			}
-			else{
-				ntf_show("term error"+result.message);
+			catch (e) {
+				console.error("term_get_all_pali:" + e + " data:" + data);
+				ntf_show("term error");
 			}
-		}
-		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_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]);
+function term_lookup_all(pali) {
+	for (var x in arrTermAllPali) {
+		if (arrTermAllPali[x].word == pali) {
+			return (arrTermAllPali[x]);
 		}
 	}
-	return(null);
+	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_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]);
+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);
+	return (null);
 }
-function term_lookup_my_id(id){
-	for(var x in arrMyTerm){
-		if(arrMyTerm[x].guid==id){
-			return(arrMyTerm[x]);
-		}		
+function term_lookup_my_id(id) {
+	for (var x in arrMyTerm) {
+		if (arrMyTerm[x].guid == id) {
+			return (arrMyTerm[x]);
+		}
 	}
-	return(null);
+	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_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();
+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]){
+	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});
+			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);
-			}
-				
-		});
-		
+	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");
+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));
+
+		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>");
+			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 {
+			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);
+				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;
+			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;
 			}
-			else{
-				termCounter[guid]=1;
+			var myterm = term_lookup_my(pali);//我的术语字典
+			let linkclass = "";
+			if (myterm) {
+				linkclass = "term_link";
 			}
-			var myterm=term_lookup_my(pali);//我的术语字典
-			let linkclass="";
-			if(myterm){
-				linkclass="term_link";
+			else {
+				linkclass = "term_link_new";
 			}
-			else{
-				linkclass="term_link_new";
-			}			
-			if(guid){
-				
-				if(renderTo=="wbw"){
-					noteText="%note%";
+			if (guid) {
+
+				if (renderTo == "wbw") {
+					noteText = "%note%";
 				}
-				else{
-					if(termCounter[guid]==1){
-						noteText=strTermTanslationTmp;
+				else {
+					if (termCounter[guid] == 1) {
+						noteText = strTermTanslationTmp;
 					}
-					else{
-						noteText=strTermTanslationTmp2;
+					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>");
+				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=noteText.replace("%mymean%","");
+				else {
+					noteText = noteText.replace("%mymean%", "");
 				}
 			}
-			else{
-				noteText="<span class='"+linkclass+"'  onclick=\""+str_term_fun_word_link+"('','"+termText+"')\">"+termText+"</span>";
+			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>");
+function term_show_win(guid, keyWord = "") {
+	if (guid == "") {
+		$(term_body).html("当前词条未创建。<br /><a onclick=\"term_add_new('" + keyWord + "')\">现在创建</a>");
 	}
-	else{
+	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> ";
+		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='我的释义'>";
+			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>";
+			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>";
+			else {
+				termString += "<div class='term_win_note'>Loading</div>";
 			}
 			$(term_body).html(termString);
 			term_get_all_meaning(currWord.word);
-			
-			if(!currWord.note){
+
+			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;
+					{
+						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;
-					}
-				});
+								catch (e) {
+									console.error(e + " data:" + data);
+								}
+								break;
+							case "error":
+								console.error("Error: " + xhr.status + ": " + xhr.statusText);
+								break;
+						}
+					});
 
 			}
 		}
-		else{
+		else {
 			$(term_body).html("undefined guid");
 		}
 	}
-	document.getElementById("term_win").style.display="flex";
-	
+	document.getElementById("term_win").style.display = "flex";
+
 }
 
-function term_tmp(type,tmp){
-	if(tmp=="new"){
-		switch(type){
+function term_tmp(type, tmp) {
+	if (tmp == "new") {
+		switch (type) {
 			case "a":
-				strTermTanslationTmp=$("#term_my_tmp").val();
+				strTermTanslationTmp = $("#term_my_tmp").val();
 				break;
 			case "a2":
-				strTermTanslationTmp2=$("#term_my_tmp").val();
-			break;
-		}		
-		
+				strTermTanslationTmp2 = $("#term_my_tmp").val();
+				break;
+		}
+
 	}
-	else{
-		switch(type){
+	else {
+		switch (type) {
 			case "a":
-				strTermTanslationTmp=tmp;
+				strTermTanslationTmp = tmp;
 				break;
 			case "a2":
-				strTermTanslationTmp2=tmp;
-			break;
+				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');
+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");
+	note_lookup(keyword, "term_dict");
 }
 
-function term_show_new(){
+function term_show_new() {
 	$("#term_new_recorder").slideToggle();
 }