Quellcode durchsuchen

备份修改的文件

visuddhinanda vor 3 Jahren
Ursprung
Commit
508634b3dd

+ 1312 - 0
public/app/studio/editor copy.php

@@ -0,0 +1,1312 @@
+<?php
+require_once 'checklogin.inc';
+require_once '../public/config.php';
+require_once '../public/load_lang.php';
+
+//load language file
+if(file_exists($dir_language.$currLanguage.".php")){
+	require $dir_language.$currLanguage.".php";
+}
+else{
+	include $dir_language."default.php";
+}
+
+
+if(isset($_GET["device"])){$currDevice=$_GET["device"];}
+else{$currDevice="computer";}
+
+//require "module/editor/language/$currLanguage.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">
+
+	<title id="file_title"><?php echo $_local->gui->pcd_studio; ?></title>	
+
+	<link rel="shortcut icon" href="../favicon.icon" />
+	<link type="text/css" rel="stylesheet" href="css/style.css"/>
+	<link type="text/css" rel="stylesheet" href="css/color_day.css" id="colorchange" />
+	<link type="text/css" rel="stylesheet" href="css/style_mobile.css" media="screen and (max-width:800px)">
+	
+	<link href="https://fonts.googleapis.com/css2?family=Padauk:wght@400;700&display=swap" rel="stylesheet">
+	<link type="text/css" rel="stylesheet" href="../public/css/notify.css"/>
+	<?php
+		if(file_exists($dir_user_base.$userid.$dir_myApp."/style.css")){
+			echo "<link type=\"text/css\" rel=\"stylesheet\" href=\"".$dir_user_base.$userid.$dir_myApp."/style.css\"/>";
+		}
+	?>
+
+	<script src="../guide/guide.js"></script>
+	<link type="text/css" rel="stylesheet" href="../guide/guide.css"/>
+	<script src="../public/js/marked.js"></script>
+
+	<script src="../public/js/jquery-3.6.js"></script>
+	<script src="../public/js/jquery-ui-1.12.1/jquery-ui.js"></script>
+
+	<script language="javascript" src="config.js"></script>
+	<script language="javascript" src="../pali_sent/pali_sent_list.js"></script>
+	<script language="javascript" src="../usent/usent_ref.js"></script>
+	<script language="javascript" src="js/data.js"></script>
+	<script language="javascript" src="js/common.js"></script>
+	<script language="javascript" src="js/render.js"></script>	
+	<script language="javascript" src="js/xml.js"></script>
+	<script language="javascript" src="js/editor.js"></script>
+	<script language="javascript" src="js/wbw_dict.js"></script>
+	<script language="javascript" src="js/wizard.js"></script>
+	<script language="javascript" src="js/wordmap.js"></script>
+	<script language="javascript" src="js/dict.js"></script>
+	<script language="javascript" src="js/relation.js"></script>
+
+	<script language="javascript" src="js/relation_list.js"></script>
+	
+	<script language="javascript" src="sent/sent.js"></script>
+	<script language="javascript" src="../public/js/notify.js"></script>
+
+	<script language="javascript" src="../widget/notify.js"></script>
+	<link type="text/css" rel="stylesheet" href="../widget/notify.css"/>
+
+	<script language="javascript" src="../public/js/comm.js"></script>
+	<script language="javascript" src="../public/js/localforage.min.js"></script>
+	<script language="javascript" src="../public/script/my.js"></script>
+	<script src="../../node_modules/mermaid/dist/mermaid.min.js"></script>
+
+	
+	<script language="javascript" src="module/editor/language/default.js"></script>	
+
+
+	<script src="../term/term.js"></script>
+	<script src="../term/note.js"></script>
+	<script src="../term/term_popup.js"></script>
+	<link type="text/css" rel="stylesheet" href="../term/term.css"/>
+
+	<script src="./js/message.js"></script>
+	<script src="../uwbw/update.js"></script>
+	<script src="../usent/usent.js"></script>
+	<script src="../ucenter/setting.js"></script>
+	<script src="../fileindex/file_info.js"></script>
+
+	<script  src="../channal/channal.js"></script>
+	<script>
+		get_channel_list_callback=renderChannelList();
+		
+
+	</script>
+
+	
+	<script language="javascript">
+	<?php 
+	//加载js语言包
+	//require_once '../public/load_lang_js.php';
+	?>
+	<?php
+	//加载js语言包
+	if(file_exists(_DIR_LANGUAGE_."/".$currLanguage.".json")){
+		echo "var gLocal = ".file_get_contents(_DIR_LANGUAGE_."/".$currLanguage.".json").";";
+	}
+	else{
+		echo "var gLocal = ".file_get_contents(_DIR_LANGUAGE_."/default.json").";";
+	}
+	?>
+		var gDownloadListString="";
+		
+		var g_device="computer";
+		var strSertch = location.search;
+		var gConfigDirMydocument="<?php echo _DIR_USER_DOC_."/".$userid._DIR_MYDOCUMENT_; ?>/";
+		
+		if(strSertch.length>0){
+			strSertch = strSertch.substr(1);
+			var sertchList=strSertch.split('&');
+			for (x in sertchList){
+				var item = sertchList[x].split('=');
+				if(item[0]=="device"){
+					g_device=item[1];
+				}
+			}
+		}
+		if(g_device=="mobile"){
+			g_is_mobile=true;
+		}
+		else{
+			g_is_mobile=false;
+		}
+		
+		var gCaseTable=<?php echo file_get_contents("../public/js/case.json"); ?>
+	</script>
+	
+</head>
+<body class="mainbody" id="mbody" onLoad="editor_windowsInit()">
+	<style>
+	.term_link:hover .guide_contence {
+		display: inline-block;
+	}
+	
+	.trans_text_block{
+		border-left: 5px solid #ccd1ff;
+		border-color: #ccd1ff;
+		background-color:unset;
+		margin-bottom: 0.5em;
+		padding: 0.5em 0.5em 0.1em 0.5em;
+		padding-top:0;
+	}
+	.translate_sent_head{
+		height: 17em;
+		overflow-y: scroll;
+	}
+	.translate_sent_head_content .readonly{
+		border-color: #d1d1d1;
+		background-color: #f1f1f1;
+	}
+	.trans_text_content{
+		color: unset;
+	}
+	.trans_text_content p{
+		margin-block-start: 0.3em;
+		margin-block-end: 0;
+	}
+	.trans_text_info{
+		font-size: 80%;
+		border-top: 1px solid gray;
+		padding-top: 5px;
+		color: var(--detail-color);
+		display:flex;
+		justify-content: space-between;
+		border:none;
+	}
+
+	.trans_text_info .tag{
+		font-size: 75%;
+	}
+	.trans_text_info .tools{
+		/*visibility: hidden;*/
+	}
+	.trans_text_block:hover .trans_text_info .tools{
+		visibility: visible;
+	}
+	wnh{
+	background-color: var(--link-hover-color);
+    color: var(--btn-color);
+    border-radius: 0.8em;
+    cursor: pointer;
+    padding: 2px;
+    font-size: 80%;
+    display: inline-block;
+	min-width: 1.2em;
+	width: fit-content;
+	height: 1.2em;
+	line-height: 1.2em;
+    text-align: center;
+	}	
+	#left_tool_bar {
+		position: fixed;
+		top: 0;
+		left: 0;
+		background-color: var(--tool-bg-color);
+		color: var(--tool-color);
+		height: 100%;
+		width: 2.5em;	
+		font-size: 100%;
+		z-index: 16;
+
+		display: -webkit-flex;
+		display: -moz-flex;
+		display: flex;
+		flex-direction: column;
+		-webkit-align-items: center;
+		-moz-align-items: center;
+		align-items: center;
+		-webkit-justify-content: space-between;
+		-moz-justify-content: space-between;
+		justify-content: space-between;
+		padding: 4em 4px 1em 4px;
+		border-right: 1px solid var(--tool-bg-color3);
+	}
+	#left_tool_bar::-webkit-scrollbar {
+		display: none;
+	}
+	.border_top{
+		border-top: 1px solid var(--tool-line-color);
+		width: 1.5em;
+		margin: 10px 5px 10px 5px;
+		display: inline-block;
+	}
+	.left_panal_caption{
+		border-bottom: 1px solid var(--tool-bg-color3);
+		padding: 8px 0 8px 3.2em;
+		font-weight: 700;
+	}
+	.left_panal_content{
+		padding: 8px 0 8px 3.2em;
+	}
+	#svg_parent2{
+		width: 1em;
+		margin-left: -1em;
+	}
+	guide {
+		margin: 0 15px 0 -8px;
+	}
+	.translate_sent_head_toolbar {
+		display: none;
+	}
+	div#input_org_select{
+		position: relative;
+	}
+	div#input_org_select .case_dropbtn {
+		padding: 0 6px;
+		border-radius: 4px;
+		min-width: 1em;
+		min-height: 1.3em;
+		background: url(../../node_modules/bootstrap-icons/icons/chevron-double-down.svg);
+		background-repeat: no-repeat;
+		background-position-x: center;
+		background-position-y: bottom;
+		background-origin: content-box;
+		background-color: var(--main-color1);
+		white-space: nowrap;
+	}
+	#parent_grammar{
+		padding: 0 6px;
+		border-radius: 4px;
+		min-width: 1em;
+		min-height: 1.3em;
+		background: url(../../node_modules/bootstrap-icons/icons/chevron-double-down.svg);
+		background-repeat: no-repeat;
+		background-position-x: center;
+		background-position-y: bottom;
+		background-origin: content-box;
+		background-color: var(--main-color1);
+		white-space: nowrap;
+	}
+
+	#word_mdf_parts_dropdown  a {
+		width: 100%;
+		display: inline-block;
+		overflow: hidden;
+		white-space: nowrap;
+		text-overflow: ellipsis;
+	}
+	#merge_button{
+		position: absolute;
+		left: 7em;
+		border: unset;
+		height: 6em;
+		width: 3em;
+		padding: unset;
+		transform: scaleX(0.6);
+	}
+	#merge_button>.icon{
+		fill: var(--link-color);
+	}
+
+	#merge_button:hover{
+		background: unset;
+	}
+	#merge_button:hover>.icon{
+		fill: var(--link-hover-color);
+	}
+	#om_dropdown_area::-webkit-scrollbar {
+		width: 10px;
+		height: 10px;
+	}
+	#om_dropdown_area::-webkit-scrollbar-thumb {
+		background-color: var(--link-color);
+	}
+	#om_dropdown_area::-webkit-scrollbar-thumb:hover {
+		background-color:var(--tool-link-hover-color);
+	}
+	#om_dropdown_area::-webkit-scrollbar-button:single-button {
+		width: 10px
+		height: 10px;
+		display: block;
+		background-color: var(--link-color);
+		border-radius: 10px;
+	}
+
+	#om_dropdown_area::-webkit-scrollbar-button:single-button:hover {
+		background-color:var(--tool-link-hover-color);
+	}
+
+		</style>
+	<link type="text/css" rel="stylesheet" href="css/print.css" media="print" />
+	<style id="display_set">
+	</style>
+	<!--左侧工具栏-->
+	<div id="left_tool_bar">
+		<div>
+<?php
+$plugin_list = json_decode(file_get_contents("plugin/index.json"));
+foreach($plugin_list as $info){
+	if($info->attach=="left_top" && $info->enable=="true"){
+		echo "<button id=\"left_toc\" type=\"button\" class=\"icon_btn\" onclick=\"setNaviVisibility('{$info->id}')\" title=\"";
+		if(substr($info->tooltip,0,1)=="#"){
+			$realTipText = substr($info->tooltip,1);
+			if(isset($_local_arr[$realTipText])){
+				echo $_local_arr[$realTipText];
+			}
+			else{
+				echo $realTipText;
+			}
+		}
+		else{
+			echo $info->tooltip;
+		}
+		echo "\">";
+		echo "<svg class=\"icon\">";
+		$iconFile = "plugin/".$info->dir."/".$info->icon;
+		echo "<use xlink:href=\"{$iconFile}\"></use>";
+		echo "</svg>";
+		echo "<span class='icon_notify' id='icon_notify_{$info->id}'></span>";
+		echo "</button>";
+	}
+}
+?>
+		</div>
+		<div>
+			<div>
+<?php
+foreach($plugin_list as $info){
+	if($info->attach=="left_mid" && $info->enable=="true"){
+		echo "<button id=\"left_toc\" type=\"button\" class=\"icon_btn\" onclick=\"setNaviVisibility('{$info->id}')\" title=\"";
+		if(substr($info->tooltip,0,1)=="#"){
+			$realTipText = substr($info->tooltip,1);
+			if(isset($_local_arr[$realTipText])){
+				echo $_local_arr[$realTipText];
+			}
+			else{
+				echo $realTipText;
+			}
+		}
+		else{
+			echo $info->tooltip;
+		}
+		echo "\">";
+		echo "<svg class=\"icon\">";
+		$iconFile = "plugin/".$info->dir."/".$info->icon;
+		echo "<use xlink:href=\"{$iconFile}\"></use>";
+		echo "</svg>";
+		echo "<span class='icon_notify' id='icon_notify_{$info->id}'></span>";
+		echo "</button>";
+	}
+}
+?>	
+			</div>
+			<span class="border_top"></span>
+			<div>
+<?php
+foreach($plugin_list as $info){
+	if($info->attach=="left_bottom" && $info->enable=="true"){
+		echo "<button id=\"left_toc\" type=\"button\" class=\"icon_btn\" onclick=\"setNaviVisibility('{$info->id}')\" title=\"";
+		if(substr($info->tooltip,0,1)=="#"){
+			$realTipText = substr($info->tooltip,1);
+			if(isset($_local_arr[$realTipText])){
+				echo $_local_arr[$realTipText];
+			}
+			else{
+				echo $realTipText;
+			}
+		}
+		else{
+			echo $info->tooltip;
+		}		
+		echo "\">";
+		echo "<svg class=\"icon\">";
+		$iconFile = "plugin/".$info->dir."/".$info->icon;
+		echo "<use xlink:href=\"{$iconFile}\"></use>";
+		echo "</svg>";
+		echo "<span class='icon_notify' id='icon_notify_{$info->id}'></span>";
+		echo "</button>";
+	}
+}
+?>
+			</div>
+		</div>
+	</div>
+	
+	<!--关闭打印模式 -->
+	<div id="btn_close_printprev">
+		<a href="#" onclick="printpreview(false)">&nbsp;&nbsp; </a>
+	</div>
+	
+	<!--顶部工具栏tool bar begin-->
+	<div id='toolbar'>
+		<!--左侧的区块-->
+		<div style="display: inline-flex;flex: 4;max-width:40vw">
+
+			<svg class="icon" style="height: 2.7em; width: 12em;">
+				<use xlink:href="../public/images/svg/wikipali_banner.svg#wikipali_banner"></use>
+			</svg>
+
+			<span style="height: fit-content;margin: auto 0;">
+				<span id="net_up" style="display:none;"></span>
+				<span id="msg_tool_bar"><svg class='icon'><use xlink:href='../studio/svg/icon.svg#pause_ms'></use></svg></span>
+				<span id="net_down" style="display:none;"></span>
+			</span>
+			<span id="editor_doc_title" style="margin: auto 0;max-width: 20em;height: fit-content;position: inherit;"></span>
+		</div>
+		
+		<!--工具栏中间的区块-->
+		<div style="flex: 2;display: flex;justify-content: center;">
+			<!--手机版显示工具栏按钮-->
+			<span class="dropdown toolbtn" onmouseover="switchMenu(this,'topTools')">
+				<div>
+				<button class="icon_btn" onClick="switchMenu(this,'topTools')" id="tools_view">
+					<svg class="icon">
+						<use xlink:href="svg/icon.svg#ic_toc"></use>
+					</svg>
+				</button>
+				</div>
+			</span>
+			
+
+			<div class="toolgroup1" id="topTools">
+
+<?php
+#头部中间的插件
+foreach($plugin_list as $info){
+	if($info->attach=="top_mid" && $info->enable=="true"){
+		echo "<style>";
+		include "plugin/{$info->dir}/style.css";
+		echo "</style>";
+		echo "<script src=\"plugin/{$info->dir}/module_function.js\"></script>";
+		
+		echo "<div class='dropdown' onmouseover=\"switchMenu(this,'".$info->id."')\" onmouseout=\"hideMenu()\">";
+		echo "<button class=\"dropbtn icon_btn\">";
+		echo "<svg class=\"icon\">";
+		$iconFile = "plugin/".$info->dir."/".$info->icon;
+		echo "<use xlink:href=\"{$iconFile}\"></use>";
+		echo "</svg>";
+		echo "<span class='icon_notify' id='icon_notify_{$info->id}'></span>";
+		echo "</button>";
+		echo "<div class=\"dropdown-content\" id=\"".$info->id."\" style=\"width:auto\">";
+		require "plugin/{$info->dir}/gui.html";
+		echo "</div>";
+		echo "</div>";	
+				
+	}
+}
+?>
+
+					
+				<!--显示模式-->
+				<div class="dropdown" onmouseover="switchMenu(this,'menuUseMode')" onmouseout="hideMenu()" style="display:none;">
+						<div style="">
+							<button class="dropbtn icon_btn" onClick="switchMenu(this,'menuUseMode')" id="use_mode">	
+								<svg class="icon">
+									<use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="svg/icon.svg#ic_reader_mode"></use>
+								</svg>
+							</button>
+						</div>
+						<div class="dropdown-content black_background" id="menuUseMode">
+							<a href="#" onclick="setUseMode('Edit')">
+								<svg class="icon">
+									<use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="svg/icon.svg#ic_mode_edit"></use>
+								</svg>
+								编辑模式
+							</a>
+							<a href="#" onclick="setUseMode('note')">
+								<svg class="icon">
+									<use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="svg/icon.svg#ic_reader_mode"></use>
+								</svg>
+								笔记模式
+							</a>
+							<a href="#" onclick="setUseMode('Read')">
+								<svg class="icon">
+									<use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="svg/icon.svg#ic_reader_mode"></use>
+								</svg>
+								阅读模式
+							</a>
+						</div>
+					</div>
+
+				<!--infomation panal-->
+				<button id="info_panal" class="icon_btn" type="button" onclick="setInfoPanalVisibility()" title="<?php echo $_local->gui->info_panal;?>" style="display:none;">
+					<svg class="icon">
+						<use xlink:href="svg/icon.svg#ic_info_outline"></use>
+					</svg>
+				</button>
+
+				
+				<!--apply all-->
+				<button id="B_ApplyAuto" class="icon_btn" onclick="applyAllSysMatch()" type="button" title="apply all" style="display:none;">
+						<svg class="icon">
+							<use xlink:href="svg/icon.svg#ic_done_all"></use>
+						</svg>
+					</button> 
+				
+				<!--Save-->
+				<button id="B_Save" class="icon_btn" onclick="editor_save()" type="button" style="display:none;" title="<?php echo $_local->gui->save;?>">
+						<svg class="icon">
+							<use xlink:href="svg/icon.svg#ic_save"></use>
+						</svg>
+					</button>					
+			
+			</div>
+			
+		</div>
+		
+		<!--工具栏右侧的区块开始-->
+		<div class="tab_a1" style="flex: 4;display: flex;justify-content: flex-end;">
+<?php
+foreach($plugin_list as $info){
+	if($info->attach=="top_right" && $info->enable=="true"){
+		echo "<button id=\"tab_rb_{$info->id}\" type=\"button\" class=\"icon_btn\" onclick=\"tab_click_b('{$info->id}','tab_rb_{$info->id}',right_panal_slide_toggle,'tab_rb_{$info->id}')\"  title=\"";
+		if(substr($info->tooltip,0,1)=="#"){
+			$realTipText = substr($info->tooltip,1);
+			if(isset($_local_arr[$realTipText])){
+				echo $_local_arr[$realTipText];
+			}
+			else{
+				echo $realTipText;
+			}
+		}
+		else{
+			echo $info->tooltip;
+		}
+		echo "\">";
+		echo "<svg class=\"icon\">";
+		$iconFile = "plugin/".$info->dir."/".$info->icon;
+		echo "<use xlink:href=\"{$iconFile}\"></use>";
+		echo "</svg>";
+		echo "<span class='icon_notify' id='icon_notify_{$info->id}'></span>";
+		echo "<span class='icon_notify' id='icon_notify_{$info->id}'></span>";
+		echo "</button>";
+			
+	}
+}
+?>		
+		
+		</div>
+
+	</div>
+	<!--顶部工具栏结束-->
+	
+	<!--文档载入进度条-->
+	<div id="load_progress_div">
+		<svg id="circleProcess" xmlns="http://www.w3.org/2000/svg">
+			<circle id="circle" cx="50%" cy="50%" r="32%" ></circle>
+		</svg>
+	</div>	
+				
+	<span id="load_progress_num" ></span>
+	<!--tool bar end -->
+	
+	<!--loading -->
+	<svg viewBox="0 0 1000 4" id="loading_bar" xmlns="http://www.w3.org/2000/svg">
+			<line x1="0" y1="2" x2="1000" y2="2" id="loading" stroke-width="5px" stroke-linecap="round"/>
+	</svg>
+	<!--tool bar end -->
+	<!--文档载入进度条结束-->
+
+	
+	<style id="mycss">
+	</style>
+	
+<div class="main">
+		<!-- leftmenu begin--> 
+		<div id="leftmenuinner" class="viewswitch_off" style="z-index:13;">
+
+			<div id="menubartoolbar" style="display: none">
+				<select id="id_editor_menu_select" name="menu" onchange="menuSelected(this)">
+					<option value="menu_toc" selected><?php echo $_local->gui->content;?></option>				
+					<option value="menu_pali_cannon"><?php echo $_local->gui->pali_canon;?></option>
+					<option value="menu_bookmark"><?php echo $_local->gui->mark;?></option>
+					<option value="menu_project"><?php echo $_local->gui->project;?></option>
+					<option value="menu_dict"><?php echo $_local->gui->dict;?></option>
+					<option value="menu_layout"><?php echo $_local->gui->layout;?></option>
+					<option value="menu_plugin"><?php echo $_local->gui->plugin;?></option>
+				</select>
+			</div>
+			<div id="menubartoolbar_New" style="display:none;">
+				<ul class="common-tab">
+					<li id="menu_toc_li" class="common-tab_li_act" onclick="menuSelected_2(menu_toc,'menu_toc_li','menu' )"><?php echo $_local->gui->content;?></li>
+					<li id="menu_bookmark_li" class="common-tab_li" onclick="menuSelected_2(menu_bookmark,'menu_bookmark_li','menu' )"><?php echo $_local->gui->mark;?></li>
+					<li id="menu_project_li" class="common-tab_li" onclick="menuSelected_2(menu_project,'menu_project_li','menu' )"><?php echo $_local->gui->project;?></li>
+					<li id="menu_dict_li" class="common-tab_li" onclick="menuSelected_2(menu_dict,'menu_dict_li','menu' )"><?php echo $_local->gui->dict;?></li>
+					<li id="menu_layout_li" class="common-tab_li" onclick="menuSelected_2(menu_layout,'menu_layout_li','menu' )"><?php echo $_local->gui->layout;?></li>
+					<li id="menu_plugin_li" class="common-tab_li" onclick="menuSelected_2(menu_plugin,'menu_plugin_li','menu' )"><?php echo $_local->gui->plugin;?></li>
+				</ul>
+			</div>			
+			
+			<div class='toc' id='leftmenuinnerinner'>	
+			<!-- toc begin -->
+<?php
+foreach($plugin_list as $info){
+	if(($info->attach=="left_top" || $info->attach=="left_mid" ||$info->attach=="left_bottom") && $info->enable=="true"){
+		echo "<div id=\"{$info->id}\">";
+		echo "<style>";
+		include "plugin/{$info->dir}/style.css";
+		echo "</style>";
+		echo "<script src=\"plugin/{$info->dir}/module_function.js\"></script>";
+		echo "<div class=\"left_panal_caption\">";
+		echo $info->caption;
+		echo "</div>";
+		echo "<div class=\"left_panal_content\">";
+		require "plugin/{$info->dir}/gui.html";
+		echo "</div>";
+		echo "</div>";
+	}
+}
+?>
+
+			
+
+			
+			<!-- dictionary begin -->
+				<style>
+				<?php include 'module/editor_dictionary/style.css';?>
+				</style>
+				<?php 
+				//require 'module/editor_dictionary/language/default.php';
+				//require "module/editor_dictionary/language/$currLanguage.php";
+				require 'module/editor_dictionary/gui.html';
+				?>
+
+			<!-- dictionary end -->
+			
+				<style>
+				<?php include 'module/editor_palicannon/style.css';?>
+				</style>
+				<?php 
+				//require 'module/editor_palicannon/language/default.php';
+				//require "module/editor_palicannon/language/$currLanguage.php";
+				//require 'module/editor_palicannon/gui.html';
+				?>
+						
+			</div>
+		
+		</div>
+		<!-- leftmenu end -->	
+		<!-- leftmenu background begin--> 
+		<div id='BV' class='blackscreen' onClick='setNaviVisibility()' style="z-index:10;"></div>
+		
+		<!--main edit begin-->
+	<div class='mainview' id='body_mainview'>
+		
+		<!--  逐词解析与译文编辑区 -->
+		<div id="sutta_text">
+			<div class="sutta_top_blank"></div>
+		</div>
+			
+		<!--  infomation panal -->	
+		<div id="id_info_panal">
+			<select id="id_info_window_select" name="menu" onchange="windowsSelected(this)">
+				<option value="view_vocabulary"><?php echo $_local->gui->vocabulary;?></option>
+				<option value="view_dict_all"><?php echo $_local->gui->inline_dictionary;?></option>
+				<option value="view_dict_curr"><?php echo $_local->gui->my_dictionary;?></option>
+				<option value="view_debug"><?php echo $_local->gui->debug;?></option>
+			</select>
+			<button type="button" onclick="setInfoPanalSize('hidden')"><?php echo $_local->gui->hidden;?></button>
+			<button type="button" onclick="setInfoPanalSize('min')"><?php echo $_local->gui->min;?></button>
+			<button type="button" onclick="setInfoPanalSize('half')"><?php echo $_local->gui->half;?></button>
+			<button type="button" onclick="setInfoPanalSize('max')"><?php echo $_local->gui->max;?></button>
+		
+			<div id='id_info_panal_inner'>
+				<div id="word_table">
+					<p><br/><?php echo $_local->gui->word_list;?><input id="button_wordlist_refresh" onclick="refreshWordList()" type="button" value="<?php echo $_local->gui->refresh;?>" /> </p>
+					<div id="word_table_inner"></div>
+				</div>
+
+				<div id="id_dict_match_result">
+					<p><br/><?php echo $_local->gui->dictionary_match_result;?></p>
+					<div id="id_dict_match_result_inner"></div>
+				</div>
+				
+				<div id="id_dict_curr_word">
+					<div id="id_dict_curr_word_inner"></div>
+				</div>		
+				
+				<div class="debugMsg" id="id_debug"><!--调试信息-->
+					<div id="id_debug_output"></div>
+				</div>
+			</div>
+	
+		</div>		
+
+		<!--  infomation panal end -->				
+	</div>
+		<!-- end-->
+	<!--class="main"-->
+	<div class="debug_info"><span id="debug"></span></div>
+	
+	<!--逐词解析编辑窗口-->
+	<div id="modifyDiv">
+		<div id="modifywin" style="">
+			<div>
+				<ul id="id_select_modyfy_type" class="common-tab">
+					<li id="detail_li" class="common-tab_li_act" onclick="select_modyfy_type('modify_detaile','detail_li')"><?php echo $_local->gui->detaile;?></li>
+					<li id="mark_li" class="common-tab_li" onclick="select_modyfy_type('modify_bookmark','mark_li')"><?php echo $_local->gui->mark;?></li>
+					<li id="note_li" class="common-tab_li" onclick="select_modyfy_type('modify_note','note_li')"><?php echo $_local->gui->note;?></li>
+					<li id="spell_li" class="common-tab_li" onclick="select_modyfy_type('modify_spell','spell_li')"><?php echo "高级";//.$_local->gui->source?></li>
+					
+				</ul>
+			</div>
+			<div id="modify_detaile">
+				<!-- 意思 -->
+				<div class="edit_detail_p">
+					<guide gid="studio_general_meaning">⑤</guide>
+					<span class="edit_detail_span"><?php echo $_local->gui->meaning;?>:</span>
+					<!--<button id="merge_button" onclick="copy_part_mean_to_mean()">
+						<svg class="icon" style="transform: rotate(315deg);height: 4em;width: 6em;">
+							<use xlink="http://www.w3.org/1999/xlink" href="../../node_modules/bootstrap-icons/bootstrap-icons.svg#arrow-90deg-right">
+						</svg>
+					</button>-->
+					<input type="text" id="input_meaning" class="input_bar" value="" name="in_meaning">
+					<div class="case_dropdown">
+						<svg class="edit_icon">
+							<use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="svg/icon.svg#ic_more"></use>
+						</svg>
+						<div id="word_mdf_mean_dropdown" class="case_dropdown-content">
+						</div>
+					</div>
+				</div>
+				<!-- 拆分 -->
+				<div class="edit_detail_p">
+					<guide gid="studio_break_down">②</guide>
+					<span class="edit_detail_span"><?php echo $_local->gui->part;?>:</span>
+					<input type="text" id="input_org" class="input_bar" value="" name="in_org" onkeydown="match_key(this)" onkeyup="unicode_key(this) " onchange="input_org_change()">
+					<div class="case_dropdown">
+						<svg class="edit_icon">
+							<use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="svg/icon.svg#ic_more"></use>
+						</svg>
+						<div id="word_mdf_parts_dropdown" class="case_dropdown-content">
+						</div>
+					</div>				
+				</div>
+				<!-- 拆分意思 -->
+
+				<div class="edit_detail_p" >
+					<guide gid="studio_part_meaning">④</guide>
+					<span class="edit_detail_span"><?php echo $_local->gui->partmeaning;?>:</span>
+					<div id="input_org_select" class="input_bar" style="width:80%; display:inline-flex;justify-content: space-between;"></div>
+					<input type="text" id="input_om" class="input_bar" value="" name="in_om" onchange='input_om_change(this)' onblur="input_org_switch('input_om','input_org_select')">
+				</div>
+				<!-- 格位 -->
+				<div class="edit_detail_p">
+					<guide gid="grammar_abbr">③</guide>
+					<span class="edit_detail_span"><?php echo $_local->gui->gramma;?>:</span>
+					<p><input type="text" id="input_case" value="" name="in_case" onblur="input_org_switch('input_case','input_select_case')" ></p>
+					<div id="input_select_case" class="input_bar" style="width:80%; display:inline-flex;">
+						<div style="display:inline-flex;">
+							<span></span>
+							<span></span>
+							<span></span>
+							<span></span>
+						</div>
+						<button style="margin-left:auto; display:none;" onclick="input_org_switch('input_select_case','input_case')">
+							<?php echo $_local->gui->source;?>
+						</button>
+					</div>				
+					<div class="case_dropdown">
+							<svg class="edit_icon">
+								<use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="svg/icon.svg#ic_more"></use>
+							</svg>
+							<!--下拉菜单-->
+							<div id="word_mdf_case_dropdown" class="case_dropdown-content">
+							</div>
+						</div>								
+				</div>
+				<!-- 语基 -->
+				<div class="edit_detail_p">
+					<guide gid="studio_parent">①</guide>
+				<script>
+
+				</script>
+				<span class="thin_icon_btn" onclick="edit_show_prt_prt(this)">
+					<svg id="svg_parent2" class="icon">
+						<use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="svg/icon.svg#ic_chevron_right_24px"></use>
+					</svg>
+				</span>
+					<span class="edit_detail_span"><?php echo $_local->gui->parent;?>:</span>
+					<input type="text" id="id_text_parent" class="input_bar" onkeydown="match_key(this)" onkeyup="unicode_key(this)" />
+					<div class="case_dropdown">
+						<svg class="edit_icon">
+							<use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="svg/icon.svg#ic_more"></use>
+						</svg>
+						<div id="word_mdf_parent_dropdown" class="case_dropdown-content">
+						</div>
+					</div>				
+				</div>
+				<!-- 词源 -->
+				<div id="edit_detail_prt_prt" class="edit_detail_p" style="display:none;">
+					<span style="display:flex;">
+						<guide gid="studio_parent2">衍生原型</guide>
+						<div class="case_dropdown" style="padding-left: 0.5em;width: 6em;display: flex;">
+							<span style="padding-right: 4px;"></span>
+							<span id="parent_grammar" style="display: inline-block;min-width: 2em;border-radius: 4px;padding: 0 4px;background-color: #8484843d;"></span>
+							<input type="hidden" id="input_parent_grammar" />
+							<div id="word_mdf_prt_prt_grammar_dropdown" style="margin-top: 22px;" class="case_dropdown-content">
+								<a onclick="edit_parent_grammar_changed('')"><?php echo $_local->gui->empty; ?></a>
+								<a onclick="edit_parent_grammar_changed('.pp.')"><?php echo $_local->gui->pp; ?></a>
+								<a onclick="edit_parent_grammar_changed('.prp.')"><?php echo $_local->gui->prp; ?></a>				
+								<a onclick="edit_parent_grammar_changed('.fpp.')"><?php echo $_local->gui->fpp; ?></a>
+								<a onclick="edit_parent_grammar_changed('.caus.')"><?php echo $_local->gui->caus; ?></a>
+								<a onclick="edit_parent_grammar_changed('.pass.')"><?php echo $_local->gui->pass; ?></a>
+							</div>
+						</div>
+						<input type="text" id="id_text_prt_prt" class="input_bar" onkeydown="match_key(this)" onkeyup="unicode_key(this)" />
+						<div class="case_dropdown">
+							<svg class="edit_icon">
+								<use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="svg/icon.svg#ic_more"></use>
+							</svg>
+							<div id="word_mdf_prt_prt_dropdown" class="case_dropdown-content">
+							</div>
+						</div>
+					</span>
+					<div>
+						<?php echo $_local->gui->relation; ?>
+						<imput type="hidden" id="id_relation_text" value="" />
+						<button onclick="rela_add_word()">➕</button>
+						<div id="relation_div">
+						</div>
+					</div>
+				</div>
+				
+			</div>
+			
+			<div id="modify_bookmark">
+				<ul id="id_book_mark_color_select" class="bookmark-tab">
+					<li id="id_bmc0" class="bookmarkcolorblock bookmarkcolor0" onclick="setBookMarkColor(this,'bmc0')">
+						<svg class="icon">
+								<use xlink:href="svg/icon.svg#ic_clear">×</use>
+						</svg>
+					</li>
+					<li id="id_bmc1" class="bookmarkcolorblock bookmarkcolor1" onclick="setBookMarkColor(this,'bmc1')">
+						<svg class="icon">
+								<use xlink:href="svg/icon.svg#ic_bookmark_on">1</use>
+						</svg>
+					</li>
+					<li id="id_bmc2" class="bookmarkcolorblock bookmarkcolor2" onclick="setBookMarkColor(this,'bmc2')">
+						<svg class="icon">
+								<use xlink:href="svg/icon.svg#ic_bookmark_on">2</use>
+						</svg>
+					</li>
+					<li id="id_bmc3" class="bookmarkcolorblock bookmarkcolor3" onclick="setBookMarkColor(this,'bmc3')">
+						<svg class="icon">
+								<use xlink:href="svg/icon.svg#ic_bookmark_on">3</use>
+						</svg>
+					</li>
+					<li id="id_bmc4" class="bookmarkcolorblock bookmarkcolor4" onclick="setBookMarkColor(this,'bmc4')">
+						<svg class="icon">
+								<use xlink:href="svg/icon.svg#ic_bookmark_on">4</use>
+						</svg>
+					</li>
+					<li id="id_bmc5" class="bookmarkcolorblock bookmarkcolor5" onclick="setBookMarkColor(this,'bmc5')">
+						<svg class="icon">
+								<use xlink:href="svg/icon.svg#ic_bookmark_on">5</use>
+						</svg>
+					</li>
+					<li id="id_bmca" class="bookmarkcolorblock bookmarkcolora" onclick="setBookMarkColor(this,'bmca')">
+						<svg class="icon">
+								<use xlink:href="svg/icon.svg#ic_bookmark_on">A</use>
+						</svg>
+					</li>
+				</ul>
+				<textarea id="id_text_bookmark" rows="6" col="28" style="margin-left: 3px; margin-right: 3px; width: 95%;"></textarea>
+			</div>
+			
+			<div id="modify_note">
+				<textarea id="id_text_note" rows="7" col="28" style="margin-left: 3px; margin-right: 3px; width: 95%;"></textarea>
+			</div>
+			
+			<div id="modify_spell">
+				<span id="id_text_id"></span><br/>
+				<?php echo $_local->gui->show;?><br />
+				<input type="input" id="id_text_pali" onkeydown="match_key(this)" onkeyup="unicode_key(this)" /><br/>
+				<?php echo $_local->gui->spell;?><br />
+				<input type="input" id="id_text_real"  onkeydown="match_key(this)" onkeyup="unicode_key(this)" /><br/>
+				<br/>
+			</div>
+			
+			<div id="modify_apply">
+			</div>
+		</div>
+	</div>
+	<!--逐词解析编辑窗口结束-->
+	
+	<!--译文编辑窗口-->
+	<div id="id_text_edit_form">
+		<div id="id_text_edit_caption"  class="dialog-title">
+			<div><button id="id_text_edit_cancel" type="button" onclick="edit_tran_cancal()"><?php echo $_local->gui->cancel;?></button></div>
+			<div><span id="id_text_edit_caption_text">
+				<?php echo $_local->gui->translation; ?></span></div>
+			<div id="id_text_edit_bottom">
+				<button id="id_text_edit_delete" type="button" onclick="edit_tran_delete()">
+					<?php echo $_local->gui->delete;?>
+				</button>
+			</div>
+			<div><button id="id_text_edit_save" type="button" onclick="edit_tran_save()"><?php echo $_local->gui->save;?></button></div>
+		</div>
+		<div id="id_text_edit_info">
+			<select id="id_heading_edit_level" >
+					<option value="0"><?php echo $_local->gui->normal;?></option>
+					<option value="1"><?php echo $_local->gui->heading_1;?></option>
+					<option value="2"><?php echo $_local->gui->heading_2;?></option>
+					<option value="3"><?php echo $_local->gui->heading_3;?></option>
+					<option value="4"><?php echo $_local->gui->heading_4;?></option>
+					<option value="5"><?php echo $_local->gui->heading_5;?></option>
+					<option value="6"><?php echo $_local->gui->heading_6;?></option>
+					<option value="7"><?php echo $_local->gui->heading_7;?></option>
+					<option value="8"><?php echo $_local->gui->heading_8;?></option>
+			</select>
+			<select id="id_text_edit_language">
+					<option value="pali">Pali</option>
+					<option value="en">English</option>
+					<option value="zh">简体中文</option>
+					<option value="tw">正體中文</option>
+			</select>
+			<span>
+				<?php echo $_local->gui->author;?>
+				<input type="input" id="id_text_edit_author" onkeydown="match_key(this)" onkeyup="unicode_key(this)"/>
+				<?php echo $_local->gui->smart_spell;?>
+				<input id="id_text_edit_area_smart_switch" type="checkbox" checked="">
+			</span>
+		</div>
+		<textarea id="id_text_edit_area" rows="10" width="100%" onkeydown="match_key(this)" onkeyup="unicode_key(this)">
+		</textarea>
+
+	</div>
+	
+	<!--  Tool bar on right side -->
+	<div id="right_tool_bar" >
+	
+		<div id="right_tool_bar_inner">
+<?php
+#头部右侧插件
+foreach($plugin_list as $info){
+	if($info->attach=="top_right" && $info->enable=="true"){
+		echo "<div id=\"{$info->id}\" >";
+		require "plugin/{$info->dir}/gui.html";
+		echo "</div>";
+			
+	}
+}
+?>			
+
+			<!--  三藏购物车 -->
+			<div id="pc_res_loader">
+				<div id="pc_res_load_button">
+					<button  id="id_open_editor_load_stream"  onclick="pc_loadStream(0)">
+						<svg class="button_icon"><use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="svg/icon.svg#ic_cloud_download"></use></svg>
+					</button>
+					<button  id="id_cancel_stream" onclick="pc_cancelStream()"><?php //echo $_local->gui->cancel;?>
+						<svg class="button_icon"><use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="svg/icon.svg#ic_note_add"></use></svg>
+					</button>
+					<button  id="pc_empty_download_list" onclick="pc_empty_download_list()"><?php //echo $module_gui_str['editor']['1045'];?>
+						<svg class="button_icon"><use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="svg/icon.svg#ic_delete"></use></svg>
+					</button>
+					<button onclick="get_pc_res_download_list_from_cookie()"><?php //echo $_local->gui->refresh;?>
+						<svg class="button_icon"><use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="svg/icon.svg#ic_autorenew"></use></svg>
+					</button>
+				</div>
+				
+				<div id="pc_res_list_div">
+				</div>
+
+				<div id="id_book_res_load_progress"></div>
+				<canvas id="book_res_load_progress_canvas" width="300" height="30"></canvas>
+			</div>
+		
+		</div>
+	</div>
+	<!--  Tool bar on right side end -->
+	
+	<div class="pop_win_full"><div id="pop_win_inner"></div></div>
+	
+	<!--  Term pop window-->
+	<div class="pop_win_full" id="term_win">
+		<div class="pop_win_inner">
+			<div class="win_title">
+				<div>
+					<button onclick="win_close('term_win')">
+						<svg class="button_icon" style="fill: var(--btn-hover-bg-color);">
+							<use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="svg/icon.svg#ic_clear">
+							</use>
+						</svg>
+					</button>
+				</div>
+				<div>
+					<span>
+						<?php echo $_local->gui->relational_map; ?>
+					</span>
+				</div>
+				<div>
+					<button onclick="term_save()">
+					<svg class="button_icon" style="fill: var(--btn-hover-bg-color);">
+							<use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="svg/icon.svg#ic_save">
+							</use>
+						</svg>
+					</button>
+				</div>
+			</div>
+			<div class="win_body" id="term_body_parent">
+				<div class="win_body_inner" id="term_body">
+				</div>
+			</div>
+		</div>
+	</div>
+
+	<!-- 逐词解析下拉菜单-->
+	<div class="display_off">
+		<div id="word_mean" style="max-width:22em;"></div>
+		<div id="word_parts" style="max-width:22em;"></div>
+		<div id="word_partmean" style="max-width:22em;"></div>
+		<div id="word_gramma" style="max-width:22em;"></div>
+	</div>
+
+	<!-- 逐词解析 词头工具栏-->
+	<div id="word_tool_bar_div">
+		<div id="word_tool_bar" class="word_head_bar"style="font-size: 70%">
+			<button  onclick="rela_link_click()">
+				<?php echo $_local->gui->link; ?>
+			</button>
+			<button  onclick="rela_link_click(false)">
+				<?php echo $_local->gui->cancel; ?>
+			</button>
+		</div>
+	</div>
+	
+	<div id="end_of_page" class="borderT textS textAc">
+	<?php echo $_local->gui->page_end; ?><br>
+	——wikipāḷi <?php echo $_local->gui->studio; ?>——
+	</div>
+	
+	<style>
+	#word_note_pop{
+	border-radius: 6px;
+    width: 95%;
+	max-height: calc(30vh);
+    position: fixed;
+    bottom: 10px;
+    left: 3em;
+	background-color: var(--drop-bg-color);
+	overflow-y: auto;
+	display:none;
+
+}
+
+
+	</style>
+	<script>
+	function close_word_note_pop(){
+		$("#word_note_pop").hide("500");
+	}
+	</script>
+	<div id="word_note_pop">
+		<div id="word_note_pop_title" style="background-color: var(--border-shadow);">
+			<span onclick="close_word_note_pop()" style="display: flex;">
+				<svg style="fill: var(--main-color);margin: 5px;height: 15px;width: 15px;"  t="1597905254064" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2185" ><path d="M573.207 527.834l404.184-404.22a52.811 52.811 0 0 0 0-74.401l-2.217-2.217a52.836 52.836 0 0 0-74.413 0l-404.209 404.73-404.22-404.9a52.823 52.823 0 0 0-74.401 0l-2.217 2.217a51.915 51.915 0 0 0 0 74.414l404.22 404.377-404.22 404.22a52.823 52.823 0 0 0 0 74.402l2.217 2.217a52.811 52.811 0 0 0 74.401 0l404.22-404.22 404.22 404.22a52.823 52.823 0 0 0 74.414 0l2.217-2.217a52.811 52.811 0 0 0 0-74.401z m0 0" p-id="2186"></path>
+				</svg>
+			</span>
+		</div>
+		<div id="word_note_pop_content">
+		</div>
+	</div>
+</div>
+	
+	
+<script type="text/javascript"> 
+//侦测页面滚动	
+
+
+var scrollEventLock=false;
+var suttaDom = document.getElementById('sutta_text');
+ window.addEventListener('scroll',winScroll);
+ function winScroll(e){ 
+	 if(scrollEventLock){
+		console.log("scroll Event Lock");
+		return;
+	 }
+	 if(getElementHeight(suttaDom)<getWindowHeight()){
+		return;
+	 }
+	 var top = getElementViewTop(suttaDom);
+	 //console.log(Date() +"-"+top);
+	 //top < 0 ? fixedDom.classList.add("fixed") : fixedDom.classList.remove("fixed");
+	 if(top>-500){
+		scrollEventLock=true;
+		prev_page();
+		scrollEventLock=false;
+		//console.log("goto prev page");
+	 }
+	 if(getElementBottomOutsideHeight(suttaDom)<1500){
+		scrollEventLock=true;
+		next_page();
+		scrollEventLock=false;
+		//console.log("goto next page");
+	 }
+	//debugOutput( document.body.scrollTop);
+	//debugOutput("top:"+top+"; outside:"+getElementBottomOutsideHeight(suttaDom));
+	//debugOutput("scrollHeight="+suttaDom.scrollHeight+ ";  clientHeight="+suttaDom.clientHeight +";offsetHeight="+suttaDom.offsetHeight);
+ }
+ 
+ function getElementViewTop(element){
+     var actualTop = element.offsetTop;
+	var elementScrollTop=GetPageScroll().y;//document.body.scrollTop;
+     return actualTop-elementScrollTop;
+   } 
+function getElementBottomOutsideHeight(element){
+	var winHeight=getWindowHeight();//document.body.clientHeight;
+	var elementHeight=getElementHeight(element);//suttaDom.scrollHeight;
+	var elementTop=getElementViewTop(element);
+	return(elementHeight+elementTop-winHeight);
+}
+
+function getElementHeight(element){
+	var scrW, scrH; 
+	if(element.innerHeight && element.scrollMaxY) 
+	{	// Mozilla	
+		scrW = element.innerWidth + element.scrollMaxX;	
+		scrH = element.innerHeight + element.scrollMaxY; 
+	} 
+	else if(element.scrollHeight > element.offsetHeight)
+	{	// all but IE Mac	
+		scrW = element.scrollWidth;	
+		scrH = element.scrollHeight; 
+	} else if(element) 
+	{ // IE Mac	
+		scrW = element.offsetWidth;	
+		scrH = element.offsetHeight;
+	} 
+	return(scrH);
+}
+function getWindowHeight(){
+	var winW, winH; 
+	if(window.innerHeight) 
+	{ // all except IE	
+		winW = window.innerWidth; 
+		winH = window.innerHeight; 
+	} else if (document.documentElement && document.documentElement.clientHeight)
+	{	// IE 6 Strict Mode	
+		winW = document.documentElement.clientWidth;	 
+		winH = document.documentElement.clientHeight; 
+	} else if (document.body) { // other	
+		winW = document.body.clientWidth;	
+		winH = document.body.clientHeight; 
+	}  
+	return(winH);
+}
+//滚动条位置
+function GetPageScroll() 
+{ 
+	var pos=new Object();
+	var x, y; 
+	if(window.pageYOffset) 
+	{	// all except IE	
+		y = window.pageYOffset;	
+		x = window.pageXOffset; 
+	} else if(document.documentElement && document.documentElement.scrollTop) 
+	{	// IE 6 Strict	
+		y = document.documentElement.scrollTop;	
+		x = document.documentElement.scrollLeft; 
+	} else if(document.body) {	// all other IE	
+		y = document.body.scrollTop;	
+		x = document.body.scrollLeft;   
+	} 
+	pos.x=x;
+	pos.y=y;
+	return(pos);
+}
+
+
+var Dragging=function(validateHandler){
+ //参数为验证点击区域是否为可移动区域,如果是返回欲移动元素,负责返回null 
+var draggingObj=null;
+//dragging Dialog 
+var diffX=0;
+var diffY=0;
+function mouseHandler(e){
+	 switch(e.type){
+	 case 'mousedown':
+		draggingObj=validateHandler(e);
+		//验证是否为可点击移动区域 
+		if(draggingObj!=null){
+			diffX=e.clientX-draggingObj.offsetLeft;
+			diffY=e.clientY-draggingObj.offsetTop;
+		 }
+	 break;
+	 case 'mousemove':
+		 if(draggingObj){
+			 draggingObj.style.left=(e.clientX-diffX)+'px';
+			 draggingObj.style.top=(e.clientY-diffY)+'px';
+		 }
+		 break;
+	 case 'mouseup': 
+	 draggingObj =null;
+		 diffX=0;
+		 diffY=0;
+		 break;
+	 }
+}
+;
+ return {
+	 enable:function(){
+		 document.addEventListener('mousedown',mouseHandler);
+		 document.addEventListener('mousemove',mouseHandler);
+		 document.addEventListener('mouseup',mouseHandler);
+		}
+	, disable:function(){
+		 document.removeEventListener('mousedown',mouseHandler);
+		 document.removeEventListener('mousemove',mouseHandler);
+		 document.removeEventListener('mouseup',mouseHandler);
+		}
+	 }
+ }
+ 
+ function getDraggingDialog(e){
+try{
+	var target=e.target;
+	if(target && target.className){
+		while(target ){
+			if(target.className){
+				if(target.className.indexOf('dialog-title')==-1){
+					target=target.offsetParent;
+				}
+				else{
+					break;
+				}
+			}
+			else{
+				target=target.offsetParent;
+			}
+		}
+		
+		if(target!=null){
+			return target.offsetParent;
+		}
+		else{
+			return null;
+		}
+	}
+}
+catch(e){
+
+}
+ 
+}
+// Dragging(getDraggingDialog).enable();
+
+</script> 
+
+	<script language="javascript" src="module/editor/language/<?php echo $currLanguage; ?>.js"></script>
+	<script language="javascript" src="module/editor_palicannon/palicannon.js"></script>
+	<script language="javascript" src="module/editor_palicannon/language/<?php echo $currLanguage; ?>.js"></script>
+	<script language="javascript" src="module/editor_toc/module_function.js"></script>
+	<script language="javascript" src="module/editor_toc/language/<?php echo $currLanguage; ?>.js"></script>
+	<script language="javascript" src="module/editor_bookmark/module_function.js"></script>
+	<script language="javascript" src="module/editor_bookmark/language/<?php echo $currLanguage; ?>.js"></script>
+	<script language="javascript" src="module/editor_layout/module_function.js"></script>
+	<script language="javascript" src="module/editor_layout/language/<?php echo $currLanguage; ?>.js"></script>
+	<script language="javascript" src="module/editor_project/module_function.js"></script>
+	<script language="javascript" src="module/editor_project/language/<?php echo $currLanguage; ?>.js"></script>
+	<script language="javascript" src="module/editor_dictionary/module_function.js"></script>
+	<script language="javascript" src="module/editor_dictionary/language/<?php echo $currLanguage; ?>.js"></script>
+	<script language="javascript" src="module/editor_plugin/module_function.js"></script>
+	<script language="javascript" src="module/editor_plugin/language/<?php echo $currLanguage; ?>.js"></script>
+	<script>
+		guide_init();
+	</script>
+</body>
+
+</html>
+

+ 5730 - 0
public/app/studio/js/editor copy.js

@@ -0,0 +1,5730 @@
+var g_DictWordList = new Array();
+var g_DocWordMean = new Array();
+var g_dictList = new Array();
+var g_DictWordNew = new Object();
+var g_DictWordUpdataIndex = 0; //正在更新的记录在内存字典表中的索引号
+var g_InlineDictWordList = new Array();
+var g_CurrDictBuffer = null;
+var g_key_match_str = "";
+
+var myFormula = Array(); //用户词典里的格位公式
+
+var g_DictCount = 0;
+var g_currEditWord = -1; //当前正在编辑词的id
+var g_eCurrWord = null; //当前正在编辑词的element对象
+var g_currBookMarkColor = "0";
+var g_dictFindParentLevel = 0;
+var g_dictFindAllDone = false;
+
+var g_currAutoMatchDictType = "user";
+
+var g_caseSelect = new Array("", "", "", "");
+
+var gEditorTranslateEditBlockId = -1;
+var gEditorNoteEditBlockId = -1;
+var gEditorHeadingEditBlockId = -1;
+var gEditorNewHeadingBookId = "";
+var gEditorNewHeadingPar = "";
+var g_fileid = 0;
+var g_docid = "";
+
+var g_op = "";
+var g_book = "";
+var g_para = "";
+var g_channal = "";
+
+var gCurrModifyWindowParNo = -1;
+
+var gUserSetup;
+
+var mDictQueue = Array();
+
+var gNaviCurrPanalId = "";
+function setNaviVisibility(strObjId = "") {
+	var objNave = document.getElementById("leftmenuinner");
+	var objblack = document.getElementById("BV");
+	if (strObjId == "") {
+		objblack.style.display = "none";
+		objNave.className = "viewswitch_off";
+	} else {
+		$("#" + strObjId).show();
+		$("#" + strObjId)
+			.siblings()
+			.hide();
+		if (strObjId == gNaviCurrPanalId) {
+			if (objNave.className == "viewswitch_off") {
+				objblack.style.display = "block";
+				objNave.className = "viewswitch_on";
+			} else {
+				objblack.style.display = "none";
+				objNave.className = "viewswitch_off";
+			}
+		} else {
+			objblack.style.display = "block";
+			objNave.className = "viewswitch_on";
+		}
+	}
+	gNaviCurrPanalId = strObjId;
+}
+//选项卡函数
+function select_modyfy_type(itemname, idname) {
+	document.getElementById("modify_detaile").style.display = "none";
+	document.getElementById("modify_bookmark").style.display = "none";
+	document.getElementById("modify_note").style.display = "none";
+	document.getElementById("modify_spell").style.display = "none";
+	document.getElementById("modify_apply").style.display = "block";
+	document.getElementById("detail_li").className = "common-tab_li";
+	document.getElementById("mark_li").className = "common-tab_li";
+	document.getElementById("note_li").className = "common-tab_li";
+	document.getElementById("spell_li").className = "common-tab_li";
+
+	document.getElementById(itemname).style.display = "block";
+	document.getElementById(idname).className = " common-tab_li_act";
+}
+
+function menuSelected(obj) {
+	var objMenuItems = document.getElementsByClassName("menu");
+	for (var i = 0; i < objMenuItems.length; i++) {
+		objMenuItems[i].style.display = "none";
+	}
+	var objThisItem = document.getElementById(obj.value);
+	objThisItem.style.display = "block";
+}
+function menuSelected_2(obj, id_name, class_Name) {
+	var objMenuItems = document.getElementsByClassName(class_Name);
+	var id_array = new Array();
+	for (var i = 0; i < objMenuItems.length; i++) {
+		if (objMenuItems[i].id.split("_")[0] == obj.id.split("_")[0]) {
+			objMenuItems[i].style.display = "none";
+			id_array.push(objMenuItems[i].id);
+		}
+	}
+	var objThisItem = document.getElementById(obj.id);
+	objThisItem.style.display = "block";
+	for (menu_selected_i in id_array) {
+		document.getElementById(id_array[menu_selected_i] + "_li").className = "common-tab_li";
+	}
+	//document.getElementById('content_menu_li').className = " common-tab_li";
+	//document.getElementById('bookmark_menu_li').className = " common-tab_li";
+	refreshBookMark();
+	//document.getElementById('project_menu_li').className = " common-tab_li";
+	//document.getElementById('dictionary_menu_li').className = " common-tab_li";
+	//document.getElementById('layout_menu_li').className = " common-tab_li";
+	//document.getElementById('plugin_menu_li').className = " common-tab_li";
+
+	document.getElementById(id_name).className = " common-tab_li_act";
+}
+
+var editor_xmlhttp;
+var currMatchingDictNum = 0; //当前正在查询的字典索引
+function editor_getDictFileList() {
+	if (window.XMLHttpRequest) {
+		// code for IE7+, Firefox, Chrome, Opera, Safari
+		editor_xmlhttp = new XMLHttpRequest();
+	} else {
+		// code for IE6, IE5
+		editor_xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
+	}
+	var d = new Date();
+	editor_xmlhttp.onreadystatechange = editor_serverResponse;
+	editor_xmlhttp.open("GET", "./dict_get_list.php?t=" + d.getTime(), true);
+	editor_xmlhttp.send();
+}
+
+function editor_serverResponse() {
+	if (editor_xmlhttp.readyState == 4) {
+		// 4 = "loaded"
+		if (editor_xmlhttp.status == 200) {
+			// 200 = "OK"
+			var DictFileList = new Array();
+			eval(editor_xmlhttp.responseText);
+			for (x in local_dict_list) {
+				g_dictList.push(local_dict_list[x]);
+			}
+			var fileList = "";
+			for (x in local_dict_list) {
+				if (local_dict_list[x].used) {
+					fileList =
+						fileList +
+						"<p><input id='id_dict_file_list_" +
+						x +
+						"'  type='checkbox' style='width: 20px; height: 20px' checked onclick='dict_active(this," +
+						x +
+						")'/>" +
+						local_dict_list[x].filename +
+						"<span id='dict_result_" +
+						x +
+						"'></span></p>";
+				} else {
+					fileList =
+						fileList +
+						"<p><input id='id_dict_file_list_" +
+						x +
+						"'  type='checkbox' style='width: 20px; height: 20px' onclick='dict_active(this," +
+						x +
+						")'/>" +
+						local_dict_list[x].filename +
+						"<span id='dict_result_" +
+						x +
+						"'></span></p>";
+				}
+			}
+			document.getElementById("basic_dict_list").innerHTML = fileList;
+		} else {
+			document.getElementById("basic_dict_list") = "Problem retrieving data:" + xmlhttp.statusText;
+		}
+	}
+}
+
+function dict_active(obj, dictIndex) {
+	if (this.checked) {
+		g_dictList[dictIndex].used = true;
+	} else {
+		g_dictList[dictIndex].used = false;
+	}
+}
+
+function editor_windowsInit() {
+	renderChannelList();
+	$("see").on("click",function () {
+		var to = $(this).attr("to");
+		var link;
+		if (to) {
+			link = to;
+		} else {
+			link = $(this).text();
+		}
+		alert(link);
+		dict_search(link);
+	});
+
+	var strSertch = location.search;
+	if (strSertch.length > 0) {
+		strSertch = strSertch.substr(1);
+		let sertchList = strSertch.split("&");
+		for (const param of sertchList) {
+			let item = param.split("=");
+			switch (item[0]) {
+				case "filename":
+					g_filename = item[1];
+					break;
+				case "fileid":
+					g_docid = item[1];
+					break;
+				case "doc_id":
+					g_docid = item[1];
+					break;
+				case "op":
+					g_op = item[1];
+					break;
+				case "book":
+					g_book = item[1];
+					break;
+				case "para":
+				case "par":
+					g_para = item[1];
+					break;
+				case "channal":
+				case "channel":
+					g_channal = item[1];
+					break;
+			}
+		}
+	}
+	checkCookie();
+	setUseMode("Edit");
+
+	editor_getDictFileList();
+	document.getElementById("id_info_window_select").value = "view_dict_curr";
+	windowsSelected(document.getElementById("id_info_window_select"));
+	document.getElementById("id_info_panal").style.height = "0px";
+
+	palicannon_init();
+
+	//载入我的术语词典
+	term_get_my();
+	//载入全部术语词头
+	term_get_all_pali();
+	//载入格位公式
+	load_my_formula();
+
+	switch (g_op) {
+		case "new":
+			document.getElementById("wizard_div").style.display = "flex";
+			document.getElementById("id_editor_menu_select").value = "menu_pali_cannon";
+			menuSelected(document.getElementById("id_editor_menu_select"));
+			createXmlDoc();
+			var_dump(gLocal.gui.newproject);
+			break;
+		case "open":
+			if (g_docid.length > 0) {
+				editor_openProject(g_docid, "pcs");
+			} else {
+				alert(gLocal.gui.nofilename);
+			}
+			break;
+		case "opendb":
+			if (g_docid.length > 0) {
+				editor_openProject(g_docid, "db");
+			} else {
+				alert("no doc id");
+			}
+			break;
+		case "openchannal":
+		case "openchannel":
+			editor_openChannal(g_book, g_para, g_channal);
+			render_channel_info(g_channal);
+			break;
+		case "import":
+			if (g_filename.length > 0) {
+				editor_importOldVer(g_filename);
+				g_filename = g_filename.substring(0, g_filename.length - 4) + ".pcs";
+			} else {
+				alert(gLocal.gui.nofilename);
+			}
+			break;
+		case "loadlist":
+			editor_show_right_tool_bar(true);
+			//get_pc_res_download_list_from_cookie();
+			get_pc_res_download_list_from_string(gDownloadListString);
+			createXmlDoc();
+			pc_loadStream(0);
+			break;
+		default:
+			break;
+	}
+
+	ntf_init();
+}
+
+var g_dict_search_one_pass_done = null;
+var g_dict_search_one_dict_done = null;
+var g_dict_search_all_done = null;
+function editor_dict_all_done() {
+	document.getElementById("editor_doc_notify").innerHTML = gLocal.gui.all_done;
+	var t = setTimeout("document.getElementById('editor_doc_notify').innerHTML=''", 5000);
+}
+function editor_dict_one_dict_done(dictIndex) {
+	document.getElementById("editor_doc_notify").innerHTML =
+		gLocal.gui.round_1 +
+		(g_dictFindParentLevel + 1) +
+		gLocal.gui.round_2 +
+		"【" +
+		g_dictList[dictIndex].name +
+		"】" +
+		gLocal.gui.done;
+	if (dictIndex + 1 < g_dictList.length - 1) {
+		document.getElementById("editor_doc_notify").innerHTML +=
+			"【" + g_dictList[dictIndex + 1].name + "】" + gLocal.gui.checking;
+	}
+}
+
+
+
+function editor_dict_match() {
+	if (currMatchingDictNum < g_dictList.length) {
+		if (g_dictList[currMatchingDictNum].used) {
+			editor_loadDictFromDB(g_filename, g_dictList[currMatchingDictNum]);
+		} else {
+			currMatchingDictNum++;
+			editor_dict_match();
+		}
+		if (g_dictFindAllDone) {
+			dictMatchXMLDoc();
+		}
+	} else {
+		if (g_dictFindParentLevel < 3) {
+			if (g_dict_search_one_pass_done) {
+				g_dict_search_one_pass_done(g_dictFindParentLevel);
+			}
+			currMatchingDictNum = 0;
+			g_dictFindParentLevel++;
+
+			var arrBuffer = dict_get_search_list();
+			g_CurrDictBuffer = JSON.stringify(arrBuffer);
+			dict_mark_word_list_done();
+			document.getElementById("id_dict_match_inner").innerHTML +=
+				"finding parent level " + g_dictFindParentLevel + " buffer:" + arrBuffer.length + "<br>";
+			editor_dict_match();
+		} else {
+			document.getElementById("id_dict_match_inner").innerHTML +=
+				"Max Parent Level " + g_dictFindParentLevel + " Stop!<br>";
+			if (g_dict_search_all_done) {
+				g_dict_search_all_done();
+			}
+			dict_mark_word_list_done();
+			dictMatchXMLDoc();
+		}
+	}
+}
+
+function dict_push_word_to_download_list(word, level) {
+	for (var i in g_InlineDictWordList) {
+		if (g_InlineDictWordList[i].word == word) {
+			return;
+		}
+	}
+	var newWord = new Object();
+	newWord.word = word;
+	newWord.done = false;
+	newWord.level = level;
+	g_InlineDictWordList.push(newWord);
+}
+
+function dict_get_search_list() {
+	var output = new Array();
+	for (var i in g_InlineDictWordList) {
+		if (g_InlineDictWordList[i].done == false) {
+			output.push(g_InlineDictWordList[i]);
+		}
+	}
+
+	return output;
+}
+
+function dict_mark_word_list_done() {
+	for (var i in g_InlineDictWordList) {
+		g_InlineDictWordList[i].done = true;
+	}
+}
+
+function dict_refresh_word_download_list() {
+	var xDict = gXmlBookDataBody.getElementsByTagName("word");
+	for (var iword = 0; iword < xDict.length; iword++) {
+		var pali = com_getPaliReal(getNodeText(xDict[iword], "real"));
+		var part = getNodeText(xDict[iword], "org");
+		var type = getNodeText(xDict[iword], "case").split("#");
+		if (pali != "") {
+			dict_push_word_to_download_list(pali, 0);
+		}
+		if (part != "") {
+			var level = 1;
+			if (type == ".un.") {
+				level = 0;
+			}
+			var arrPart = part.split("+");
+			for (var ipart in arrPart) {
+				var onePart = com_getPaliReal(arrPart[ipart]);
+				if (onePart != "") {
+					dict_push_word_to_download_list(onePart, level);
+				}
+			}
+		}
+	}
+
+	for (var i in g_DictWordList) {
+		var pali = com_getPaliReal(g_DictWordList[i].Pali);
+		var wparent = com_getPaliReal(g_DictWordList[i].Parent);
+		var part = g_DictWordList[i].Factors;
+		var type = g_DictWordList[i].Type;
+		var level = 1;
+		if (type == ".un.") {
+			level = 0;
+		}
+		if (wparent != "") {
+			dict_push_word_to_download_list(wparent, level);
+		}
+		if (part != "") {
+			var arrPart = part.split("+");
+			for (var ipart in arrPart) {
+				var onePart = com_getPaliReal(arrPart[ipart]);
+				if (onePart != "") {
+					dict_push_word_to_download_list(onePart, level);
+				}
+			}
+		}
+	}
+}
+
+function dict_inid_ild_word_list() {
+	g_InlineDictWordList = new Array();
+	for (var i in g_DictWordList) {
+		var pali = g_DictWordList[i].Pali;
+		var wparent = g_DictWordList[i].Parent;
+		var part = g_DictWordList[i].Factors;
+		var type = g_DictWordList[i].Type;
+		var level = 1;
+		dict_push_word_to_download_list(g_DictWordList[i].Pali, 0);
+	}
+	dict_mark_word_list_done();
+}
+
+function getAllWordList() {
+	var output = new Array();
+	if (g_dictFindParentLevel == 0) {
+		var xDict = gXmlBookDataBody.getElementsByTagName("word");
+		for (iword = 0; iword < xDict.length; iword++) {
+			pali = getNodeText(xDict[iword], "real");
+			if (isPaliWord(pali)) {
+				output.push(pali);
+			}
+		}
+	} else {
+		var currLevel = g_dictFindParentLevel - 1;
+		for (i = 0; i < g_DictWordList.length; i++) {
+			if (g_DictWordList[i].ParentLevel == currLevel) {
+				if (g_DictWordList[i].Parent.length > 0 && g_DictWordList[i].Parent != g_DictWordList[i].Pali) {
+					var arrList = g_DictWordList[i].Parent.split("$");
+					var paliInParent = false;
+					for (x = 0; x < arrList.length; x++) {
+						if (arrList[x] == g_DictWordList[i].Pali) {
+							paliInParent = true;
+						}
+					}
+					if (paliInParent == false) {
+						output.push(g_DictWordList[i].Parent);
+					}
+				}
+				if (g_DictWordList[i].Factors.length > 0) {
+					arrList = g_DictWordList[i].Factors.split("+");
+					for (x = 0; x < arrList.length; x++) {
+						if (arrList[x] != g_DictWordList[i].Pali) {
+							output.push(arrList[x]);
+						}
+					}
+				}
+			}
+		}
+	}
+	if (output.length > 0) {
+		return output.join("$");
+	} else {
+		return null;
+	}
+}
+
+var editor_DictXmlHttp = null;
+function editor_loadDictFromDB(strFileName, dictName) {
+	var xmlText = "";
+
+	if (window.XMLHttpRequest) {
+		// code for IE7, Firefox, Opera, etc.
+		editor_DictXmlHttp = new XMLHttpRequest();
+	} else if (window.ActiveXObject) {
+		// code for IE6, IE5
+		editor_DictXmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
+	}
+
+	if (editor_DictXmlHttp != null) {
+		var d = new Date();
+		var strLink =
+			"./dict_find.php?mode=xml&filename=" + strFileName + "&type=" + dictName.type + "&dict=" + dictName.filename;
+		editor_DictXmlHttp.onreadystatechange = editor_dict_serverResponse;
+		//var wordList=getAllWordList();
+
+		var wordList = g_CurrDictBuffer;
+
+		if (wordList != null) {
+			document.getElementById("id_dict_msg").innerHTML = "开始匹配字典" + dictName.name;
+			editor_DictXmlHttp.open("POST", "./dict_find2.php", true);
+			//editor_DictXmlHttp.send(dictName.type+"$"+dictName.filename+"$"+g_dictFindParentLevel+"$"+wordList);
+			editor_DictXmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
+			editor_DictXmlHttp.send(
+				"type=" +
+					dictName.type +
+					"&filename=" +
+					dictName.filename +
+					"&level=" +
+					g_dictFindParentLevel +
+					"&data=" +
+					wordList
+			);
+		} else {
+			g_dictFindAllDone = true;
+			document.getElementById("id_dict_match_inner").innerHTML += "all done!";
+			if (g_dict_search_all_done) {
+				g_dict_search_all_done();
+			}
+		}
+	} else {
+		alert("Your browser does not support XMLHTTP.");
+	}
+}
+
+function editor_dict_serverResponse() {
+	if (editor_DictXmlHttp.readyState == 4) {
+		// 4 = "loaded"
+		document.getElementById("id_dict_msg").innerHTML = "已经获取字典数据";
+		if (editor_DictXmlHttp.status == 200) {
+			// 200 = "OK"
+			var xmlText = editor_DictXmlHttp.responseText;
+
+			if (window.DOMParser) {
+				parser = new DOMParser();
+				xmlDict = parser.parseFromString(xmlText, "text/xml");
+			} // Internet Explorer
+			else {
+				xmlDict = new ActiveXObject("Microsoft.XMLDOM");
+				xmlDict.async = "false";
+				xmlDict.loadXML(xmlText);
+			}
+
+			if (xmlDict == null) {
+				alert("error:can not load dict.");
+				return;
+			}
+
+			document.getElementById("dict_result_" + currMatchingDictNum).innerHTML =
+				" : " + g_dictFindParentLevel + "-" + xmlDict.getElementsByTagName("word").length;
+			dictDataParse(xmlDict, currMatchingDictNum);
+			editor_addDictDataToXmlDoc(xmlDict);
+		} else {
+			document.getElementById("id_dict_match_inner").innerHTML =
+				"Problem retrieving data:" + editor_DictXmlHttp.statusText;
+		}
+		if (g_dict_search_one_dict_done) {
+			g_dict_search_one_dict_done(currMatchingDictNum);
+		}
+		currMatchingDictNum++;
+		editor_dict_match();
+	}
+}
+//添加字典数据到内联字典
+function editor_addDictDataToXmlDoc(xmlDictData) {
+	var xDict = xmlDictData.getElementsByTagName("word");
+	for (iword = 0; iword < xDict.length; iword++) {
+		gXmlBookDataInlineDict.appendChild(xDict[iword].cloneNode(true));
+	}
+}
+/*解析字典数据*/
+function dictDataParse(xmlDictData, dictID) {
+	document.getElementById("id_dict_msg").innerHTML = "正在解析字典数据";
+	var xDict = xmlDictData.getElementsByTagName("word");
+	var tOut = "";
+	var sDictPali = "";
+	var sDictId = "";
+	var sDictOrg = "";
+	var sDictMean = "";
+	var sDictCase = "";
+	for (iword = 0; iword < xDict.length; iword++) {
+		var objDictItem = new Object(); /*一个字典元素*/
+		objDictItem.Id = getNodeText(xDict[iword], "id");
+		objDictItem.Guid = getNodeText(xDict[iword], "guid");
+		objDictItem.Pali = getNodeText(xDict[iword], "pali");
+		objDictItem.Mean = getNodeText(xDict[iword], "mean");
+		objDictItem.Type = getNodeText(xDict[iword], "type");
+		objDictItem.Gramma = getNodeText(xDict[iword], "gramma");
+		objDictItem.Parent = getNodeText(xDict[iword], "parent");
+		objDictItem.Factors = getNodeText(xDict[iword], "factors");
+		objDictItem.PartId = getNodeText(xDict[iword], "part_id");
+		objDictItem.FactorMean = getNodeText(xDict[iword], "factormean");
+		objDictItem.Note = getNodeText(xDict[iword], "note");
+		objDictItem.Confer = getNodeText(xDict[iword], "confer");
+		objDictItem.Status = getNodeText(xDict[iword], "status");
+		objDictItem.Enable = getNodeText(xDict[iword], "enable");
+		objDictItem.Language = getNodeText(xDict[iword], "language");
+		objDictItem.dictname = getNodeText(xDict[iword], "dict_name");
+		//objDictItem.dictname=g_dictList[dictID].name;
+		objDictItem.dictType = g_dictList[dictID].type;
+		objDictItem.fileName = g_dictList[dictID].filename;
+		objDictItem.dictID = dictID;
+		objDictItem.ParentLevel = g_dictFindParentLevel;
+
+		//插入数据到内联字典索引表
+		var level = 1;
+		if (objDictItem.Type == ".un.") {
+			level = 0;
+		}
+		if (objDictItem.Parent != "") {
+			dict_push_word_to_download_list(objDictItem.Parent, level);
+		}
+		if (objDictItem.Factors != "") {
+			var arrPart = objDictItem.Factors.split("+");
+			for (var ipart in arrPart) {
+				dict_push_word_to_download_list(arrPart[ipart], level);
+			}
+		}
+
+		if (objDictItem.Case != "?" || objDictItem.Org != "?" || objDictItem.Mean != "?") {
+			pushNewDictItem(g_DictWordList, objDictItem);
+		}
+	}
+	//dict end
+}
+
+function pushNewDictItem(inArray, objNew) {
+	for (const iterator of inArray) {
+		if (iterator.Id == objNew.Id && iterator.dictID == objNew.dictID) {
+			return;
+		}
+	}
+	inArray.push(objNew);
+}
+
+function dictShowAsTable() {
+	var outData = "<table>";
+	for (var i = 0; i < g_DictWordList.length; i++) {
+		outData += "<tr class='dict_row" + g_DictWordList[i].ParentLevel + "'>";
+		outData = outData + "<td>" + g_DictWordList[i].dictname + "</td>";
+		outData = outData + "<td>" + g_DictWordList[i].Pali + "</td>";
+		outData = outData + "<td>" + g_DictWordList[i].Type + "</td>";
+		outData = outData + "<td>" + g_DictWordList[i].Gramma + "</td>";
+		outData = outData + "<td>" + g_DictWordList[i].Parent + "</td>";
+		outData = outData + "<td>" + g_DictWordList[i].Mean + "</td>";
+		outData = outData + "<td>" + g_DictWordList[i].Factors + "</td>";
+		outData = outData + "</tr>";
+	}
+	outData += "</table>";
+	return outData;
+}
+
+var g_CurrActiveRecorder = "new";
+function setCurrActiveRecorder(recorderName) {
+	g_CurrActiveRecorder = recorderName;
+}
+
+function updataCurrActiveRecorder(filder, value) {
+	if (filder == "all") {
+	} else {
+		document.getElementById(filder + "_" + g_CurrActiveRecorder).value = value;
+		mean_change(g_CurrActiveRecorder);
+	}
+}
+function addToCurrActiveRecorder(filder, value) {
+	if (filder == "all") {
+	} else {
+		meanString = document.getElementById(filder + "_" + g_CurrActiveRecorder).value;
+		meanList = meanString.split("$");
+		for (i in meanList) {
+			if (meanList[i] == value) {
+				return;
+			}
+		}
+		document.getElementById(filder + "_" + g_CurrActiveRecorder).value += "$" + value;
+		mean_change(g_CurrActiveRecorder);
+	}
+}
+
+function updataFactorMeanPrev(id, strNew) {
+	//if(strNew!=null){
+	//document.getElementById("id_factormean_prev_"+id).value=strNew;
+	//}
+}
+
+function factorMeanItemChange(id, iPos, count, obj) {
+	//alert(id+":"+iPos+":"+newMean);
+	newMean = obj.value;
+	var factorMeanPrevString = document.getElementById("id_factormean_prev_" + id).value;
+	currFactorMeanPrevList = factorMeanPrevString.split("+");
+	currFactorMeanPrevList[iPos] = newMean;
+	document.getElementById("id_factormean_prev_" + id).value = currFactorMeanPrevList.join("+");
+}
+
+function makeFactorBlock(factorStr, id) {
+	var output = "";
+	var factorList = factorStr.split("+");
+	var defualtFactorMeanList = new Array();
+
+	for (iFactor in factorList) {
+		arrFM = findAllMeanInDict(factorList[iFactor], 10);
+		if (arrFM.length == 0) {
+			arrFM[0] = "unkow";
+		}
+		output +=
+			"<select onclick=\"factorMeanItemChange('" +
+			id +
+			"','" +
+			iFactor +
+			"','" +
+			factorList.length +
+			"',this)\">";
+		defualtFactorMeanList.push(arrFM[0]);
+		for (iFM in arrFM) {
+			output += "<option value='" + arrFM[iFM] + "' >" + arrFM[iFM] + "</option>";
+		}
+		output += "</select>";
+		if (iFactor < factorList.length - 1) {
+			output += "+";
+		}
+	}
+	//updataFactorMeanPrev(id,defualtFactorMeanList.join("+"));
+	g_FactorMean = defualtFactorMeanList.join("+");
+	return output;
+}
+function factor_change(id) {
+	var factorString = document.getElementById("id_dict_user_factors_" + id).value;
+	document.getElementById("id_factor_block_" + id).innerHTML = makeFactorBlock(factorString, id);
+}
+
+function makeMeanBlock(meanStr, id) {
+	var output = "";
+	var meanList = meanStr.split("$");
+	for (i in meanList) {
+		output += '<div class="mean_cell">';
+		output += '<div class="button_shell">';
+		output += '<p class="mean_button" onclick="meanBlockMove(\'' + id + "'," + i + "," + (i - 1) + ')">«</p>';
+		output += "</div>";
+		output +=
+			'<p class="mean_inner" onclick="meanBlockMove(\'' + id + "'," + i + "," + 0 + ')">' + meanList[i] + "</p>";
+		output += '<div class="button_shell">';
+		output += '<p class="mean_button" onclick="meanBlockDelete(\'' + id + "'," + i + ')">x</p>';
+		output += "</div>";
+		output += "</div>";
+	}
+	return output;
+}
+
+function mean_change(id) {
+	var meanString = document.getElementById("id_dict_user_mean_" + id).value;
+	document.getElementById("id_mean_block_" + id).innerHTML = makeMeanBlock(meanString, id);
+}
+
+function meanBlockDelete(id, indexDelete) {
+	var meanString = document.getElementById("id_dict_user_mean_" + id).value;
+	var meanBlock = "";
+	var meanList = meanString.split("$");
+	meanList.splice(indexDelete, 1);
+	var newString = meanList.join("$");
+	document.getElementById("id_dict_user_mean_" + id).value = newString;
+	mean_change(id);
+}
+
+function meanBlockMove(id, moveFrom, moveTo) {
+	var meanString = document.getElementById("id_dict_user_mean_" + id).value;
+	var meanBlock = "";
+	var meanList = meanString.split("$");
+	if (moveTo < 0) {
+		moveTo = 0;
+	}
+	if (moveFrom == moveTo) {
+		return;
+	}
+	var temp = meanList[moveTo];
+	meanList[moveTo] = meanList[moveFrom];
+	for (i = moveFrom - 1; i > moveTo; i--) {
+		meanList[i + 1] = meanList[i];
+	}
+	meanList[moveTo + 1] = temp;
+	var newString = meanList.join("$");
+	/*
+	for(x in meanList){
+		newString+=meanList[x]+"$";
+	}
+	*/
+	document.getElementById("id_dict_user_mean_" + id).value = newString;
+	mean_change(id);
+}
+
+function addAutoMeanToFactorMean(id) {
+	document.getElementById("id_dict_user_fm_" + id).value = document.getElementById("id_factormean_prev_" + id).value;
+}
+
+//show current selected word in the word window to modify
+var g_WordTableCurrWord = "";
+function dictCurrWordShowAsTable(inCurrWord) {
+	g_WordTableCurrWord = inCurrWord;
+	g_CurrActiveRecorder = "new";
+	var outData = "";
+	var listParent = new Array();
+	var listFactors = new Array();
+	var listChildren = new Array();
+	outData += "<p class='word_parent'>" + gLocal.gui.parent + ":";
+	for (var i = 0; i < g_DictWordList.length; i++) {
+		if (g_DictWordList[i].Pali == inCurrWord) {
+			if (g_DictWordList[i].Parent.length > 0) {
+				var find = false;
+				for (x in listParent) {
+					if (listParent[x] == g_DictWordList[i].Parent) {
+						find = true;
+						break;
+					}
+				}
+				if (!find) {
+					listParent.push(g_DictWordList[i].Parent);
+				}
+			}
+			if (g_DictWordList[i].Factors.length > 0) {
+				arrFactors = g_DictWordList[i].Factors.split("+");
+				for (iFactors in arrFactors) {
+					var find = false;
+					for (x in listFactors) {
+						if (listFactors[x] == arrFactors[iFactors]) {
+							find = true;
+							break;
+						}
+					}
+					if (!find) {
+						listFactors.push(arrFactors[iFactors]);
+					}
+				}
+			}
+		}
+	}
+	for (x in listParent) {
+		outData += "<a onclick=\"showCurrWordTable('" + listParent[x] + "')\">" + listParent[x] + "</a> ";
+	}
+	for (x in listFactors) {
+		outData += "[<a onclick=\"showCurrWordTable('" + listFactors[x] + "')\">" + listFactors[x] + "</a>] ";
+	}
+	outData += "</p>";
+
+	outData = outData + '<p class="word_current">└' + inCurrWord + "</p>";
+
+	outData += "<p class='word_child'>└" + gLocal.gui.children + ": ";
+	for (var i = 0; i < g_DictWordList.length; i++) {
+		if (g_DictWordList[i].Parent == inCurrWord) {
+			if (g_DictWordList[i].Pali.length > 0) {
+				var find = false;
+				for (x in listChildren) {
+					if (listChildren[x] == g_DictWordList[i].Pali) {
+						find = true;
+						break;
+					}
+				}
+				if (!find) {
+					listChildren.push(g_DictWordList[i].Pali);
+				}
+			}
+		}
+	}
+	for (x in listChildren) {
+		outData += "<a onclick=\"showCurrWordTable('" + listChildren[x] + "')\">" + listChildren[x] + "</a> ";
+	}
+	outData += "</p>";
+
+	//get new recorder filder
+	var newRecorder = new Object();
+	newRecorder.Type = "";
+	newRecorder.Gramma = "";
+	newRecorder.Parent = "";
+	newRecorder.Mean = "";
+	newRecorder.Note = "";
+	newRecorder.Factors = "";
+	newRecorder.FactorMean = "";
+	newRecorder.Confer = "";
+	newRecorder.Status = "";
+	newRecorder.Lock = "";
+	newRecorder.Tag = "";
+	var newMeanList = new Array();
+	for (var i = 0; i < g_DictWordList.length; i++) {
+		if (g_DictWordList[i].Pali == inCurrWord) {
+			if (newRecorder.Type == "" && g_DictWordList[i].Type.length > 0) {
+				newRecorder.Type = g_DictWordList[i].Type;
+			}
+			if (newRecorder.Gramma == "" && g_DictWordList[i].Gramma.length > 0) {
+				newRecorder.Gramma = g_DictWordList[i].Gramma;
+			}
+			if (newRecorder.Parent == "" && g_DictWordList[i].Parent.length > 0) {
+				newRecorder.Parent = g_DictWordList[i].Parent;
+			}
+			if (g_DictWordList[i].Mean.length > 0) {
+				otherMean = g_DictWordList[i].Mean.split("$");
+				for (iMean in otherMean) {
+					pushNewToList(newMeanList, otherMean[iMean]);
+				}
+				newRecorder.Mean = newMeanList.join("$");
+			}
+			if (newRecorder.Factors == "" && g_DictWordList[i].Factors.length > 0) {
+				newRecorder.Factors = g_DictWordList[i].Factors;
+			}
+			if (newRecorder.FactorMean == "" && g_DictWordList[i].FactorMean.length > 0) {
+				newRecorder.FactorMean = g_DictWordList[i].FactorMean;
+			}
+			if (newRecorder.Note == "" && g_DictWordList[i].Note) {
+				if (g_DictWordList[i].Note.length > 0) {
+					newRecorder.Note = g_DictWordList[i].Note;
+				}
+			}
+		}
+	}
+	newMeanBlock = makeMeanBlock(newRecorder.Mean, "new");
+	newFactorBlock = makeFactorBlock(newRecorder.Factors, "new");
+	newFactorMeanPrevString = g_FactorMean;
+
+	outData += '<div class="word_edit">';
+	outData += '	<div class="word_edit_head">';
+	outData += '<input type="input" id="id_dict_user_id_new" hidden value="0" >';
+	outData += '<input type="input" id="id_dict_user_pali_new" hidden value="' + inCurrWord + '" >';
+	outData +=
+		'		<button type="button" onclick="editor_UserDictUpdata(\'new\',this)">' + gLocal.gui.newword + "</button>";
+	outData += "		" + gLocal.gui.wordtype + ":";
+	outData += '	<select name="type" id="id_dict_user_type_new" onchange="typeChange(this)">';
+	for (x in gLocal.type_str) {
+		if (gLocal.type_str[x].id == newRecorder.Type) {
+			outData =
+				outData +
+				'<option value="' +
+				gLocal.type_str[x].id +
+				'" selected>' +
+				gLocal.type_str[x].value +
+				"</option>";
+		} else {
+			outData =
+				outData + '<option value="' + gLocal.type_str[x].id + '">' + gLocal.type_str[x].value + "</option>";
+		}
+	}
+	outData = outData + "	</select>";
+	outData +=
+		"		" +
+		gLocal.gui.gramma +
+		':<input type="input" id="id_dict_user_gramma_new" size="12" value="' +
+		newRecorder.Gramma +
+		'" />';
+	outData +=
+		"		" +
+		gLocal.gui.parent +
+		':<input type="input" id="id_dict_user_parent_new" size="12" value="' +
+		newRecorder.Parent +
+		'" />';
+	outData +=
+		"		" +
+		gLocal.gui.part +
+		':<input type="input" id="id_dict_user_factors_new" size="' +
+		inCurrWord.length * 1.2 +
+		'" value="' +
+		newRecorder.Factors +
+		'" onkeyup="factor_change(\'new\')" />';
+	outData += "		" + gLocal.gui.partmeaning + ":" + newFactorBlock;
+	outData += '<button type="button" onclick="addAutoMeanToFactorMean(\'new\')" >▶</button>';
+	outData +=
+		'		<input type="input" id="id_dict_user_fm_new" size="' +
+		inCurrWord.length +
+		'" value="' +
+		newRecorder.FactorMean +
+		'" />';
+	outData += "	</div>";
+	outData += '	<div class="word_edit_mean">';
+	outData +=
+		"	" +
+		gLocal.gui.meaning +
+		':<input type="input" size=\'50\' id="id_dict_user_mean_new" value="' +
+		newRecorder.Mean +
+		"\" onkeyup=\"mean_change('new')\"/><div class='mean_block' id='id_mean_block_new'>" +
+		newMeanBlock +
+		"</div>";
+	outData += "	</div>";
+	outData += "<input type='text' id='id_factormean_prev_new' value='" + newFactorMeanPrevString + "' hidden />";
+	outData += '	<div class="word_edit_note">';
+	outData +=
+		gLocal.gui.note +
+		":<br /><textarea id=\"id_dict_user_note_new\" rows='3' cols='100'>" +
+		newRecorder.Note +
+		"</textarea>";
+	outData += "	</div>";
+	outData += "</div>";
+
+	//draw new
+
+	/*
+		outData=outData+"<h3>New:</h3>";
+		outData+="<table>";
+		
+		outData+="<tr class='dict_row_new'><td></td><td>Type</td><td>Parent</td><td>Meaning</td></tr>";
+		outData+="<tr class='dict_row_new'><td><input type='radio' name='dictupdata' checked onclick=\"setCurrActiveRecorder('new')\" /></td>"+
+		"<td><input type=\"input\" id=\"id_dict_user_id_new\" hidden value=\"0\" >"+
+		"<input type=\"input\" id=\"id_dict_user_pali_new\" hidden value=\""+inCurrWord+"\" >"+
+		"	<select name=\"type\" id=\"id_dict_user_type_new\" onchange=\"typeChange(this)\">";
+			for (x in gLocal.type_str){
+			if(gLocal.type_str[x].id==newRecorder.Type){
+				outData=outData+"<option value=\""+gLocal.type_str[x].id+"\" selected>"+gLocal.type_str[x].value+"</option>";
+			}
+			else{
+				outData=outData+"<option value=\""+gLocal.type_str[x].id+"\">"+gLocal.type_str[x].value+"</option>";
+			}
+		}
+		outData=outData+"	</select>";
+		outData=outData+"</td>";
+		outData=outData+"<td><input type=\"input\" id=\"id_dict_user_parent_new\" size=\"12\" value=\""+newRecorder.Parent+"\" /></td>";
+		outData=outData+"<td><input type=\"input\" size='50' id=\"id_dict_user_mean_new\" value=\""+newRecorder.Mean+"\" onkeyup=\"mean_change('new')\"/><div class='mean_block' id='id_mean_block_new'>"+newMeanBlock+"</div></td>";
+		outData+="</tr>";
+		outData+="<tr class='dict_row_new'><td></td><td>Gramma</td><td>Parts</td><td>Parts Meaning</td></tr>";
+		outData+="<tr class='dict_row_new'><td><button type=\"button\" onclick=\"editor_UserDictUpdata('new',this)\">Submit</button></td>";
+		outData+="<td><input type=\"input\" id=\"id_dict_user_gramma_new\" size=\"12\" value=\""+newRecorder.Gramma+"\" /></td>";
+		outData+="<td><input type=\"input\" id=\"id_dict_user_factors_new\" size=\""+inCurrWord.length*1.2+"\" value=\""+newRecorder.Factors+"\" onkeyup=\"factor_change('new')\" />";
+		outData+="<br /><input type='text' id='id_factormean_prev_new' value='"+newFactorMeanPrevString+"' hidden />";
+		outData+="<div class='factor' id='id_factor_block_new'>"+newFactorBlock+"</div>";
+		outData+="<button type=\"button\" onclick=\"addAutoMeanToFactorMean('new')\" >▶</button></td>";
+		outData+="<td><input type=\"input\" id=\"id_dict_user_fm_new\" size=\""+inCurrWord.length*1.5+"\" value=\""+newRecorder.FactorMean+"\" /></td></tr>";
+		outData+="<tr class='dict_row_new'><td>Note</td>";
+		outData+="<td colspan=3><textarea id=\"id_dict_user_note_new\" rows='3' cols='100'>"+newRecorder.Note+"</textarea></td></tr>"
+		
+		outData+="</table>";
+		
+	*/
+	// end of New
+
+	outData += "<h3>" + gLocal.gui.userdict + "</h3>";
+	outData += "<table>";
+
+	outData =
+		outData +
+		"<tr><th></th><th>" +
+		gLocal.gui.dictsouce +
+		"</th> <th>" +
+		gLocal.gui.wordtype +
+		"</th> <th>" +
+		gLocal.gui.gramma +
+		"</th> <th>" +
+		gLocal.gui.parent +
+		"</th> <th>" +
+		gLocal.gui.meaning +
+		"</th> <th>" +
+		gLocal.gui.part +
+		"</th> <th>" +
+		gLocal.gui.partmeaning +
+		"</th> <th></th> </tr>";
+	for (var i = 0; i < g_DictWordList.length; i++) {
+		if (g_DictWordList[i].Pali == inCurrWord) {
+			if (g_DictWordList[i].dictname == "用户字典") {
+				outData += "<tr class='dict_row" + g_DictWordList[i].ParentLevel + "'>";
+				outData +=
+					"<td><input type=radio name='dictupdata' onclick=\"setCurrActiveRecorder('" + i + "')\" /></td>";
+				outData = outData + "<td>" + g_DictWordList[i].dictname + "</td>";
+				outData =
+					outData +
+					'<td><input type="input" id="id_dict_user_id_' +
+					i +
+					'" hidden value="' +
+					g_DictWordList[i].Id +
+					'" >';
+				outData =
+					outData +
+					'<input type="input" id="id_dict_user_pali_' +
+					i +
+					'" hidden value="' +
+					g_DictWordList[i].Pali +
+					'" >';
+				outData = outData + '	<select name="type" id="id_dict_user_type_' + i + '" onchange="typeChange(this)">';
+				for (x in gLocal.type_str) {
+					if (gLocal.type_str[x].id == g_DictWordList[i].Type) {
+						outData =
+							outData +
+							'<option value="' +
+							gLocal.type_str[x].id +
+							'" selected>' +
+							gLocal.type_str[x].value +
+							"</option>";
+					} else {
+						outData =
+							outData +
+							'<option value="' +
+							gLocal.type_str[x].id +
+							'">' +
+							gLocal.type_str[x].value +
+							"</option>";
+					}
+				}
+				outData = outData + "	</select>";
+				outData = outData + "</td>";
+				outData =
+					outData +
+					'<td><input type="input" id="id_dict_user_gramma_' +
+					i +
+					'" size="12" value="' +
+					g_DictWordList[i].Gramma +
+					'" /></td>';
+				outData =
+					outData +
+					'<td><input type="input" id="id_dict_user_parent_' +
+					i +
+					'" size="12" value="' +
+					g_DictWordList[i].Parent +
+					'" />';
+				outData =
+					outData +
+					"<button type='button' onclick=\"showCurrWordTable('" +
+					g_DictWordList[i].Parent +
+					"')\">»</button></td>";
+				outData =
+					outData +
+					'<td><input type="input" size=\'50\' id="id_dict_user_mean_' +
+					i +
+					'" value="' +
+					g_DictWordList[i].Mean +
+					"\" onkeyup='mean_change(" +
+					i +
+					")' /><div class='mean_block' id='id_mean_block_" +
+					i +
+					"'></div></td>";
+				outData =
+					outData +
+					'<td><input type="input" id="id_dict_user_factors_' +
+					i +
+					'" size="15" value="' +
+					g_DictWordList[i].Factors +
+					'" /></td>';
+				outData =
+					outData +
+					'<td><input type="input" id="id_dict_user_fm_' +
+					i +
+					'" size="15" value="' +
+					g_DictWordList[i].FactorMean +
+					'" /></td>';
+				outData =
+					outData +
+					'<td><button type="button" onclick="editor_UserDictUpdata(\'' +
+					i +
+					"',this)\">Updata</button></td>";
+				outData = outData + "</tr>";
+				outData += "<tr ><td>Note</td>";
+				outData +=
+					'<td colspan=3><textarea id="id_dict_user_note_' +
+					i +
+					"\" rows='3' cols='100'>" +
+					g_DictWordList[i].Note +
+					"</textarea></td></tr>";
+			}
+		}
+	}
+
+	/*
+	for(var i=0;i<g_DictWordList.length;i++){
+		if(g_DictWordList[i].Pali==inCurrWord){
+			if(g_DictWordList[i].dictname=="用户字典"){
+				outData+="<tr ><td></td><td>Type</td><td>Parent</td><td>Meaning</td></tr>";
+				outData+="<tr ><td><input type='radio' name='dictupdata' checked onclick=\"setCurrActiveRecorder('new')\" /></td>"+
+				"<td><input type=\"input\" id=\"id_dict_user_id_new"+i+"\" hidden value=\"0\" >"+
+				"<input type=\"input\" id=\"id_dict_user_pali_"+i+"\" hidden value=\""+inCurrWord+"\" >"+
+				"	<select name=\"type\" id=\"id_dict_user_type_"+i+"\" onchange=\"typeChange(this)\">";
+					for (x in gLocal.type_str){
+					if(gLocal.type_str[x].id==g_DictWordList[i].Type){
+						outData=outData+"<option value=\""+gLocal.type_str[x].id+"\" selected>"+gLocal.type_str[x].value+"</option>";
+					}
+					else{
+						outData=outData+"<option value=\""+gLocal.type_str[x].id+"\">"+gLocal.type_str[x].value+"</option>";
+					}
+				}
+				outData=outData+"	</select>";
+				outData=outData+"</td>";
+				outData=outData+"<td><input type=\"input\" id=\"id_dict_user_parent_"+i+"\" size=\"12\" value=\""+g_DictWordList[i].Parent+"\" /></td>";
+				outData=outData+"<td><input type=\"input\" size='50' id=\"id_dict_user_mean_"+i+"\" value=\""+g_DictWordList[i].Mean+"\" onkeyup=\"mean_change('new')\"/><div class='mean_block' id='id_mean_block_new'>"+newMeanBlock+"</div></td>";
+				outData+="</tr>";
+				outData+="<tr ><td></td><td>Gramma</td><td>Parts</td><td>Parts Meaning</td></tr>";
+				outData+="<tr ><td><button type=\"button\" onclick=\"editor_UserDictUpdata('"+i+"',this)\">Submit</button></td>";
+				outData+="<td><input type=\"input\" id=\"id_dict_user_gramma_"+i+"\" size=\"12\" value=\""+g_DictWordList[i].Gramma+"\" /></td>";
+				outData+="<td><input type=\"input\" id=\"id_dict_user_factors_"+i+"\" size=\""+inCurrWord.length*1.2+"\" value=\""+g_DictWordList[i].Factors+"\" onkeyup=\"factor_change('new')\" />";
+				outData+="<br /><input type='text' id='id_factormean_prev_"+i+"' value='"+newFactorMeanPrevString+"' hidden />";
+				outData+="<div class='factor' id='id_factor_block_"+i+"'>"+newFactorBlock+"</div>";
+				outData+="<button type=\"button\" onclick=\"addAutoMeanToFactorMean('"+i+"')\" >▲</button></td>";
+				outData+="<td><input type=\"input\" id=\"id_dict_user_fm_"+i+"\" size=\""+inCurrWord.length*1.5+"\" value=\""+g_DictWordList[i].FactorMean+"\" /></td></tr>";
+				outData+="<tr ><td>Note</td>";
+				outData+="<td colspan=3><textarea id=\"id_dict_user_note_"+i+"\" rows='3' cols='100'>"+g_DictWordList[i].Note+"</textarea></td></tr>"
+			
+			}
+		}
+	}
+	*/
+	outData = outData + "</table>";
+
+	outData += "<h3>" + gLocal.gui.otherdict + "</h3>";
+	outData += "<table>";
+	outData =
+		outData +
+		"<tr><th></th><th>" +
+		gLocal.gui.dictsouce +
+		"</th> <th>" +
+		gLocal.gui.wordtype +
+		"</th> <th>" +
+		gLocal.gui.gramma +
+		"</th> <th>" +
+		gLocal.gui.parent +
+		"</th> <th>" +
+		gLocal.gui.meaning +
+		"</th> <th>" +
+		gLocal.gui.part +
+		"</th> <th>" +
+		gLocal.gui.partmeaning +
+		"</th> <th></th> </tr>";
+
+	for (var i = 0; i < g_DictWordList.length; i++) {
+		if (g_DictWordList[i].Pali == inCurrWord) {
+			if (g_DictWordList[i].dictname == "用户字典") {
+			} else {
+				outData += "<tr class='dict_row" + g_DictWordList[i].ParentLevel + "'>";
+				outData += '<td><button type="button" >▲</button></td>';
+				outData = outData + "<td>" + g_DictWordList[i].dictname + "</td>";
+				outData =
+					outData +
+					"<td><button type=\"button\" onclick=\"updataCurrActiveRecorder('id_dict_user_type','" +
+					g_DictWordList[i].Type +
+					'\')" >▲</button><span id="id_dict_user_gramma_' +
+					i +
+					'">' +
+					g_DictWordList[i].Type +
+					"</span></td>";
+				outData =
+					outData +
+					"<td><button type=\"button\" onclick=\"updataCurrActiveRecorder('id_dict_user_gramma','" +
+					g_DictWordList[i].Gramma +
+					"')\">▲</button>" +
+					g_DictWordList[i].Gramma +
+					"</td>";
+				outData =
+					outData +
+					"<td><button type=\"button\" onclick=\"updataCurrActiveRecorder('id_dict_user_parent','" +
+					g_DictWordList[i].Parent +
+					"')\">▲</button>" +
+					g_DictWordList[i].Parent;
+				outData =
+					outData +
+					"<button type='button' onclick=\"showCurrWordTable('" +
+					g_DictWordList[i].Parent +
+					"')\">»</button></td>";
+				outData =
+					outData +
+					"<td><button type=\"button\" onclick=\"updataCurrActiveRecorder('id_dict_user_mean','" +
+					g_DictWordList[i].Mean +
+					"')\">▲</button>" +
+					g_DictWordList[i].Mean +
+					"<br />" +
+					makeMeanLink(g_DictWordList[i].Mean) +
+					"</td>";
+				outData =
+					outData +
+					"<td><button type=\"button\" onclick=\"updataCurrActiveRecorder('id_dict_user_factors','" +
+					g_DictWordList[i].Factors +
+					"')\">▲</button>" +
+					g_DictWordList[i].Factors +
+					"</td>";
+				outData =
+					outData +
+					"<td><button type=\"button\" onclick=\"updataCurrActiveRecorder('id_dict_user_fm','" +
+					g_DictWordList[i].FactorMean +
+					"')\">▲</button>" +
+					g_DictWordList[i].FactorMean +
+					"</td>";
+				outData =
+					outData +
+					"<td><button type=\"button\" onclick=\"updataCurrActiveRecorder('all','" +
+					g_DictWordList[i].Type +
+					"')\">▲</button></td>";
+				outData = outData + "</tr>";
+			}
+		}
+	}
+	outData += "</table>";
+
+	//children
+	for (x in listChildren) {
+		wordChildren = listChildren[x];
+		outData += "<h4>" + wordChildren + "</h4> ";
+		outData += "<table>";
+		outData =
+			outData +
+			"<tr><th></th><th>" +
+			gLocal.gui.dictsouce +
+			"</th> <th>" +
+			gLocal.gui.wordtype +
+			"</th> <th>" +
+			gLocal.gui.gramma +
+			"</th> <th>" +
+			gLocal.gui.parent +
+			"</th> <th>" +
+			gLocal.gui.meaning +
+			"</th> <th>" +
+			gLocal.gui.part +
+			"</th> <th>" +
+			gLocal.gui.partmeaning +
+			"</th> <th></th> </tr>";
+		for (var i = 0; i < g_DictWordList.length; i++) {
+			if (g_DictWordList[i].Pali == wordChildren) {
+				{
+					outData += "<tr class='dict_row" + g_DictWordList[i].ParentLevel + "'>";
+					outData += '<td><button type="button" >▲</button></td>';
+					outData = outData + "<td>" + g_DictWordList[i].dictname + "</td>";
+					outData =
+						outData +
+						"<td><button type=\"button\" onclick=\"updataCurrActiveRecorder('id_dict_user_type','" +
+						g_DictWordList[i].Type +
+						'\')" >▲</button><span id="id_dict_user_gramma_' +
+						i +
+						'">' +
+						g_DictWordList[i].Type +
+						"</span></td>";
+					outData =
+						outData +
+						"<td><button type=\"button\" onclick=\"updataCurrActiveRecorder('id_dict_user_gramma','" +
+						g_DictWordList[i].Gramma +
+						"')\">▲</button>" +
+						g_DictWordList[i].Gramma +
+						"</td>";
+					outData =
+						outData +
+						"<td><button type=\"button\" onclick=\"updataCurrActiveRecorder('id_dict_user_parent','" +
+						g_DictWordList[i].Parent +
+						"')\">▲</button>" +
+						g_DictWordList[i].Parent;
+					outData =
+						outData +
+						"<button type='button' onclick=\"showCurrWordTable('" +
+						g_DictWordList[i].Parent +
+						"')\">»</button></td>";
+					outData =
+						outData +
+						"<td><button type=\"button\" onclick=\"updataCurrActiveRecorder('id_dict_user_mean','" +
+						g_DictWordList[i].Mean +
+						"')\">▲</button>" +
+						g_DictWordList[i].Mean +
+						"<br />" +
+						makeMeanLink(g_DictWordList[i].Mean) +
+						"</td>";
+					outData =
+						outData +
+						"<td><button type=\"button\" onclick=\"updataCurrActiveRecorder('id_dict_user_factors','" +
+						g_DictWordList[i].Factors +
+						"')\">▲</button>" +
+						g_DictWordList[i].Factors +
+						"</td>";
+					outData =
+						outData +
+						"<td><button type=\"button\" onclick=\"updataCurrActiveRecorder('id_dict_user_fm','" +
+						g_DictWordList[i].FactorMean +
+						"')\">▲</button>" +
+						g_DictWordList[i].FactorMean +
+						"</td>";
+					outData =
+						outData +
+						"<td><button type=\"button\" onclick=\"updataCurrActiveRecorder('all','" +
+						g_DictWordList[i].Type +
+						"')\">▲</button></td>";
+					outData = outData + "</tr>";
+				}
+			}
+		}
+		outData += "</table>";
+	}
+	return outData;
+}
+
+function makeMeanLink(inStr) {
+	var arrList = inStr.split("$");
+	var output = "";
+	for (i in arrList) {
+		output +=
+			"<a onclick=\"addToCurrActiveRecorder('id_dict_user_mean','" + arrList[i] + "')\">" + arrList[i] + "</a> ";
+	}
+	return output;
+}
+
+function showCurrWordTable(currWord) {
+	document.getElementById("id_dict_curr_word_inner").innerHTML = dictCurrWordShowAsTable(currWord);
+}
+
+//匹配字典数据到文档
+function dictMatchXMLDoc() {
+	document.getElementById("id_dict_msg").innerHTML = gLocal.gui.dict_match;
+	var docWordCounter = 0;
+	var matchedCounter = 0;
+
+	var xDocWords = gXmlBookDataBody.getElementsByTagName("word");
+	for (var iword = 0; iword < xDocWords.length; iword++) {
+		var sPaliWord = getNodeText(xDocWords[iword], "real");
+		var sFactorsWord = getNodeText(xDocWords[iword], "org");
+		var sMeanWord = getNodeText(xDocWords[iword], "mean");
+		var sTypeWord = getNodeText(xDocWords[iword], "case");
+
+		if (isPaliWord(sPaliWord)) {
+			docWordCounter++;
+
+			/*将这个词与字典匹配,*/
+			var iDict = 0;
+			//if(sMeanWord=="?"){
+			var thisWord = sPaliWord;
+			for (iDict = 0; iDict < g_DictWordList.length; iDict++) {
+				if (thisWord == g_DictWordList[iDict].Pali && g_DictWordList[iDict].ParentLevel == 0) {
+					if (sMeanWord == "?") {
+						setNodeText(xDocWords[iword], "bmc", "bmca");
+					}
+					modifyWordDetailByWordIndex(iword);
+					matchedCounter++;
+					break;
+				}
+			}
+			//}
+			/*
+			else{
+				if(isPaliWord(sPaliWord)){
+					matchedCounter++;
+				}
+			}*/
+		}
+	}
+
+	var progress = (matchedCounter * 100) / docWordCounter;
+
+	document.getElementById("id_dict_msg").innerHTML = gLocal.gui.match_end + Math.round(progress) + "%";
+}
+
+function dictGetFirstMean(strMean) {
+	var arrMean = strMean.split("$");
+	if (arrMean.length > 0) {
+		for (var i = 0; i < arrMean.length; i++) {
+			if (arrMean[i].length > 0) {
+				return arrMean[i];
+			} else {
+				return "";
+			}
+		}
+		return "";
+	} else {
+		return "";
+	}
+}
+//test word is pali word or not
+function isPaliWord(inWord) {
+	if (inWord.length < 2) {
+		return false;
+	}
+	if (inWord.match(/[x]/)) {
+		return false;
+	}
+	if (inWord.match(/[q]/)) {
+		return false;
+	}
+	if (inWord.match(/[w]/)) {
+		return false;
+	}
+	if (inWord.match(/[a-y]/)) {
+		return true;
+	} else {
+		return false;
+	}
+}
+
+function submenu_show_detail(obj) {
+	eParent = obj.parentNode;
+	//var y = obj.getElementsByTagName("svg");
+	var x = eParent.getElementsByTagName("div");
+	var o = obj.getElementsByTagName("svg");
+	if (x[0].style.maxHeight == "200em") {
+		x[0].style.maxHeight = "0px";
+		x[0].style.padding = "0px";
+		x[0].style.opacity = "0";
+		o[0].style.transform = "rotate(0deg)";
+	} else {
+		x[0].style.maxHeight = "200em";
+		x[0].style.padding = "10px";
+		x[0].style.opacity = "1";
+		o[0].style.transform = "rotate(45deg)";
+	}
+}
+function getAutoMaxWidth() {
+	var Width = $("#").width;
+}
+
+//在导航窗口中显示与此词匹配的字典中的词
+function showMatchedWordsInNavi(wordId) {
+	//var matchedCounter=0;
+	/*
+	var xDocWords = gXmlBookDataBody.getElementsByTagName("word");
+	
+	for(var iWord=0;iWord<xDocWords.length;iWord++){
+		if(getNodeText(xDocWords[iWord],"id")==wordId){
+			wIndex=iWord;
+		}
+	}
+	
+	var sPaliWord = getNodeText(xDocWords[wIndex],"real");
+	showWordInNavi(sPaliWord);
+	*/
+}
+
+//在导航窗口中显示与此词匹配的字典中的词
+function showWordInNavi(inWord) {
+	var matchedCounter = 0;
+	var outText = "";
+	var sLastDict = "";
+
+	var sPaliWord = inWord;
+	outText = outText + "<h3>" + sPaliWord + "</h3>";
+	/*将这个词与字典匹配,*/
+	var iDict = 0;
+	var thisWord = sPaliWord;
+	for (iDict = 0; iDict < g_DictWordList.length; iDict++) {
+		if (thisWord == g_DictWordList[iDict].Pali) {
+			if (g_DictWordList[iDict].dictname != sLastDict) {
+				outText = outText + "<dict><span>" + g_DictWordList[iDict].dictname + "<span></dict>";
+				sLastDict = g_DictWordList[iDict].dictname;
+			}
+			outText =
+				outText +
+				"<input type='input' id=\"id_dict_word_list_" +
+				iDict +
+				"\" size='5' value='" +
+				g_DictWordList[iDict].Type +
+				"' />";
+			outText = outText + "<input type='input' size='15' value='" + g_DictWordList[iDict].Gramma + "' /><br />";
+			outText =
+				outText +
+				"<input type='input' size='20' value='" +
+				g_DictWordList[iDict].Parent +
+				"' /> <button type='button' onclick=\"showWordInNavi('" +
+				g_DictWordList[iDict].Parent +
+				"')\">»</button><br />";
+			outText =
+				outText +
+				'<textarea name="dict_mean" rows="3" col="25" style="width:20em;">' +
+				g_DictWordList[iDict].Mean +
+				"</textarea>";
+			outText = outText + "<input type='input' size='20' value='" + g_DictWordList[iDict].Factors + "' /><br />";
+			outText =
+				outText + "<input type='input' size='20' value='" + g_DictWordList[iDict].FactorMean + "' /><br />";
+			outText =
+				outText +
+				"<button type='button' onclick=\"updataDict('" +
+				iDict +
+				"','userdict')\">Modify</button><br />";
+			/*
+			outText=outText+"<mean onclick=\"updataWordFromDict(this,'mean')\">"+g_DictWordList[iDict].Mean+"</mean>";				
+			outText=outText+"<org onclick=\"updataWordFromDict(this,'org')\">"+g_DictWordList[iDict].Factors+"</org>";
+			outText=outText+"<om onclick=\"updataWordFromDict(this,'om')\">"+g_DictWordList[iDict].FactorMean+"</om>";					
+			outText=outText+"<case onclick=\"updataWordFromDict(this,'case')\">"+g_DictWordList[iDict].Type+"#"+g_DictWordList[iDict].Gramma+"</case>";
+			*/
+			matchedCounter++;
+		}
+	}
+
+	document.getElementById("id_dict_matched").innerHTML = outText;
+	document.getElementById("id_dict_curr_word_inner").innerHTML = dictCurrWordShowAsTable(inWord);
+}
+
+function updataWordFromDict(obj, field) {
+	var xDocWords = gXmlBookDataBody.getElementsByTagName("word");
+	var strValue = obj.innerHTML;
+	var applayTo = document.getElementById("id_dict_applay_to").value;
+	var strCurrPali = getNodeText(xDocWords[g_currEditWord], "pali");
+	switch (applayTo) {
+		case "current":
+			setNodeText(xDocWords[g_currEditWord], field, strValue);
+			modifyWordDetailByWordIndex(g_currEditWord);
+			break;
+		case "sys":
+			for (i = 0; i < xDocWords.length; i++) {
+				var strPali = getNodeText(xDocWords[i], "pali");
+				if (strCurrPali == strPali) {
+					var isAuto = getNodeText(xDocWords[i], "bmc");
+					if (isAuto == "bmca") {
+						setNodeText(xDocWords[g_currEditWord], field, strValue);
+						modifyWordDetailByWordIndex(i);
+					}
+				}
+			}
+			break;
+		case "all":
+			for (i = 0; i < xDocWords.length; i++) {
+				var strPali = getNodeText(xDocWords[i], "pali");
+				if (strCurrPali == strPali) {
+					setNodeText(xDocWords[g_currEditWord], field, strValue);
+					modifyWordDetailByWordIndex(i);
+				}
+			}
+			break;
+	}
+}
+
+function setBookMarkColor(obj, strColor) {
+	var items = obj.parentNode.getElementsByTagName("li");
+	for (var i = 0; i < items.length; i++) {
+		items[i].style.outline = "0px solid";
+	}
+	if (g_currBookMarkColor == strColor || strColor == "bmc0") {
+		g_currBookMarkColor = "bmc0";
+	} else {
+		obj.style.outline = "0.2em solid";
+		g_currBookMarkColor = strColor;
+	}
+
+	//apply_button_lock();
+}
+
+function getBookMarkColor(idColor) {
+	var items = document.getElementById("id_book_mark_color_select").getElementsByTagName("li");
+	for (var i = 0; i < items.length; i++) {
+		items[i].style.outline = "0px solid";
+	}
+	if (document.getElementById("id_" + idColor)) {
+		document.getElementById("id_" + idColor).style.outline = "0.2em solid";
+	}
+}
+
+function match_key(obj) {
+	g_key_match_str = obj.value;
+	for (unicode_key_i in local_code_str) {
+		g_key_match_str = g_key_match_str.replace(/\+/g, "");
+		g_key_match_str = g_key_match_str.replace(/\[/g, "");
+		g_key_match_str = g_key_match_str.replace(/\]/g, "");
+	}
+}
+
+function unicode_key(obj) {
+	var strNew = obj.value;
+	var key_match_str = strNew;
+	var replace_judge = 0;
+	key_match_str = key_match_str.replace(/\+/g, "");
+	key_match_str = key_match_str.replace(/\[/g, "");
+	key_match_str = key_match_str.replace(/\]/g, "");
+	for (unicode_key_i in local_code_str) {
+		if (strNew.lastIndexOf(local_code_str[unicode_key_i].id) != -1) {
+			replace_judge = 1;
+			break;
+		}
+	}
+
+	if (
+		key_match_str != g_key_match_str &&
+		replace_judge == 1 &&
+		document.getElementById("input_smart_switch").checked
+	) {
+		for (unicode_key_i in local_code_str) {
+			strNew = strNew.replace(local_code_str[unicode_key_i].id, local_code_str[unicode_key_i].value);
+		}
+		obj.value = strNew;
+	}
+}
+function input_key(obj) {
+	var strNew = obj.value;
+	for (input_key_i in local_codestr_sinhala) {
+		strNew = strNew.replace(local_codestr_sinhala[input_key_i].id, local_codestr_sinhala[input_key_i].value);
+	}
+	for (input_key_i in local_codestr_sinhala) {
+		strNew = strNew.replace(local_codestr_sinhala[input_key_i].id, local_codestr_sinhala[input_key_i].value);
+	}
+
+	obj.value = strNew;
+}
+
+function getPaliReal(inStr) {
+	var paliletter = "abcdefghijklmnoprstuvyāīūṅñṭḍṇḷṃ";
+	var output = "";
+	inStr = inStr.toLowerCase();
+	inStr = inStr.replace(/ṁ/g, "ṃ");
+	inStr = inStr.replace(/ŋ/g, "ṃ");
+	for (x in inStr) {
+		if (paliletter.indexOf(inStr[x]) != -1) {
+			output += inStr[x];
+		}
+	}
+	return output;
+}
+
+function menu_file_convert() {
+	var xDocWords = gXmlBookDataBody.getElementsByTagName("word");
+	var outText = "";
+	var sLastDict = "";
+	for (var iword = 0; iword < xDocWords.length; iword++) {
+		var sPaliWord = getNodeText(xDocWords[iword], "pali");
+		var sPaliMean = getNodeText(xDocWords[iword], "mean");
+		/*var thisWord = sPaliWord.toLowerCase();
+		thisWord = thisWord.replace(/-/g,"");
+		thisWord = thisWord.replace(/'/g,"");
+		thisWord = thisWord.replace(/’/g,"");*/
+		setNodeText(xDocWords[iword], "real", getPaliReal(sPaliWord));
+		setNodeText(xDocWords[iword], "om", sPaliMean);
+	}
+	alert("convert " + xDocWords.length + "words.");
+}
+
+function editor_save() {
+	$.post(
+		"./dom_http.php",
+		{
+			fileid: g_docid,
+			xmldata: com_xmlToString(gXmlBookData),
+		},
+		function (data, status) {
+			ntf_show("Data: " + data + "\nStatus: " + status);
+		}
+	);
+}
+
+/*Parse csv data and fill this document*/
+function csvDataParse(xmlCSVData) {
+	document.getElementById("id_csv_msg_inner").innerHTML = "Parseing CSV Data";
+	var xCSV = xmlCSVData.getElementsByTagName("word");
+	var xDocWords = gXmlBookDataBody.getElementsByTagName("word");
+
+	for (iword = 0; iword < xCSV.length; iword++) {
+		setNodeText(xDocWords[iword], "pali", getNodeText(xCSV[iword], "pali"));
+		setNodeText(xDocWords[iword], "real", getNodeText(xCSV[iword], "real"));
+		setNodeText(xDocWords[iword], "id", getNodeText(xCSV[iword], "id"));
+		setNodeText(xDocWords[iword], "mean", getNodeText(xCSV[iword], "mean"));
+		setNodeText(xDocWords[iword], "org", getNodeText(xCSV[iword], "org"));
+		setNodeText(xDocWords[iword], "om", getNodeText(xCSV[iword], "om"));
+		setNodeText(xDocWords[iword], "case", getNodeText(xCSV[iword], "case"));
+		setNodeText(xDocWords[iword], "bmc", getNodeText(xCSV[iword], "bmc"));
+		setNodeText(xDocWords[iword], "bmt", getNodeText(xCSV[iword], "bmt"));
+		setNodeText(xDocWords[iword], "note", getNodeText(xCSV[iword], "note"));
+		setNodeText(xDocWords[iword], "lock", getNodeText(xCSV[iword], "lock"));
+		modifyWordDetailByWordIndex(iword);
+	}
+	document.getElementById("id_csv_msg_inner").innerHTML = "Updata Document Data OK!";
+}
+
+//import csv end
+
+//export cav begin
+function menu_file_export_ild() {
+	xmlHttp = null;
+	var_dump(gLocal.gui.loading);
+	if (window.XMLHttpRequest) {
+		// code for IE7, Firefox, Opera, etc.
+		xmlHttp = new XMLHttpRequest();
+		var_dump("test XMLHttpRequest<br/>");
+	} else if (window.ActiveXObject) {
+		// code for IE6, IE5
+		xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
+		var_dump("testing Microsoft.XMLHTTP<br/>");
+	}
+
+	if (xmlHttp != null) {
+		var_dump(gLocal.gui.ok);
+		xmlHttp.open("POST", "./export_ild.php", false);
+		var sendHead = "filename=" + g_filename + "#";
+		var dictDataString = "<dict>";
+		for (iDict in g_DictWordList) {
+			dictDataString += "<word>";
+			dictDataString += "<recorderId>" + g_DictWordList[iDict].Id + "</recorderId>";
+			dictDataString += "<pali>" + g_DictWordList[iDict].Pali + "</pali>";
+			dictDataString += "<mean>" + g_DictWordList[iDict].Mean + "</mean>";
+			dictDataString += "<type>" + g_DictWordList[iDict].Type + "</type>";
+			dictDataString += "<gramma>" + g_DictWordList[iDict].Gramma + "</gramma>";
+			dictDataString += "<parent>" + g_DictWordList[iDict].Parent + "</parent>";
+			dictDataString += "<factors>" + g_DictWordList[iDict].Factors + "</factors>";
+			dictDataString += "<factorMean>" + g_DictWordList[iDict].FactorMean + "</factorMean>";
+			dictDataString += "<note>" + g_DictWordList[iDict].Note + "</note>";
+			dictDataString += "<confer>" + g_DictWordList[iDict].Confer + "</confer>";
+			dictDataString += "<status>" + g_DictWordList[iDict].Status + "</status>";
+			dictDataString += "<delete>" + g_DictWordList[iDict].Delete + "</delete>";
+			dictDataString += "<dictname>" + g_DictWordList[iDict].dictname + "</dictname>";
+			dictDataString += "<dictType>" + g_DictWordList[iDict].dictType + "</dictType>";
+			dictDataString += "<fileName>" + g_DictWordList[iDict].fileName + "</fileName>";
+			dictDataString += "<parentLevel>" + g_DictWordList[iDict].ParentLevel + "</parentLevel>";
+			dictDataString += "</word>";
+		}
+		dictDataString += "</dict>";
+		xmlHttp.send(sendHead + dictDataString);
+		var_dump(xmlHttp.responseText);
+	} else {
+		alert("Your browser does not support XMLHTTP.");
+	}
+}
+
+function menu_file_tools_empty(opt) {
+	var xDocWords = gXmlBookDataBody.getElementsByTagName("word");
+	if (opt == "all") {
+		for (var iword = 0; iword < xDocWords.length; iword++) {
+			setNodeText(xDocWords[iword], "mean", "?");
+			setNodeText(xDocWords[iword], "org", "?");
+			setNodeText(xDocWords[iword], "om", "?");
+			setNodeText(xDocWords[iword], "case", "?");
+			setNodeText(xDocWords[iword], "parent","?");
+			setNodeText(xDocWords[iword], "bmc", "");
+			setNodeText(xDocWords[iword], "bmt", "");
+			setNodeText(xDocWords[iword], "note", "");
+			setNodeText(xDocWords[iword], "lock", "FALSE");
+			modifyWordDetailByWordIndex(iword);
+		}
+	} else if (opt == "mean") {
+		for (var iword = 0; iword < xDocWords.length; iword++) {
+			setNodeText(xDocWords[iword], "mean", "[]");
+			//setNodeText(xDocWords[iword],"org","?");
+			setNodeText(xDocWords[iword], "om", "");
+			//setNodeText(xDocWords[iword],"case","?");
+			//setNodeText(xDocWords[iword],"bmc","");
+			//setNodeText(xDocWords[iword],"bmt","");
+			//setNodeText(xDocWords[iword],"note","");
+			//setNodeText(xDocWords[iword],"lock","FALSE");
+			modifyWordDetailByWordIndex(iword);
+		}
+	} else if (opt == "case") {
+		for (var iword = 0; iword < xDocWords.length; iword++) {
+			//setNodeText(xDocWords[iword],"mean","[]");
+			//setNodeText(xDocWords[iword],"org","?");
+			//setNodeText(xDocWords[iword],"om","");
+			setNodeText(xDocWords[iword], "case", "?#?");
+			//setNodeText(xDocWords[iword],"bmc","");
+			//setNodeText(xDocWords[iword],"bmt","");
+			//setNodeText(xDocWords[iword],"note","");
+			//setNodeText(xDocWords[iword],"lock","FALSE");
+			modifyWordDetailByWordIndex(iword);
+		}
+	} else if (opt == "bookmark") {
+		for (var iword = 0; iword < xDocWords.length; iword++) {
+			//setNodeText(xDocWords[iword],"mean","[]");
+			//setNodeText(xDocWords[iword],"org","?");
+			//setNodeText(xDocWords[iword],"om","");
+			//setNodeText(xDocWords[iword],"case","?#?");
+			setNodeText(xDocWords[iword], "bmc", "");
+			setNodeText(xDocWords[iword], "bmt", "");
+			//setNodeText(xDocWords[iword],"note","");
+			//setNodeText(xDocWords[iword],"lock","FALSE");
+			modifyWordDetailByWordIndex(iword);
+		}
+	} else if (opt == "note") {
+		for (var iword = 0; iword < xDocWords.length; iword++) {
+			//setNodeText(xDocWords[iword],"mean","[]");
+			//setNodeText(xDocWords[iword],"org","?");
+			//setNodeText(xDocWords[iword],"om","");
+			//setNodeText(xDocWords[iword],"case","?#?");
+			//setNodeText(xDocWords[iword],"bmc","");
+			//setNodeText(xDocWords[iword],"bmt","");
+			setNodeText(xDocWords[iword], "note", "");
+			//setNodeText(xDocWords[iword],"lock","FALSE");
+			modifyWordDetailByWordIndex(iword);
+		}
+	}
+}
+
+function menu_file_tools_GUID() {
+	var xDocWords = gXmlBookDataBody.getElementsByTagName("word");
+
+	for (var iword = 0; iword < xDocWords.length; iword++) {
+		setNodeText(xDocWords[iword], "id", com_guid());
+		modifyWordDetailByWordIndex(iword);
+	}
+	var_dump("reset id finished!");
+}
+
+function showDebugPanal() {
+	var w = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
+
+	var h = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
+}
+
+function show_popup(strMsg) {
+	var p = window.createPopup();
+	var pbody = p.document.body;
+	pbody.style.backgroundColor = "red";
+	pbody.style.border = "solid black 1px";
+	pbody.innerHTML = strMsg + "<br />外面点击,即可关闭它!";
+	p.show(150, 150, 200, 50, document.body);
+}
+//Info_Panal顯示 begin
+
+function setInfoPanalVisibility() {
+	if (document.getElementById("id_info_panal").style.height == "0px") {
+		setInfoPanalSize("half");
+	} else {
+		setInfoPanalSize("hidden");
+	}
+}
+
+//Info_Panal顯示尺寸
+function setInfoPanalSize(inSize) {
+	var h = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
+
+	var objInfoPanal = document.getElementById("id_info_panal");
+	//show_popup(w);
+	//alert(objInfoPanal.style.right);
+
+	switch (inSize) {
+		case "hidden": //min
+			objInfoPanal.style.height = 0 + "px";
+			//setTimeout("hiddenPanal()",400);
+			break;
+
+		case "min": //min
+			objInfoPanal.style.height = 30 + "px";
+			break;
+		case "half": //half
+			objInfoPanal.style.height = h / 2 + "px";
+			break;
+		case "0.6": //2/3
+			objInfoPanal.style.height = h * 0.6 + "px";
+			break;
+		case "max": //max
+			objInfoPanal.style.height = h + "px";
+			break;
+	}
+}
+function hiddenPanal() {
+	document.getElementById("id_info_panal").style.display = "none";
+}
+
+//Info_Panal顯示 end
+
+function windowsSelected(obj) {
+	document.getElementById("word_table").style.display = "none";
+	document.getElementById("id_dict_match_result").style.display = "none";
+	document.getElementById("id_dict_curr_word").style.display = "none";
+	document.getElementById("id_debug").style.display = "none";
+	switch (obj.value) {
+		case "view_vocabulary":
+			document.getElementById("word_table").style.display = "block";
+			break;
+		case "view_dict_all":
+			document.getElementById("id_dict_match_result").style.display = "block";
+			break;
+		case "view_dict_curr":
+			document.getElementById("id_dict_curr_word").style.display = "block";
+			break;
+		case "view_debug":
+			document.getElementById("id_debug").style.display = "block";
+			break;
+	}
+}
+
+function userDictUpdata() {}
+
+var editor_DictUpdataXmlHttp = null;
+function editor_UserDictUpdata(recorderName, thisObj) {
+	thisObj.disabled = true;
+	var xmlText = "";
+
+	if (window.XMLHttpRequest) {
+		// code for IE7, Firefox, Opera, etc.
+		editor_DictUpdataXmlHttp = new XMLHttpRequest();
+	} else if (window.ActiveXObject) {
+		// code for IE6, IE5
+		editor_DictUpdataXmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
+	}
+
+	if (editor_DictUpdataXmlHttp != null) {
+		var queryString = "<wordlist>";
+		queryString += "<word>";
+		var d_id = document.getElementById("id_dict_user_id_" + recorderName).value;
+		var d_pali = document.getElementById("id_dict_user_pali_" + recorderName).value;
+		var d_type = document.getElementById("id_dict_user_type_" + recorderName).value;
+		var d_gramma = document.getElementById("id_dict_user_gramma_" + recorderName).value;
+		var d_parent = document.getElementById("id_dict_user_parent_" + recorderName).value;
+		var d_mean = document.getElementById("id_dict_user_mean_" + recorderName).value;
+		var d_note = document.getElementById("id_dict_user_note_" + recorderName).value;
+		var d_factors = document.getElementById("id_dict_user_factors_" + recorderName).value;
+		var d_fm = document.getElementById("id_dict_user_fm_" + recorderName).value;
+		var d_confer = "";
+		var d_status = "";
+		var d_delete = "";
+		var d_tag = "";
+		var d_language = language_translation;
+		queryString += "<id>" + d_id + "</id>";
+		queryString += "<pali>" + d_pali + "</pali>";
+		queryString += "<type>" + d_type + "</type>";
+		queryString += "<gramma>" + d_gramma + "</gramma>";
+		queryString += "<parent>" + d_parent + "</parent>";
+		queryString += "<mean>" + d_mean + "</mean>";
+		queryString += "<note>" + d_note + "</note>";
+		queryString += "<factors>" + d_factors + "</factors>";
+		queryString += "<fm>" + d_fm + "</fm>";
+		queryString += "<confer>" + d_confer + "</confer>";
+		queryString += "<status>" + d_status + "</status>";
+		queryString += "<enable>TRUE</enable>";
+		queryString += "<language>" + d_language + "</language>";
+		queryString += "</word>";
+		queryString += "</wordlist>";
+		editor_DictUpdataXmlHttp.onreadystatechange = editor_UserDictUpdata_serverResponse;
+		debugOutput("updata user dict start.", 0);
+		editor_DictUpdataXmlHttp.open("POST", "./dict_updata_user.php", true);
+		editor_DictUpdataXmlHttp.send(queryString);
+
+		var i = recorderName;
+		g_DictWordUpdataIndex = i;
+		g_DictWordNew.Id = d_id;
+		g_DictWordNew.Pali = d_pali;
+		g_DictWordNew.Mean = d_mean;
+		g_DictWordNew.Type = d_type;
+		g_DictWordNew.Gramma = d_gramma;
+		g_DictWordNew.Parent = d_parent;
+		g_DictWordNew.Factors = d_factors;
+		g_DictWordNew.FactorMean = d_fm;
+		g_DictWordNew.Note = d_note;
+		g_DictWordNew.Confer = d_confer;
+		g_DictWordNew.Status = d_status;
+		g_DictWordNew.Delete = d_delete;
+		g_DictWordNew.dictname = "用户字典";
+		g_DictWordNew.dictType = "user";
+		g_DictWordNew.fileName = "user_default";
+		g_DictWordNew.ParentLevel = 0;
+	} else {
+		alert("Your browser does not support XMLHTTP.");
+	}
+}
+
+function editor_UserDictUpdata_serverResponse() {
+	if (editor_DictUpdataXmlHttp.readyState == 4) {
+		// 4 = "loaded"
+		debugOutput("server response.", 0);
+		if (editor_DictUpdataXmlHttp.status == 200) {
+			// 200 = "OK"
+			var serverText = editor_DictUpdataXmlHttp.responseText;
+			debugOutput(serverText, 0);
+			obj = JSON.parse(serverText);
+			if (obj.msg[0].server_return == -1) {
+				alert(obj.msg[0].server_error);
+			} else {
+				var_dump(gLocal.gui.userdict + obj.msg[0].server_op + " " + gLocal.gui.ok);
+				switch (obj.msg[0].server_op) {
+					case "insert":
+						g_DictWordNew.Id = obj.msg[0].server_return;
+						g_DictWordNew.dictID = 1; /*temp code*/
+						var inDict = false;
+						for (iFindNew in g_DictWordList) {
+							if (
+								g_DictWordList[iFindNew].Id == g_DictWordNew.Id &&
+								g_DictWordList[iFindNew].fileName == "user_default"
+							) {
+								inDict = true;
+								break;
+							}
+						}
+						//if recorder in list don't add to list
+						if (!inDict) {
+							g_DictWordList.unshift(g_DictWordNew);
+							editor_insertNewWordToInlineDict(g_DictWordNew);
+						}
+						break;
+					case "update":
+						g_DictWordList[g_DictWordUpdataIndex] = g_DictWordNew;
+						editor_updataInlineDict(g_DictWordUpdataIndex, g_DictWordNew);
+						break;
+				}
+			}
+			showCurrWordTable(g_WordTableCurrWord);
+			modifyWordDetailByWordId(g_currEditWord);
+		} else {
+			debugOutput(xmlhttp.statusText, 0);
+		}
+	}
+}
+
+function editor_insertNewWordToInlineDict(newWord) {
+	var xAllWord = gXmlBookDataInlineDict.getElementsByTagName("word");
+	var newElement = gXmlBookData.createElement("word");
+	setNodeText(newElement, "id", newWord.Id.toString());
+	setNodeText(newElement, "guid", newWord.Guid);
+	setNodeText(newElement, "pali", newWord.Pali);
+	setNodeText(newElement, "mean", newWord.Mean);
+	setNodeText(newElement, "type", newWord.Type);
+	setNodeText(newElement, "gramma", newWord.Gramma);
+	setNodeText(newElement, "parent", newWord.Parent);
+	setNodeText(newElement, "parentid", newWord.ParentId);
+	setNodeText(newElement, "factors", newWord.Factors);
+	setNodeText(newElement, "factorMean", newWord.FactorMean);
+	setNodeText(newElement, "partid", newWord.PartId);
+	setNodeText(newElement, "note", newWord.Note);
+	setNodeText(newElement, "confer", newWord.Confer);
+	setNodeText(newElement, "status", newWord.Status);
+	setNodeText(newElement, "enable", newWord.Enable);
+	setNodeText(newElement, "dictname", newWord.dictname);
+	setNodeText(newElement, "dictType", newWord.dictType);
+	setNodeText(newElement, "fileName", newWord.fileName);
+	setNodeText(newElement, "parentLevel", newWord.ParentLevel.toString());
+	if (xAllWord.length > 0) {
+		gXmlBookDataInlineDict.insertBefore(newElement, xAllWord[0]);
+	} else {
+		gXmlBookDataInlineDict.insertBefore(newElement, null);
+	}
+}
+
+function editor_updataInlineDict(iword, newWord) {
+	var xILD = gXmlBookDataInlineDict.getElementsByTagName("word");
+	if (xILD == null) {
+		return;
+	}
+
+	setNodeText(xILD[iword], "id", newWord.Id);
+	setNodeText(xILD[iword], "pali", newWord.Pali);
+	setNodeText(xILD[iword], "mean", newWord.Mean);
+	setNodeText(xILD[iword], "type", newWord.Type);
+	setNodeText(xILD[iword], "gramma", newWord.Gramma);
+	setNodeText(xILD[iword], "parent", newWord.Parent);
+	setNodeText(xILD[iword], "factors", newWord.Factors);
+	setNodeText(xILD[iword], "factorMean", newWord.FactorMean);
+	setNodeText(xILD[iword], "note", newWord.Note);
+	setNodeText(xILD[iword], "confer", newWord.Confer);
+	setNodeText(xILD[iword], "status", newWord.Status);
+	setNodeText(xILD[iword], "delete", newWord.Delete);
+	setNodeText(xILD[iword], "dictname", newWord.dictname);
+	setNodeText(xILD[iword], "dictType", newWord.dictType);
+	setNodeText(xILD[iword], "fileName", newWord.fileName);
+	setNodeText(xILD[iword], "parentLevel", newWord.ParentLevel);
+}
+/*
+上传到我的字典
+*/
+function upload_to_my_dict(wordIdFrom = -1, wordIdTo = -1) {
+	let words = new Array();
+
+	let queryString = "<wordlist>";
+	let x = gXmlBookDataBody.getElementsByTagName("word");
+	let iCount = 0;
+
+	let wordNode;
+	let d_pali;
+	let d_guid;
+	let d_mean;
+	let d_parent;
+	let d_parent_id;
+	let d_parentmean;
+	let d_factors;
+	let d_fm;
+	let d_part_id;
+	let d_case;
+	let d_note;
+	let formula;
+
+	for (let wordID = wordIdFrom; wordID <= wordIdTo; wordID++) {
+		if (wordIdFrom == -1) {
+			d_pali = doc_word("#" + g_currEditWord).val("real");
+			d_guid = "";
+			d_mean = $("#input_meaning").val();
+
+			d_parent = $("#id_text_parent").val();
+			d_parent_id = "";
+			d_parent = com_getPaliReal(d_parent);
+			d_parentmean = removeFormulaB(d_mean, "[", "]");
+			d_parentmean = removeFormulaB(d_parentmean, "{", "}");
+			//if(d_parentmean.substr())
+			d_factors = $("#input_org").val();
+			d_fm = $("#input_om").val(); //g_arrPartMean.join("+");
+			d_part_id = "";
+			d_case = $("#input_case").val();
+			d_note = $("#id_text_note").val();
+		} else {
+			wordNode = x[wordID];
+			d_pali = getNodeText(wordNode, "real");
+			d_guid = getNodeText(wordNode, "guid");
+			d_mean = getNodeText(wordNode, "mean");
+			d_parent = getNodeText(wordNode, "parent");
+			d_parent_id = getNodeText(wordNode, "parent_id");
+			d_parent = com_getPaliReal(d_parent);
+			d_parentmean = removeFormulaB(d_mean, "[", "]");
+			d_parentmean = removeFormulaB(d_parentmean, "{", "}");
+			d_factors = getNodeText(wordNode, "org");
+			d_fm = getNodeText(wordNode, "om");
+			d_part_id = getNodeText(wordNode, "part_id");
+			d_case = getNodeText(wordNode, "case");
+			d_note = getNodeText(wordNode, "note");
+		}
+		var iPos = d_case.indexOf("#");
+		if (iPos >= 0) {
+			var d_type = d_case.substring(0, iPos);
+			if (iPos < d_case.length - 1) {
+				var d_gramma = d_case.substring(iPos + 1);
+			} else {
+				var d_gramma = "";
+			}
+		} else {
+			var d_type = "";
+			var d_gramma = d_case;
+		}
+		formula = getFormulaFromMeaning(d_mean, "[", "]");
+
+		let d_language = get_string_lang(d_mean);
+
+		if (d_mean == "?") {
+			d_mean = "";
+		}
+		if (d_factors == "?") {
+			d_factors = "";
+		}
+		if (d_fm == "?" || d_fm == "[a]?") {
+			d_fm = "";
+		}
+
+		if ((d_type == ".un." || d_type == ".comp.") && d_mean == "" && d_factors == "" && d_fm == "") {
+		} else if (d_pali.length > 0 && !(d_mean == "" && d_factors == "" && d_fm == "" && d_case == "")) {
+			//parent gramma infomation
+			switch (d_type) {
+				case ".n.":
+					d_parentType = ".n:base.";
+					d_parentGramma = d_gramma.split("$")[0];
+					if (d_parentGramma == ".m." || d_parentGramma == ".f." || d_parentGramma == ".nt.") {
+						d_parentGramma = d_parentGramma;
+					} else {
+						d_parentGramma = "";
+					}
+					break;
+				case ".adj.":
+					d_parentType = ".ti:base.";
+					d_parentGramma = ".adj.";
+					break;
+				case ".ti.":
+					d_parentType = ".ti:base.";
+					d_parentGramma = "";
+					break;
+				case ".pron.":
+					d_parentType = ".pron:base.";
+					d_parentGramma = "";
+					break;
+				case ".num.":
+					d_parentType = ".num:base.";
+					d_parentGramma = "";
+					break;
+				case ".v.":
+					d_parentType = ".v:base.";
+					d_parentGramma = "";
+					break;
+				case ".v:ind.":
+					d_parentType = ".v:base.";
+					d_parentGramma = "";
+					break;
+				case ".ind.":
+					d_parentType = ".ind.";
+					d_parentGramma = "";
+					break;
+				default:
+					d_parentType = "";
+					d_parentGramma = "";
+					break;
+			}
+
+			let d_confer = "";
+			let d_status = "512";
+			let d_enable = "TRUE";
+
+			queryString += "<word>";
+			queryString += "<pali>" + d_pali + "</pali>";
+			queryString += "<guid>" + d_guid + "</guid>";
+			queryString += "<type>" + d_type + "</type>";
+			queryString += "<gramma>" + d_gramma + "</gramma>";
+			queryString += "<parent>" + d_parent + "</parent>";
+			queryString += "<parent_id>" + d_parent_id + "</parent_id>";
+			queryString += "<mean>" + d_mean + "</mean>";
+			queryString += "<note>" + d_note + "</note>";
+			queryString += "<factors>" + d_factors + "</factors>";
+			queryString += "<fm>" + d_fm + "</fm>";
+			queryString += "<part_id>" + d_part_id + "</part_id>";
+			queryString += "<confer>" + d_confer + "</confer>";
+			queryString += "<status>" + d_status + "</status>";
+			queryString += "<enable>" + d_enable + "</enable>";
+			queryString += "<language>" + d_language + "</language>";
+			queryString += "</word>";
+			words.push(
+				{
+					word:d_pali,
+					type:d_type,
+					grammar:d_gramma,
+					parent:d_parent,
+					mean:d_mean,
+					factors:d_factors,
+					factormean:d_fm,
+					language:d_language,
+				}
+			)
+			iCount++;
+
+			//formula
+			if (formula != "~") {
+				queryString += "<word>";
+				queryString += "<pali>_formula_</pali>";
+				queryString += "<guid></guid>";
+				queryString += "<type>" + d_type + "</type>";
+				queryString += "<gramma>" + d_gramma + "</gramma>";
+				queryString += "<parent></parent>";
+				queryString += "<parent_id></parent_id>";
+				queryString += "<mean>" + formula + "</mean>";
+				queryString += "<note></note>";
+				queryString += "<factors></factors>";
+				queryString += "<fm></fm>";
+				queryString += "<part_id></part_id>";
+				queryString += "<confer></confer>";
+				queryString += "<status>" + d_status + "</status>";
+				queryString += "<enable>" + d_enable + "</enable>";
+				queryString += "<language>" + d_language + "</language>";
+				queryString += "</word>";
+				iCount++;
+				words.push(
+					{
+						word:"_formula_",
+						type:d_type,
+						grammar:d_gramma,
+						parent:"",
+						mean:formula,
+						factors:"",
+						factormean:"",
+						language:d_language,
+					}
+				);
+			}
+
+			//parent recorder
+			if (d_parent.length > 0) {
+				queryString += "<word>";
+				queryString += "<pali>" + d_parent + "</pali>";
+				queryString += "<guid></guid>";
+				queryString += "<type>" + d_parentType + "</type>";
+				queryString += "<gramma>" + d_parentGramma + "</gramma>";
+				queryString += "<parent></parent>";
+				queryString += "<parent_id></parent_id>";
+				queryString += "<mean>" + d_parentmean + "</mean>";
+				queryString += "<note></note>";
+				let fc = d_factors.split("+");
+				if (fc.length > 0 && fc[fc.length - 1].slice(0, 1) == "[" && fc[fc.length - 1].slice(-1) == "]") {
+					fc.pop();
+				}
+				queryString += "<factors>" + fc.join("+") + "</factors>";
+				let fm = d_fm.split("+");
+				fm.length = fc.length;
+				queryString += "<fm>" + fm.join("+") + "</fm>";
+				queryString += "<part_id></part_id>";
+				queryString += "<confer></confer>";
+				queryString += "<status>512</status>";
+				queryString += "<enable>TRUE</enable>";
+				queryString += "<language>" + d_language + "</language>";
+				queryString += "</word>";
+				iCount++;
+				words.push(
+					{
+						word:d_parent,
+						type:d_parentType,
+						grammar:d_parentGramma,
+						parent:"",
+						mean:d_parentmean,
+						factors:fc.join("+"),
+						factormean:fm.join("+"),
+						language:d_language,
+					}
+				);
+			}
+
+			//part recorder
+			if (d_fm.slice(0, 3) != "[a]") {
+				let arrPart = d_factors.split("+");
+				let arrPartMean = d_fm.split("+");
+				if (arrPart.length > 0 && arrPart.length == arrPartMean.length) {
+					for (iPart in arrPart) {
+						if (arrPartMean[iPart] != "" && arrPartMean[iPart] != "?")
+							arrPart[iPart] = arrPart[iPart].replace("(", "");
+						arrPart[iPart] = arrPart[iPart].replace(")", "");
+						queryString += "<word>";
+						queryString += "<guid></guid>";
+						queryString += "<pali>" + arrPart[iPart] + "</pali>";
+						queryString += "<type>.part.</type>";
+						queryString += "<gramma></gramma>";
+						queryString += "<parent></parent>";
+						queryString += "<parent_id></parent_id>";
+						queryString += "<mean>" + arrPartMean[iPart] + "</mean>";
+						queryString += "<note></note>";
+						queryString += "<factors></factors>";
+						queryString += "<fm></fm>";
+						queryString += "<part_id></part_id>";
+						queryString += "<confer></confer>";
+						queryString += "<status>512</status>";
+						queryString += "<enable>TRUE</enable>";
+						queryString += "<language>" + d_language + "</language>";
+						queryString += "</word>";
+						iCount++;
+						words.push(
+							{
+								word:arrPart[iPart],
+								type:".part.",
+								grammar:"",
+								parent:"",
+								mean:arrPartMean[iPart],
+								factors:"",
+								factormean:"",
+								language:d_language,
+							}
+						);
+					}
+				}
+			}
+		}
+	}
+	queryString += "</wordlist>";
+
+	if (iCount == 0) {
+		ntf_show("no word update");
+	} else {
+		/*
+		$.post(
+			"./dict_updata_wbw.php", 
+			queryString, 
+			function (data, status) {
+				ntf_show("Data: " + data + "\nStatus: " + status);
+			}
+		);
+		*/
+		$.post(
+			"../api/user_dicts.php", 
+			{
+				op:'create',
+				view:'wbw',
+				data: JSON.stringify(words),
+			}, 
+			function (data, status) {
+				ntf_show("Data: " + data + "\nStatus: " + status);
+			}
+		);
+	}
+}
+
+// word by word dict updata
+var editor_wbwUpdataXmlHttp = null;
+function editor_WbwUpdata(wordIdFrom, wordIdTo) {
+	var xmlText = "";
+
+	if (window.XMLHttpRequest) {
+		// code for IE7, Firefox, Opera, etc.
+		editor_wbwUpdataXmlHttp = new XMLHttpRequest();
+	} else if (window.ActiveXObject) {
+		// code for IE6, IE5
+		editor_wbwUpdataXmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
+	}
+
+	if (editor_wbwUpdataXmlHttp != null) {
+		let queryString = "<wordlist>";
+		let x = gXmlBookDataBody.getElementsByTagName("word");
+		let iCount = 0;
+		let d_language = language_translation;
+		for (let wordID = wordIdFrom; wordID <= wordIdTo; wordID++) {
+			let wordNode = x[wordID];
+			let d_pali = getNodeText(wordNode, "real");
+			let d_guid = getNodeText(wordNode, "guid");
+			let d_mean = getNodeText(wordNode, "mean");
+			let d_parent = getNodeText(wordNode, "parent");
+			let d_parent_id = getNodeText(wordNode, "parent_id");
+			d_parent = com_getPaliReal(d_parent);
+			let d_parentmean = removeFormulaB(d_mean, "[", "]");
+			d_parentmean = removeFormulaB(d_parentmean, "{", "}");
+			let formula = getFormulaFromMeaning(d_mean);
+			let d_factors = getNodeText(wordNode, "org");
+			let d_fm = getNodeText(wordNode, "om");
+			let d_part_id = getNodeText(wordNode, "part_id");
+			let d_case = getNodeText(wordNode, "case");
+			let d_note = getNodeText(wordNode, "note");
+
+			if (d_pali.length > 0 && !(d_mean == "?" && d_factors == "?" && d_fm == "?" && d_case == "?")) {
+				let iPos = d_case.indexOf("#");
+				if (iPos >= 0) {
+					let d_type = d_case.substring(0, iPos);
+					if (iPos < d_case.length - 1) {
+						let d_gramma = d_case.substring(iPos + 1);
+					} else {
+						let d_gramma = "";
+					}
+				} else {
+					let d_type = "";
+					let d_gramma = d_case;
+				}
+
+				//parent gramma infomation
+				switch (d_type) {
+					case ".n.":
+						d_parentType = ".n:base.";
+						d_parentGramma = d_gramma.split("$")[0];
+						if (d_parentGramma == ".m." || d_parentGramma == ".f." || d_parentGramma == ".nt.") {
+							d_parentGramma = d_parentGramma;
+						} else {
+							d_parentGramma = "";
+						}
+						break;
+					case ".adj.":
+						d_parentType = ".adj:base.";
+						d_parentGramma = "";
+						break;
+					case ".ti.":
+						d_parentType = ".ti:base.";
+						d_parentGramma = "";
+						break;
+					case ".pron.":
+						d_parentType = ".pron:base.";
+						d_parentGramma = "";
+						break;
+					case ".num.":
+						d_parentType = ".num:base.";
+						d_parentGramma = "";
+						break;
+					case ".v.":
+						d_parentType = ".v:base.";
+						d_parentGramma = "";
+						break;
+					case ".ind.":
+						d_parentType = ".ind.";
+						d_parentGramma = "";
+						break;
+					default:
+						d_parentType = "";
+						d_parentGramma = "";
+						break;
+				}
+
+				let d_confer = "";
+				let d_status = "512";
+				let d_enable = "TRUE";
+
+				queryString += "<word>";
+				queryString += "<pali>" + d_pali + "</pali>";
+				queryString += "<guid>" + d_guid + "</guid>";
+				queryString += "<type>" + d_type + "</type>";
+				queryString += "<gramma>" + d_gramma + "</gramma>";
+				queryString += "<parent>" + d_parent + "</parent>";
+				queryString += "<parent_id>" + d_parent_id + "</parent_id>";
+				queryString += "<mean>" + d_mean + "</mean>";
+				queryString += "<note>" + d_note + "</note>";
+				queryString += "<factors>" + d_factors + "</factors>";
+				queryString += "<fm>" + d_fm + "</fm>";
+				queryString += "<part_id>" + d_part_id + "</part_id>";
+				queryString += "<confer>" + d_confer + "</confer>";
+				queryString += "<status>" + d_status + "</status>";
+				queryString += "<enable>" + d_enable + "</enable>";
+				queryString += "<language>" + d_language + "</language>";
+				queryString += "</word>";
+				iCount++;
+
+				//formula
+				queryString += "<word>";
+				queryString += "<pali>_formula_</pali>";
+				queryString += "<guid></guid>";
+				queryString += "<type>" + d_type + "</type>";
+				queryString += "<gramma>" + d_gramma + "</gramma>";
+				queryString += "<parent></parent>";
+				queryString += "<parent_id></parent_id>";
+				queryString += "<mean>" + formula + "</mean>";
+				queryString += "<note></note>";
+				queryString += "<factors></factors>";
+				queryString += "<fm></fm>";
+				queryString += "<part_id></part_id>";
+				queryString += "<confer></confer>";
+				queryString += "<status>" + d_status + "</status>";
+				queryString += "<enable>" + d_enable + "</enable>";
+				queryString += "<language>" + d_language + "</language>";
+				queryString += "</word>";
+				iCount++;
+
+				//parent recorder
+				if (d_parent.length > 0) {
+					queryString += "<word>";
+					queryString += "<pali>" + d_parent + "</pali>";
+					queryString += "<guid></guid>";
+					queryString += "<type>" + d_parentType + "</type>";
+					queryString += "<gramma>" + d_parentGramma + "</gramma>";
+					queryString += "<parent></parent>";
+					queryString += "<parent_id></parent_id>";
+					queryString += "<mean>" + d_parentmean + "</mean>";
+					queryString += "<note></note>";
+					queryString += "<factors></factors>";
+					queryString += "<fm></fm>";
+					queryString += "<part_id></part_id>";
+					queryString += "<confer></confer>";
+					queryString += "<status>512</status>";
+					queryString += "<enable>TRUE</enable>";
+					queryString += "<language>" + d_language + "</language>";
+					queryString += "</word>";
+					iCount++;
+				}
+
+				//part recorder
+				arrPart = d_factors.split("+");
+				arrPartMean = d_fm.split("+");
+				if (arrPart.length > 0 && arrPart.length == arrPartMean.length) {
+					for (iPart in arrPart) {
+						if (arrPartMean[iPart] != "?" && arrPartMean[iPart] != "" && arrPartMean[iPart] != "") {
+							arrPart[iPart] = arrPart[iPart].replace("(", "");
+							arrPart[iPart] = arrPart[iPart].replace(")", "");
+							queryString += "<word>";
+							queryString += "<guid></guid>";
+							queryString += "<pali>" + arrPart[iPart] + "</pali>";
+							queryString += "<type>.part.</type>";
+							queryString += "<gramma></gramma>";
+							queryString += "<parent></parent>";
+							queryString += "<parent_id></parent_id>";
+							queryString += "<mean>" + arrPartMean[iPart] + "</mean>";
+							queryString += "<note></note>";
+							queryString += "<factors></factors>";
+							queryString += "<fm></fm>";
+							queryString += "<part_id></part_id>";
+							queryString += "<confer></confer>";
+							queryString += "<status>512</status>";
+							queryString += "<enable>TRUE</enable>";
+							queryString += "<language>" + d_language + "</language>";
+							queryString += "</word>";
+							iCount++;
+						}
+					}
+				}
+			}
+		}
+		queryString += "</wordlist>";
+		if (iCount > 0) {
+			editor_wbwUpdataXmlHttp.onreadystatechange = editor_wbwDictUpdata_serverResponse;
+			console.log("updata user dict start.", 0);
+			editor_wbwUpdataXmlHttp.open("POST", "./dict_updata_wbw.php", true);
+			editor_wbwUpdataXmlHttp.send(queryString);
+		} else {
+			console.log("no user dicttionary data need updata.", 0);
+		}
+	} else {
+		alert("Your browser does not support XMLHTTP.");
+	}
+}
+
+function editor_wbwDictUpdata_serverResponse() {
+	if (editor_wbwUpdataXmlHttp.readyState == 4) {
+		// 4 = "loaded"
+		debugOutput("server response.", 0);
+		if (editor_wbwUpdataXmlHttp.status == 200) {
+			// 200 = "OK"
+			let serverText = editor_wbwUpdataXmlHttp.responseText;
+			var_dump(serverText);
+			debugOutput(serverText, 0);
+		} else {
+			debugOutput(xmlhttp.statusText, 0);
+		}
+	}
+}
+
+function uploadAllWordData() {
+	let x = gXmlBookDataBody.getElementsByTagName("word");
+	if (x.length > 0) {
+		editor_WbwUpdata(0, x.length - 1);
+	} else {
+	}
+}
+function renderCaseSelect(type, case1, case2, case3, unique_id, padding_width) {
+	eCaseTable = document.getElementById("input_select_case");
+	eCaseItems = eCaseTable.getElementsByTagName("span");
+
+	if (type) {
+		strTypeSelect =
+			'<div id="id_case_dropdown_0_' +
+			unique_id +
+			'" class="case_dropdown gramma_selector" style=\'min-width: unset;padding-right: ' +
+			padding_width +
+			"em;'>";
+		strTypeSelect +=
+			"<p class=\"case_dropbtn cell\" style='line-height: 1.2em;'>" + getLocalGrammaStr(type) + "</p>";
+	} else {
+		strTypeSelect =
+			'<div id="id_case_dropdown_0_' +
+			unique_id +
+			'" class="case_dropdown gramma_selector" style=\'min-width: unset;padding-right: ' +
+			padding_width +
+			"em;'>";
+		strTypeSelect += "<p class=\"case_dropbtn  cell\" style='line-height: 1.2em;'>?</p>";
+	}
+	strTypeSelect += '<div class="case_dropdown-content">';
+
+	for (iType = 0; iType < gLocal.type_str.length; iType++) {
+		strTypeSelect +=
+			"<a onclick=\"caseChanged(0,'" +
+			gLocal.type_str[iType].id +
+			"')\">" +
+			gLocal.type_str[iType].value +
+			"</a>";
+	}
+	strTypeSelect += "</div>";
+	strTypeSelect += "</div>";
+	eCaseItems[0].innerHTML = strTypeSelect;
+
+	for (iType = 0; iType < gramma_str.length; iType++) {
+		if (gramma_str[iType].id == type) {
+			var strTypeSelect = "";
+			gramma = gramma_str[iType].a;
+			if (gramma.length > 0) {
+				items = gramma.split("$");
+				if (case1 == "") {
+					case1 = items[0];
+					g_caseSelect[1] = case1;
+				}
+				strTypeSelect =
+					'<div id="id_case_dropdown_1_' +
+					unique_id +
+					'" class="case_dropdown gramma_selector" style=\'min-width: unset;padding-right: ' +
+					padding_width +
+					"em;'><p class=\"case_dropbtn\" style='line-height: 1.2em;'>" +
+					getLocalGrammaStr(case1) +
+					"</p>";
+				strTypeSelect += '<div class="case_dropdown-content">';
+				for (iItem = 0; iItem < items.length; iItem++) {
+					strTypeSelect +=
+						"<a onclick=\"caseChanged(1,'" +
+						items[iItem] +
+						"')\">" +
+						getLocalGrammaStr(items[iItem]) +
+						"</a>";
+				}
+				strTypeSelect += "</div>";
+				strTypeSelect += "</div>";
+			} else {
+				g_caseSelect[1] = "";
+			}
+			eCaseItems[1].innerHTML = strTypeSelect;
+
+			strTypeSelect = "";
+			gramma = gramma_str[iType].b;
+			if (gramma.length > 0) {
+				items = gramma.split("$");
+				if (case2 == "") {
+					case2 = items[0];
+					g_caseSelect[2] = case2;
+				}
+				strTypeSelect =
+					'<div id="id_case_dropdown_2_' +
+					unique_id +
+					'" class="case_dropdown gramma_selector" style=\'min-width: unset;padding-right: ' +
+					padding_width +
+					"em;'><p class=\"case_dropbtn\" style='line-height: 1.2em;'>" +
+					getLocalGrammaStr(case2) +
+					"</p>";
+				strTypeSelect += '<div class="case_dropdown-content">';
+				for (iItem = 0; iItem < items.length; iItem++) {
+					strTypeSelect +=
+						"<a onclick=\"caseChanged(2,'" +
+						items[iItem] +
+						"')\">" +
+						getLocalGrammaStr(items[iItem]) +
+						"</a>";
+				}
+				strTypeSelect += "</div>";
+				strTypeSelect += "</div>";
+			} else {
+				g_caseSelect[2] = "";
+			}
+			eCaseItems[2].innerHTML = strTypeSelect;
+
+			strTypeSelect = "";
+			gramma = gramma_str[iType].c;
+			if (gramma.length > 0) {
+				items = gramma.split("$");
+				if (case3 == "") {
+					case3 = items[0];
+					g_caseSelect[3] = case3;
+				}
+				strTypeSelect =
+					'<div id="id_case_dropdown_3_' +
+					unique_id +
+					'" class="case_dropdown gramma_selector" style=\'min-width: unset;padding-right: ' +
+					padding_width +
+					"em;'><p class=\"case_dropbtn\" style='line-height: 1.2em;'>" +
+					getLocalGrammaStr(case3) +
+					"</p>";
+				strTypeSelect += '<div class="case_dropdown-content">';
+				for (iItem = 0; iItem < items.length; iItem++) {
+					strTypeSelect +=
+						"<a onclick=\"caseChanged(3,'" +
+						items[iItem] +
+						"')\">" +
+						getLocalGrammaStr(items[iItem]) +
+						"</a>";
+				}
+				strTypeSelect += "</div>";
+				strTypeSelect += "</div>";
+			} else {
+				g_caseSelect[3] = "";
+			}
+			eCaseItems[3].innerHTML = strTypeSelect;
+		}
+	}
+}
+
+function refreshCaseSelect() {
+	renderCaseSelect(g_caseSelect[0], g_caseSelect[1], g_caseSelect[2], g_caseSelect[3], "wbw", 1);
+	var newCaseString = g_caseSelect[0] + "#";
+	if (g_caseSelect[1].length > 0) {
+		newCaseString += g_caseSelect[1];
+	}
+	if (g_caseSelect[2].length > 0) {
+		newCaseString += "$" + g_caseSelect[2];
+	}
+	if (g_caseSelect[3].length > 0) {
+		newCaseString += "$" + g_caseSelect[3];
+	}
+	document.getElementById("input_case").value = newCaseString;
+	rela_refresh(g_currEditWord);
+}
+
+function caseChanged(index, newValue) {
+	g_caseSelect[index] = newValue;
+	refreshCaseSelect();
+	refreshPartMeaningSelect();
+}
+
+function removeFormula_B(inStr) {
+	pos = 0;
+	copy = true;
+	var output = "";
+	for (i = 0; i < inStr.length; i++) {
+		if (inStr[i] == "{" || inStr[i] == "[") {
+			copy = false;
+		}
+		if (copy) {
+			output += inStr[i];
+		}
+		if (inStr[i] == "}" || inStr[i] == "]") {
+			copy = true;
+		}
+	}
+	return output;
+}
+function removeFormula(inStr) {
+	if (inStr.indexOf("[") >= 0) {
+		return inStr;
+	}
+	pos = 0;
+	copy = true;
+	var output = "";
+	for (i = 0; i < inStr.length; i++) {
+		if (inStr[i] == "{") {
+			copy = false;
+		}
+		if (copy) {
+			output += inStr[i];
+		}
+		if (inStr[i] == "}") {
+			copy = true;
+		}
+	}
+	return output;
+}
+
+//移除字符串中的格位公式
+//input:[zzz]xxx[yyy]
+//output:xxx
+function removeFormulaB(inStr, sBegin, sEnd) {
+	pos = 0;
+	copy = true;
+	var output = "";
+	for (i = 0; i < inStr.length; i++) {
+		if (inStr[i] == sBegin) {
+			copy = false;
+		}
+		if (copy) {
+			output += inStr[i];
+		}
+		if (inStr[i] == sEnd) {
+			copy = true;
+		}
+	}
+	return output;
+}
+
+function getFormulaFromMeaning(inStr, sBegin, sEnd) {
+	let pos = 0;
+	let fromulaBegin = false;
+	let meaningBegin = false;
+	let output = "";
+	let meaningExisted = false;
+	for (i = 0; i < inStr.length; i++) {
+		if (inStr[i] == sBegin) {
+			fromulaBegin = true;
+			meaningBegin = false;
+		} else if (inStr[i] == sEnd) {
+			fromulaBegin = false;
+			meaningBegin = true;
+			output += inStr[i];
+		} else {
+			if (!fromulaBegin) {
+				meaningBegin = true;
+			}
+		}
+
+		if (meaningBegin && !meaningExisted) {
+			output += "~";
+			meaningExisted = true;
+		}
+		if (fromulaBegin) {
+			output += inStr[i];
+		}
+	}
+	return output;
+}
+
+//关闭单词修改窗口
+function closeModifyWindow() {
+	var eWin = document.getElementById("modifywin");
+	if (eWin) {
+		eWin.style.display = "none";
+		document.getElementById("modifyDiv").appendChild(eWin);
+		gCurrModifyWindowParNo = -1;
+	} else {
+	}
+	if (_display_sbs == 1) {
+		$("#ws_" + g_currEditWord).removeClass("wbw_selected");
+	}
+}
+
+//取消对单个词的修改
+function modifyCancel() {
+	//关闭单词修改窗口
+	closeModifyWindow();
+
+	//??????
+	getStyleClass("debug_info").style.display = "none";
+	document.getElementById("debug").style.display = "-webkit-flex";
+	document.getElementById("debug").style.display = "-moz-flex";
+	document.getElementById("debug").style.display = "-webkit-flex";
+	refreshNoteNumber();
+}
+
+//获取某词的段落索引
+function getParIndexByWordId(wordId) {
+	//遍历所有块,找到这个单词
+	var bookId = "";
+	var parNo = "";
+
+	var allBlock = gXmlBookDataBody.getElementsByTagName("block");
+	for (var iBlock = 0; iBlock < allBlock.length; iBlock++) {
+		xmlParInfo = allBlock[iBlock].getElementsByTagName("info")[0];
+		xmlParData = allBlock[iBlock].getElementsByTagName("data")[0];
+
+		type = getNodeText(xmlParInfo, "type");
+		if (type == "wbw") {
+			words = xmlParData.getElementsByTagName("word");
+			for (var iWord = 0; iWord < words.length; iWord++) {
+				wId = getNodeText(words[iWord], "id");
+				if (wId == wordId) {
+					bookId = getNodeText(xmlParInfo, "book");
+					parNo = getNodeText(xmlParInfo, "paragraph");
+					break;
+				}
+			}
+		}
+	}
+	if (bookId == "" || parNo == "") {
+		return false;
+	} else {
+		for (var iPar = 0; iPar < gArrayDocParagraph.length; iPar++) {
+			currBookId = gArrayDocParagraph[iPar].book;
+			currParNo = gArrayDocParagraph[iPar].paragraph;
+
+			if (currBookId == bookId && currParNo == parNo) {
+				return iPar;
+			}
+		}
+	}
+
+	return false;
+}
+var mouse_action_edit = true;
+var mouse_action_lookup = true;
+var mouse_action_translate = false;
+function lock_key(obj, key, check_id, svg_id) {
+	var lock_key_str = "";
+	switch (key) {
+		case "off":
+			lock_key_str += "<input id='" + check_id + '\' type="checkbox" style="display:none; " />';
+			lock_key_str +=
+				'<svg class="icon" onclick=lock_key(\'' + obj + "','on','" + check_id + "','" + svg_id + "')>";
+			lock_key_str += '<use xlink="http://www.w3.org/1999/xlink" href="svg/icon.svg#ic_' + svg_id + '_off">';
+			lock_key_str += "</use></svg>";
+			document.getElementById(obj).innerHTML = lock_key_str;
+			break;
+		case "on":
+			lock_key_str += "<input id='" + check_id + '\' type="checkbox" style="display:none; " checked/>';
+			lock_key_str +=
+				'<svg class="icon" onclick=lock_key(\'' + obj + "','off','" + check_id + "','" + svg_id + "')>";
+			lock_key_str += '<use xlink="http://www.w3.org/1999/xlink" href="svg/icon.svg#ic_' + svg_id + '_on ">';
+			lock_key_str += "</use></svg>";
+			document.getElementById(obj).innerHTML = lock_key_str;
+			break;
+	}
+}
+
+function set_word_click_action(obj, item) {
+	switch (item) {
+		case "normal":
+			if (document.getElementById(obj).checked == true) {
+				document.getElementById(obj).checked = false;
+				document.getElementById("icon_" + obj + "_on").style.display = "none";
+				document.getElementById("icon_" + obj + "_off").style.display = "block";
+			} else {
+				document.getElementById(obj).checked = true;
+				document.getElementById("icon_" + obj + "_on").style.display = "block";
+				document.getElementById("icon_" + obj + "_off").style.display = "none";
+			}
+
+			break;
+		case "edit":
+			if (document.getElementById(obj).checked == true) {
+				document.getElementById(obj).checked = false;
+				document.getElementById("icon_" + obj + "_on").style.display = "none";
+				document.getElementById("icon_" + obj + "_off").style.display = "block";
+				mouse_action_edit = document.getElementById(obj).checked;
+			} else {
+				document.getElementById(obj).checked = true;
+				document.getElementById("icon_" + obj + "_on").style.display = "block";
+				document.getElementById("icon_" + obj + "_off").style.display = "none";
+				document.getElementById("icon_Trans_as_on").style.display = "none";
+				document.getElementById("icon_Trans_as_off").style.display = "block";
+				document.getElementById("Trans_as").checked = false;
+				mouse_action_translate = false;
+				mouse_action_edit = document.getElementById(obj).checked;
+			}
+			break;
+		case "lookup":
+			if (document.getElementById(obj).checked == true) {
+				document.getElementById(obj).checked = false;
+				document.getElementById("icon_" + obj + "_on").style.display = "none";
+				document.getElementById("icon_" + obj + "_off").style.display = "block";
+				mouse_action_lookup = document.getElementById(obj).checked;
+			} else {
+				document.getElementById(obj).checked = true;
+				document.getElementById("icon_" + obj + "_on").style.display = "block";
+				document.getElementById("icon_" + obj + "_off").style.display = "none";
+				document.getElementById("icon_Trans_as_on").style.display = "none";
+				document.getElementById("icon_Trans_as_off").style.display = "block";
+				document.getElementById("Trans_as").checked = false;
+				mouse_action_translate = false;
+				mouse_action_lookup = document.getElementById(obj).checked;
+			}
+			break;
+		case "translate":
+			if (document.getElementById(obj).checked == true) {
+				document.getElementById(obj).checked = false;
+				document.getElementById("icon_" + obj + "_on").style.display = "none";
+				document.getElementById("icon_" + obj + "_off").style.display = "block";
+				mouse_action_translate = document.getElementById(obj).checked;
+			} else {
+				document.getElementById(obj).checked = true;
+				document.getElementById("icon_" + obj + "_on").style.display = "block";
+				document.getElementById("icon_" + obj + "_off").style.display = "none";
+				document.getElementById("icon_Look_Up_on").style.display = "none";
+				document.getElementById("icon_Look_Up_off").style.display = "block";
+				document.getElementById("icon_Edit_Dialog_on").style.display = "none";
+				document.getElementById("icon_Edit_Dialog_off").style.display = "block";
+				document.getElementById("Edit_Dialog").checked = false;
+				document.getElementById("Look_Up").checked = false;
+				mouse_action_edit = false;
+				mouse_action_lookup = false;
+				mouse_action_translate = document.getElementById(obj).checked;
+			}
+			break;
+	}
+}
+
+//鼠标点击词头
+function on_word_click(sWordId) {
+	closeModifyWindow();
+	g_currEditWord = sWordId;
+	var xAllWord = gXmlBookDataBody.getElementsByTagName("word");
+	var wid = getWordIndex(sWordId);
+	g_eCurrWord = xAllWord[wid];
+	var sReal = getNodeText(xAllWord[wid], "real");
+	var sParent = getNodeText(xAllWord[wid], "parent");
+	var sMeaning = getNodeText(xAllWord[wid], "mean");
+
+	//显示修改单个词的窗口
+	if (mouse_action_edit) {
+		showModifyWin(sWordId);
+	}
+
+	//word Message
+	msg_show_content(1, sWordId);
+	msg_show_content_panal();
+
+	//术语
+	note_lookup(sParent, "term_dict");
+
+	//参考字典
+	if (mouse_action_lookup) {
+		//dict_search(sReal);
+		window.open("../dict/index.php?builtin=true&theme=dark&key="+sReal,target="dict");
+
+	}
+
+	//添加词到翻译框
+	//if(mouse_action_translate){
+	//	add_word_to_tran_win(sMeaning);
+	//}
+}
+
+function note_apply(guid) {}
+/*
+function apply_button_lock(){
+
+	if($("#input_lock")[0].checked){// || g_currBookMarkColor!="bmc0"
+		$("#apply_to_down")[0].disabled=true;
+		$("#apply_to_up")[0].disabled=true;
+		$("#apply_to_all")[0].disabled=true;
+
+	}
+	else{
+		$("#apply_to_down")[0].disabled=false;
+		$("#apply_to_up")[0].disabled=false;
+		$("#apply_to_all")[0].disabled=false;
+	}
+
+}
+ */
+
+function mdf_win_data_change(key, value) {
+	$("#" + key).val(value);
+}
+function mdf_win_part_change(strPart) {
+	$("#input_org").val(strPart);
+	input_org_change();
+}
+function mdf_win_case_change(strCase) {
+	let aCase = strCase.split("#");
+	let type = "";
+	let gramma = "";
+	if (aCase[0]) {
+		type = aCase[0];
+	}
+	if (aCase[0]) {
+		type = aCase[0];
+	}
+	if (aCase[1]) {
+		gramma = aCase[1];
+	}
+	$("#input_case").val(strCase);
+	let arrGramma = gramma.split("$");
+	g_caseSelect[0] = type;
+	if (arrGramma[0]) {
+		g_caseSelect[1] = arrGramma[0];
+	} else {
+		g_caseSelect[1] = "";
+	}
+	if (arrGramma[1]) {
+		g_caseSelect[2] = arrGramma[1];
+	} else {
+		g_caseSelect[2] = "";
+	}
+	if (arrGramma[2]) {
+		g_caseSelect[3] = arrGramma[2];
+	} else {
+		g_caseSelect[3] = "";
+	}
+	refreshCaseSelect();
+}
+//显示修改单个词的窗口
+function showModifyWin(sWordId) {
+	//获取当前编辑的单词所在的段的索引号
+	gCurrModifyWindowParNo = getParIndexByWordId(sWordId);
+
+	let xAllWord = gXmlBookDataBody.getElementsByTagName("word");
+	let wid = getWordIndex(sWordId);
+
+	let tWin = "";
+	let tApply = "";
+	let eWord = document.getElementById("wb" + sWordId);
+	let eWin = document.getElementById("modifywin");
+	let eWordInfo = document.getElementById("modify_detaile");
+	let eApply = document.getElementById("modify_apply");
+
+	let sReal = getNodeText(xAllWord[wid], "real");
+	let sParent = getNodeText(xAllWord[wid], "parent");
+	let sMeaning = getNodeText(xAllWord[wid], "mean");
+	let sOrg = getNodeText(xAllWord[wid], "org");
+	let sOm = getNodeText(xAllWord[wid], "om");
+	let sCase = getNodeText(xAllWord[wid], "case");
+	let sParentGrammar = getNodeText(xAllWord[wid], "pg");
+	let sParent2 = getNodeText(xAllWord[wid], "parent2");
+
+	//showCurrWordTable(sReal);
+
+	if (g_useMode == "edit") {
+		//初始值
+		$("#input_meaning").val(sMeaning);
+		$("#input_org").val(sOrg);
+		$("#input_om").val(sOm);
+		$("#input_case").val(sCase);
+		$("#input_parent_grammar").val(sParentGrammar);
+		$("#id_text_prt_prt").val(sParent2);
+		
+		if (sParentGrammar != "" || sParent2 != "" || sParent2 != " ") {
+			document.getElementById("edit_detail_prt_prt").style.display = "block";
+			document.getElementById("svg_parent2").style.transform = "rotate(90deg)";
+		} else {
+			document.getElementById("edit_detail_prt_prt").style.display = "none";
+			document.getElementById("svg_parent2").style.transform = "rotate(0deg)";
+		}
+		document.getElementById("parent_grammar").innerHTML = getLocalGrammaStr(sParentGrammar);
+
+
+		//右侧修改菜单
+		$("#word_mdf_mean_dropdown").html(render_word_menu_mean(g_currEditWord, 1));
+		$("#word_mdf_parts_dropdown").html(render_word_menu_parts(sWordId, 1));
+		$("#word_mdf_case_dropdown").html(render_word_menu_gramma(sWordId, 1));
+		$("#word_mdf_parent_dropdown").html(render_word_menu_parent(sWordId));
+		$("#word_mdf_prt_prt_dropdown").html(render_word_menu_parent_parent(sWordId));
+
+		let typeAndGramma = sCase.split("#");
+		if (typeAndGramma.length > 1) {
+			sType = typeAndGramma[0];
+			sGramma = typeAndGramma[1];
+		} else {
+			sType = "";
+			sGramma = typeAndGramma[0];
+		}
+		g_caseSelect[0] = sType;
+		aGramma = sGramma.split("$");
+		lenGramma = aGramma.length;
+		if (lenGramma > 3) {
+			lenGramma = 3;
+		}
+		for (iGramma = 0; iGramma < lenGramma; iGramma++) {
+			g_caseSelect[iGramma + 1] = aGramma[iGramma];
+		}
+		//刷新type and gramma 下拉菜单选项
+		refreshCaseSelect();
+
+		//刷新part meaning 下拉菜单选项
+		g_currPartMeaning = "";
+		g_initPartMeaning = true;
+		refreshPartMeaningSelect();
+		if (sOrg != "?" && sOrg != "") {
+			input_org_change(document.getElementById("input_org"));
+		}
+
+		tApply += '<div class="modifybutton">';
+		tApply += "<p style='display: flex' >"; //onclick=apply_button_lock()
+
+		if (getNodeText(xAllWord[wid], "lock") == "true") {
+			tApply += "<span class='apply_to' id='edit_lock' align=\"left\">";
+			tApply += '<input type="checkbox" style=" display:none;" align="left" id=\'input_lock\' checked />';
+			tApply +=
+				"<svg class=\"icon\" onclick=lock_key('edit_lock','off','input_lock','lock')><use xlink=\"http://www.w3.org/1999/xlink\" href=\"svg/icon.svg#ic_lock_on \"></use></svg>";
+			tApply += "</span>";
+		} else {
+			tApply += "<span class='apply_to' id='edit_lock' align=\"left\">";
+			tApply += '<input type="checkbox" style=" display:none;" align="left" id=\'input_lock\' />';
+			tApply +=
+				"<svg class=\"icon\" onclick=lock_key('edit_lock','on','input_lock','lock')><use xlink=\"http://www.w3.org/1999/xlink\" href=\"svg/icon.svg#ic_lock_off\"></use></svg>";
+			tApply += "</span>";
+		}
+		//tApply += "<button onclick=\"upload_to_my_dict()\">上传到我的字典</button>";
+
+		let allword = doc_word();
+		let sameCount = 0;
+		for (let i = 0; i < allword.length; i++) {
+			if (
+				sReal == getNodeText(allword[i], "real") ||
+				(sParent != "" && sParent == getNodeText(allword[i], "parent"))
+			) {
+				sameCount++;
+			}
+		}
+
+		if (sameCount > 1) {
+			tApply += "<span>";
+		} else {
+			tApply += "<span style='display:none'>";
+		}
+		tApply +=
+			'<input id=\'checkbox_apply_same\' type="checkbox" style=" width:14px; height:14px; margin-left:10px;" align="left"/>' +
+			gLocal.gui.applyto +
+			"&nbsp;<span id='same_word_count' >" +
+			(sameCount + 1) +
+			"&nbsp;" +
+			gLocal.gui.same_word +
+			"</span>";
+		tApply += "</span>";
+
+		tApply += "<span class='apply_to' id='upload_lock' align=\"left\">";
+		tApply +=
+			'<input type="checkbox" style="display:none; width:14px; height:14px; margin-left:10px;" align="left" id=\'input_to_db\' />';
+		//tApply += "<svg class=\"icon\" onclick=lock_key('upload_lock','on','input_to_db','cloud')><use xlink=\"http://www.w3.org/1999/xlink\" href=\"svg/icon.svg#ic_cloud_off\"></span>";
+		tApply += "</span>";
+
+		tApply += "</p>";
+
+		tApply += "</div>";
+		tApply += '<div class="modifycancel" align="right">';
+		/*		
+		tApply += "<span class='apply_to'>" 
+		tApply+= "<svg class=\"icon\"><use xlink=\"http://www.w3.org/1999/xlink\" href=\"svg/icon.svg#ic_format_paint\">";
+		tApply += "</span>";
+		
+
+		tApply+= "<button class='apply_to' id='apply_to_down' onclick=\"modifyApply('" + sWordId + "','down')\" title='向下填充'>";
+		tApply+= "<svg style='transform: rotate(180deg)' class=\"icon\"><use xlink=\"http://www.w3.org/1999/xlink\" href=\"svg/icon.svg#ic_file_upload\">";
+		tApply+= "</button>";
+		
+		tApply+= "<button class=' apply_to' id='apply_to_up' onclick=\"modifyApply('" + sWordId + "','up')\"  title='向上填充'>";
+		tApply+= "<svg class=\"icon\"><use xlink=\"http://www.w3.org/1999/xlink\" href=\"svg/icon.svg#ic_file_upload\">";
+		tApply+= "</button>";
+		
+		tApply+= "<button class=' apply_to' id='apply_to_all' onclick=\"modifyApply('" + sWordId + "','all')\"  title='更新全部'>";
+		tApply+= "<svg class=\"icon\"><use xlink=\"http://www.w3.org/1999/xlink\" href=\"svg/icon.svg#ic_format_line_spacing\">";
+		tApply+= "</button>";
+		*/
+		tApply +=
+			"<button class=' apply_to' id='apply_to_this' onclick=\"modifyApply('" +
+			sWordId +
+			"',true)\"  title='Save and Favorite'>";
+		tApply += "💾&🌐"+gLocal.gui.to_user_dictionary;
+		tApply += "</button>";
+
+		tApply +=
+			"<button class=' apply_to' id='apply_to_this' onclick=\"modifyApply('" +
+			sWordId +
+			"',false)\"  title='Save Draft'>";
+		tApply += "💾";//gLocal.gui.save
+		//tApply += '<svg class="icon" style="fill: var(--box-bg-color1)"><use xlink:href="../../node_modules/bootstrap-icons/bootstrap-icons.svg#translate"></use></svg>'
+		tApply += "</button>";
+
+		tApply += "<button class=' apply_to' onclick=\"modifyCancel()\">";
+		tApply += "❌";//gLocal.gui.cancel+
+		tApply += "</button>";
+		tApply += "</div>";
+		eApply.innerHTML = tApply;
+
+		document.getElementById("id_text_bookmark").value = getNodeText(xAllWord[wid], "bmt");
+		document.getElementById("id_text_note").value = getNodeText(xAllWord[wid], "note");
+		document.getElementById("id_text_id").innerHTML = get_book_name_by_id(getNodeText(xAllWord[wid], "id"));
+		document.getElementById("id_text_pali").value = getNodeText(xAllWord[wid], "pali");
+		document.getElementById("id_text_real").value = getNodeText(xAllWord[wid], "real");
+		document.getElementById("id_text_parent").value = getNodeText(xAllWord[wid], "parent");
+
+		$("#id_relation_text").val(getNodeText(xAllWord[wid], "rela"));
+		rela_refresh(sWordId);
+
+		if (getNodeText(xAllWord[wid], "bmc") == "") {
+			g_currBookMarkColor = "bmc0";
+		} else {
+			g_currBookMarkColor = getNodeText(xAllWord[wid], "bmc");
+		}
+		getBookMarkColor(g_currBookMarkColor);
+
+		//显示编辑窗口
+		eWin.style.display = "block";
+		if (_display_sbs == 1) {
+			$("#modifywin").addClass("left_edit_frame");
+			//根据偏移量设置窗口位置
+			if (
+				$(".sent_wbw").outerWidth() +
+					$("#left_tool_bar").outerWidth() -
+					$("#wb" + sWordId).offset().left -
+					$("#modifywin").outerWidth() >
+				0
+			) {
+				//$("#modifywin").removeClass("right_edit_frame")
+				$("#modifywin").css("margin-left", "0");
+
+				//$("#modifywin").style();
+				//$("#modifywin").css("margin-left", "8px");
+				//$("#modifywin::after").css("left", "0");
+				//$("#modifywin::after").style.left = "0";, "": "" }
+			} else {
+				let margin_change =
+					$(".sent_wbw").outerWidth() +
+					$("#left_tool_bar").outerWidth() -
+					$("#wb" + sWordId).offset().left -
+					$("#modifywin").outerWidth();
+				//$("#modifywin").removeClass("left_edit_frame")
+				//$("#modifywin").addClass("right_edit_frame")
+				$("#modifywin").css("margin-left", margin_change + "px");
+				//$("#modifywin::after").css("right", "0");
+				//$("#modifywin::after").style.right = "0";
+			}
+			$("#ws_" + sWordId).addClass("wbw_selected");
+		}
+
+		var sDetail = "detail" + sWordId;
+		var eDetail = document.getElementById(sDetail);
+		eWord.insertBefore(eWin, eDetail);
+
+		//document.getElementById("dict_ref_search_input").value = sReal;
+
+		//editor_refresh_inline_dict(sReal);
+	}
+}
+
+function get_book_name_by_id(bookid) {
+	var book_id = bookid.split("-")[0];
+	var book_id2 = bookid.slice(book_id.length);
+
+	for (i_bookname in local_palicannon_index) {
+		if (book_id == local_palicannon_index[i_bookname].id) {
+			book_id2 = local_palicannon_index[i_bookname].title + book_id2;
+		}
+	}
+	return book_id2;
+}
+
+function add_word_to_tran_win(sMeaning) {
+	var tranObj = document.getElementById("id_text_edit_form");
+	if (tranObj && tranObj.style.display != "none") {
+		var textObj = document.getElementById("id_text_edit_area");
+		if (textObj) {
+			textObj.value += sMeaning;
+		}
+	}
+}
+
+function on_word_mouse_enter() {
+	let wordid = $(this).attr("id");
+
+	if (gCurrMoseEnterWordId == wordid) {
+		return;
+	}
+	gCurrMoseEnterWordId = wordid;
+
+	//remove the 'wb' in string head
+	_curr_mouse_enter_wordid = wordid.substr(2);
+
+	relation_link_show(_curr_mouse_enter_wordid);
+
+	let xAllWord = gXmlBookDataBody.getElementsByTagName("word");
+	let iIndex = getWordIndex(_curr_mouse_enter_wordid);
+	if (iIndex >= 0) {
+		let paliword = getNodeText(xAllWord[iIndex], "real");
+		let factors = [];
+		if(getNodeText(xAllWord[iIndex], "org") != '?'){
+			factors = getNodeText(xAllWord[iIndex], "org").split('+');
+		}
+		//渲染单词下拉菜单
+		dictFetch([paliword].concat(factors),function(){
+			render_word_menu(_curr_mouse_enter_wordid);
+		})
+
+	}
+	//如果显示relation
+	if (gRelationSelectWordBegin) {
+		gCurrWordDivBorder = $(this).css("border");
+		$(this).css("border", "1px solid #65c5bd");
+		let eHeadBar = document.getElementById("word_tool_bar");
+		if (eHeadBar) {
+			eHeadBar.style.display = "block";
+		}
+		let eWord = document.getElementById("ws_" + _curr_mouse_enter_wordid);
+		let eWordHead = document.getElementById("whead_" + _curr_mouse_enter_wordid);
+		eWord.insertBefore(eHeadBar, eWordHead);
+
+		gWordHeadBarVisible = true;
+	}
+}
+
+//编辑窗口拆分改变
+var g_arrPartMean = null;
+var g_initPartMeaning = true;
+var mDict = new Array();
+function input_org_change() {
+	g_arrPartMean = null;
+	g_initPartMeaning = true;
+
+	var arrPart = $("#input_org").val().split("+");
+	var arrNewPart = new Array();
+	var i;
+	for (i in arrPart) {
+		if (!mDict[arrPart[i]]) {
+			arrNewPart.push(arrPart[i]);
+		}
+	}
+	if (arrNewPart.length > 0) {
+		//如果有内存字典里面没有的单词,查询
+		lookupNewWord({
+			word: arrNewPart.join(),
+			type: "part",
+		},
+		refreshPartMeaningSelect);
+	} else {
+		refreshPartMeaningSelect();
+	}
+}
+
+
+/*
+  |------------------------------------
+  |当人工输入拆分意思后,更新拆分意思数组
+  |------------------------------------
+  |obj : 输入框
+  |------------------------------------
+*/
+function input_om_change(obj){
+	g_arrPartMean = obj.value().split('+');
+}
+
+/*
+  |------------------------------------
+  |当选择拆分意思菜单后,更新拆分意思输入框
+  |------------------------------------
+  | 
+  |------------------------------------
+*/
+function part_mean_ok() {
+	var part_mean_ok_str = g_arrPartMean.join("+");
+	part_mean_ok_str = "#" + part_mean_ok_str + "#";
+	part_mean_ok_str = part_mean_ok_str.replace(/\+ /g, "+");
+	part_mean_ok_str = part_mean_ok_str.replace(/ \+/g, "+");
+	part_mean_ok_str = part_mean_ok_str.replace(/\# /g, "");
+	part_mean_ok_str = part_mean_ok_str.replace(/ \#/g, "");
+	part_mean_ok_str = part_mean_ok_str.replace(/\#/g, "");
+	document.getElementById("input_om").value = part_mean_ok_str; //.slice(0,-1);
+}
+
+/*
+编辑窗口中拆分下拉菜单改变
+*/
+function meaningPartChange(index, newValue) {
+	g_initPartMeaning = false;
+
+	g_arrPartMean[index] = newValue;
+	part_mean_ok();
+
+	refreshPartMeaningSelect();
+}
+function input_org_switch(id_1, id_2) {
+	document.getElementById(id_1).style.display = "none";
+	document.getElementById(id_2).style.display = "inline-flex";
+	document.getElementById(id_2).focus();
+	refreshPartMeaningSelect();
+}
+function refreshPartMeaningSelect() {
+	var part = document.getElementById("input_org").value;
+	var arrPart = new Array();
+	if (part == "" || part.lastIndexOf("+") == -1) {
+		arrPart.push(part);
+	} else {
+		arrPart = part.split("+");
+	}
+	if (g_initPartMeaning) {
+		g_arrPartMean = part.split("+");
+	}
+	var output = "<div id='om_dropdown_area' style='overflow-x: auto;white-space: nowrap;max-width: 13em;'>";
+	//output="<span style='width:90%' onclick=\"input_org_switch('input_org_select','input_om')\"></span><br/>"
+	for (iPart in arrPart) {
+		output += getMeaningMenuList(iPart, arrPart[iPart]);
+		if (arrPart.length == 1) {
+			break;
+		} else if (iPart < arrPart.length - 1) {
+			output += "+";
+		}
+	}
+	output += "</div>";
+	output += "<div style='width: 5.5em;'>";
+	output += "<button style='margin-left:auto; padding: 1px 6px;' onclick=\"copy_part_mean_to_mean()\">";
+	output += '<svg class="icon"><use xlink="http://www.w3.org/1999/xlink" href="svg/icon.svg#ic_vertical_align_top">';
+	output += "</button>";
+
+	output +=
+		"<button style='margin-left:auto; padding: 1px 6px;' onclick=\"input_org_switch('input_org_select','input_om')\">";
+	output += "<svg class='icon'><use xlink='http://www.w3.org/1999/xlink' href='svg/icon.svg#ic_mode_edit'>";
+	output += "</button>";
+	output += "</div>";
+
+	document.getElementById("input_org_select").innerHTML = output;
+	//增加拆分意思所见即所得
+	var part_mean_display_str = document.getElementById("input_om").value;
+	var part_mean_display_array = new Array();
+	if (part_mean_display_str.lastIndexOf("+") != -1) {
+		part_mean_display_array = part_mean_display_str.split("+");
+	} else {
+		part_mean_display_array.push(part_mean_display_str);
+	}
+
+	if (part_mean_display_array.length <= arrPart.length) {
+		for (i_display in part_mean_display_array) {
+			document.getElementById("org_part_mean_" + i_display).innerHTML = part_mean_display_array[i_display];
+		}
+		if (part_mean_display_array.length < arrPart.length) {
+			for (i_display = part_mean_display_array.length; i_display < arrPart.length; i_display++) {
+				//document.getElementById("org_part_mean_" + i_display).innerHTML = "⬇";
+			}
+		}
+	} else {
+		for (i_display in arrPart) {
+			if (i_display == arrPart.length - 1) {
+				var part_mean_display_str_last = "";
+				for (j_display = i_display; j_display < part_mean_display_array.length; j_display++) {
+					part_mean_display_str_last += part_mean_display_array[j_display];
+				}
+				document.getElementById("org_part_mean_" + i_display).innerHTML = part_mean_display_str_last;
+			} else {
+				document.getElementById("org_part_mean_" + i_display).innerHTML = part_mean_display_array[i_display];
+			}
+		}
+	}
+}
+//编辑窗口拆分意思复制到整体意思
+function copy_part_mean_to_mean() {
+	let meaning = g_arrPartMean.join("");
+	if(testCJK(meaning)){
+		$("#input_meaning").val(removeFormulaB(g_arrPartMean.join(""), "[", "]"));
+	}else{
+		$("#input_meaning").val(removeFormulaB(g_arrPartMean.join(" "), "[", "]"));
+	}
+	
+}
+//编辑窗口拆分意思下拉菜单
+function getMeaningMenuList(index, word) {
+	var currMeaningList0 = getWordMeaningList(word);
+	var currMeaningList = new Array();
+	var part_mean_display_str = document.getElementById("input_om").value;
+	var part_mean_display_array = new Array();
+	if (part_mean_display_str.lastIndexOf("+") != -1) {
+		part_mean_display_array = part_mean_display_str.split("+");
+	} else {
+		part_mean_display_array.push(part_mean_display_str);
+	}
+	if (part_mean_display_array.length - 1 >= index) {
+		currMeaningList.push(part_mean_display_array[index]);
+	} else {
+		currMeaningList.push(" ");
+	}
+	for (const iterator of currMeaningList0) {
+		if (iterator != "") {
+			currMeaningList.push(iterator);
+		}
+	}
+
+	var output = "";
+	output += "<div class=\"case_dropdown\" style='display:inline-block;'>";
+
+	let currMean;
+	output += "<p id='org_part_mean_" + index + "' class='case_dropbtn' >";
+	if (g_initPartMeaning) {
+		currMean = currMeaningList[0];
+		g_arrPartMean[index] = currMeaningList[0];
+	} else {
+		currMean = g_arrPartMean[index];
+	}
+	if (currMean == "") {
+		currMean = " ";
+	}
+	output += currMean + "</p>";
+
+	output += '<div class="case_dropdown-content" id=\'part_mean_menu_' + index + "' style='left:0;right:0;'>";
+	//直列菜单
+	output += "<a onclick='meaningPartLookup(\"" +word +"\")'>🔍" +gLocal.gui.dict +"</a>";	
+	for (const itMean of currMeaningList) {
+		if(itMean!="?"){
+			output += "<a onclick='meaningPartChange(" +index +	',"' +itMean +	"\")'>" +itMean +"</a>";					
+		}
+
+	}
+
+	output += "</div>";
+	output += "</div>";
+	return output;
+}
+function meaningPartLookup(word){
+	window.open("../dict/index.php?builtin=true&theme=dark&key="+word,target="dict");
+}
+function getWordMeaningList(word) {
+	var currOM = "";
+	var arrOM = new Array();
+	var thisWord = word;
+	//新的方法 内存字典用索引数组
+	if (mDict[word]) {
+		for (var j = 0; j < mDict[word].length; j++) {
+			if (mDict[word][j].mean) {
+				var currOM = mDict[word][j].mean.split("$");
+				for (iMean in currOM) {
+					if (currOM[iMean].length > 0 && currOM[iMean] != "?") {
+						pushNewToList(arrOM, currOM[iMean]);
+					}
+				}
+			}
+		}
+	}
+
+	if (arrOM.length == 0) {
+		arrOM.push("?");
+	}
+	return arrOM;
+}
+
+//删除连音词
+function edit_un_remove(parentId) {
+	edit_un_RemoveHtmlNode(parentId);
+
+	let xWord = gXmlBookDataBody.getElementsByTagName("word");
+	var count = 0;
+	//移除内存数据
+
+	for (iWord = xWord.length - 1; iWord >= 0; iWord--) {
+		let id = getNodeText(xWord[iWord], "id");
+		if (id.indexOf(parentId) == 0 && id != parentId) {
+			xWord[iWord].parentNode.removeChild(xWord[iWord]);
+			count++;
+		}
+	}
+	//移除根单词的类标志
+	var parentElement = document.getElementById("wb" + parentId);
+	if (parentElement) {
+		parentElement.classList.remove("un_parent");
+		parentElement.classList.remove("comp_parent");
+	}
+
+	user_wbw_push_word(parentId);
+	user_wbw_commit();
+	com_XmlAllWordRefresh();
+	modifyWordDetailByWordId(parentId);
+	var_dump(gLocal.gui.removeword + ": " + count);
+}
+
+function edit_un_RemoveHtmlNode(parentId) {
+	var xAllWord = gXmlBookDataBody.getElementsByTagName("word");
+	for (wordIndex = 0; wordIndex < xAllWord.length; wordIndex++) {
+		if (getNodeText(xAllWord[wordIndex], "un") == parentId) {
+			var childId = getNodeText(xAllWord[wordIndex], "id");
+			var element = document.getElementById("wb" + childId);
+			element.parentNode.removeChild(element);
+		}
+	}
+}
+
+/*
+拆连读词
+*/
+function edit_un_split(parentId) {
+	var xBlock = gXmlBookDataBody.getElementsByTagName("block");
+	var iWordCount = 0;
+	for (iBlock = 0; iBlock < xBlock.length; iBlock++) {
+		var xData = xBlock[iBlock].getElementsByTagName("data")[0];
+		xWord = xData.getElementsByTagName("word");
+		for (iWord = 0; iWord < xWord.length; iWord++) {
+			if (getNodeText(xWord[iWord], "id") == parentId) {
+				mType = getNodeText(xWord[iWord], "case").split("#")[0];
+				if (mType == ".un." || mType == ".comp.") {
+					nextElement = com_get_nextsibling(xWord[iWord]);
+					if (nextElement != null) {
+						//下一个元素存在
+						if (getNodeText(nextElement, "un") == parentId) {
+							//若有孩子則不进行任何处理,直接返回
+							return;
+						}
+					}
+				} else {
+					//若不是连读词則不进行任何处理,直接返回
+					return;
+				}
+				if (getNodeText(xWord[iWord], "mean") == "?") {
+					setNodeText(xWord[iWord], "mean", "_un_auto_mean_");
+				}
+				if (getNodeText(xWord[iWord], "om") == "?") {
+					setNodeText(xWord[iWord], "om", "_un_auto_factormean_");
+				}
+
+				var parentElement = document.getElementById("wb" + parentId);
+				if (parentElement) {
+					if (mType == ".un.") {
+						parentElement.classList.add("un_parent");
+					} else {
+						parentElement.classList.add("comp_parent");
+					}
+				}
+				var nextWordNodeId = getNodeText(xWord[iWord + 1], "id");
+				if (mType == ".un.") {
+					var org = "[+" + getNodeText(xWord[iWord], "org") + "+]";
+				} else {
+					var org = getNodeText(xWord[iWord], "org").replace(/\+/g, "+-+");
+				}
+				var sSubPali = org.split("+");
+				var orgReal = org.replace(/n\+/g, "ṃ+"); //智能識別結尾為n的拆分
+				orgReal = orgReal.replace(/ñ\+/g, "ṃ+"); //智能識別結尾為n的拆分
+				orgReal = orgReal.replace(/m\+/g, "ṃ+"); //智能識別結尾為n的拆分
+				orgReal = orgReal.replace(/d\+/g, "ṃ+"); //智能識別結尾為n的拆分
+				var sSubReal = orgReal.split("+");
+				for (iNewWord = 0; iNewWord < sSubPali.length; iNewWord++) {
+					var newNode = gXmlBookData.createElement("word");
+					setNodeText(newNode, "pali", sSubPali[iNewWord]);
+					var newGUID = parentId + "-" + iNewWord;
+					setNodeText(newNode, "id", newGUID);
+					setNodeText(newNode, "un", parentId);
+					let newPali = sSubReal[iNewWord].toLowerCase();
+					if (sSubPali[iNewWord] == "[") {
+						setNodeText(newNode, "real", "");
+						setNodeText(newNode, "case", ".un:begin.");
+					} else if (sSubPali[iNewWord] == "]") {
+						setNodeText(newNode, "real", "");
+						setNodeText(newNode, "case", ".un:end.");
+					} else {
+						setNodeText(newNode, "real", newPali); //real转换为小写
+						setNodeText(newNode, "case", "?");
+					}
+					let newMeaning = findFirstMeanInDict(newPali);
+					let newParts = findFirstPartInDict(newPali);
+					let newPartMean = findFirstPartMeanInDict(newPali);
+					let newCase = findFirstCaseInDict(newPali);
+
+					setNodeText(newNode, "mean", newMeaning);
+					setNodeText(newNode, "org", newParts);
+					setNodeText(newNode, "om", newPartMean);
+					setNodeText(newNode, "case", newCase);
+
+					if (iWord == xWord.length - 1) {
+						xData.insertBefore(newNode, null);
+						edit_un_AddNewHtmlNode(nextWordNodeId, sSubPali[iNewWord], newGUID, iWordCount + iNewWord + 1);
+					} else {
+						xData.insertBefore(newNode, xWord[iWord + iNewWord + 1]);
+						edit_un_AddNewHtmlNode(nextWordNodeId, sSubPali[iNewWord], newGUID, iWordCount + iNewWord + 1);
+					}
+				}
+				modifyWordDetailByWordId(parentId);
+				word_mouse_event(); //添加鼠标事件,每次都执行效率低以后需要修改
+				var_dump(gLocal.gui.unsplit + " " + gLocal.gui.ok);
+				user_wbw_push_word(parentId);
+				user_wbw_commit();
+				return;
+			}
+			iWordCount++;
+		}
+	}
+}
+//添加连音词拆分html块
+function edit_un_AddNewHtmlNode(nextNodeId, strInsert, guid, id) {
+	let xWord = gXmlBookDataBody.getElementsByTagName("word");
+	let iWordIndex = getWordIndex(guid);
+	let parentId = guid.split("_")[0];
+	let parentElement = document.getElementById("wb" + parentId);
+	let element = document.getElementById("wb" + nextNodeId);
+
+	let htmlNewWord = renderWordBlock(xWord[iWordIndex]);
+	if (element) {
+		//下一个词存在。
+		$(element).before(htmlNewWord);
+	} else {
+		//下一个词不存在。
+		$(parentElement).append(htmlNewWord);
+	}
+}
+
+function file_export_html_validate_form(thisform) {
+	with (thisform) {
+		var tocstring = document.getElementById("content").innerHTML;
+		var suttastring = document.getElementById("sutta_text").innerHTML;
+		txt_toc.value = tocstring.replace(/onclick/g, "");
+		txt_sutta.value = suttastring.replace(/onclick/g, "");
+		return true;
+	}
+}
+
+function show_case_input(obj) {
+	if (obj.checked) {
+		document.getElementById("input_case").style.display = "block";
+	} else {
+		document.getElementById("input_case").style.display = "none";
+	}
+}
+
+function edit_tran_save() {
+	let eBlock;
+	switch (gTextEditMediaType) {
+		case "translate":
+			newText = document.getElementById("id_text_edit_area").value;
+			newText = newText.replace(/\n\n/g, "<br />");
+			newText = term_edit_to_std_str(newText);
+			setTranText(gEditorTranslateEditBlockId, newText);
+
+			eBlock = document.getElementById("id_tran_" + gEditorTranslateEditBlockId);
+			if (eBlock) {
+				eBlock.innerHTML = renderTranslateParBlockInnerById(gEditorTranslateEditBlockId);
+				term_updata_translation();
+			}
+			break;
+		case "note":
+			setNoteText(gEditorNoteEditBlockId, document.getElementById("id_text_edit_area").value);
+			newText = document.getElementById("id_text_edit_area").value;
+			newText = newText.replace(/\n/g, "<br />");
+			eBlock = document.getElementById("note_sen_" + gEditorNoteEditBlockId + "_0");
+			if (eBlock) {
+				eBlock.innerHTML = newText;
+			}
+			break;
+		case "heading":
+			var newHeadingInfo = new Object();
+			newHeadingInfo.level = document.getElementById("id_heading_edit_level").value;
+			newHeadingInfo.language = document.getElementById("id_text_edit_language").value;
+			newHeadingInfo.author = document.getElementById("id_text_edit_author").value;
+			newHeadingInfo.text = document.getElementById("id_text_edit_area").value;
+			setHeadingInfo(gEditorHeadingEditBlockId, newHeadingInfo);
+			newText = document.getElementById("id_text_edit_area").value;
+			newText = newText.replace(/\n/g, "<br />");
+			eBlock = document.getElementById("id_heading_text_" + gEditorHeadingEditBlockId);
+			if (eBlock) {
+				eBlock.innerHTML = newText;
+			}
+			updataToc();
+			break;
+		case "new_heading":
+			var newHeadingInfo = new Object();
+			newHeadingInfo.book = gEditorNewHeadingBookId;
+			newHeadingInfo.paragraph = gEditorNewHeadingPar;
+			newHeadingInfo.level = document.getElementById("id_heading_edit_level").value;
+			newHeadingInfo.language = document.getElementById("id_text_edit_language").value;
+			newHeadingInfo.author = document.getElementById("id_text_edit_author").value;
+			newHeadingInfo.text = document.getElementById("id_text_edit_area").value;
+			newHeadBlock(newHeadingInfo);
+			updataToc();
+			break;
+	}
+	document.getElementById("id_text_edit_form").style.display = "none";
+	Dragging(getDraggingDialog).disable();
+}
+function edit_tran_cancal() {
+	document.getElementById("id_text_edit_form").style.display = "none";
+	Dragging(getDraggingDialog).disable();
+}
+
+function edit_tran_delete() {
+	switch (gTextEditMediaType) {
+		case "heading":
+			xBlock = gXmlBookDataBody.getElementsByTagName("block");
+			for (var iBlock = 0; iBlock < xBlock.length; iBlock++) {
+				xmlParInfo = xBlock[iBlock].getElementsByTagName("info")[0];
+				xmlParData = xBlock[iBlock].getElementsByTagName("data")[0];
+				mId = getNodeText(xmlParInfo, "id");
+				type = getNodeText(xmlParInfo, "type");
+
+				if (mId == gEditorHeadingEditBlockId) {
+					gXmlBookDataBody.removeChild(xBlock[iBlock]);
+					return;
+				}
+			}
+			htmlNode = document.getElementById("id_heading_" + gEditorHeadingEditBlockId);
+			if (htmlNode) {
+				htmlNode.parentNode.removeChild(htmlNode);
+			}
+			updataToc();
+			break;
+	}
+
+	document.getElementById("id_text_edit_form").style.display = "none";
+}
+
+function editor_translate_edit(id) {
+	gTextEditMediaType = "translate";
+	gEditorTranslateEditBlockId = id;
+	var headingObj = getTranslateText(id);
+	document.getElementById("id_text_edit_language").value = headingObj.language;
+	document.getElementById("id_text_edit_author").value = headingObj.author;
+	document.getElementById("id_text_edit_area").value = term_std_str_to_edit(headingObj.text);
+	//document.getElementById("id_heading_edit_level").style.display="none";
+	document.getElementById("id_text_edit_delete").style.display = "none";
+	document.getElementById("id_text_edit_form").style.display = "block";
+	Dragging(getDraggingDialog).enable();
+}
+
+function editor_note_edit(id) {
+	gTextEditMediaType = "note";
+	gEditorNoteEditBlockId = id;
+	var tranText = getNoteText(id);
+	document.getElementById("id_text_edit_area").value = tranText;
+	document.getElementById("id_heading_edit_level").style.display = "none";
+	document.getElementById("id_text_edit_delete").style.display = "none";
+	document.getElementById("id_text_edit_form").style.display = "block";
+}
+function getNoteText(id) {
+	xBlock = gXmlBookDataBody.getElementsByTagName("block");
+	for (var iBlock = 0; iBlock < xBlock.length; iBlock++) {
+		xmlParInfo = xBlock[iBlock].getElementsByTagName("info")[0];
+		xmlParData = xBlock[iBlock].getElementsByTagName("data")[0];
+		mId = getNodeText(xmlParInfo, "id");
+		type = getNodeText(xmlParInfo, "type");
+
+		if (mId == id) {
+			xmlParDataSen = xmlParData.getElementsByTagName("sen");
+			var currText = "";
+			for (iSen = 0; iSen < xmlParDataSen.length; iSen++) {
+				currText += getNodeText(xmlParDataSen[iSen], "text");
+			}
+			return currText;
+		}
+	}
+	return "";
+}
+
+function editor_heading_add_new(inBook, inPar) {
+	document.getElementById("id_text_edit_caption_text").innerHTML = gLocal.gui.newheading;
+	gTextEditMediaType = "new_heading";
+	gEditorHeadingEditBlockId = -1;
+	gEditorNewHeadingBookId = inBook;
+	gEditorNewHeadingPar = inPar;
+	document.getElementById("id_heading_edit_level").value = "1";
+	document.getElementById("id_text_edit_language").value = "pali";
+	document.getElementById("id_text_edit_author").value = config_user_name;
+	document.getElementById("id_text_edit_area").value = "";
+	document.getElementById("id_heading_edit_level").style.display = "flex";
+	document.getElementById("id_text_edit_delete").style.display = "none";
+	document.getElementById("id_text_edit_form").style.display = "block";
+}
+
+function editor_heading_edit(id) {
+	document.getElementById("id_text_edit_caption_text").innerHTML = "Heading";
+	gTextEditMediaType = "heading";
+	gEditorHeadingEditBlockId = id;
+	var headingObj = getHeadingText(id);
+	document.getElementById("id_heading_edit_level").value = headingObj.level;
+	document.getElementById("id_text_edit_language").value = headingObj.language;
+	document.getElementById("id_text_edit_author").value = headingObj.author;
+	document.getElementById("id_text_edit_area").value = headingObj.text;
+	document.getElementById("id_heading_edit_level").style.display = "flex";
+	document.getElementById("id_text_edit_delete").style.display = "inline";
+	document.getElementById("id_text_edit_form").style.display = "block";
+}
+function getHeadingText(id) {
+	xBlock = gXmlBookDataBody.getElementsByTagName("block");
+	for (var iBlock = 0; iBlock < xBlock.length; iBlock++) {
+		xmlParInfo = xBlock[iBlock].getElementsByTagName("info")[0];
+		xmlParData = xBlock[iBlock].getElementsByTagName("data")[0];
+		mId = getNodeText(xmlParInfo, "id");
+		type = getNodeText(xmlParInfo, "type");
+
+		if (mId == id) {
+			var obj = new Object();
+			obj.text = getNodeText(xmlParData, "text");
+			obj.level = getNodeText(xmlParInfo, "level");
+			obj.language = getNodeText(xmlParInfo, "language");
+			obj.author = getNodeText(xmlParInfo, "author");
+			return obj;
+		}
+	}
+	return null;
+}
+function setHeadingInfo(id, objValue) {
+	xBlock = gXmlBookDataBody.getElementsByTagName("block");
+	for (var iBlock = 0; iBlock < xBlock.length; iBlock++) {
+		xmlParInfo = xBlock[iBlock].getElementsByTagName("info")[0];
+		xmlParData = xBlock[iBlock].getElementsByTagName("data")[0];
+		blockId = getNodeText(xmlParInfo, "id");
+		if (blockId == id) {
+			newText = objValue.text.replace(/\n/g, "<br />");
+			setNodeText(xmlParData, "text", newText);
+			setNodeText(xmlParInfo, "level", objValue.level);
+			setNodeText(xmlParInfo, "author", objValue.author);
+			setNodeText(xmlParInfo, "language", objValue.language);
+			return;
+		}
+	}
+}
+
+function editor_openChannal(book, para, channal) {
+	$.post(
+		"../doc/load_channal_para.php",
+		{
+			book: book,
+			para: para,
+			channal: channal,
+		},
+		function (data) {
+			editor_parse_doc_xml(data);
+		}
+	);
+}
+
+function render_channel_info(channel_id){
+	fetch('/api/v2/channel/'+channel_id,{
+        method: 'GET',
+        credentials: 'include',
+        headers: {
+            'Content-Type': 'application/json'
+        }
+    })
+  .then(response => response.json())
+  .then(function(data){
+      console.log(data);
+		let result = data.data;
+		if(data.ok==true){
+			$("#editor_doc_title").html("/" + data.data.owner_info.nickname + "/" + data.data.name);
+		}
+  });
+}
+//open project begin
+var editor_openProjectXmlHttp = null;
+function editor_openProject(strFileId, filetype) {
+	if (window.XMLHttpRequest) {
+		// code for IE7, Firefox, Opera, etc.
+		editor_openProjectXmlHttp = new XMLHttpRequest();
+	} else if (window.ActiveXObject) {
+		// code for IE6, IE5
+		editor_openProjectXmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
+	}
+
+	if (editor_openProjectXmlHttp != null) {
+		var d = new Date();
+		var strLink = "";
+		if (filetype == "db") {
+			strLink = "./project_load_db.php?id=" + strFileId;
+		} else {
+			strLink = "./project_load.php?id=" + strFileId;
+		}
+		editor_openProjectXmlHttp.onreadystatechange = editor_open_project_serverResponse;
+		editor_openProjectXmlHttp.open("GET", strLink, true);
+		editor_openProjectXmlHttp.send(null);
+	} else {
+		alert("Your browser does not support XMLHTTP.");
+	}
+}
+
+function editor_parse_doc_xml(xmlText) {
+	if (window.DOMParser) {
+		parser = new DOMParser();
+		gXmlBookData = parser.parseFromString(xmlText, "text/xml");
+	} else {
+		// Internet Explorer
+
+		gXmlBookData = new ActiveXObject("Microsoft.XMLDOM");
+		gXmlBookData.async = "false";
+		gXmlBookData.loadXML(xmlText);
+	}
+
+	if (gXmlBookData == null) {
+		alert("error:can not load Project. xml obj is null.");
+		return;
+	}
+
+	projectDataParse(gXmlBookData);
+	doc_file_info_get();
+	doc_info_change("accese_time", "");
+	//消息系统初始化
+	let msg_id = doc_head("msg_db_max_id");
+	if (msg_id != "" && !isNaN(msg_id)) {
+		msg_init(msg_id);
+	} else {
+		msg_init(1);
+	}
+	updataDocParagraphList();
+	updataToc();
+	//渲染数据块
+	blockShow(0);
+	//refreshResource();
+	editro_layout_loadStyle();
+}
+
+function editor_open_project_serverResponse() {
+	// 4 = "loaded"
+	if (editor_openProjectXmlHttp.readyState == 4) {
+		if (editor_openProjectXmlHttp.status == 200) {
+			// 200 = "OK"
+			var xmlText = editor_openProjectXmlHttp.responseText;
+			editor_parse_doc_xml(xmlText);
+		} else {
+			$("#sutta_text").html("Problem retrieving data:" + editor_openProjectXmlHttp.statusText);
+		}
+	}
+}
+
+//数据块显示
+function blockShow(id) {
+	xmlBlock = gXmlBookDataBody.getElementsByTagName("block");
+	if (id < xmlBlock.length) {
+		insertBlockToHtml(xmlBlock[id]);
+		t = setTimeout("blockShow(" + (id + 1) + ")", 1);
+		progress = id / xmlBlock.length; //计算比例
+		strProgress = (progress * 100).toFixed(0) + "%"; //计算百分比,保留1位小数
+		document.getElementById("load_progress_num").innerHTML = strProgress; //显示计算结果
+
+		loading.setAttribute("stroke-dashoffset", 255 - progress * 140 + "%");
+	} else {
+		//文档载入完毕
+		strProgress = "OK";
+		loading.setAttribute("stroke-dashoffset", "0%");
+
+		document.getElementById("load_progress_num").innerHTML = strProgress;
+
+		setTimeout("hiddenProgressDiv()", 1000);
+
+		term_array_updata();
+		//单词块响应鼠标消息
+		word_mouse_event();
+
+		//刷新译文中的术语
+		term_updata_translation();
+
+		//自动将逐词译段落切分为句子
+		layout_wbw_auto_cut();
+	}
+}
+
+function word_mouse_event() {
+	$(".word").mouseenter(on_word_mouse_enter);
+	$(".word").mouseleave(on_word_mouse_leave);
+}
+var _curr_mouse_enter_wordid = "";
+//单词快鼠标退出
+function on_word_mouse_leave() {
+	$("#mean_" + _curr_mouse_enter_wordid).html("loading");
+	$("#parts_" + _curr_mouse_enter_wordid).html("loading");
+	$("#partmean_" + _curr_mouse_enter_wordid).html("loading");
+	$("#gramma_" + _curr_mouse_enter_wordid).html("loading");
+	relation_link_hide();
+	if (gRelationSelectWordBegin) {
+		//$(this).css(gCurrWordDivBorder);
+		$(this).css("border", "none");
+	}
+	gCurrMoseEnterWordId = "";
+}
+
+//单词块鼠标进入事件
+var gCurrLookupWord = "";
+//save the broder style when mouse leave recover
+var gCurrWordDivBorder = "none";
+var gWordHeadBarVisible = false;
+var gCurrMoseEnterWordId = "";
+
+/**
+ * 渲染单词意思,拆分,语法下拉菜单
+ * @param {string} id 单词id
+ * 
+ */
+function render_word_menu(id) {
+	$("#word_mean").html(render_word_menu_mean(id));
+	$("#word_parts").html(render_word_menu_parts(id));
+	$("#word_partmean").html(render_word_menu_partmean(id));
+	$("#word_gramma").html(render_word_menu_gramma(id));
+
+	show_word_menu_mean(id);
+	show_word_menu_parts(id);
+	show_word_menu_partmean(id);
+	show_word_menu_gramma(id);
+}
+
+//根据单词长度排序  短词优先
+function sortWordLen(a, b) {
+	return a.length - b.length;
+}
+//渲染单词意思下拉菜单
+function render_word_menu_mean(id, target = 0) {
+	var output = "";
+	var word_real = doc_word("#" + id).val("real");
+	var word_parent = doc_word("#" + id).val("parent");
+	var arrParent = new Array();
+	//检索语基
+	if (word_parent.length > 0) {
+		//arrParent[word_parent]=1;
+	}
+	if (mDict[word_real]) {
+		for (var i in mDict[word_real]) {
+			if (mDict[word_real][i].parent && mDict[word_real][i].parent.length > 0) {
+				if (word_parent != mDict[word_real][i].parent && word_real != mDict[word_real][i].parent) {
+					arrParent[mDict[word_real][i].parent] = 1;
+				}
+			}
+		}
+	}
+	var sWord = new Array();
+	for (var sParent in arrParent) {
+		sWord.push(sParent);
+	}
+	//按照base长度升序
+	sWord.sort(sortWordLen);
+	if (word_parent.length > 0) {
+		sWord.unshift(word_parent);
+	}
+	sWord.unshift(word_real);
+
+	output += "<button ";
+	output += "style='font-size:100%;display:inline-flex; padding:0.1em 0.5em' ";
+	output += "onclick='fieldListChanged(\"" + id + '","mean","")\'>' ;
+	output += gLocal.gui.empty1 ;
+	output += "</button>";
+	output += '<div class="case_dropdown-org">';
+	for (var iWord in sWord) {
+		var pali = sWord[iWord];
+		//该词字典数量
+		var dict_count = 0;
+		if (mDict[pali]) {
+			for (iCount in mDict[pali]) {
+				if (mDict[pali][iCount].mean && mDict[pali][iCount].mean.length > 0) {
+					dict_count++;
+				}
+			}
+		}
+
+		if (pali == word_parent) {
+			output += '<div class="case_dropdown-base">';
+		} else {
+			output += '<div class="case_dropdown-first">';
+		}
+		output +=
+			'<a style="z-index:250; position:absolute; margin-right:2em;" onclick=\'dict_search("' + pali + "\")'>";
+		if (pali == word_parent) {
+			output += "<b>·" + pali + "·</b>";
+		} else {
+			output += pali;
+		}
+		output += "-" + dict_count + "</a>";
+		output += '<span style="z-index:220" class="case_dropdown-title" onclick="submenu_show_detail(this)">';
+		output += '<svg class="icon" style="fill:var(--main-color)"><use xlink:href="svg/icon.svg#ic_add"></use></svg>';
+		output += "</span>";
+		output += "<div class=\"case_dropdown-detail\" style='display:block;'>";
+		var currWordMean = new Array();
+
+		if (mDict[pali]) {
+			for (var i in mDict[pali]) {
+				var objMean = new Object();
+				objMean.type = "";
+				objMean.gramma = "";
+				objMean.dict_name = "";
+				objMean.mean = "";
+				if (mDict[pali][i].type) {
+					objMean.type = mDict[pali][i].type;
+				}
+				if (mDict[pali][i].gramma) {
+					objMean.gramma = mDict[pali][i].gramma;
+				}
+				if (mDict[pali][i].dict_name) {
+					objMean.dict_name = mDict[pali][i].dict_name;
+				}
+				if (mDict[pali][i].mean) {
+					objMean.mean = mDict[pali][i].mean;
+				}
+				if (objMean.mean.length > 0) {
+					_mean_push(currWordMean, objMean);
+				}
+			}
+		}
+		for (var i in currWordMean) {
+			var htmlMean = "";
+			var wId = id;
+			output += "<a style='display:flex; flex-wrap: wrap;'>";
+			output +=
+				"<div id='div_dictname_" + wId + "_" + iWord + "_" + i + "' style='margin-right: auto; display:flex;'>";
+			output +=
+				"<span id='span_dictname_" +
+				wId +
+				"_" +
+				iWord +
+				"_" +
+				i +
+				"' style='height: 1.5em;' class='wm_dictname' >";
+			output += getLocalDictname(currWordMean[i].dict_name) + "</span>";
+			output += "</div>";
+			output +=
+				"<div id='div_type_" + wId + "_" + iWord + "_" + i + "' style='margin-left: 0.4em; display:flex'>";
+			output +=
+				"<span id='span_type_" +
+				wId +
+				"_" +
+				iWord +
+				"_" +
+				i +
+				"' style='height: 1.5em;' class='wm_wordtype'>" +
+				getLocalGrammaStr(currWordMean[i].type) +
+				"</span>";
+
+			for (var iMean in currWordMean[i].mean) {
+				if (currWordMean[i].mean[iMean] != "") {
+					if (target == 0) {
+						htmlMean +=
+							"<span class='wm_one_mean' onclick='fieldListChanged(\"" +
+							wId +
+							'","mean","' +
+							currWordMean[i].mean[iMean] +
+							'" ';
+						//parent 与意思联动
+						if (iWord > 0) {
+							htmlMean += ',"' + pali + '"';
+						}
+						htmlMean += " )'>" + currWordMean[i].mean[iMean] + "</span>";
+					} else {
+						htmlMean +=
+							"<span class='wm_one_mean' onclick='_win_mean_change(\"" +
+							currWordMean[i].mean[iMean] +
+							"\" )'>" +
+							currWordMean[i].mean[iMean] +
+							"</span>";
+					}
+				}
+			}
+			output += "</div>";
+			output += "<div style='width:15em; display:flex; flex-wrap: wrap;'>" + htmlMean + "</div>";
+			output += "</a>";
+		}
+
+		output += "</div></div>";
+	}
+
+	output += "</div>";
+	return output;
+}
+
+function _win_mean_change(newmean) {
+	$("#input_meaning").val(newmean);
+}
+function _mean_push(arr, obj) {
+	var arrMean = obj.mean.split("$");
+
+	var strIndex = obj.dict_name + "-" + obj.type + "-" + obj.gramma;
+	if (arr[strIndex] == null) {
+		arr[strIndex] = new Object();
+		arr[strIndex].dict_name = obj.dict_name;
+		arr[strIndex].type = obj.type;
+		arr[strIndex].gramma = obj.gramma;
+		arr[strIndex].mean = new Array();
+	}
+
+	for (var i = 0; i < arrMean.length; i++) {
+		var found = false;
+		for (var j = 0; j < arr[strIndex].mean.length; j++) {
+			if (arr[strIndex].mean[j] == arrMean[i]) {
+				found = true;
+				break;
+			}
+		}
+		if (!found) {
+			arr[strIndex].mean.push(arrMean[i]);
+		}
+	}
+}
+
+function show_word_menu_mean(id) {
+	var word_menu_div = document.getElementById("mean_" + id);
+	if (word_menu_div) {
+		var menu_div = document.getElementById("word_mean");
+		if (menu_div) {
+			$("#mean_" + id).html($("#word_mean").html());
+		}
+	}
+}
+
+/**
+ * 渲染单词拆分下拉菜单
+ * @param {string} id	单词id
+ * @param {string} target	默认渲染目标 0:主编辑窗口下拉菜 1:编辑窗口下拉菜单
+ * @return {void}
+ */
+function render_word_menu_parts(id, target = 0) {
+	let output = "";
+	let wordID = id;
+	output += "<div>";
+	output += "<button ";
+	output += "style='font-size:100%;display:inline-flex; padding:0.1em 0.5em'";
+	output += "onclick='fieldListChanged(\"" + wordID + '","org","")\'>' ;
+	output += gLocal.gui.empty1 ;
+	output += "</button>";
+	output += "<button ";
+	output += "style='font-size:100%;display:inline-flex; padding:0.1em 0.5em' ";
+	output += "onclick='show_word_map(\"" + wordID + "\")'>" ;
+	output += gLocal.gui.wordmap ;
+	output += "</button>";
+	output += "</div>";
+	let pali = doc_word("#" + id).val("real");
+	let wParent = doc_word("#" + id).val("parent");
+	let wParts = doc_word("#" + id).val("org");
+	let arrParts = new Array();
+	let arrParent = new Array();
+	if (wParent != "") {
+		arrParts[wParent] = 1;
+	}
+	if (target == 1) {
+		arrParts[pali] = 1;
+	}
+	if (typeof mDict[pali] !== "undefined") {
+		for (const word of mDict[pali]) {
+			if (!isEmpty(word.factors)) {
+				arrParts[word.factors] = 1;
+			}
+			if (!isEmpty(word.parent)) {
+				arrParent[word.parent] = 1;
+			}			
+		}
+	}
+	//加入base拆分
+	if (mDict[wParent]) {
+		let ending = getAutoEnding(pali, wParent);
+		for (const word of mDict[wParent]) {
+			if (word.factors && word.factors != "") {
+				arrParts[word.factors] = 1;
+				{
+					for (let end in ending) {
+						arrParts[word.factors + "+[" + end + "]"] = 1;
+					}
+				}
+			}
+		}
+	}
+
+	output += "<div>";
+	let outputPart = "";
+	for (let sPart in arrParts) {
+		if (wParts == sPart) {
+			outputPart = "<b>" + sPart + "</b>";
+		} else {
+			outputPart = sPart;
+		}
+		if (target == 0) {
+			output += "<a onclick='fieldListChanged(\"" + wordID + '","org","' + sPart + "\")'>" + outputPart + "</a>";
+		} else {
+			output += "<a onclick='mdf_win_part_change(\"" + sPart + "\")'>" + outputPart + "</a>";
+		}
+	}
+	output += "</div>";
+
+	//base parts 信息
+	for (let sParent in arrParent) {
+		if (mDict[sParent]) {
+			let arrParts = new Array();
+			for (const word of mDict[sParent]) {
+				if (word.factors && word.factors != "") {
+					arrParts[word.factors] = 1;
+				}
+			}
+			if (arrParts.length > 0) {
+				output += '<div class="case_dropdown-org">';
+				output += '<div class="case_dropdown-first">';
+				output += "<a style='z-index:250; position:absolute; margin-right:2em;'>";
+				output += sParent + "</a>";
+				output += "<span style='z-index:220' class='case_dropdown-title'>";
+				output += gLocal.gui.more + "»</span>";
+				output += "</div>";
+
+				output += "<div>";
+				for (const sPart in arrParts) {
+					if (Object.hasOwnProperty.call(arrParts, sPart)) {
+						output += "<a onclick='fieldListChanged(\"" + wordID + '","org","' + sPart + "\")'>";
+						output += sPart ;
+						output += "</a>";
+					}
+				}
+				output += "</div>";
+
+				output += "</div>";
+			}
+		}
+	}
+	return output;
+}
+function show_word_menu_parts(id) {
+	var word_parts_div = document.getElementById("parts_" + id);
+	if (word_parts_div) {
+		var parts_div = document.getElementById("word_parts");
+		if (parts_div) {
+			//word_menu_div.appendChild(menu_div);
+			$("#parts_" + id).html($("#word_parts").html());
+		}
+	}
+}
+
+/**
+ * 渲染单词拆分意思下拉菜单
+ * @param {string} id 单词id
+ * @returns {string} html string
+ */
+function render_word_menu_partmean(id) {
+	let wordID = id;
+	let sHtml = "";
+	let pali = doc_word("#" + id).val("real");
+	let sOrg = doc_word("#" + id).val("org");
+	let currDefualtFM = getAutoFactorMeaning(sOrg);
+	
+	sHtml += "<button ";
+	sHtml += "style='font-size:100%;display:inline-flex; padding:0.1em 0.5em' ";
+	sHtml += "onclick='fieldListChanged(\"" + wordID + '","om","")\'>' ;
+	sHtml += gLocal.gui.empty1 ;
+	sHtml += "</button>";
+	sHtml += "<a onclick='fieldListChanged(\"" + wordID + '","om","[a]' + currDefualtFM + "\")'>";
+	sHtml += "[" + gLocal.gui.auto + "]" ;
+	sHtml += currDefualtFM ;
+	sHtml += "</a>";
+
+	var arrPartMean = new Array();
+	if (mDict[pali]) {
+		for (var i in mDict[pali]) {
+			if (mDict[pali][i].partmean && mDict[pali][i].partmean.length > 0) {
+				arrPartMean[mDict[pali][i].partmean] = 1;
+			}
+		}
+	}
+	for (var sPM in arrPartMean) {
+		sHtml += "<a onclick='fieldListChanged(\"" + wordID + '","om","' + sPM + "\")'>" + sPM + "</a>";
+	}
+	return sHtml;
+}
+
+/*
+渲染单词语基下拉菜单
+id	单词id
+
+
+return	无
+*/
+function render_word_menu_parent(id) {
+	let output = "";
+	let word_real = doc_word("#" + id).val("real");
+	let word_parent = doc_word("#" + id).val("parent");
+	let arrParent = new Array();
+	//检索语基
+	if (word_parent != "") {
+		arrParent[word_parent] = 1;
+	}
+	if (mDict[word_real]) {
+		for (let i in mDict[word_real]) {
+			if (mDict[word_real][i].parent && mDict[word_real][i].parent.length > 0) {
+				arrParent[mDict[word_real][i].parent] = 1;
+			}
+		}
+	}
+	let sWord = new Array();
+	for (let sParent in arrParent) {
+		sWord.push(sParent);
+	}
+	//按照base长度升序
+	sWord.sort(sortWordLen);
+	if (!str_in_array(word_real, sWord)) {
+		sWord.push(word_real);
+	}
+	output += "<a onclick=\"ParentLookup('"+$("#id_text_parent").val()+"')\">🔍" +gLocal.gui.dict +"</a>";
+
+	for (var iWord in sWord) {
+		var pali = sWord[iWord];
+		output += "<a onclick=\"mdf_win_data_change('id_text_parent','" + pali + "')\">";
+		if (word_parent == pali) {
+			output += "<b>" + pali + "</b>";
+		} else {
+			output += pali;
+		}
+		output += "</a>";
+	}
+	return output;
+}
+/*
+渲染单词语基下拉菜单
+id	单词id
+
+
+return	无
+*/
+function render_word_menu_parent_parent(id) {
+	let output = "";
+	let word_parent = doc_word("#" + id).val("parent");
+	let word_parent2 = doc_word("#" + id).val("parent2");
+	let word_pg = doc_word("#" + id).val("pg");
+	let arrParent = new Array();
+	//检索语基
+	if (word_parent2 != "") {
+		//arrParent[word_parent2+"#"+word_pg] = 1;
+	}
+	if (mDict[word_parent]) {
+		for (let i in mDict[word_parent]) {
+			if (mDict[word_parent][i].parent && mDict[word_parent][i].parent!=word_parent && mDict[word_parent][i].parent.length > 0) {
+				arrParent[mDict[word_parent][i].parent+"#"+mDict[word_parent][i].gramma] = 1;
+			}
+		}
+	}
+	let sWord = new Array();
+	for (const key in arrParent) {
+		if (arrParent.hasOwnProperty.call(arrParent, key)) {
+			sWord.push(key);
+		}
+	}
+
+
+	if($("#id_text_prt_prt").val()!=""){
+		output += "<a onclick=\"ParentLookup('"+$("#id_text_prt_prt").val()+"')\">🔍" +gLocal.gui.dict +"</a>";
+	}
+	output += "<a onclick=\"parent_parent_changed('','')\">清空</a>";
+
+	for (const it of sWord) {
+		let pali = it.split("#");
+		if(pali.length<2){
+			pali[1]="";
+		}
+		output += "<a onclick=\"parent_parent_changed('" + pali[0] + "','" + pali[1] + "')\" style='display:flex;justify-content: space-between;'>";
+		if (word_parent2 == pali[0]) {
+			output += "<b>" + pali[0] + "</b>";
+		} else {
+			output += "<span>" +pali[0]+ "</span>";
+		}
+		output += "<span style='background-color: wheat;'>" +pali[1]+ "</span>";
+		output += "</a>";		
+	}
+	for (let iWord in sWord) {
+
+	}
+	return output;
+}
+
+function parent_parent_changed(spell,grammar){
+	mdf_win_data_change('id_text_prt_prt',spell);
+	edit_parent_grammar_changed(grammar);
+}
+
+function ParentLookup(word){
+	window.open("../dict/index.php?builtin=true&theme=dark&key="+word,target="dict");
+}
+function show_word_menu_partmean(id) {
+	var word_partmean_div = document.getElementById("partmean_" + id);
+	if (word_partmean_div) {
+		var partmean_div = document.getElementById("word_partmean");
+		if (partmean_div) {
+			//word_menu_div.appendChild(menu_div);
+			$("#partmean_" + id).html($("#word_partmean").html());
+		}
+	}
+}
+
+//语法按照信心指数排序
+function sortWordConfidence(a, b) {
+	return b - a;
+}
+/*渲染语法菜单
+//@param 
+	target 
+		0:主窗口
+		1:编辑窗口
+			
+*/
+function render_word_menu_gramma(id, target = 0) {
+	var wordID = id;
+	var sHtml = "";
+	var pali = doc_word("#" + id).val("real");
+
+	var arrGramma = new Array();
+	if (mDict[pali]) {
+		for (var i in mDict[pali]) {
+			var type = mDict[pali][i].type;
+			var gramma = mDict[pali][i].gramma;
+			if ((type && type.length > 0) || (gramma && gramma.length > 0)) {
+				var sCase = type + "#" + gramma;
+				if (arrGramma[sCase]) {
+					if (mDict[pali][i].confidence > arrGramma[sCase]) {
+						arrGramma[sCase] = mDict[pali][i].confidence;
+					}
+				} else {
+					arrGramma[sCase] = 1;
+				}
+			}
+		}
+	}
+	arrGramma.sort(sortWordConfidence);
+
+	for (var sGramma in arrGramma) {
+		var sLocalCase = getLocalGrammaStr(sGramma);
+		if (target == 0) {
+			sHtml +=
+				"<a onclick='fieldListChanged(\"" +
+				wordID +
+				'","case","' +
+				sGramma +
+				"\")'>" +
+				cutString(sLocalCase, 30) +
+				"</a>";
+		} else {
+			sHtml += "<a onclick='mdf_win_case_change(\"" + sGramma + "\")'>" + cutString(sLocalCase, 30) + "</a>";
+		}
+	}
+	return sHtml;
+}
+
+function show_word_menu_gramma(id) {
+	var gramma_div = document.getElementById("gramma_" + id);
+	if (gramma_div) {
+		var word_gramma_div = document.getElementById("word_gramma");
+		if (word_gramma_div) {
+			//word_menu_div.appendChild(menu_div);
+			$("#gramma_" + id).html($("#word_gramma").html());
+		}
+	}
+}
+
+function hiddenProgressDiv() {
+	document.getElementById("loading_bar").style.animation = "opacityGo 1s both";
+}
+
+function editor_project_updataProjectInfo() {
+	var strInfo = "";
+	var iInlineDictCount = gXmlBookDataInlineDict.getElementsByTagName("word").length;
+	var iWordCount = gXmlBookDataBody.getElementsByTagName("word").length;
+	strInfo += gLocal.gui.wordnum + iWordCount + "<br />";
+	strInfo += gLocal.gui.para + ":" + gArrayDocParagraph.length + "<br />";
+	strInfo += gLocal.gui.innerdict + ":" + iInlineDictCount + "<br />";
+	strInfo += gLocal.gui.vocabulary + CountVocabulary() + "<br />";
+
+	//document.getElementById("id_editor_project_infomation").innerHTML = strInfo;
+	//document.getElementById("doc_info_title").value = getNodeText(gXmlBookDataHead, "doc_title");
+	document.getElementById("editor_doc_title").innerHTML = getNodeText(gXmlBookDataHead, "doc_title");
+	document.getElementById("file_title").innerHTML = getNodeText(gXmlBookDataHead, "doc_title");
+}
+
+//import old ver file
+
+var editor_importOldVerXmlHttp = null;
+function editor_importOldVer(strFileName) {
+	if (window.XMLHttpRequest) {
+		// code for IE7, Firefox, Opera, etc.
+		editor_importOldVerXmlHttp = new XMLHttpRequest();
+	} else if (window.ActiveXObject) {
+		// code for IE6, IE5
+		editor_importOldVerXmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
+	}
+
+	if (editor_importOldVerXmlHttp != null) {
+		var d = new Date();
+		var strLink = "";
+		strLink = "./com_fileopen.php?filename=" + strFileName;
+		if (strLink.length > 0) {
+			editor_importOldVerXmlHttp.onreadystatechange = editor_import_old_ver_serverResponse;
+			editor_importOldVerXmlHttp.open("GET", strLink, true);
+			editor_importOldVerXmlHttp.send(null);
+			//document.getElementById('sutta_text').innerHTML="Importing..."+strFileName;
+		} else {
+			//document.getElementById('sutta_text').innerHTML="无法识别的文件类型";
+		}
+	} else {
+		alert("Your browser does not support XMLHTTP.");
+	}
+}
+
+function editor_import_old_ver_serverResponse() {
+	// 4 = "loaded"
+	if (editor_importOldVerXmlHttp.readyState == 4) {
+		document.getElementById("sutta_text").innerHTML = '<div class="sutta_top_blank"></div>';
+		if (editor_importOldVerXmlHttp.status == 200) {
+			// 200 = "OK"
+			var xmlText = editor_importOldVerXmlHttp.responseText;
+
+			if (window.DOMParser) {
+				parser = new DOMParser();
+				gXmlOldVerData = parser.parseFromString(xmlText, "text/xml");
+			} else {
+				// Internet Explorer
+
+				gXmlOldVerData = new ActiveXObject("Microsoft.XMLDOM");
+				gXmlOldVerData.async = "false";
+				gXmlOldVerData.loadXML(xmlText);
+			}
+
+			if (gXmlOldVerData == null) {
+				alert("error:can not load. xml obj is null.");
+				return;
+			}
+
+			oldVerDataParse(gXmlOldVerData);
+		} else {
+			document.getElementById("sutta_text").innerHTML =
+				"Problem retrieving data:" + editor_openProjectXmlHttp.statusText;
+		}
+	}
+}
+
+//在段落前设置或取消分页
+function editor_page_break(obj, book, par) {
+	if (obj.checked) {
+		document.getElementById("par_" + book + "_" + par).style.pageBreakBefore = "always";
+	} else {
+		document.getElementById("par_" + book + "_" + par).style.pageBreakBefore = "auto";
+	}
+}
+
+function editor_heading_change(obj, book, par) {
+	document.getElementById("content").innerHTML = "";
+	allBlock = gXmlBookDataBody.getElementsByTagName("block");
+	for (var iBlock = 0; iBlock < allBlock.length; iBlock++) {
+		xmlParInfo = allBlock[iBlock].getElementsByTagName("info")[0];
+		xmlParData = allBlock[iBlock].getElementsByTagName("data")[0];
+
+		bookId = getNodeText(xmlParInfo, "book");
+		paragraph = getNodeText(xmlParInfo, "paragraph");
+		type = getNodeText(xmlParInfo, "type");
+		if (bookId == book && paragraph == par && type == "heading") {
+			setNodeText(xmlParInfo, "level", obj.value);
+		}
+	}
+	updataHeadingBlockInHtml(book, par);
+	updataToc();
+}
+
+function editor_par_show(obj, book, par) {
+	parId = "par_" + book + "_" + (par - 1);
+	if (obj.checked) {
+		document.getElementById(parId).style.display = "block";
+	} else {
+		document.getElementById(parId).style.display = "none";
+	}
+
+	var rootIndex = -1;
+	var rootLevel = -1;
+	allBlock = gXmlBookDataBody.getElementsByTagName("block");
+	for (var iBlock = 0; iBlock < allBlock.length; iBlock++) {
+		xmlParInfo = allBlock[iBlock].getElementsByTagName("info")[0];
+		xmlParData = allBlock[iBlock].getElementsByTagName("data")[0];
+
+		bookId = getNodeText(xmlParInfo, "book");
+		paragraph = getNodeText(xmlParInfo, "paragraph");
+		type = getNodeText(xmlParInfo, "type");
+		if (bookId == book && paragraph == par && type == "heading") {
+			rootIndex = iBlock;
+			rootLevel = getNodeText(xmlParInfo, "level");
+			break;
+		}
+	}
+
+	var opBegin = false;
+	for (var iBlock = rootIndex + 1; iBlock < allBlock.length; iBlock++) {
+		xmlParInfo = allBlock[iBlock].getElementsByTagName("info")[0];
+		xmlParData = allBlock[iBlock].getElementsByTagName("data")[0];
+
+		bookId = getNodeText(xmlParInfo, "book");
+		paragraph = getNodeText(xmlParInfo, "paragraph");
+		type = getNodeText(xmlParInfo, "type");
+		if (type == "heading") {
+			currLevel = getNodeText(xmlParInfo, "level");
+			if (currLevel == 0 || currLevel > rootLevel) {
+				opBegin = true;
+				parId = "par_" + bookId + "_" + (paragraph - 1);
+				if (obj.checked) {
+					document.getElementById(parId).style.display = "block";
+				} else {
+					document.getElementById(parId).style.display = "none";
+				}
+			} else {
+				if (opBegin) {
+					break;
+				}
+			}
+		}
+	}
+}
+
+function editor_right_tool_bar_slide_toggle() {
+	if (document.getElementById("right_tool_bar").style.left == "100%") {
+		document.getElementById("right_tool_bar").style.display = "block";
+		document.getElementById("right_tool_bar").style.left = "calc(100% - 28vw)";
+		document.getElementById("right_tool_bar").style.width = "28vw";
+	} else {
+		document.getElementById("right_tool_bar").style.left = "100%";
+	}
+}
+function right_panal_slide_toggle(idPanal) {
+	if ($("#" + idPanal).hasClass("act")) {
+		document.getElementById("right_tool_bar").style.display = "block";
+		document.getElementById("right_tool_bar").style.left = "calc(100% - 28vw)";
+		document.getElementById("right_tool_bar").style.width = "28vw";
+	} else {
+		document.getElementById("right_tool_bar").style.left = "100%";
+	}
+}
+
+function editor_show_right_tool_bar(visible) {
+	if (visible) {
+		document.getElementById("right_tool_bar").style.display = "block";
+		document.getElementById("right_tool_bar").style.left = "calc(100% - 28vw)";
+		document.getElementById("right_tool_bar").style.width = "28vw";
+	} else {
+		document.getElementById("right_tool_bar").style.left = "100%";
+	}
+}
+
+function editor_goto_link(bookId, parNo, strLink = "") {
+	parIndex = getParIndex(bookId, parNo);
+	scrollEventLock = true;
+	setNewView(parIndex - 3, parIndex + 6);
+	scrollEventLock = false;
+	if (strLink == "") {
+		window.location.assign("#par_begin_" + bookId + "_" + (parNo - 1));
+	} else {
+		window.location.assign("#" + strLink);
+	}
+}
+
+function get_language_order(strLanguage) {
+	for (iLan in dict_language_order) {
+		if (dict_language_order[iLan] == strLanguage) {
+			return iLan;
+		}
+	}
+	return 1000;
+}
+
+function removeAllInlinDictItem() {
+	var count;
+	var xAllWord = gXmlBookDataInlineDict.getElementsByTagName("word");
+	count = xAllWord.length;
+	while (xAllWord.length) {
+		gXmlBookDataInlineDict.removeChild(xAllWord[0]);
+	}
+	g_DictWordList = new Array();
+	return count;
+}
+
+function editor_refresh_inline_dict(word) {
+	currMatchingDictNum = 0;
+	g_dictFindParentLevel = 0;
+	g_dictFindAllDone = false;
+
+	g_dict_search_one_dict_done = editor_dict_one_dict_done;
+	g_dict_search_all_done = editor_dict_all_done;
+	g_dict_search_one_pass_done = null;
+
+	dict_mark_word_list_done();
+	dict_push_word_to_download_list(word, 0);
+
+	var arrBuffer = dict_get_search_list();
+	if (arrBuffer.length > 0) {
+		g_CurrDictBuffer = JSON.stringify(arrBuffer);
+		dict_mark_word_list_done();
+		editor_dict_match();
+	} else {
+		document.getElementById("editor_doc_notify").innerHTML = "no new part";
+	}
+}
+
+function win_close(id) {
+	document.getElementById(id).style.display = "none";
+}
+
+/**
+ * 利用下拉菜单修改单词信息
+ * @param {string} inWordId 单词id
+ * @param {string} inField 要修改的字段名
+ * @param {string} inChangeTo 改为某个值
+ * @param {string} sParent 
+ */
+function fieldListChanged(inWordId, inField, inChangeTo, sParent = null) {
+	let xAllWord = gXmlBookDataBody.getElementsByTagName("word");
+	let wordIndex = getWordIndex(inWordId);
+	let arr_id_word = inWordId.split("-");
+	let book = arr_id_word[0].slice(1);
+	let paragraph = arr_id_word[1];
+
+	setNodeText(xAllWord[wordIndex], "status", "7");
+	setNodeAttr(xAllWord[wordIndex], inField, "status", "7");
+
+	if (inField == "om") {
+		/*拆分意思去掉开头的[a]*/
+		inChangeTo = inChangeTo.replace("[a]", "");
+	}
+	setNodeText(xAllWord[wordIndex], inField, inChangeTo);
+	if (sParent) {
+		setNodeText(xAllWord[wordIndex], "parent", sParent);
+	}
+
+	//提交用户逐词解析数据库
+	user_wbw_push_word(inWordId);
+	user_wbw_commit();
+
+	//新的拆分查字典
+	if(inField == "org"){
+		let parts = inChangeTo.split('+');
+		dictFetch(parts,function(){
+			render_word_menu(inWordId);
+		})
+	}
+
+	//准备消息数据
+	let d = new Date();
+	let msg_doc_id;
+	if (doc_info.sendmsg) {
+		if (doc_info.parent_id != "") {
+			msg_doc_id = doc_info.parent_id;
+		} else {
+			msg_doc_id = doc_info.doc_id;
+		}
+		let msg_data = new Object();
+		msg_data.id = inWordId;
+		msg_data[inField] = inChangeTo;
+		msg_data.status = 7;
+		msg_push(1, JSON.stringify(msg_data), msg_doc_id, d.getTime(), book, paragraph);
+	}
+	modifyWordDetailByWordIndex(wordIndex);
+
+	//modify other same word with auto-mark
+	var word = getNodeText(xAllWord[wordIndex], "real");
+	for (var i = wordIndex + 1; i < xAllWord.length; i++) {
+		let status = getNodeText(xAllWord[i], "status");
+		if (status != 7) {
+			if (getNodeText(xAllWord[i], "real") == word) {
+				setNodeText(xAllWord[i], inField, inChangeTo);
+				if (sParent) {
+					setNodeText(xAllWord[i], "parent", sParent);
+				}
+				setNodeText(xAllWord[i], "status", "5");
+				//准备消息数据
+				if (doc_info.sendmsg) {
+					let wordid = getNodeText(xAllWord[i], "id");
+					let msg_data = new Object();
+					msg_data.id = wordid;
+					msg_data[inField] = inChangeTo;
+					msg_data.status = 5;
+					msg_push(1, JSON.stringify(msg_data), msg_doc_id, d.getTime(), book, paragraph);
+				}
+				modifyWordDetailByWordIndex(i);
+			}
+		}
+	}
+}
+
+function editor_word_status_by_id(id, newStatus = null) {
+	var xAllWord = gXmlBookDataBody.getElementsByTagName("word");
+	return editor_word_status(xAllWord[getWordIndex(wordId)]), newStatus;
+}
+function editor_word_status(wElement, newStatus = null) {
+	if (newStatus == null) {
+		var wStatus = getNodeText(wElement, "status");
+		if (wStatus == "") {
+			var oldVerStauts = getNodeText(wElement, "bmc");
+			if (oldVerStauts == "") {
+				setNodeText(wElement, "status", "1"); //未处理
+				return 1;
+			} else if (oldVerStauts == "bmca") {
+				setNodeText(wElement, "status", "3"); //自己机器自动
+				return 3;
+			} else {
+				setNodeText(wElement, "status", "7"); //人工
+				return 7;
+			}
+		} else {
+			return wStatus;
+		}
+	} else {
+		setNodeText(wElement, "status", newStatus.toString());
+	}
+}
+
+//载入用户设置
+function editor_setup_load() {
+	$.post(
+		"./user_setup.php",
+		{
+			op: "load",
+		},
+		function (data, status) {
+			if (data.length > 0) {
+				gUserSetup = JSON.parse(data);
+			}
+		}
+	);
+}
+//修改用户设置
+function editor_setup_save(key, value) {
+	$.post(
+		"./user_setup.php",
+		{
+			op: "save",
+			key: key,
+			value: value,
+		},
+		function (data, status) {
+			if (data.length > 0) {
+				gUserSetup = JSON.parse(data);
+			}
+		}
+	);
+}
+
+function tran_sen_save_click(blockid, senBegin, senEnd, obj) {
+	let textareaid = "ta_" + blockid + "_" + senBegin + "_" + senEnd;
+	let newText = $("#" + textareaid).val();
+	tran_sen_save(blockid, senBegin, senEnd, newText);
+}
+function tran_sen_save(blockid, senBegin, senEnd, input) {
+	if (input.length > 0) {
+		//input=input.replace(/\n\n/g,"<br />");
+	}
+	input = term_edit_to_std_str(input);
+	setTranText(blockid, senEnd, input);
+	doc_tran("#" + blockid).text(senBegin, senEnd, "status", 7);
+}
+
+function tran_text_onchange(blockid, senBegin, senEnd, obj) {
+	let newText = obj.value;
+	tran_sen_save(blockid, senBegin, senEnd, newText);
+	//保存到数据库
+	sen_save(blockid, senBegin, senEnd, newText);
+}
+
+/*
+句子失去焦点
+退出编辑状态
+*/
+function tran_sent_div_blur(blockId, senBegin, senEnd, obj) {
+	obj.style.height = "28px";
+}
+function tran_sent_div_onfocus(blockId, senBegin, senEnd, obj) {
+	obj.style.height = "100px";
+}
+//鼠标移到逐句翻译上 编辑状态
+function tran_sent_div_mouseenter(blockId, wordSn) {
+	/*
+		$("#tran_sent_text_div_"+blockId+"_"+wordSn).show();
+		if(_tran_show_preview_on_edit==true){
+			$("#tran_pre_"+blockId+"_"+wordSn).show();
+		}
+		else{
+			$("#tran_pre_"+blockId+"_"+wordSn).hide();
+		}
+		*/
+}
+function set_tran_show_mode(set, obj) {
+	if (set == 1) {
+		_tran_show_preview_on_edit = obj.checked;
+	} else if (set == 2) {
+		_tran_show_textarea_esc_edit = obj.checked;
+		if (obj.checked) {
+			$(".tran_sen_textarea").show();
+		} else {
+			$(".tran_sen_textarea").hide();
+		}
+	}
+}
+
+//按自动查词典按钮
+var _para_list = new Array();
+
+function menu_dict_match1() {
+	let book;
+	let para = new Array();
+	xBlock = gXmlBookDataBody.getElementsByTagName("block");
+	for (const block of xBlock) {
+		xmlParInfo = block.getElementsByTagName("info")[0];
+		xmlParData = block.getElementsByTagName("data")[0];
+		book = getNodeText(xmlParInfo, "book");
+		paragraph = getNodeText(xmlParInfo, "paragraph");
+
+		para[book + "-" + paragraph] = { book: book, para: paragraph };		
+	}
+
+	_para_list = new Array();
+	for (var i in para) {
+		_para_list.push(para[i]);
+	}
+	if (_para_list.length > 0) {
+		auto_match_wbw(0);
+	}
+}
+
+//自动查词典
+function auto_match_wbw(para_index) {
+	$.get(
+		"./dict_find_auto.php",
+		{
+			book: _para_list[para_index].book,
+			para: _para_list[para_index].para,
+		},
+		function (data, status) {
+			if (data.length > 0) {
+				var dict_data = new Array();
+				try {
+					dict_data = JSON.parse(data);
+				} catch (error) {
+					ntf_show("Error:" + error + "<br>" + data);
+				}
+				var counter = 0;
+				var xAllWord = gXmlBookDataBody.getElementsByTagName("word");
+				for (var x = 0; x < xAllWord.length; x++) {
+					let wordStatus = getNodeText(xAllWord[x], "status");
+					if (parseInt(wordStatus) > 3) {
+						//忽略已经被用户修改的词
+						continue;
+					}
+					let wid = getNodeText(xAllWord[x], "id");
+					let aid = wid.split("-");
+					let book = aid[0].substr(1);
+					let para = aid[1];
+					let num = aid[2];
+					for (var i = 0; i < dict_data.length; i++) {
+						if (dict_data[i].book == book && dict_data[i].paragraph == para && dict_data[i].num == num) {
+							if (dict_data[i].type) {
+								setNodeText(xAllWord[x], "type", dict_data[i].type);
+							}
+							if (dict_data[i].gramma) {
+								setNodeText(xAllWord[x], "gramma", dict_data[i].gramma);
+							}
+							setNodeText(xAllWord[x], "case", dict_data[i].type + "#" + dict_data[i].gramma);
+							if (dict_data[i].mean) {
+								setNodeText(xAllWord[x], "mean", dict_data[i].mean);
+							}
+							if (dict_data[i].parent) {
+								setNodeText(xAllWord[x], "parent", dict_data[i].parent);
+							}
+							if (dict_data[i].parts) {
+								setNodeText(xAllWord[x], "org", dict_data[i].parts);
+							}
+							if (dict_data[i].partmean) {
+								setNodeText(xAllWord[x], "om", dict_data[i].partmean);
+							}
+							setNodeText(xAllWord[x], "status", "3");
+							counter++;
+							modifyWordDetailByWordId(wid);
+							user_wbw_push_word(wid);
+							break;
+						}
+					}
+				}
+				user_wbw_commit();
+			}
+			//计算查字典的进度
+			var precent = (para_index * 100) / (_para_list.length - 1);
+			ntf_show(
+				gLocal.gui.auto_fill +
+					_para_list[para_index].book +
+					"-" +
+					_para_list[para_index].para +
+					"-" +
+					precent.toFixed(1) +
+					"%" +
+					gLocal.gui.finished
+			);
+			para_index++;
+			if (para_index < _para_list.length) {
+				auto_match_wbw(para_index);
+			}
+		}
+	);
+}
+
+function isEmpty(val){
+	if(typeof val == "undefined" || val == null || val ==""){
+		return true;
+	}else{
+		return false;
+	}
+}
+/**
+ * 自动填充单词
+ * @param {string} word 需要自动填充的单词
+ */
+function FillAllWord(word=''){
+	let counter = 0;
+	let xAllWord = gXmlBookDataBody.getElementsByTagName("word");
+	for (let x = 0; x < xAllWord.length; x++) {
+		let wordStatus = getNodeText(xAllWord[x], "status");
+		if (parseInt(wordStatus) > 3) {
+			//忽略已经被用户修改的词
+			continue;
+		}
+		let wid = getNodeText(xAllWord[x], "id");
+		let real = getNodeText(xAllWord[x], "real");
+		if(word !== ''){
+			if(word !== real){
+				continue;
+			}
+		}
+		let aid = wid.split("-");
+		let book = aid[0].substr(1);
+		let para = aid[1];
+		let num = aid[2];
+		if (mDict.hasOwnProperty(real)) {
+			setNodeText(xAllWord[x], "parent", "");			
+			console.log('setNodeAttr',setNodeAttr(xAllWord[x], "type",'status',0)) ;
+			setNodeAttr(xAllWord[x], "gramma",'status',0);
+			setNodeAttr(xAllWord[x], "case",'status',0);
+			setNodeAttr(xAllWord[x], "parent",'status',0);
+			setNodeAttr(xAllWord[x], "mean",'status',0);
+			setNodeAttr(xAllWord[x], "org",'status',0);
+			setNodeAttr(xAllWord[x], "om",'status',0);
+
+			for (const iterator of mDict[real]) {
+				if (getNodeAttr(xAllWord[x], "type",'status') == '0' && !isEmpty(iterator.type)) {
+					setNodeText(xAllWord[x], "type", iterator.type);
+					setNodeAttr(xAllWord[x], "type",'status',3);
+					console.log('type:',iterator.type);
+
+					if (!isEmpty(iterator.grammar)) {
+						setNodeText(xAllWord[x], "gramma", iterator.grammar);
+						setNodeAttr(xAllWord[x], "gramma",'status',3);
+					}
+					setNodeText(xAllWord[x], "case", iterator.type + "#" + iterator.grammar);
+					setNodeAttr(xAllWord[x], "case",'status',3);
+					if (!isEmpty(iterator.parent)) {
+						setNodeText(xAllWord[x], "parent", iterator.parent);
+						setNodeAttr(xAllWord[x], "parent",'status',3);
+					}
+				}
+
+				if (getNodeAttr(xAllWord[x], "parent",'status') == '0' && !isEmpty(iterator.parent)) {
+					setNodeText(xAllWord[x], "parent", iterator.parent);
+					setNodeAttr(xAllWord[x], "parent",'status',3);
+					console.log('parent:',iterator.parent);
+
+				}
+
+				if (getNodeAttr(xAllWord[x], "mean",'status') == '0' && !isEmpty(iterator.mean)) {
+					setNodeText(xAllWord[x], "mean", iterator.mean);
+					setNodeAttr(xAllWord[x], "mean",'status',3);
+					console.log('mean:',iterator.mean);
+
+				}
+
+				if (getNodeAttr(xAllWord[x], "org",'status') == '0' && !isEmpty(iterator.factors)) {
+					setNodeText(xAllWord[x], "org", iterator.factors);
+					setNodeAttr(xAllWord[x], "org",'status',3);
+					console.log('org:',iterator.factors);
+				}
+				if (getNodeAttr(xAllWord[x], "om",'status') == '0' && !isEmpty(iterator.factormean)) {
+					setNodeText(xAllWord[x], "om", iterator.factormean);
+					setNodeAttr(xAllWord[x], "om",'status',3);
+				}
+				   counter++;
+			}
+			setNodeText(xAllWord[x], "status", "3");
+			//查看是否有没匹配上的项目
+			let parts = getNodeText(xAllWord[x], "org").split('+');
+			if(getNodeText(xAllWord[x], "type") == '.cp.'){
+				//复合词,猜测parent 和语法信息
+				if(parts.length>0){
+					let endOfParts = parts[parts.length-1];//末尾的一个单词
+					if(!isEmpty(endOfParts)){
+						if (mDict.hasOwnProperty(endOfParts) && mDict[endOfParts].length>0) {
+							setNodeText(xAllWord[x], "type", mDict[endOfParts][0].type);
+							setNodeText(xAllWord[x], "gramma", mDict[endOfParts][0].grammar);
+							setNodeText(xAllWord[x], "case", mDict[endOfParts][0].type + "#" + mDict[endOfParts][0].grammar);
+							setNodeAttr(xAllWord[x], "case",'status',3);
+							if(isEmpty(getNodeText(xAllWord[x], "parent"))){
+								inline_dict_auto_case(real);
+								for (const iterator of mDict[real]) {
+									if(iterator.type == mDict[endOfParts][0].type && 
+									   iterator.grammar == mDict[endOfParts][0].grammar){
+										setNodeText(xAllWord[x], "parent", iterator.parent);
+										setNodeAttr(xAllWord[x], "parent",'status',3);
+										break;
+									}
+								}
+							}	
+						}
+					}
+				}
+			}
+			let fm = "";
+			if(isEmpty(getNodeText(xAllWord[x], "om"))){
+				//根据拆分,自动给出拆分意思
+				fm = getAutoFactorMeaning(getNodeText(xAllWord[x], "org"));
+				setNodeText(xAllWord[x], "om", fm);
+				setNodeAttr(xAllWord[x], "om",'status',3);
+			}
+			if(isEmpty(getNodeText(xAllWord[x], "mean"))){
+				//先查parent
+				let parent = getNodeText(xAllWord[x], "parent");
+				if(!isEmpty(parent) && mDict.hasOwnProperty(parent)){
+					for (const iterator of mDict[parent]) {
+						if(!isEmpty(iterator.mean)){
+							setNodeText(xAllWord[x], "mean", iterator.mean);
+							setNodeAttr(xAllWord[x], "mean",'status',3);
+							break;
+						}
+					}
+				}
+			}
+			if(isEmpty(getNodeText(xAllWord[x], "mean"))){
+				//根据拆分,自动给出整体意思
+				console.log('meaning empty '+getNodeText(xAllWord[x], "mean"));
+				setNodeText(xAllWord[x], "mean", fm.replace(/\+/g,' '));
+				setNodeAttr(xAllWord[x], "mean",'status',3);
+			}
+			console.log('auto fill:'+real);
+			outputFilder('type:',getNodeText(xAllWord[x], "type"));
+			outputFilder('gramma:',getNodeText(xAllWord[x], "gramma"));
+			outputFilder('parent:',getNodeText(xAllWord[x], "parent"));
+			outputFilder('mean:',getNodeText(xAllWord[x], "mean"));
+			outputFilder('org:',getNodeText(xAllWord[x], "org"));
+			outputFilder('om:',getNodeText(xAllWord[x], "om"));
+
+			modifyWordDetailByWordId(wid);
+			user_wbw_push_word(wid);	
+		}
+	}
+}
+
+
+function outputFilder(filder,value){
+	if(isEmpty(value)){
+		console.log("%c"+filder+"empty" ,"color:red;");
+	}else{
+		console.log(filder,value);
+	}
+}
+
+//旧版本的xml解析
+function oldVerDataParse(oldXmlData) {
+	createXmlDoc();
+	newBlockString = "<root><block><info></info><data></data></block></root>";
+	if (window.DOMParser) {
+		parser = new DOMParser();
+		newXmlBlock = parser.parseFromString(newBlockString, "text/xml");
+	} else {
+		// Internet Explorer
+		newXmlBlock = new ActiveXObject("Microsoft.XMLDOM");
+		newXmlBlock.async = "false";
+		newXmlBlock.loadXML(newBlockString);
+	}
+
+	if (newXmlBlock == null) {
+		alert("error:can not load book index.");
+		return;
+	}
+
+	var titleBlockInfo = new Array();
+	var titleInfo = new Object();
+	titleInfo.language = "pali";
+	titleInfo.author = "author";
+	titleBlockInfo.push(titleInfo);
+	var titleInfo = new Object();
+	titleInfo.language = "en";
+	titleInfo.author = "author";
+	titleBlockInfo.push(titleInfo);
+	var titleInfo = new Object();
+	titleInfo.language = "zh";
+	titleInfo.author = "author";
+	titleBlockInfo.push(titleInfo);
+
+	var iPara = 1;
+	var BookId = com_guid();
+	var x = gXmlOldVerData.getElementsByTagName("sutta");
+	for (var i = 0; i < x.length; i++) {
+		//title begin
+		xTitle = x[i].getElementsByTagName("title");
+		/*if title node is */
+		if (xTitle.length > 0) {
+			/*text of title*/
+			var xTitleText = xTitle[0].getElementsByTagName("text");
+			if (xTitleText.length > 0) {
+				for (var iTitleText = 0; iTitleText < xTitleText.length; iTitleText++) {
+					cloneBlock = newXmlBlock.cloneNode(true);
+					newBlock = cloneBlock.getElementsByTagName("block")[0];
+					xmlNewInfo = newBlock.getElementsByTagName("info")[0];
+					xmlNewData = newBlock.getElementsByTagName("data")[0];
+
+					var titleLangauge = "en";
+					var titleAuthor = "unkow";
+					var xTitleTextInfo = xTitleText[iTitleText].getElementsByTagName("info");
+					if (xTitleTextInfo.length > 0) {
+						titleLangauge = getNodeText(xTitleTextInfo[0], "language");
+						titleAuthor = getNodeText(xTitleTextInfo[0], "tranAuthor");
+					}
+					var strTitle = getNodeText(xTitleText[iTitleText], "data");
+
+					setNodeText(xmlNewInfo, "type", "heading");
+					setNodeText(xmlNewInfo, "paragraph", iPara.toString());
+					setNodeText(xmlNewInfo, "book", BookId);
+					setNodeText(xmlNewInfo, "author", "kosalla");
+					setNodeText(xmlNewInfo, "language", titleLangauge);
+					setNodeText(xmlNewInfo, "edition", "0");
+					setNodeText(xmlNewInfo, "subedition", "0");
+					setNodeText(xmlNewInfo, "level", "1");
+					setNodeText(xmlNewInfo, "id", com_guid());
+					setNodeText(xmlNewData, "text", strTitle);
+					gXmlBookDataBody.appendChild(newBlock);
+				}
+			}
+			/*end of text of title*/
+		}
+		//end of title
+
+		xParagraph = x[i].getElementsByTagName("paragraph");
+		for (var j = 0; j < xParagraph.length; j++) {
+			//toc begin
+			if (j > 0) {
+				for (var iTran = 0; iTran < titleBlockInfo.length; iTran++) {
+					cloneBlock = newXmlBlock.cloneNode(true);
+					newBlock = cloneBlock.getElementsByTagName("block")[0];
+					xmlNewInfo = newBlock.getElementsByTagName("info")[0];
+					xmlNewData = newBlock.getElementsByTagName("data")[0];
+
+					titleLangauge = titleBlockInfo[iTran].language;
+					titleAuthor = titleBlockInfo[iTran].author;
+					var strTitle = "new title";
+
+					setNodeText(xmlNewInfo, "type", "heading");
+					setNodeText(xmlNewInfo, "paragraph", iPara.toString());
+					setNodeText(xmlNewInfo, "book", BookId);
+					setNodeText(xmlNewInfo, "author", titleAuthor);
+					setNodeText(xmlNewInfo, "language", titleLangauge);
+					setNodeText(xmlNewInfo, "edition", "0");
+					setNodeText(xmlNewInfo, "subedition", "0");
+					setNodeText(xmlNewInfo, "level", "0");
+					setNodeText(xmlNewInfo, "id", com_guid());
+					setNodeText(xmlNewData, "text", strTitle);
+					gXmlBookDataBody.appendChild(newBlock);
+				}
+			}
+			//toc end
+			//word by word paragraph begin
+			xPali = xParagraph[j].getElementsByTagName("palipar");
+			if (xPali.length > 0) {
+				cloneBlock = newXmlBlock.cloneNode(true);
+				newBlock = cloneBlock.getElementsByTagName("block")[0];
+				xmlNewInfo = newBlock.getElementsByTagName("info")[0];
+				xmlNewData = newBlock.getElementsByTagName("data")[0];
+				setNodeText(xmlNewInfo, "type", "wbw");
+				setNodeText(xmlNewInfo, "paragraph", iPara.toString());
+				setNodeText(xmlNewInfo, "book", BookId);
+				setNodeText(xmlNewInfo, "author", "kosalla");
+				setNodeText(xmlNewInfo, "edition", "0");
+				setNodeText(xmlNewInfo, "subedition", "0");
+				setNodeText(xmlNewInfo, "id", com_guid());
+				xWord = xPali[0].getElementsByTagName("word"); //如果只有一个palipar
+				/*遍历此段落中所有单词*/
+				var iSen = 0;
+				var strTranWords = "";
+				for (k = 0; k < xWord.length; k++) {
+					newWord = xWord[k].cloneNode(true);
+					xmlNewData.appendChild(newWord);
+				}
+				gXmlBookDataBody.appendChild(newBlock);
+			}
+			//word by word paragraph begin
+
+			/*翻译块开始*/
+			xTran = xParagraph[j].getElementsByTagName("translate");
+			if (xTran.length > 0) {
+				/*text of translate*/
+				var xTranText = xTran[0].getElementsByTagName("text");
+				if (xTranText.length > 0) {
+					for (iTranText = 0; iTranText < xTranText.length; iTranText++) {
+						cloneBlock = newXmlBlock.cloneNode(true);
+						newBlock = cloneBlock.getElementsByTagName("block")[0];
+						xmlNewInfo = newBlock.getElementsByTagName("info")[0];
+						xmlNewData = newBlock.getElementsByTagName("data")[0];
+
+						var tranLangauge = "";
+						var tranAuthor = "";
+						var xTranTextInfo = xTranText[iTranText].getElementsByTagName("info");
+						if (xTranTextInfo.length > 0) {
+							tranLangauge = getNodeText(xTranTextInfo[0], "language");
+							tranAuthor = getNodeText(xTranTextInfo[0], "author");
+						}
+						var strTran = getNodeText(xTranText[iTranText], "data");
+
+						setNodeText(xmlNewInfo, "type", "translate");
+						setNodeText(xmlNewInfo, "paragraph", iPara.toString());
+						setNodeText(xmlNewInfo, "book", BookId);
+						setNodeText(xmlNewInfo, "author", tranAuthor);
+						setNodeText(xmlNewInfo, "language", tranLangauge);
+						setNodeText(xmlNewInfo, "edition", "0");
+						setNodeText(xmlNewInfo, "subedition", "0");
+						setNodeText(xmlNewInfo, "id", com_guid());
+						newSen = newXmlBlock.createElement("sen");
+						setNodeText(newSen, "a", "");
+						setNodeText(newSen, "text", strTran);
+						xmlNewData.appendChild(newSen);
+						gXmlBookDataBody.appendChild(newBlock);
+					}
+				}
+				/*end of text of translate*/
+			}
+			/*翻译块结束*/
+
+			/*文件内note块开始*/
+			xTran = xParagraph[j].getElementsByTagName("comm");
+			if (xTran.length > 0) {
+				/*text of translate*/
+				var xTranText = xTran[0].getElementsByTagName("text");
+				if (xTranText.length > 0) {
+					for (iTranText = 0; iTranText < xTranText.length; iTranText++) {
+						cloneBlock = newXmlBlock.cloneNode(true);
+						newBlock = cloneBlock.getElementsByTagName("block")[0];
+						xmlNewInfo = newBlock.getElementsByTagName("info")[0];
+						xmlNewData = newBlock.getElementsByTagName("data")[0];
+
+						var tranLangauge = "";
+						var tranAuthor = "";
+						var xTranTextInfo = xTranText[iTranText].getElementsByTagName("info");
+						if (xTranTextInfo.length > 0) {
+							tranLangauge = getNodeText(xTranTextInfo[0], "language");
+							tranAuthor = getNodeText(xTranTextInfo[0], "author");
+						}
+						var strNote = getNodeText(xTranText[iTranText], "data");
+
+						setNodeText(xmlNewInfo, "type", "note");
+						setNodeText(xmlNewInfo, "paragraph", iPara.toString());
+						setNodeText(xmlNewInfo, "book", BookId);
+						setNodeText(xmlNewInfo, "author", tranAuthor);
+						setNodeText(xmlNewInfo, "language", titleLangauge);
+						setNodeText(xmlNewInfo, "edition", "0");
+						setNodeText(xmlNewInfo, "subedition", "0");
+						setNodeText(xmlNewInfo, "id", com_guid());
+						newSen = newXmlBlock.createElement("sen");
+						setNodeText(newSen, "a", "");
+						setNodeText(newSen, "text", strNote);
+						xmlNewData.appendChild(newSen);
+						gXmlBookDataBody.appendChild(newBlock);
+					}
+				}
+				/*end of text of translate*/
+			}
+			/*文件内翻译块结束*/
+
+			iPara++;
+		}
+	}
+	projectDataParse(gXmlBookData);
+	updataToc();
+	refreshResource();
+}
+
+function add_part(part) {
+	$("#input_org").val(part);
+}
+
+function edit_show_prt_prt(obj){
+	let o = obj.getElementsByTagName("svg");
+	if(document.getElementById("edit_detail_prt_prt").style.display=="none"){
+		document.getElementById("edit_detail_prt_prt").style.display="block";
+		o[0].style.transform="rotate(90deg)";
+	}
+	else{
+		document.getElementById("edit_detail_prt_prt").style.display="none";
+		o[0].style.transform="rotate(0deg)";
+	}
+}
+
+function edit_parent_grammar_changed(str){
+	document.getElementById("parent_grammar").innerHTML=getLocalGrammaStr(str);
+	document.getElementById("input_parent_grammar").value=str;
+	
+}

+ 4421 - 0
public/app/studio/js/render copy.js

@@ -0,0 +1,4421 @@
+var gRenderPageLimit = 1; //限制 1 不限制 设为1000
+
+var gDisplayCapacity = 20 * gRenderPageLimit;
+var gCurrTopParagraph = 0;
+var gVisibleParBegin = 0;
+var gVisibleParEnd = 10 * gRenderPageLimit;
+
+//显示模式
+var _display_para_arrange = 0; //0:横向 排列 1:纵向排列
+var _display_sbs = 0; //0:逐段  1:逐句
+
+//翻译块显示模式
+//在编辑状态下显示预览
+var _tran_show_preview_on_edit = true;
+//在非编辑状态下显示编辑框
+var _tran_show_textarea_esc_edit = true;
+
+var gVisibleParBeginOld = 0;
+var gVisibleParEndOld = gDisplayCapacity;
+//var gPalitext_length=0
+var gtext_max_length = 0;
+var g_allparlen_array = new Array();
+function palitext_calculator() {
+	var allText = "";
+	var allTextLen_array = new Array();
+	var text_max2_length = 0;
+	allBlock = gXmlBookDataBody.getElementsByTagName("block");
+	for (var iBlock = 0; iBlock < allBlock.length; iBlock++) {
+		xmlParInfo = allBlock[iBlock].getElementsByTagName("info")[0];
+		xmlParData = allBlock[iBlock].getElementsByTagName("data")[0];
+
+		//bookId=getNodeText(xmlParInfo,"book")
+		//paragraph=getNodeText(xmlParInfo,"paragraph")
+		type = getNodeText(xmlParInfo, "type");
+		if (type == "wbw") {
+			var wbwTextNode = xmlParData.getElementsByTagName("word");
+			var para_text_cal = "";
+			for (var iText = 0; iText < wbwTextNode.length; iText++) {
+				if (getNodeText(wbwTextNode[iText], "type") != ".ctl.") {
+					para_text_cal += getNodeText(wbwTextNode[iText], "pali") + " ";
+				}
+			}
+			allText += para_text_cal;
+			allTextLen_array.push(allText.length);
+			//gPalitext_length+=para_text_cal.length
+			if (para_text_cal.length > text_max2_length) {
+				text_max2_length = para_text_cal.length;
+				if (text_max2_length > gtext_max_length) {
+					var num_max_tem = gtext_max_length;
+					gtext_max_length = text_max2_length;
+					text_max2_length = num_max_tem;
+				}
+			}
+		}
+	}
+	for (i_cal in allTextLen_array) {
+		g_allparlen_array.push(allTextLen_array[i_cal] / gtext_max_length);
+	}
+	gDisplayCapacity = 19 * gRenderPageLimit + text_max2_length / gtext_max_length;
+	if (gDisplayCapacity * gtext_max_length < 5000 * gRenderPageLimit) {
+		gDisplayCapacity = (5000 * gRenderPageLimit) / gtext_max_length;
+	}
+}
+//添加新的段落块
+function addNewBlockToHTML(bookId, parId, begin = -1, end = -1) {
+	parHeadingLevel = 0;
+	parTitle = "";
+	var divBlock = document.createElement("div");
+	var typId = document.createAttribute("id");
+	if (begin == -1 && end == -1) {
+		//基于段落的块
+		typId.nodeValue = "par_" + bookId + "_" + (parId - 1);
+	} else {
+		//基于句子的块
+		typId.nodeValue = "par_" + bookId + "_" + (parId - 1) + "_" + begin + "_" + end;
+	}
+
+	divBlock.attributes.setNamedItem(typId);
+	var typClass = document.createAttribute("class");
+	typClass.nodeValue = "pardiv";
+	divBlock.attributes.setNamedItem(typClass);
+
+	var output = '<a name="par_begin_' + bookId + "_" + (parId - 1) + '"></a>';
+	output += '	<div id="head_tool_' + bookId + "_" + (parId - 1) + '" class="head_tool edit_tool">';
+	output +=
+		'	<button id="id_heading_add_new" onclick="editor_heading_add_new(\'' +
+		bookId +
+		"','" +
+		parId +
+		"')\" >" +
+		gui_string_editor[0] +
+		"</button>";
+	output +=
+		"<input id='page_break_'" +
+		bookId +
+		"_" +
+		(parId - 1) +
+		' type="checkbox" onclick="editor_page_break(this,\'' +
+		bookId +
+		"','" +
+		(parId - 1) +
+		"')\" />" +
+		gui_string_editor[1];
+	output += "</div>";
+
+	//heading
+	output += '	<div id="heading_' + bookId + "_" + (parId - 1) + '" class="par_heading"></div>';
+
+	//word by word translate block
+	//内部可以包含多个wbw块
+	output += '	<div id="wblock_' + bookId + "_" + (parId - 1) + '" class="wbwdiv"></div>';
+
+	//translate div
+	output += '	<div id="tran_' + bookId + "_" + (parId - 1) + '" class="trandiv"></div>';
+
+	//word note div
+	output += '	<div id="wnote_' + bookId + "_" + (parId - 1) + '" class="wnotediv"></div>';
+
+	//note div
+	output += '	<div id="note_' + bookId + "_" + (parId - 1) + '" class="pnotediv"></div>';
+
+	//vedio div
+	output += '	<div id="vedioblock_' + bookId + "_" + (parId - 1) + '" class="vediodiv"></div>';
+
+	divBlock.innerHTML = output;
+	document.getElementById("sutta_text").appendChild(divBlock);
+}
+
+function renderToc(bookId, parBegin, parEnd) {
+	var firstHeadingLevel = getNodeText(gXmlParIndex[parBegin - 1], "level");
+
+	var output = "<ul>";
+	for (var iPar = parBegin; iPar < parEnd; iPar++) {
+		parTitle = getNodeText(gXmlParIndex[iPar - 1], "title");
+		parHeadingLevel = getNodeText(gXmlParIndex[iPar - 1], "level");
+		if (parHeadingLevel > 0) {
+			output += '<li class="toc_h_' + (parHeadingLevel - firstHeadingLevel + 1) + '">';
+			output += '<a href="#par-' + bookId + "-" + iPar + '">' + parTitle + "</a>";
+			output += "</li>";
+		}
+	}
+	output += "</ul>";
+	return output;
+}
+
+function updataWordParContainer(bookId, parId) {
+	document.getElementById("wblock-" + bookId + "-" + parId + '"').innerHTML = renderWordParContainerInner(
+		bookId,
+		parId
+	);
+}
+
+function renderWordParContainerInner(bookId, parId) {
+	var strHtml = "";
+	strHtml += '<div class="wbwparblock">';
+	strHtml += renderWordParBlockInner(packageIndex);
+	strHtml += "</div>";
+}
+
+//根据block数据更新 目录 列表
+function updataToc() {
+	document.getElementById("content").innerHTML = "";
+	//创建目录空壳
+	for (let iPar = 0; iPar < gArrayDocParagraph.length; iPar++) {
+		if (gArrayDocParagraph[iPar].level > 0) {
+			let bookId = gArrayDocParagraph[iPar].book;
+			let parIndex = gArrayDocParagraph[iPar].paragraph;
+			let tocId = "toc_" + bookId + "_" + (parIndex - 1);
+			let str = '<div class="toc_heading">';
+			str += "<table><tr><td>";
+			str +=
+				"<input type='checkbox' checked onclick=\"editor_par_show(this,'" +
+				bookId +
+				"','" +
+				parIndex +
+				"')\" />";
+			str += "</td><td>";
+			str += '<div class="toc_heading_inner" id="' + tocId + '">';
+			str += "<a onclick=\"editor_goto_link('" + bookId + "'," + parIndex + ')" >[' + parIndex + "]</a>";
+			str += "</div>";
+			str += "</td></tr></table>";
+			str += "</div>";
+			document.getElementById("content").innerHTML += str;
+		}
+	}
+
+	allBlock = gXmlBookDataBody.getElementsByTagName("block");
+	for (let iBlock = 0; iBlock < allBlock.length; iBlock++) {
+		xmlParInfo = allBlock[iBlock].getElementsByTagName("info")[0];
+		xmlParData = allBlock[iBlock].getElementsByTagName("data")[0];
+
+		bookId = getNodeText(xmlParInfo, "book");
+		paragraph = getNodeText(xmlParInfo, "paragraph");
+		type = getNodeText(xmlParInfo, "type");
+		if (type == "heading") {
+			level = getNodeText(xmlParInfo, "level");
+			//if(level>0)
+			{
+				language = getNodeText(xmlParInfo, "language");
+				bId = getNodeText(xmlParInfo, "id");
+				strHeadingText = getNodeText(xmlParData, "text");
+				tocId = "toc_" + bookId + "_" + (paragraph - 1);
+				/*
+				var htmlBlock=document.getElementById(tocId)
+				if(htmlBlock==null){
+					var str="<div class=\"toc_heading\">";
+					str += "<table><tr><td>";
+					str += "<input type='checkbox' checked onclick=\"editor_par_show(this,'"+bookId+"','"+(paragraph-1)+"')\" />";
+					str += "</td><td>";
+					str += "<div class=\"toc_heading_inner\" id=\""+tocId+"\"></div>";
+					str += "</td></tr></table>";
+					str += "</div>";
+					document.getElementById("content").innerHTML+=str
+				}
+				*/
+				let tocText = '<p class="toc_item_' + level + " " + language + '_text">';
+				tocText +=
+					"<a onclick=\"editor_goto_link('" +
+					bookId +
+					"'," +
+					paragraph +
+					')" >[' +
+					paragraph +
+					"]-" +
+					strHeadingText +
+					"</a>";
+				tocText += "</p>";
+
+				$("#toc_" + bookId + "_" + (paragraph - 1)).html(tocText);
+			}
+		}
+	}
+	palitext_calculator();
+}
+//向html中插入数据块
+function insertBlockToHtml(element) {
+	xmlParInfo = element.getElementsByTagName("info")[0];
+	xmlParData = element.getElementsByTagName("data")[0];
+
+	let bookId = getNodeText(xmlParInfo, "book");
+	let paragraph = getNodeText(xmlParInfo, "paragraph");
+	let base_on = getNodeText(xmlParInfo, "base");
+	let begin = getNodeText(xmlParInfo, "begin");
+	let end = getNodeText(xmlParInfo, "end");
+
+	type = getNodeText(xmlParInfo, "type");
+	language = getNodeText(xmlParInfo, "language");
+	bId = getNodeText(xmlParInfo, "id");
+
+	let htmlBlock;
+	if (base_on == "sentence") {
+		blockId = "par_" + bookId + "_" + (paragraph - 1) + "_" + begin + "_" + end;
+		htmlBlock = document.getElementById(blockId);
+		if (htmlBlock == null) {
+			addNewBlockToHTML(bookId, paragraph, begin, end);
+		}
+	} else {
+		blockId = "par_" + bookId + "_" + (paragraph - 1);
+		htmlBlock = document.getElementById(blockId);
+		if (htmlBlock == null) {
+			addNewBlockToHTML(bookId, paragraph);
+		}
+	}
+
+	if (!isParInView(getParIndex(bookId, paragraph))) {
+		document.getElementById(blockId).style.display = "none";
+		return;
+	} else {
+		document.getElementById(blockId).style.display = "inline-flex";
+	}
+
+	switch (type) {
+		case "wbw":
+			var strHtml = renderWordParBlockInner(element);
+			$("#wnote_" + bookId + "_" + (paragraph - 1)).html(renderNoteShell(element));
+			var paraDiv = document.createElement("div");
+			var node = document.createTextNode("");
+			paraDiv.appendChild(node);
+			paraDiv.innerHTML = strHtml;
+			note_refresh_new();
+			var typ = document.createAttribute("class");
+			typ.nodeValue = "wbwparblock";
+			paraDiv.attributes.setNamedItem(typ);
+
+			var id = document.createAttribute("id");
+			id.nodeValue = "id_wbw_" + bId;
+			paraDiv.attributes.setNamedItem(id);
+
+			blockId = "wblock_" + bookId + "_" + (paragraph - 1);
+			document.getElementById(blockId).appendChild(paraDiv);
+
+			refreshWordNoteDiv(element);
+			refreshNoteNumber();
+			break;
+		case "translate":
+			var strHtml = "";
+			strHtml = renderTranslateParBlockInner(element);
+			var paraDiv = document.createElement("div");
+			var node = document.createTextNode("");
+			paraDiv.appendChild(node);
+			paraDiv.innerHTML = strHtml;
+			var typ = document.createAttribute("class");
+			typ.nodeValue = "tran_parblock " + language + "_text";
+			paraDiv.attributes.setNamedItem(typ);
+
+			var id = document.createAttribute("id");
+			id.nodeValue = "id_tran_" + bId;
+			paraDiv.attributes.setNamedItem(id);
+
+			blockId = "tran_" + bookId + "_" + (paragraph - 1);
+			document.getElementById(blockId).appendChild(paraDiv);
+			//逐句
+			if (_display_sbs == 1) {
+				let eAllSent = document.getElementById(blockId).getElementsByClassName("tran_sent");
+				for (let iSen = 0; iSen < eAllSent.length; iSen++) {
+					let senA = eAllSent[iSen].getAttributeNode("sn").value;
+					let blockId = eAllSent[iSen].getAttributeNode("block").value;
+					let eSBSDiv = document.getElementById("sent_" + senA);
+					if (eSBSDiv) {
+						let eBlockSenDiv = document.getElementById("sent_" + senA + "_" + blockId);
+						if (!eBlockSenDiv) {
+							//没有 添加
+							let divSen = document.createElement("div");
+							let typ = document.createAttribute("class");
+							typ.nodeValue = "sbs_sent_block";
+							divSen.attributes.setNamedItem(typ);
+
+							let typId = document.createAttribute("id");
+							typId.nodeValue = "sent_" + senA + "_" + blockId;
+							divSen.attributes.setNamedItem(typId);
+
+							let sn = document.createAttribute("sn");
+							sn.nodeValue = senA;
+							divSen.attributes.setNamedItem(sn);
+
+							let block = document.createAttribute("block");
+							block.nodeValue = blockId;
+							divSen.attributes.setNamedItem(block);
+
+							divSen.innerHTML = eAllSent[iSen].innerHTML;
+							eSBSDiv.appendChild(divSen);
+						} else {
+							eBlockSenDiv.innerHTML = eAllSent[iSen].innerHTML;
+						}
+						eAllSent[iSen].innerHTML = "";
+					}
+				}
+			}
+			break;
+		case "note":
+			var strHtml = "";
+			strHtml = renderNoteParBlockInner(element);
+			var paraDiv = document.createElement("div");
+			var node = document.createTextNode("");
+			paraDiv.appendChild(node);
+			paraDiv.innerHTML = strHtml;
+			var typ = document.createAttribute("class");
+			typ.nodeValue = "note_parblock " + language + "_text";
+			paraDiv.attributes.setNamedItem(typ);
+
+			var id = document.createAttribute("id");
+			id.nodeValue = "id_note_" + bId;
+			paraDiv.attributes.setNamedItem(id);
+
+			blockId = "note_" + bookId + "_" + (paragraph - 1);
+			document.getElementById(blockId).appendChild(paraDiv);
+			document.getElementById(blockId).style.display = "block";
+			break;
+		case "heading":
+			headingLevel = getNodeText(xmlParInfo, "level");
+			var strHtml = "";
+			strHtml = renderHeadingBlockInner(element);
+			var paraDiv = document.createElement("div");
+			var node = document.createTextNode("");
+			paraDiv.appendChild(node);
+			paraDiv.innerHTML = strHtml;
+			var typ = document.createAttribute("class");
+			typ.nodeValue = "heading_parblock_" + headingLevel + "_" + language + " " + language + "_text";
+			paraDiv.attributes.setNamedItem(typ);
+
+			var id = document.createAttribute("id");
+			id.nodeValue = "id_heading_" + bId;
+			paraDiv.attributes.setNamedItem(id);
+
+			blockId = "heading_" + bookId + "_" + (paragraph - 1);
+			document.getElementById(blockId).appendChild(paraDiv);
+			document.getElementById(blockId).style.display = "block";
+			//document.getElementById("id_heading_level_"+bookId+"_"+(paragraph-1)).value=headingLevel;
+			break;
+	}
+	guide_init();
+}
+
+function updataHeadingBlockInHtml(book, par) {
+	document.getElementById("heading_" + book + "_" + (par - 1)).innerHTML = "";
+	allBlock = gXmlBookDataBody.getElementsByTagName("block");
+	for (var iBlock = 0; iBlock < allBlock.length; iBlock++) {
+		xmlParInfo = allBlock[iBlock].getElementsByTagName("info")[0];
+		xmlParData = allBlock[iBlock].getElementsByTagName("data")[0];
+
+		bookId = getNodeText(xmlParInfo, "book");
+		paragraph = getNodeText(xmlParInfo, "paragraph");
+		type = getNodeText(xmlParInfo, "type");
+		if (type == "heading" && bookId == book && paragraph == par) {
+			insertBlockToHtml(allBlock[iBlock]);
+		}
+	}
+}
+
+function renderBlock() {}
+/*
+重绘翻译数据块
+*/
+function update_tran_sent(blockId, begin, end) {
+	let eBlock = document.getElementById("id_tran_" + blockId);
+	if (eBlock) {
+		eBlock.innerHTML = renderTranslateParBlockInnerById(blockId);
+		term_updata_translation();
+	}
+	/*
+	$("#id_tran_"+blockId).html(renderTranslateParBlockInnerById(blockId));
+	term_updata_translation();
+*/
+}
+
+/*
+更新翻译数据块数据
+*/
+function update_tran_block_text(blockId) {
+	let block = doc_tran("#" + blockId);
+	if (block != null) {
+		let book = block.info("book");
+		let para = block.info("paragraph");
+		let sent = block.list();
+		if (sent != null) {
+			for (const element of sent) {
+				let eText = document.getElementById("ta_" + blockId + "_" + element.begin + "_" + element.end);
+				if (eText) {
+					eText.innerHTML = element.text;
+				}
+				let eLable = document.getElementById(
+					"tran_pre_" + blockId + "_p" + book + "-" + para + "-" + element.end
+				);
+				if (eLable) {
+					eLable.innerHTML = element.text;
+				}
+			}
+			term_updata_translation();
+		}
+	}
+}
+
+/*
+重绘翻译数据块
+*/
+function update_tran_block(blockId) {
+	let eBlock = document.getElementById("id_tran_" + blockId);
+	if (eBlock) {
+		eBlock.innerHTML = renderTranslateParBlockInnerById(blockId);
+		term_updata_translation();
+	}
+	/*
+	$("#id_tran_"+blockId).html(renderTranslateParBlockInnerById(blockId));
+	term_updata_translation();
+*/
+}
+//譯文段落渲染
+function renderTranslateParBlockInnerById(blockId) {
+	var xBlock = gXmlBookDataBody.getElementsByTagName("block");
+	for (var iBlock = 0; iBlock < xBlock.length; iBlock++) {
+		xmlParInfo = xBlock[iBlock].getElementsByTagName("info")[0];
+		xmlParData = xBlock[iBlock].getElementsByTagName("data")[0];
+		bId = getNodeText(xmlParInfo, "id");
+		if (bId == blockId) {
+			return renderTranslateParBlockInner(xBlock[iBlock]);
+		}
+	}
+}
+//譯文段落渲染
+function renderTranslateParBlockInner(elementBlock) {
+	var output = "";
+	xmlParInfo = elementBlock.getElementsByTagName("info")[0];
+	var book = getNodeText(xmlParInfo, "book");
+	var paragraph = getNodeText(xmlParInfo, "paragraph");
+	var bId = getNodeText(xmlParInfo, "id");
+	var power = getNodeText(xmlParInfo, "power");
+	var readonly = getNodeText(xmlParInfo, "readonly");
+
+	par_num = paragraph - 1;
+
+	type = getNodeText(xmlParInfo, "type");
+	language = getNodeText(xmlParInfo, "language");
+	var allSen = elementBlock.getElementsByTagName("sen");
+	output += "<div>";
+	for (iSen = 0; iSen < allSen.length; iSen++) {
+		var senText = getNodeText(allSen[iSen], "text");
+		var senBegin = getNodeText(allSen[iSen], "begin");
+		var senEnd = getNodeText(allSen[iSen], "end");
+		var senA = "p" + book + "-" + paragraph + "-" + senEnd;
+
+		output +=
+			"<div id='tran_sent_" + bId + "_" + senA + "' block='" + bId + "' sn='" + senA + "' class='tran_sent' >";
+
+		if (power != "read") {
+			//可写入模式
+			if (readonly != 1) {
+				output +=
+					"<div class='tran_sent_inner' onmouseenter=\"tran_sent_div_mouseenter('" +
+					bId +
+					"','" +
+					senA +
+					"')\" >";
+			}
+		} else {
+			output += "<div class='tran_sent_inner' >";
+		}
+		output += "<div id='tran_pre_" + bId + "_" + senA + "' class='tran_sent_pre'>";
+		if (senText == "") {
+			output += "<span style='color:gray;'>" + gLocal.gui.translation + "</span>";
+		} else {
+			output += term_std_str_to_tran(senText);
+		}
+		output += "</div>";
+		output += "<div id='tran_sent_text_div_" + bId + "_" + senA + "' class='tran_sen_textarea'";
+		//在非编辑状态下 不显示 编辑框
+		if (_tran_show_textarea_esc_edit == false) {
+			output += " style='display:none'";
+		}
+		output += ">";
+		//只读权限不显示修改框
+		if (power != "read") {
+			//可写入模式
+			if (readonly != 1) {
+				//只读模式不显示修改框 只有power=write才考虑只读模式
+				output += "<textarea id='ta_" + bId + "_" + senBegin + "_" + senEnd + "' ";
+				output += " onkeyup=\"updateTranslationPreview('" + bId + "_" + senA + "',this)\" ";
+				output += " onchange=\"tran_text_onchange('" + bId + "','" + senBegin + "','" + senEnd + "',this)\" ";
+				//output += " onchange=\"sen_save('"+bId+"','"+senBegin+"','"+senEnd+"',this.value)\" ";
+				output += " onblur=\"tran_sent_div_blur('" + bId + "','" + senBegin + "','" + senEnd + "',this)\" ";
+				output +=
+					" onfocus=\"tran_sent_div_onfocus('" + bId + "','" + senBegin + "','" + senEnd + "',this)\" >";
+				senText = senText.replace(/\<br \/\>/g, "\n\n");
+				output += term_std_str_to_edit(senText);
+				output += "</textarea>";
+			}
+		}
+
+		output += "</div>";
+		output += '<div class="tran_sent_text_tool_bar">';
+		//output += "<button onclick=\"tran_sen_save_click('"+bId+"','"+senBegin+"','"+senEnd+"',this)\">Save</button>";
+		output += "<span></span>";
+		output +=
+			"<span onclick=\"show_tran_msg('" +
+			bId +
+			"','" +
+			senBegin +
+			"','" +
+			senEnd +
+			"')\"><span id='' class=\"word_msg\"></span></span>";
+
+		output += "</div>";
+		output += "</div>";
+		output += "</div>";
+
+		output += "</div>";
+	}
+	output += "</div>";
+
+	return output;
+}
+
+function renderTranslateParBlockInnerPreview(strText) {}
+function updateTranslationPreview_a(blockId, text) {
+	let out = "";
+	let newText = text;
+	newText = marked(newText);
+	//newText = term_tran_edit_replace(newText);
+	//newText = term_edit_to_std_str(newText);
+	newText = term_std_str_to_tran(newText);
+	out += newText;
+	if (out == "") {
+		out = "<span style='color:#ccbfbf;'>" + gLocal.gui.with_idea + "</span>";
+	}
+	$("#tran_pre_" + blockId).html(out);
+	term_updata_translation();
+}
+function updateTranslationPreview(blockId, obj) {
+	let out = "";
+	let newText = obj.value;
+	newText = marked(newText);
+	let channal = $(obj).attr("channal");
+	let lang = $(obj).attr("lang");
+
+	newText = term_std_str_to_tran(newText, channal, getCookie("userid"), lang);
+	out += newText;
+	if (out == "") {
+		out = "<span style='color:#ccbfbf;'>" + gLocal.gui.with_idea + "</span>";
+	}
+	$("#tran_pre_" + blockId).html(out);
+	term_updata_translation();
+	$(obj).css({'height': 'auto'}).height($(obj)[0].scrollHeight+"px");
+}
+
+function getSuperTranslateModifyString(inString, par_num, par_guid, language) {
+	var curr_super_info = getPrevNextTrans_Guid("curr", par_guid);
+
+	var arrString = translate_split(curr_super_info.senText, language).string;
+	var output = "";
+	var arrString_last = "";
+	var sent_ID = "";
+	var arr_sentA_ID = g_arr_Para_ID[par_num];
+	var y = 0;
+	for (y in arr_par_sent_num) {
+		//得到本段句子外殻數0~par_num_last
+		var arr_sentID = arr_par_sent_num[y].split("_");
+		if (arr_sentID[1] == par_num) {
+			var par_num_last = arr_sentID[2];
+		}
+	}
+	if (par_num_last >= arrString.length - 1) {
+		//外殻數大於等於切分結果,執行充填
+		for (var x = 0; x < arrString.length; x++) {
+			//整段渲染
+			sent_ID = "sent_" + arr_sentA_ID[x];
+			var superStringPosition_Start = 0;
+			var superStringPosition_End = 0;
+			var superString = translate_super_split(arrString[x], language).string;
+			var language_type = translate_super_split(arrString[x], language).language_type;
+			var output_super = "";
+			for (var super_x = 0; super_x < superString.length; super_x++) {
+				superStringPosition_End = superStringPosition_Start;
+				superStringPosition_Start += superString[super_x].length;
+				output_super +=
+					"<span id='SBS_senA_" +
+					par_guid +
+					"_" +
+					superStringPosition_End +
+					"' class=\"tran_sen\" style='display:none'>";
+				output_super += superStringPosition_End + "_" + superStringPosition_Start;
+				output_super += "</span>";
+				output_super +=
+					"<span id='SBS_senText_" + par_guid + "_" + superStringPosition_End + '\' class="tooltip">';
+				output_super += superString[super_x];
+				output_super += '<span class="tooltiptext tooltip-bottom">';
+				output_super +=
+					"<button onclick='super_trans_modify(up_sen," +
+					superStringPosition_Start +
+					"," +
+					par_guid +
+					"," +
+					language +
+					")'>▲</button>";
+				output_super +=
+					"<button onclick='super_trans_modify(down_sen," +
+					superStringPosition_End +
+					"," +
+					par_guid +
+					"," +
+					language +
+					")'>▼</button>";
+				output_super += "</span></span>";
+			}
+			var output_super_0 = "<div class=" + language_type + "_text>" + output_super + "</div>";
+			if (document.getElementById(sent_ID).innerHTML.length != 0) {
+				if (document.getElementById(sent_ID).innerHTML == gLocal.gui.sent_trans) {
+					document.getElementById(sent_ID).innerHTML = output_super_0; //把逐句譯內容根據相應ID號寫入
+				} else {
+					document.getElementById(sent_ID).innerHTML += output_super_0; //把逐句譯內容根據相應ID號寫入
+				}
+			}
+			output += output_super.replace(/SBS_/g, "PBP_"); //逐句譯id轉換為逐段id
+			output = output.replace(/up_sen/g, "up_par"); //逐句譯id轉換為逐段id
+			output = output.replace(/down_sen/g, "down_par"); //逐句譯id轉換為逐段id
+		}
+	} else if (par_num_last < arrString.length - 1) {
+		//外殻數小於切分結果
+		for (var x = 0; x < par_num_last; x++) {
+			//除最後一句,其他充填
+			//整段渲染
+			sent_ID = "sent_" + arr_sentA_ID[x];
+			var superStringPosition_Start = 0;
+			var superStringPosition_End = 0;
+			var superString = translate_super_split(arrString[x], language).string;
+			var language_type = translate_super_split(arrString[x], language).language_type;
+			var output_super = "";
+			for (var super_x = 0; super_x < superString.length; super_x++) {
+				superStringPosition_End = superStringPosition_Start;
+				superStringPosition_Start += superString[super_x].length;
+				output_super +=
+					"<span id='SBS_senA_" +
+					par_guid +
+					"_" +
+					superStringPosition_End +
+					"' class=\"tran_sen\" style='display:none'>";
+				output_super += superStringPosition_End + "_" + superStringPosition_Start;
+				output_super += "</span>";
+				output_super +=
+					"<span id='SBS_senText_" + par_guid + "_" + superStringPosition_End + '\' class="tooltip">';
+				output_super += superString[super_x];
+				output_super += '<span class="tooltiptext tooltip-bottom">';
+				output_super +=
+					"<button onclick='super_trans_modify(up_sen," +
+					superStringPosition_Start +
+					"," +
+					par_guid +
+					"," +
+					language +
+					")'>▲</button>";
+				output_super +=
+					"<button onclick='super_trans_modify(down_sen," +
+					superStringPosition_End +
+					"," +
+					par_guid +
+					"," +
+					language +
+					")'>▼</button>";
+				output_super += "</span></span>";
+			}
+			output += output_super.replace(/SBS_/g, "PBP_"); //逐句譯id轉換為逐段id
+			output = output.replace(/up_sen/g, "up_par"); //逐句譯id轉換為逐段id
+			output = output.replace(/down_sen/g, "down_par"); //逐句譯id轉換為逐段id
+			var output_super_0 = "<div class=" + language_type + "_text>" + output_super + "</div>";
+			if (document.getElementById(sent_ID).innerHTML.length != 0) {
+				if (document.getElementById(sent_ID).innerHTML == gLocal.gui.sent_trans) {
+					document.getElementById(sent_ID).innerHTML = output_super_0; //把逐句譯內容根據相應ID號寫入
+				} else {
+					document.getElementById(sent_ID).innerHTML += output_super_0; //把逐句譯內容根據相應ID號寫入
+				}
+			}
+		}
+		var output_super = "";
+		for (var x = par_num_last; x < arrString.length - 1; x++) {
+			//最後一句,合併所有譯文
+			var superString = translate_super_split(arrString[x], language).string;
+			var language_type = translate_super_split(arrString[x], language).language_type;
+			for (var super_x = 0; super_x < superString.length; super_x++) {
+				superStringPosition_End = superStringPosition_Start;
+				superStringPosition_Start += superString[super_x].length;
+				output_super +=
+					"<span id='SBS_senA_" +
+					par_guid +
+					"_" +
+					superStringPosition_End +
+					"' class=\"tran_sen\" style='display:none'>";
+				output_super += superStringPosition_End + "_" + superStringPosition_Start;
+				output_super += "</span>";
+				output_super +=
+					"<span id='SBS_senText_" + par_guid + "_" + superStringPosition_End + '\' class="tooltip">';
+				output_super += superString[super_x];
+				output_super += '<span class="tooltiptext tooltip-bottom">';
+				output_super +=
+					"<button onclick='super_trans_modify(up_sen," +
+					superStringPosition_Start +
+					"," +
+					par_guid +
+					"," +
+					language +
+					")'>▲</button>";
+				output_super +=
+					"<button onclick='super_trans_modify(down_sen," +
+					superStringPosition_End +
+					"," +
+					par_guid +
+					"," +
+					language +
+					")'>▼</button>";
+				output_super += "</span></span>";
+			}
+			output += output_super.replace(/SBS_/g, "PBP_"); //逐句譯id轉換為逐段id
+			output = output.replace(/up_sen/g, "up_par"); //逐句譯id轉換為逐段id
+			output = output.replace(/down_sen/g, "down_par"); //逐句譯id轉換為逐段id
+		}
+		sent_ID = "sent_" + arr_sentA_ID[par_num_last];
+		var output_super_0 = "<div class=" + language_type + "_text>" + output_super + "</div>";
+		if (document.getElementById(sent_ID).innerHTML.length != 0) {
+			if (document.getElementById(sent_ID).innerHTML == gLocal.gui.sent_trans) {
+				document.getElementById(sent_ID).innerHTML = output_super_0; //把逐句譯內容根據相應ID號寫入
+			} else {
+				document.getElementById(sent_ID).innerHTML += output_super_0; //把逐句譯內容根據相應ID號寫入
+			}
+		}
+	}
+	return output;
+}
+
+function super_trans_modify(updown, superStringPosition, par_guid, language) {
+	//未完成
+
+	var prev_super_info = getPrevNextTrans_Guid(prev, par_guid);
+	var next_super_info = getPrevNextTrans_Guid(next, par_guid);
+	var curr_super_info = getPrevNextTrans_Guid(curr, par_guid);
+
+	var new_prev_super_info = new Object();
+	var new_next_super_info = new Object();
+	var new_curr_super_info = new Object();
+
+	switch (updown) {
+		case "up_par":
+			new_prev_super_info.GUID = prev_super_info.GUID;
+			new_prev_super_info.senText =
+				prev_super_info.senText + curr_super_info.senText.replace(/#/g, "").slice(0, superStringPosition);
+			var new_senText_array = translate_super_split(new_prev_super_info.senText, language);
+			new_prev_super_info.senA = "0_";
+			for (new_senText_array_i in new_senText_array) {
+				new_prev_super_info.senA += new_senText_array[new_senText_array_i].length;
+				new_prev_super_info.senA += "#" + new_senText_array[new_senText_array_i].length + "_";
+				if (new_senText_array_i == new_senText_array.length - 1) {
+					new_prev_super_info.senA += new_senText_array[new_senText_array_i].length;
+					break;
+				}
+			}
+			new_prev_super_info.senA = (new_prev_super_info.senA + "#").replace(/##/g, "");
+
+			new_curr_super_info.GUID = curr_super_info.GUID;
+			new_curr_super_info.senText = curr_super_info.senText.replace(/#/g, "").slice(superStringPosition);
+			var new_senText_array = translate_super_split(new_curr_super_info.senText, language);
+			new_curr_super_info.senA = "";
+			for (new_senText_array_i in new_senText_array) {
+				new_curr_super_info.senA += new_senText_array[new_senText_array_i].length;
+				new_curr_super_info.senA += "#" + new_senText_array[new_senText_array_i].length + "_";
+				if (new_senText_array_i == new_senText_array.length - 1) {
+					new_curr_super_info.senA += new_senText_array[new_senText_array_i].length;
+					break;
+				}
+			}
+			new_curr_super_info.senA = (new_curr_super_info.senA + "#").replace(/##/g, "");
+
+			break;
+		case "down_par":
+			if (par_num > max_par_num) {
+				//无效通知
+			}
+
+			break;
+	}
+}
+function getPrevNextTrans_Guid(direction, par_guid) {
+	var allBlock = gXmlBookDataBody.getElementsByTagName("block"); //得到全局block
+	var prev_super_info = new Object();
+	var next_super_info = new Object();
+	var curr_super_info = new Object();
+	var super_arr_xmlParInfo = new Array();
+	var super_arr_xmlParData = new Array();
+	var super_arr_xmlParAllsen = new Array();
+	var super_arr_xmlParAllloc = new Array();
+
+	curr_super_info.GUID = par_guid;
+	for (var super_iBlock = 0; super_iBlock < allBlock.length; super_iBlock++) {
+		if (super_iBlock == "length") {
+			break;
+		}
+		var elementBlock = allBlock[super_iBlock]; //得到其中一段的數據
+		if (elementBlock.getElementsByTagName("sen").length != 0) {
+			super_arr_xmlParInfo.push(elementBlock.getElementsByTagName("info")[0]);
+			super_arr_xmlParData.push(elementBlock.getElementsByTagName("data")[0]);
+		}
+	}
+	if (elementBlock.getElementsByTagName("sen").length != 0) {
+		for (var super_iData in super_arr_xmlParData) {
+			var super_xmlParAll_Sen = "";
+			var super_xmlParAll_Loc = "";
+			for (var super_iSen = 0; super_iSen < super_arr_xmlParData[super_iData].childNodes.length; super_iSen++) {
+				var super_xmlParData_Detail = super_arr_xmlParData[super_iData].childNodes[super_iSen];
+				super_xmlParAll_Sen += super_xmlParData_Detail.getElementsByTagName("text")[0].innerHTML + "#";
+				super_xmlParAll_Loc += super_xmlParData_Detail.getElementsByTagName("a")[0].innerHTML + "#";
+			}
+			super_xmlParAll_Sen = (super_xmlParAll_Sen + "#").replace(/##/g, "");
+			super_xmlParAll_Loc = (super_xmlParAll_Loc + "#").replace(/##/g, "");
+			super_arr_xmlParAllsen.push(super_xmlParAll_Sen);
+			super_arr_xmlParAllloc.push(super_xmlParAll_Loc);
+		}
+
+		for (var super_iBlock = 0; super_iBlock < super_arr_xmlParInfo.length; super_iBlock++) {
+			if (super_iBlock == "length") {
+				break;
+			}
+			var super_GUID = getNodeText(super_arr_xmlParInfo[super_iBlock], "id"); //得到guid
+			prev_super_info.senText = "";
+			prev_super_info.senA = "";
+			curr_super_info.senText = super_arr_xmlParAllsen[super_iBlock];
+			curr_super_info.senA = super_arr_xmlParAllloc[super_iBlock];
+			next_super_info.senText = "";
+			next_super_info.senA = "";
+			if (super_GUID == par_guid && super_iBlock == 0) {
+				prev_super_info.GUID = ""; //前一個為空
+				next_super_info.GUID = getNodeText(super_arr_xmlParInfo[super_iBlock + 1], "id"); //得到後一個guid
+				next_super_info.senText = super_arr_xmlParAllsen[super_iBlock + 1];
+				next_super_info.senA = super_arr_xmlParAllloc[super_iBlock + 1]; //根據譯文數組得到錨點
+
+				break;
+			} else if (super_GUID == par_guid && super_iBlock > 0 && super_iBlock < super_arr_xmlParAllsen.length - 1) {
+				prev_super_info.GUID = getNodeText(super_arr_xmlParInfo[super_iBlock - 1], "id"); //得到前一個guid
+				next_super_info.GUID = getNodeText(super_arr_xmlParInfo[super_iBlock + 1], "id"); //得到後一個guid
+				prev_super_info.senText = super_arr_xmlParAllsen[super_iBlock - 1];
+				prev_super_info.senA = super_arr_xmlParAllloc[super_iBlock - 1]; //根據譯文數組得到錨點
+				next_super_info.senText = super_arr_xmlParAllsen[super_iBlock + 1];
+				next_super_info.senA = super_arr_xmlParAllloc[super_iBlock + 1]; //根據譯文數組得到錨點
+
+				break;
+			} else if (super_GUID == par_guid && super_iBlock == super_arr_xmlParAllsen.length - 1) {
+				prev_super_info.GUID = getNodeText(super_arr_xmlParInfo[super_iBlock - 1], "id"); //得到前一個guid
+				next_super_info.GUID = "";
+				prev_super_info.senText = super_arr_xmlParAllsen[super_iBlock - 1];
+				prev_super_info.senA = super_arr_xmlParAllloc[super_iBlock - 1]; //根據譯文數組得到錨點
+				break;
+			}
+		}
+	} else {
+		prev_super_info.GUID = "";
+		prev_super_info.senText = "";
+		prev_super_info.senA = "";
+		curr_super_info.GUID = "";
+		curr_super_info.senText = "";
+		curr_super_info.senA = "";
+		next_super_info.GUID = "";
+		next_super_info.senText = "";
+		next_super_info.senA = "";
+	}
+	switch (direction) {
+		case "next":
+			return next_super_info;
+			break;
+		case "curr":
+			return curr_super_info;
+			break;
+		case "prev":
+			return prev_super_info;
+			break;
+	}
+}
+
+function translate_split(inString, language) {
+	var newString = "";
+	var arrString = new Object();
+	var language_type = "";
+	if (
+		language.toLowerCase() == "tw" ||
+		language.toLowerCase() == "zh" ||
+		language.toLowerCase() == "sc" ||
+		language.toLowerCase() == "tc"
+	) {
+		language_type = "ZH";
+	} else {
+		language_type = "EN";
+	}
+	arrString.language_type = language_type.toLowerCase();
+	switch (language_type) {
+		case "ZH":
+			for (var i_cntransplit in cn_transplit) {
+				newString = inString;
+				eval("newString = newString.replace(" + cn_transplit[i_cntransplit] + ")");
+			}
+			/*newString = inString.replace(/。/g,"。#");
+			newString = newString.replace(/;/g,";");
+			newString = newString.replace(/ /g,"");
+			newString = newString.replace(/;/g,";#");
+			newString = newString.replace(/?/g,"?#");
+			newString = newString.replace(/”“/g,"”#“");
+			newString = newString.replace(/’‘/g,"’#‘");
+			newString = newString.replace(/。#”/g,"。”#");
+			newString = newString.replace(/?#”/g,"?”#");
+			newString = newString.replace(/?“/g,"?#“");
+			newString = newString.replace(/:“/g,":#“");
+			newString = newString.replace(/:「/g,":#「");
+			newString = newString.replace(/!#’/g,"!’#");
+			newString = newString.replace(/。#’/g,"。’#");
+			newString = newString.replace(/?#’/g,"?’#");
+			newString = newString.replace(/?‘/g,"?#‘");
+			newString = newString.replace(/:‘/g,":#‘");
+			newString = newString.replace(/##/g,"#");
+			*/
+
+			arrString.string = newString.split("#");
+			break;
+		case "EN":
+			newString = inString;
+			for (var i_entransplit in en_transplit) {
+				newString = inString;
+				eval("newString = newString.replace(" + en_transplit[i_entransplit] + ")");
+			}
+
+			/*newString = inString.replace(/\./g,"\.#");
+			newString = newString.replace(/;/g,";");
+			newString = newString.replace(/;/g,";#");
+			newString = newString.replace(/\?/g,"?#");
+			newString = newString.replace(/\"\"/g,"”#“");
+			newString = newString.replace(/.\'\'/g,".”");
+			newString = newString.replace(/.#\"/g,".”#");
+			newString = newString.replace(/\?#\"/g,"?”#");
+			newString = newString.replace(/\?“/g,"?#“");
+			newString = newString.replace(/,\"/g,",#“");
+			newString = newString.replace(/!#\'/g,"!’#");
+			newString = newString.replace(/.#\'/g,".’#");
+			newString = newString.replace(/?#’/g,"?’#");
+			newString = newString.replace(/?‘/g,"?#‘");
+			newString = newString.replace(/##/g,"#");
+			*/
+
+			arrString.string = newString.split("#");
+			break;
+	}
+	return arrString;
+	// body...
+}
+function translate_super_split(inString) {
+	var newString = inString;
+	var arrString = new Object();
+	var language_type = "";
+	if (
+		language.toLowerCase() == "tw" ||
+		language.toLowerCase() == "zh" ||
+		language.toLowerCase() == "sc" ||
+		language.toLowerCase() == "tc"
+	) {
+		language_type = "ZH";
+	} else {
+		language_type = "EN";
+	}
+	arrString.language_type = language_type.toLowerCase();
+	switch (language_type) {
+		case "ZH":
+			newString = newString.replace(/,/g, ",#");
+			newString = newString.replace(/!/g, "!#");
+			newString = newString.replace(/!#”/g, "!”#");
+			newString = newString.replace(/!#’/g, "!’#");
+
+			arrString.string = newString.split("#");
+			break;
+		case "EN":
+			newString = newString.replace(/,/g, ",#");
+			newString = newString.replace(/!/g, "!#");
+
+			arrString.string = newString.split("#");
+
+			break;
+	}
+	return arrString;
+	// body...
+}
+
+function renderNoteParBlockInner(elementBlock) {
+	var output = "";
+	xmlParInfo = elementBlock.getElementsByTagName("info")[0];
+	book = getNodeText(xmlParInfo, "book");
+	paragraph = getNodeText(xmlParInfo, "paragraph");
+	bId = getNodeText(xmlParInfo, "id");
+
+	type = getNodeText(xmlParInfo, "type");
+	var allSen = elementBlock.getElementsByTagName("sen");
+	output +=
+		'<button type="button" class="edit_note_button imgbutton" onclick="editor_note_edit(\'' +
+		bId +
+		"')\"><svg class='icon' style='fill: var(--detail-color);'><use xlink:href='svg/icon.svg#ic_mode_edit'></use></svg></button>";
+	for (iSen = 0; iSen < allSen.length; iSen++) {
+		senText = getNodeText(allSen[iSen], "text");
+		senA = getNodeText(allSen[iSen], "a");
+		output += '<span id="note_sen_' + bId + "_" + iSen + '" class="note_sen">';
+		output += senText;
+		output += "</span>";
+	}
+
+	return output;
+}
+
+function renderHeadingBlockInner(elementBlock) {
+	var output = "";
+	xmlParInfo = elementBlock.getElementsByTagName("info")[0];
+	book = getNodeText(xmlParInfo, "book");
+	paragraph = getNodeText(xmlParInfo, "paragraph");
+	bId = getNodeText(xmlParInfo, "id");
+
+	type = getNodeText(xmlParInfo, "type");
+	var headingData = elementBlock.getElementsByTagName("data")[0];
+	headingText = getNodeText(headingData, "text");
+	output += '<span id="id_heading_text_' + bId + '">' + headingText + "</span>";
+
+	output +=
+		'<button type="button" class="edit_tool imgbutton" onclick="editor_heading_edit(\'' +
+		bId +
+		"')\"><svg class='icon' style='fill: var(--detail-color);'><use xlink:href='svg/icon.svg#ic_mode_edit'></use></svg></button>";
+
+	return output;
+}
+
+function updateWordParBlockInnerAll() {
+	var xBlock = gXmlBookDataBody.getElementsByTagName("block");
+	for (var iBlock = 0; iBlock < xBlock.length; iBlock++) {
+		xmlParInfo = xBlock[iBlock].getElementsByTagName("info")[0];
+		xmlParData = xBlock[iBlock].getElementsByTagName("data")[0];
+		mId = getNodeText(xmlParInfo, "id");
+		type = getNodeText(xmlParInfo, "type");
+		if ((type = "wbw")) {
+			updateWordParBlockInner(xBlock[iBlock]);
+		}
+	}
+}
+
+function updateWordParBlockInner(elementBlock) {
+	var xmlParInfo = elementBlock.getElementsByTagName("info")[0];
+	var blockId = getNodeText(xmlParInfo, "id");
+	var wbwblock = document.getElementById("id_wbw_" + blockId);
+	if (wbwblock) {
+		wbwblock.innerHTML = renderWordParBlockInner(elementBlock);
+		word_mouse_event();
+		note_refresh_new();
+	}
+}
+
+function renderNoteShell(elementBlock) {
+	let output = "";
+	let allWord = elementBlock.getElementsByTagName("word");
+	for (iWord = 0; iWord < allWord.length; iWord++) {
+		let wID = getNodeText(allWord[iWord], "id");
+		output += '<div id="wn_' + wID + '">';
+		output += '<div id="wnn_' + wID + '"></div>';
+		output += '<div id="wnr_' + wID + '"></div>';
+		output += '<div id="wnc_' + wID + '"></div>';
+		output += "</div>";
+	}
+	return output;
+}
+
+//句子上面的工具条
+function render_sent_tool_bar(elementBlock, begin) {
+	let output = "";
+	let axmlParInfo = elementBlock.getElementsByTagName("info")[0];
+	let abook = getNodeText(axmlParInfo, "book");
+	let aparagraph = getNodeText(axmlParInfo, "paragraph");
+	let xallWord = elementBlock.getElementsByTagName("word");
+	let iBegin = -1;
+	let iEnd = -1;
+	let iWordId = 0;
+	for (let i = 0; i < xallWord.length; i++) {
+		let aID = getNodeText(xallWord[i], "id");
+		let aEnter = getNodeText(xallWord[i], "enter");
+		let arrId = aID.split("-");
+		iWordId = parseInt(arrId[2]);
+		if (iWordId > begin && iBegin < 0) {
+			iBegin = iWordId;
+		}
+		if (iWordId > begin && aEnter == "1") {
+			//句子末尾
+			iEnd = iWordId;
+			break;
+		}
+	}
+	if (iEnd == -1) {
+		iEnd = iWordId;
+	}
+
+	output += "<div class='sent_wbw_trans_bar'>";
+	let sentIdString = abook + "-" + aparagraph + "-" + iBegin + "-" + iEnd;
+	let sentIdStringLink = "{{" + sentIdString + "}}";
+
+	output += "<span style='flex: 7;display: flex;'>";
+	output += "<div style='background-color: silver;'>";
+	//句子编号
+	output += "<span style='font-size: large; font-weight: bolder;' title=" + gLocal.gui.text_num + ">";
+	output += sentIdString;
+	output += "</span>";
+	//功能按钮
+	//拷贝到剪贴板
+	output +=
+		"<button class='icon_btn' onclick=\"copy_to_clipboard('" +
+		sentIdStringLink +
+		"')\" title=" +
+		gLocal.gui.copy_to_clipboard +
+		">";
+	output +=
+		'<svg style="fill: var(--link-color);" t="1601480724259" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4644"><path d="M791.272727 93.090909H139.636364v837.818182a93.090909 93.090909 0 0 1-93.090909-93.090909V93.090909a93.090909 93.090909 0 0 1 93.090909-93.090909h558.545454a93.090909 93.090909 0 0 1 93.090909 93.090909zM232.727273 186.181818h744.727272v837.818182H232.727273V186.181818z" p-id="4645"></path></svg>';
+	output += "</button>";
+
+	//在阅读器中打开
+	let reader_open_link = "";
+	if (_display_sbs == 0) {
+		//逐段模式
+		reader_open_link = "../reader/?view=para&book=" + abook + "&par=" + aparagraph;
+	} else {
+		//逐句模式
+		reader_open_link =
+			"../reader/?view=sent&book=" + abook + "&par=" + aparagraph + "&begin=" + iBegin + "&end=" + iEnd;
+	}
+	output +=
+		"<button class='icon_btn'  onclick=\"window.open('" +
+		reader_open_link +
+		"')\" target='_blank' title='" +
+		gLocal.gui.scan_in_reader +
+		"'>";
+	output +=
+		'<svg style="fill: var(--link-color);" t="1601482753387" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="22291"><path d="M703.730499 544.578527a191.730499 191.730499 0 0 1 156.260356 302.806368l122.004508 122.004507a31.955083 31.955083 0 0 1-45.248398 45.184488l-121.940597-121.940598A191.730499 191.730499 0 1 1 703.730499 544.642437z m-6.391017-511.28133c38.857381 0 70.301183 30.67688 70.301183 68.511698v386.912146a255.640665 255.640665 0 1 0-69.022979 503.16474l-563.687667 0.06391c-38.857381 0-70.301183-30.67688-70.301183-68.447788V101.808895C64.628836 63.910166 96.072638 33.233286 134.930019 33.233286h562.409463z m6.391017 575.191496a127.820333 127.820333 0 1 0 0 255.640665 127.820333 127.820333 0 0 0 0-255.640665z m-351.505915 0h-127.820332a31.955083 31.955083 0 0 0-5.751915 63.398885l5.751915 0.511281h127.820332a31.955083 31.955083 0 0 0 0-63.910166z m0-191.730499h-127.820332a31.955083 31.955083 0 0 0-5.751915 63.398885l5.751915 0.511282h127.820332a31.955083 31.955083 0 0 0 0-63.910167z m191.730499-191.730499h-319.550831a31.955083 31.955083 0 0 0-5.751915 63.398885l5.751915 0.511282h319.550831a31.955083 31.955083 0 0 0 0-63.910167z" p-id="22292"></path></svg>';
+	output += "</button>";
+
+	//关系图
+	output +=
+		"<button class='icon_btn' title='" +
+		gLocal.gui.relational_map +
+		"' class='rel_map' onclick=\"sent_show_rel_map('" +
+		abook +
+		"','" +
+		aparagraph +
+		"','" +
+		iBegin +
+		"','" +
+		iEnd +
+		"')\">" +
+		'<svg style="transform: rotate(-90deg); fill: var(--link-color);" t="1601482033694" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="18290"><path d="M903.3 650.8H791.9V511.3H540.5V399.9h167.7c30.9 0 55.9-25.5 55.9-56.4V120.3c0-31.3-25.1-56.4-55.9-56.4H316.4c-30.9 0-55.5 25.1-55.5 56.4 0 0 0 222.8-0.4 223.2 0 31.3 25.1 56.4 55.9 56.4h168.2v111.4H232.8v139.6H120.9c-30.9-0.1-55.9 25-55.9 55.9v196.4c0 30.4 25.1 55.5 55.9 55.9h279.6c30.9 0 55.9-25.1 55.9-55.9V706.8c0-30.9-25.1-55.9-55.9-55.9H288.7v-83.7H736v83.7H624.2c-30.9 0-55.9 25.1-55.9 55.9v196.4c0 30.9 25.1 55.9 55.9 55.9h279.1c30.9 0 55.9-25.1 55.9-55.9V706.8c0-30.9-25-56-55.9-56z" p-id="18291"></path></svg>' +
+		"</button>";
+
+	//拷贝词意到剪贴板
+	output +=
+		"<button class='icon_btn' title='" +
+		gLocal.gui.form_sent +
+		"' class='rel_map' onclick=\"sent_copy_meaning('" +
+		abook +
+		"','" +
+		aparagraph +
+		"','" +
+		iBegin +
+		"','" +
+		iEnd +
+		"')\">" +
+		'<svg style="fill: var(--link-color);" t="1611985739555" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="6173" width="200" height="200"><path d="M423.198 640a83.84 83.84 0 0 1-64-28.8 259.84 259.84 0 0 1-26.88-308.48L441.118 128a261.12 261.12 0 1 1 448 272l-35.2 57.6a83.84 83.84 0 1 1-145.92-90.24l35.2-57.6a92.8 92.8 0 0 0-158.72-96.64l-107.52 176.64a92.8 92.8 0 0 0 9.6 109.44 83.84 83.84 0 0 1-64 139.52z" p-id="6174"></path><path d="M357.918 1024a261.12 261.12 0 0 1-222.72-397.44l31.36-50.56a83.84 83.84 0 1 1 144 87.68l-31.36 51.2a92.8 92.8 0 0 0 30.72 128 91.52 91.52 0 0 0 70.4 10.88 92.16 92.16 0 0 0 57.6-41.6l107.52-177.92a93.44 93.44 0 0 0-6.4-105.6 83.84 83.84 0 1 1 134.4-103.68 262.4 262.4 0 0 1 17.28 296.96L581.278 896a259.84 259.84 0 0 1-163.84 120.32 263.68 263.68 0 0 1-59.52 7.68z" p-id="6175"></path></svg>' +
+		"</button>";
+
+	//功能按钮结束
+	output += "</div>";
+	output += "<guide gid='sent_func' style='margin:unset;'></guide>";
+	output += "</span>";
+	output += "<span style='flex: 3;'><guide gid='sent_trans' style='margin-left:100%;'></guide></span>";
+	output += "</div>";
+	return output;
+}
+function renderWordBlock(element) {
+	let output = "";
+	let Note_Mark = 0;
+	let wID = getNodeText(element, "id");
+	let wPali = getNodeText(element, "pali");
+	let wReal = getNodeText(element, "real");
+	let wType = getNodeText(element, "type");
+	let wGramma = getNodeText(element, "gramma");
+	let wCase = getNodeText(element, "case");
+	let wUn = getNodeText(element, "un");
+	if ((wType == "" || wType == "?") && wCase != "") {
+		wType = wCase.split("#")[0];
+	}
+
+	//渲染单词块
+	//word div class
+	let wordclass;
+	let strMouseEvent = ' onmouseover="on_word_mouse_enter()" onmouseout="on_word_mouse_leave()"';
+	if (wType == ".ctl." && wGramma == ".a.") {
+		wordclass = "ctrl";
+	} else if (Note_Mark == 1) {
+		wordclass = "word org_note";
+	} else {
+		if (wReal == "") {
+			wordclass = "word word_punc un_parent "; //符號
+		} else {
+			if (wType == ".un.") {
+				wordclass = "word un_parent"; //粘音詞
+			} else if (wType == ".comp.") {
+				wordclass = "word comp_parent"; //複合詞
+			} else {
+				wordclass = "word"; //普通
+			}
+		}
+	}
+	output += '<div id="wb' + wID + "\" class='" + wordclass + "'> <a name='" + wPali + "'></a>";
+	//head div class
+	output += "	<div id='ws_" + wID + "' class='word_head_shell' >";
+	let wordheadclass;
+	if (wUn.length > 0) {
+		wordheadclass = "word_head un_pali";
+	} else {
+		wordheadclass = "word_head";
+	}
+	output += "	<div class='" + wordheadclass + "' id=\"whead_" + wID + '">';
+	output += renderWordHeadInner(element);
+	output += "	</div>";
+	output += "	</div>"; //word_head_shell
+	output += '	<div id="detail' + wID + '" class="wbody">';
+	output += renderWordBodyInner(element);
+	output += "	</div>";
+
+	output += "</div>";
+	return output;
+}
+var arr_par_sent_num = new Array();
+var g_arr_Para_ID = new Array();
+function renderWordParBlockInner(elementBlock) {
+	var output = "<div style='display:block;width:100%'>";
+	var Note_Mark = 0;
+	var sent_num = 0;
+
+	var arr_Para_ID = new Array();
+	let xmlParInfo = elementBlock.getElementsByTagName("info")[0];
+	let book = getNodeText(xmlParInfo, "book");
+	let paragraph = getNodeText(xmlParInfo, "paragraph");
+	let par_num = paragraph - 1;
+	let allWord = elementBlock.getElementsByTagName("word");
+	output += "<div class='sent_wbw_trans'>";
+	output += render_sent_tool_bar(elementBlock, 0);
+	output += "<div class='sent_wbw'>";
+
+	let sent_begin = 0;
+	let wID;
+	let word_id;
+	for (let iWord = 0; iWord < allWord.length; iWord++) {
+		wID = getNodeText(allWord[iWord], "id");
+		let wPali = getNodeText(allWord[iWord], "pali");
+		let wReal = getNodeText(allWord[iWord], "real");
+		let wType = getNodeText(allWord[iWord], "type");
+		let wGramma = getNodeText(allWord[iWord], "gramma");
+		let wCase = getNodeText(allWord[iWord], "case");
+		let wUn = getNodeText(allWord[iWord], "un");
+		let wEnter = getNodeText(allWord[iWord], "enter");
+		if ((wType == "" || wType == "?") && wCase != "") {
+			wType = wCase.split("#")[0];
+		}
+
+		//渲染单词块
+		output += renderWordBlock(allWord[iWord]);
+		/*
+		//word div class
+		let wordclass;
+		let strMouseEvent = ' onmouseover="on_word_mouse_enter()" onmouseout="on_word_mouse_leave()"';
+		if (wType == ".ctl." && wGramma == ".a.") {
+			wordclass = "ctrl";
+		} else if (Note_Mark == 1) {
+			wordclass = "word org_note";
+		} else {
+			if (wReal == "") {
+				wordclass = "word word_punc un_parent "; //符號
+			} else {
+				if (wType == ".un.") {
+					wordclass = "word un_parent"; //粘音詞
+				} else if (wType == ".comp.") {
+					wordclass = "word comp_parent"; //複合詞
+				} else {
+					wordclass = "word"; //普通
+				}
+			}
+		}
+		output += '<div id="wb' + wID + "\" class='" + wordclass + "'> <a name='" + wPali + "'></a>";
+		//head div class
+		output += "	<div id='ws_" + wID + "' class='word_head_shell' >";
+		let wordheadclass;
+		if (wUn.length > 0) {
+			wordheadclass = "word_head un_pali";
+		} else {
+			wordheadclass = "word_head";
+		}
+		output += "	<div class='" + wordheadclass + "' id=\"whead_" + wID + '">';
+		output += renderWordHeadInner(allWord[iWord]);
+		output += "	</div>";
+		output += "	</div>"; //word_head_shell
+		output += '	<div id="detail' + wID + '" class="wbody">';
+		output += renderWordBodyInner(allWord[iWord]);
+		output += "	</div>";
+
+		output += "</div>";
+*/
+		//渲染单词块结束
+
+		word_id = parseInt(wID.split("-")[2]);
+		if (sent_begin == 0) {
+			sent_begin = word_id;
+		}
+
+		if (iWord >= 1) {
+			var pre_pali_spell = getNodeText(allWord[iWord - 1], "pali");
+			var pre_pali_type = getNodeText(allWord[iWord - 1], "type");
+			var pre_pali_Gramma = getNodeText(allWord[iWord - 1], "gramma");
+			var pre_pali_Case = getNodeText(allWord[iWord - 1], "case");
+			if (pre_pali_type == "" && pre_pali_Case != "") {
+				pre_pali_type = pre_pali_Case.split("#")[0];
+			}
+			if (pre_pali_Case != "" && pre_pali_Case.lastIndexOf("$") != -1) {
+				var pre_case_array = pre_pali_Case.split("$");
+				pre_pali_Case = pre_case_array[pre_case_array.length - 1];
+			}
+		}
+		if (iWord + 2 <= allWord.length) {
+			var next_pali_spell = getNodeText(allWord[iWord + 1], "pali");
+			var next_pali_type = getNodeText(allWord[iWord + 1], "type");
+			var next_pali_Gramma = getNodeText(allWord[iWord + 1], "gramma");
+			var next_pali_Case = getNodeText(allWord[iWord + 1], "case");
+			if (next_pali_type == "" && next_pali_Case != "") {
+				next_pali_type = next_pali_Case.split("#")[0];
+			}
+			if (next_pali_Case != "" && next_pali_Case.lastIndexOf("$") != -1) {
+				var next_case_array = next_pali_Case.split("$");
+				next_pali_Case = next_case_array[next_case_array.length - 1];
+			}
+		}
+		if (next_pali_spell == "(" || wPali == "(") {
+			Note_Mark = 1;
+		} else if ((pre_pali_spell == ")" || wPali == ")") && Note_Mark == 1) {
+			Note_Mark = 0;
+		} else {
+		}
+		/*
+		if (next_pali_spell == "[" || curr_pali_spell == "[") {
+			Note_Mark2 = 1;
+		} else if ((pre_pali_spell == "]" || curr_pali_spell == "]") && Note_Mark2 == 1) {
+			Note_Mark2 = 0;
+		} else {
+		}*/
+
+		if (wEnter == 1) {
+			//句子末尾
+			var sent_ID = "sent_" + par_num + "_" + sent_num;
+			if (_display_sbs == 1) {
+				//逐句显示模式
+				output += "</div>"; //逐句逐词译块结束
+
+				//逐句翻译块开始
+				output += "<div id='sent_div_" + wID + "' class='translate_sent'>";
+				output += "<div class='translate_sent_head'>";
+				output += "<div class='translate_sent_head_toolbar' style='display:none;'>";
+				output += "<span></span>";
+				output +=
+					"<span onclick=\"show_tran_net('" +
+					book +
+					"','" +
+					paragraph +
+					"','" +
+					sent_begin +
+					"','" +
+					word_id +
+					"')\"><span id='' class=\"word_msg\">issue</span></span>";
+				//
+				output += "</div>";
+
+				output += "<div class='translate_sent_head_content'>";
+				//句子预览
+				output += render_tran_sent_block(book, paragraph, sent_begin, word_id, 0, true);
+				if (_my_channal != null) {
+					for (const iterator of _my_channal) {
+						if (iterator.status > 0) {
+							let readonly;
+							if (iterator.power > 0 && iterator.power < 20) {
+								readonly = true;
+							} else {
+								readonly = false;
+							}
+							output += render_tran_sent_block(
+								book,
+								paragraph,
+								sent_begin,
+								word_id,
+								iterator.uid,
+								readonly
+							);
+						}
+					}
+				}
+				//句子预览结束
+				output += "</div>";
+
+				output +=
+					"<div class='trans_text_content'  pcds='sent-net' book='" +
+					book +
+					"' para='" +
+					paragraph +
+					"' begin='" +
+					sent_begin +
+					"' end=''>";
+				output += "</div>";
+
+				output += "<div id='sent_" + wID + "' class='translate_sent_content'>";
+				output += "</div>";
+				output += "</div>";
+				output += "</div>";
+
+				//逐句翻译块内容结束
+				output += "<div class='translate_sent_foot'>";
+				output += "</div>";
+				//output += "</div>";
+				//逐句翻译块结束
+
+				output += "</div>"; //逐句块结束
+
+				sent_begin = word_id + 1;
+				//下一个逐句块开始
+				output += "<div class='sent_wbw_trans'>";
+				//output += output += render_sent_tool_bar(elementBlock,word_id);
+				let nextBegin = word_id + 1;
+				let nextEnd = 0;
+				for (let j = iWord + 1; j < allWord.length; j++) {
+					let aID = getNodeText(allWord[j], "id");
+					let aEnter = getNodeText(allWord[j], "enter");
+					let arrId = aID.split("-");
+					iWordId = parseInt(arrId[2]);
+					if (aEnter == 1) {
+						nextEnd = iWordId;
+						break;
+					}
+				}
+				if (nextEnd == 0) {
+					nextEnd = iWordId;
+				}
+
+				output += "<div class='sent_wbw_trans_bar'>";
+				let sentIdString = book + "-" + paragraph + "-" + nextBegin + "-" + nextEnd;
+				let sentIdStringLink = "{{" + sentIdString + "}}";
+				output +=
+					"<span style='flex: 7;display: flex;'><div style='background-color: silver;'><span style='font-size: large; font-weight: bolder;' title=" +
+					gLocal.gui.text_num +
+					">" +
+					sentIdString +
+					"</span><button class='icon_btn' onclick=\"copy_to_clipboard('" +
+					sentIdStringLink +
+					"')\" title=" +
+					gLocal.gui.copy_to_clipboard +
+					">";
+				output +=
+					'<svg style="fill: var(--link-color);" t="1601480724259" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4644"><path d="M791.272727 93.090909H139.636364v837.818182a93.090909 93.090909 0 0 1-93.090909-93.090909V93.090909a93.090909 93.090909 0 0 1 93.090909-93.090909h558.545454a93.090909 93.090909 0 0 1 93.090909 93.090909zM232.727273 186.181818h744.727272v837.818182H232.727273V186.181818z" p-id="4645"></path></svg>';
+				output += "</button>";
+				output +=
+					"<button class='icon_btn'  onclick=\"window.open('../reader/?view=sent&book=" +
+					book +
+					"&par=" +
+					paragraph +
+					"&begin=" +
+					nextBegin +
+					"&end=" +
+					nextEnd +
+					"')\" target='_blank' title='" +
+					gLocal.gui.scan_in_reader +
+					"'>";
+
+				output +=
+					'<svg style="fill: var(--link-color);" t="1601482753387" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="22291"><path d="M703.730499 544.578527a191.730499 191.730499 0 0 1 156.260356 302.806368l122.004508 122.004507a31.955083 31.955083 0 0 1-45.248398 45.184488l-121.940597-121.940598A191.730499 191.730499 0 1 1 703.730499 544.642437z m-6.391017-511.28133c38.857381 0 70.301183 30.67688 70.301183 68.511698v386.912146a255.640665 255.640665 0 1 0-69.022979 503.16474l-563.687667 0.06391c-38.857381 0-70.301183-30.67688-70.301183-68.447788V101.808895C64.628836 63.910166 96.072638 33.233286 134.930019 33.233286h562.409463z m6.391017 575.191496a127.820333 127.820333 0 1 0 0 255.640665 127.820333 127.820333 0 0 0 0-255.640665z m-351.505915 0h-127.820332a31.955083 31.955083 0 0 0-5.751915 63.398885l5.751915 0.511281h127.820332a31.955083 31.955083 0 0 0 0-63.910166z m0-191.730499h-127.820332a31.955083 31.955083 0 0 0-5.751915 63.398885l5.751915 0.511282h127.820332a31.955083 31.955083 0 0 0 0-63.910167z m191.730499-191.730499h-319.550831a31.955083 31.955083 0 0 0-5.751915 63.398885l5.751915 0.511282h319.550831a31.955083 31.955083 0 0 0 0-63.910167z" p-id="22292"></path></svg>';
+				output += "</button>";
+				output +=
+					"<button class='icon_btn' title='" +
+					gLocal.gui.relational_map +
+					"' class='rel_map' onclick=\"sent_show_rel_map('" +
+					book +
+					"','" +
+					paragraph +
+					"','" +
+					nextBegin +
+					"','" +
+					nextEnd +
+					"')\">" +
+					'<svg style="transform: rotate(-90deg); fill: var(--link-color);" t="1601482033694" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="18290"><path d="M903.3 650.8H791.9V511.3H540.5V399.9h167.7c30.9 0 55.9-25.5 55.9-56.4V120.3c0-31.3-25.1-56.4-55.9-56.4H316.4c-30.9 0-55.5 25.1-55.5 56.4 0 0 0 222.8-0.4 223.2 0 31.3 25.1 56.4 55.9 56.4h168.2v111.4H232.8v139.6H120.9c-30.9-0.1-55.9 25-55.9 55.9v196.4c0 30.4 25.1 55.5 55.9 55.9h279.6c30.9 0 55.9-25.1 55.9-55.9V706.8c0-30.9-25.1-55.9-55.9-55.9H288.7v-83.7H736v83.7H624.2c-30.9 0-55.9 25.1-55.9 55.9v196.4c0 30.9 25.1 55.9 55.9 55.9h279.1c30.9 0 55.9-25.1 55.9-55.9V706.8c0-30.9-25-56-55.9-56z" p-id="18291"></path></svg>' +
+					"</button>";
+				//拷贝词意到剪贴板
+				output +=
+					"<button class='icon_btn' title='" +
+					gLocal.gui.form_sent +
+					"' class='rel_map' onclick=\"sent_copy_meaning('" +
+					book +
+					"','" +
+					paragraph +
+					"','" +
+					nextBegin +
+					"','" +
+					nextEnd +
+					"')\">" +
+					'<svg style="fill: var(--link-color);" t="1611985739555" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="6173" width="200" height="200"><path d="M423.198 640a83.84 83.84 0 0 1-64-28.8 259.84 259.84 0 0 1-26.88-308.48L441.118 128a261.12 261.12 0 1 1 448 272l-35.2 57.6a83.84 83.84 0 1 1-145.92-90.24l35.2-57.6a92.8 92.8 0 0 0-158.72-96.64l-107.52 176.64a92.8 92.8 0 0 0 9.6 109.44 83.84 83.84 0 0 1-64 139.52z" p-id="6174"></path><path d="M357.918 1024a261.12 261.12 0 0 1-222.72-397.44l31.36-50.56a83.84 83.84 0 1 1 144 87.68l-31.36 51.2a92.8 92.8 0 0 0 30.72 128 91.52 91.52 0 0 0 70.4 10.88 92.16 92.16 0 0 0 57.6-41.6l107.52-177.92a93.44 93.44 0 0 0-6.4-105.6 83.84 83.84 0 1 1 134.4-103.68 262.4 262.4 0 0 1 17.28 296.96L581.278 896a259.84 259.84 0 0 1-163.84 120.32 263.68 263.68 0 0 1-59.52 7.68z" p-id="6175"></path></svg>' +
+					"</button>";
+
+				output += "</div>";
+				output += "<guide gid='sent_func' style='margin:unset;'></guide>";
+				output += "</span>";
+				output += "<span style='flex: 3;'><guide gid='sent_trans' style='margin-left:100%;'></guide></span>";
+				output += "</div>";
+
+				output += "<div class='sent_wbw'>";
+			}
+			sent_num += 1;
+			arr_Para_ID.push(wID);
+		}
+	} //循環結束
+
+	output += "</div>";
+
+	//逐句翻译块开始
+	output += "<div id='sent_div_" + wID + "' class='translate_sent'>";
+	output += "<div class='translate_sent_head'>";
+	output += "<div class='translate_sent_head_toolbar'>";
+	output += "<span></span>";
+	output +=
+		"<span onclick=\"show_tran_net('" +
+		book +
+		"','" +
+		paragraph +
+		"','" +
+		sent_begin +
+		"','" +
+		word_id +
+		"')\"><span id='' class=\"word_msg\">issue</span></span>";
+	output += "</div>";
+	output += "<div class='translate_sent_head_content'>";
+
+	//逐句译文开始
+	output += render_tran_sent_block(book, paragraph, sent_begin, word_id, 0, true);
+	if (_my_channal != null) {
+		for (const iterator of _my_channal) {
+			if (iterator.status > 0) {
+				let readonly;
+				if (iterator.power > 0 && iterator.power < 20) {
+					readonly = true;
+				} else {
+					readonly = false;
+				}
+				output += render_tran_sent_block(book, paragraph, sent_begin, word_id, iterator.uid, readonly);
+			}
+		}
+	}
+
+	output += "</div>";
+	output += "<div id='sent_" + wID + "' class='translate_sent_content'>";
+	output += "</div>";
+	//逐句翻译块内容结束
+
+	output += "<div class='translate_sent_foot'>";
+	output += "</div>";
+	output += "</div>";
+	//逐句翻译块结束
+
+	output += "</div>";
+
+	var sent_ID = "sent_" + par_num + "_" + sent_num;
+	arr_Para_ID.push(wID);
+	arr_par_sent_num.push(sent_ID);
+	g_arr_Para_ID[par_num] = arr_Para_ID;
+	return output;
+}
+//根据relation 绘制关系图
+function sent_copy_meaning(book, para, begin, end) {
+	let wordId = 0;
+
+	let output = "";
+	for (wordId = parseInt(begin); wordId <= parseInt(end); wordId++) {
+		output += doc_word("#p" + book + "-" + para + "-" + wordId).val("mean");
+	}
+	copy_to_clipboard(output);
+}
+
+var relaSearchDeep=0;
+function relaMoveSubgraph(seed,from,to){
+	let iFound = 0;
+	//查找与种子相连接的节点
+	from.forEach(function(item,index,arr){
+		if(relaSearchDeep==0){
+			if( item.bid==seed){
+				to.push(item);
+				arr.splice(index,1);
+				iFound++;
+			}
+			//删除连接到iti的线
+			/*
+			if( item.aid==seed && item.b=='iti'){
+				arr.splice(index,1);
+			}
+			*/
+		}
+		else{
+			if(item.aid==seed || item.bid==seed){
+				to.push(item);
+				arr.splice(index,1);
+				iFound++;
+			}
+		}
+	})
+	if(iFound>0){
+		//找到了继续查找
+		to.forEach(function(item,index,arr){
+			relaSearchDeep++;
+			relaMoveSubgraph(item.aid,from,to);
+		})		
+	}
+	relaSearchDeep--;
+
+}
+//根据relation 绘制关系图
+function sent_show_rel_map(book, para, begin, end) {
+	let memind = "graph LR\n";
+	let pali_text = "";
+	let rListA = new Array();
+	
+	let rListPool = new Array();
+	let arrIti = new Array();
+
+	let idList = new Array();
+	$("#wbp" + book + "-" + para + "-" + begin)
+		.parent()
+		.children(".word")
+		.each(function (index, element) {
+			idList.push(this.id.slice(3));
+		});
+
+	for (const iterator_wid of idList) {
+		let rel = doc_word("#p" + iterator_wid).val("rela");
+		let pali = doc_word("#p" + iterator_wid).val("pali");
+		let real = doc_word("#p" + iterator_wid).val("real");
+		let type = doc_word("#p" + iterator_wid).val("type");
+
+		let meaning = doc_word("#p" + iterator_wid).val("mean");
+
+		if (type != ".ctl.") {
+			pali_text += pali + " ";
+		}
+		if (rel != "") {
+			let relaData = JSON.parse(rel);
+			let language = getCookie("language");
+			for (const iterator of relaData) {
+				let strRel = iterator.relation;
+				let relation_locstr = "";
+				for (let x in list_relation) {
+					if (list_relation[x].id == strRel && language == list_relation[x].language) {
+						relation_locstr = list_relation[x].note;
+						break;
+					}
+				}
+
+				let dest = iterator.dest_spell;
+				let type = doc_word("#p" + iterator.dest_id).val("case");
+				let meanDest = doc_word("#p" + iterator.dest_id).val("mean");
+
+				if (type.indexOf(".v.") >= 0) {
+					dest = iterator.dest_id + '(("' + dest + "<br>" + meanDest + '"))';
+				} else {
+					dest = iterator.dest_id + '["' + dest + "<br>" + meanDest + '"]';
+				}
+
+				if(iterator.dest_spell=="iti"){
+					arrIti.push({id:"p"+iterator_wid,dest_id:iterator.dest_id});
+				}
+				memind =
+					"p" +
+					iterator_wid +
+					'("' +
+					real +
+					"<br>" +
+					meaning +
+					'")--"' +
+					strRel +
+					"<br>" +
+					relation_locstr +
+					'" --> ' +
+					dest +
+					"\n";
+
+				rListA.push({a:real,aid:"p"+iterator_wid,b:iterator.dest_spell,bid:iterator.dest_id,str:memind});
+			}
+		}
+	}
+
+	let subgraphTitle = 1;
+	rListPool.push({id:0,value:rListA,parent:-1});
+
+	//倒序处理,能够处理iti嵌套
+	for (let index = arrIti.length-1; index >=0; index--) {
+		const element = arrIti[index];
+		let rListB = new Array();
+		for (let iPool = 0; iPool < rListPool.length; iPool++) {
+			;
+			relaSearchDeep = 0;
+			relaMoveSubgraph(element.id,rListPool[iPool].value,rListB);
+			if(rListB.length>0){
+				rListPool.push({id:subgraphTitle++,value:rListB,parent:rListPool[iPool].id});
+				console.log("找到:",element.id);
+				break;
+			}
+		}
+	}
+
+
+	memind = "flowchart LR\n";
+	for (const iterator of rListA) {
+		memind +=iterator.str;
+	}
+	//渲染subgraph
+	rListPool.forEach(function(item,index,arr){
+		if(item.parent==0){
+			memind += renderRelationSubgraph(rListPool,index);
+		}
+	});
+
+	let graph = mermaid.render("graphDiv", memind);
+	document.querySelector("#term_body_parent").innerHTML = '<div class="win_body_inner" id="term_body"></div>'; //清空之前的记录
+	document.querySelector("#term_body").outerHTML =
+		"<h3 style='padding: 0 1em;'>" + pali_text + "</h3>" + document.querySelector("#term_body").outerHTML;
+	document.querySelector("#term_body").innerHTML = graph;
+	document.querySelector("#term_win").style.display = "flex";
+	document.querySelector(".win_body").style.display = "block";
+}
+
+//用递归渲染,subgraph嵌套
+function renderRelationSubgraph(arrData,index){
+	let output = "";
+	output += "\nsubgraph "+arrData[index].id+"\n";
+	for (const rb of arrData[index].value) {
+		output +=rb.str;
+	}	
+
+	arrData.forEach(function(item,indexSub,arr){
+		if(item.parent==arrData[index].id){
+			output += renderRelationSubgraph(arrData,indexSub);
+		}
+	});
+	output += "end\n";
+	//output += subgraphTitle + " --> " + element.dest_id+ "\n";
+	return output;
+}
+
+//句子编辑块
+function render_tran_sent_block(book, para, begin, end, channal = 0, readonly = true) {
+	let usent_count = _user_sent_buffer.getSentNum(book, para, begin, end);
+	let netSent = doc_msg_get_trans(book, para, begin, end);
+	let sender = "";
+	let sChannalName = "";
+	let sent_text = "";
+	let sent_lang = "en";
+	let objSent = {
+                text:"",
+                language:"en",
+                id:"",
+                tag:"[]",
+                author:"{}"
+            };
+	let thischannal;
+	let shell_class = "";
+	if (channal == 0) {
+		//百家言
+		shell_class += " channel_0";
+		if (netSent.length > 0) {
+			sender = netSent[netSent.length - 1].sender;
+			sent_text += netSent[netSent.length - 1].data.text;
+		} else if (usent_count > 0) {
+			sender = _user_sent_buffer.getSentText(book, para, begin, end)[0].nickname;
+			sChannalName = "channal name";
+			sent_text += _user_sent_buffer.getSentText(book, para, begin, end)[0].text;
+		}
+	} else {
+		sender = "通道的名字";
+		shell_class += " mychannel";
+		objSent = _user_sent_buffer.getSentText(book, para, begin, end, channal);
+		thischannal = channal_getById(channal);
+		if (objSent == false) {
+			objSent = {
+                text:"",
+                language:thischannal.lang,
+                id:"",
+                tag:"[]",
+                author:"{}"
+            };
+			sent_text = "";
+		} else {
+			sent_text = objSent.text;
+		}
+		sent_lang = objSent.language;
+	}
+
+	let output = "";
+
+	if (readonly == true) {
+		shell_class += " readonly";
+	}
+
+	output += "<div class='trans_text_block " + shell_class + "' channel_id='" + channal + "'>";
+	output += "<div class='trans_text_info' >";
+
+	if (channal == 0) {
+		output += "<span class='author'>" + sender + "</span>";
+	} else {
+		output += "<span style='width: 100%;display: contents;'>";
+		output += "<span>";
+
+		if (thischannal) {
+			output += "<b>" + thischannal.name + "</b>@";
+			if (parseInt(thischannal.power) >= 30) {
+				output += gLocal.gui.your;
+			} else {
+				output += thischannal.nickname;
+			}
+		} else {
+			output += "未知的频道名";
+		}
+		output += "-[" + thischannal.lang + "]";
+		output += "</span>";
+		output +=
+			"<span style='margin-left: auto;' class='send_status' id='send_" +
+			book +
+			"_" +
+			para +
+			"_" +
+			begin +
+			"_" +
+			end +
+			"_" +
+			channal +
+			"'></span>";
+	}
+	output += "</span><span></span>";
+	output += "</div>";
+	let id = "tran_pre_" + book + "_" + para + "_" + begin + "_" + end + "_" + channal;
+	output += "<div class='trans_text_content' tid = '" + id;
+	if (channal == 0) {
+		output += "'  pcds='sent-net-all' ";
+	} else {
+		output += "'  pcds='sent-net' ";
+	}
+
+	output +=
+		" book='" + book + "' para='" + para + "' begin='" + begin + "' end='" + end + "' channal='" + channal + "'>";
+	if (readonly) {
+		output += note_init(term_std_str_to_tran(sent_text, channal, getCookie("userid"), sent_lang));
+	} else {
+		output += "<span id='" + id + "' ";
+		output += "onclick=\"sent_edit_click('";
+		output += book + "','" + para + "','" + begin + "','" + end + "','" + channal + "',)\">";
+        if(typeof objSent !== 'undefined'){
+            if (objSent.text == null || objSent.text == "") {
+                output += "<span style='color:gray;'>";
+                output += "<svg class='icon' style='fill: var(--detail-color);'>";
+                output += "<use xlink='http://www.w3.org/1999/xlink' href='svg/icon.svg#ic_mode_edit'>";
+                output += "</span>";
+            } else {
+                output += note_init(term_std_str_to_tran(objSent.text, channal, getCookie("userid"), sent_lang));
+            }            
+        }
+
+
+		output += "</span>";
+	}
+
+	output += "</div>";
+	//句子预览结束
+	//编辑框开始
+	if (readonly == false) {
+		output += "<div style='display:none;'>";
+		let id = book + "_" + para + "_" + begin + "_" + end + "_" + channal;
+		output += "<textarea id='trans_sent_edit_" + id + "' ";
+		output += " onkeyup = \"updateTranslationPreview('" + id + "',this)\" ";
+		output +=
+			" onchange=\"trans_text_save('" +
+			book +
+			"','" +
+			para +
+			"','" +
+			begin +
+			"','" +
+			end +
+			"','" +
+			channal +
+			"')\"";
+		output += "class='trans_sent_edit' style='background-color: #f8f8fa;color: black;border-color: silver;' ";
+		output += "sent_id='" + objSent.id + "' ";
+		output += "book='" + book + "'  para='" + para + "'  begin='" + begin + "'  end='" + end + "' ";
+		output +=
+			" channal='" +
+			channal +
+			"'  author='" +
+			objSent.author +
+			"'  lang='" +
+			objSent.language +
+			"'  tag='" +
+			objSent.tag +
+			"' >";
+		output += objSent.text;
+		output += "</textarea>";
+		output += "<div class='trans_text_info' style='justify-content: flex-end;'>";
+		output += "<span></span>";
+		output += "<button class='icon_btn' ";
+		output +=
+			"onclick=\"trans_text_save('" +
+			book +
+			"','" +
+			para +
+			"','" +
+			begin +
+			"','" +
+			end +
+			"','" +
+			channal +
+			"')\" ";
+		output +=
+			"title=" +
+			gLocal.gui.draft +
+			">" +
+			'<svg class="icon" style="fill: var(--link-color); height: 2em; width: 2em;"><use xlink:href="svg/icon.svg#ic_save"></use></svg>';
+		output += "</button>";
+		output += "<button class='icon_btn' ";
+		output +=
+			"onclick=\"trans_text_send('" +
+			book +
+			"','" +
+			para +
+			"','" +
+			begin +
+			"','" +
+			end +
+			"','" +
+			channal +
+			"')\"";
+		output +=
+			" title=" +
+			gLocal.gui.send +
+			" disabled>" +
+			'<svg class="icon" style="fill: var(--link-color); height: 2em; width: 2em;"><use xlink:href="svg/icon.svg#send_by_paper_plane"></use></svg>';
+		output += "</button>";
+
+		output += "</div>";
+		output += "</div>";
+	}
+
+	if (readonly) {
+		output += "<div class='trans_text_info'>" + "<span></span>" + "<span><span class='tools'>";
+
+		output +=
+			"<button class='icon_btn' title=" +
+			gLocal.gui.accept_copy +
+			">" +
+			"<svg class='icon' style='fill: var(--link-color); height: 2em; width: 2em; '><use xlink='http://www.w3.org/1999/xlink' href='svg/icon.svg#ic_move_to_inbox'></use></svg>" +
+			"</button>";
+
+		if (channal == 0) {
+			//百家言 显示更多按钮
+			output +=
+				"<button class='icon_btn' onclick=\"show_tran_net('" +
+				book +
+				"','" +
+				para +
+				"','" +
+				begin +
+				"','" +
+				end +
+				"')\" title=" +
+				gLocal.gui.message +
+				">" +
+				'<svg class="icon" style="fill: var(--link-color); height: 2em; width: 2em;"><use xlink:href="plugin/system_message/icon.svg#icon_message"></use></svg>' +
+				"</button>";
+		}
+
+		output += "</span><span>" + usent_count + "</span></span>";
+		output += "</div>";
+	}
+	output += "</div>";
+	return output;
+}
+
+function trans_text_save(book, para, begin, end, channal) {
+	let textarea = $("#trans_sent_edit_" + book + "_" + para + "_" + begin + "_" + end + "_" + channal);
+	if (textarea) {
+		let objsent = new Object();
+		objsent.id = textarea.attr("sent_id");
+		objsent.book = book;
+		objsent.paragraph = para;
+		objsent.begin = begin;
+		objsent.end = end;
+		objsent.channal = channal;
+		objsent.author = textarea.attr("author");
+		objsent.lang = textarea.attr("lang");
+		objsent.text = textarea.val();
+		_user_sent_buffer.setSent(objsent);
+	}
+}
+
+function sent_edit_click(book, para, begin, end, channal) {
+	$(".trans_sent_edit").parent().hide(200);
+	$(
+		".trans_sent_edit[book='" +
+			book +
+			"'][para='" +
+			para +
+			"'][begin='" +
+			begin +
+			"'][end='" +
+			end +
+			"'][channal='" +
+			channal +
+			"']"
+	)
+		.parent()
+		.show();
+		$(
+			".trans_sent_edit[book='" +
+				book +
+				"'][para='" +
+				para +
+				"'][begin='" +
+				begin +
+				"'][end='" +
+				end +
+				"'][channal='" +
+				channal +
+				"']"
+		).css({'height': 'auto'}).height($(
+			".trans_sent_edit[book='" +
+				book +
+				"'][para='" +
+				para +
+				"'][begin='" +
+				begin +
+				"'][end='" +
+				end +
+				"'][channal='" +
+				channal +
+				"']"
+		)[0].scrollHeight+"px");
+
+	}
+function magic_sentence_cut() {
+	var all_sent_array = document.getElementsByClassName("sent_wbw");
+	for (i_magic = 0; i_magic < all_sent_array.length; i_magic++) {
+		if (all_sent_array[i_magic].getElementsByClassName("word sent_gramma_1").length != 0) {
+			all_sent_array[i_magic].getElementsByClassName("word sent_gramma_1")[0].className += " sent_cut";
+		}
+		if (all_sent_array[i_magic].getElementsByClassName("word sent_gramma_2").length != 0) {
+			all_sent_array[i_magic].getElementsByClassName("word sent_gramma_2")[0].className += " sent_cut";
+		}
+	}
+}
+
+function updataWordHeadById(wordId) {
+	var xAllWord = gXmlBookDataBody.getElementsByTagName("word");
+	var iIndex = getWordIndex(wordId);
+	if (iIndex >= 0) {
+		$("#whead_" + wordId).html(renderWordHeadInner(xAllWord[iIndex]));
+	}
+}
+
+function updataWordHeadByIndex(wordIndex) {
+	if (wordIndex > 0) {
+		let xAllWord = gXmlBookDataBody.getElementsByTagName("word");
+		let wordId = getNodeText(xAllWord[wordIndex], "id");
+		let obj = document.getElementById("whead_" + wordId);
+		if (obj) {
+			obj.innerHTML = renderWordHeadInner(xAllWord[wordIndex]);
+		}
+	}
+}
+function updateWordBodyById(wordId) {
+	var xAllWord = gXmlBookDataBody.getElementsByTagName("word");
+	var wordIndex = getWordIndex(wordId);
+	var obj = document.getElementById("detail" + wordId);
+	if (obj) {
+		obj.innerHTML = renderWordBodyInner(xAllWord[wordIndex]);
+	}
+}
+//根据xmlDocument 对象中的单词序号修改单词块的显示(不含Pali)
+//返回 无
+function modifyWordDetailByWordIndex(wordIndex) {
+	xAllWord = gXmlBookDataBody.getElementsByTagName("word");
+	wordId = getNodeText(xAllWord[wordIndex], "id");
+	try {
+		var sDetail = "detail" + wordId;
+		var cDetail = document.getElementById(sDetail);
+		if (cDetail != null) {
+			cDetail.innerHTML = renderWordDetailByElement(xAllWord[wordIndex]);
+		}
+	} catch (error) {
+		debugOutput(error);
+	}
+}
+
+function renderWordHeadInner(element) {
+	var output = "";
+	var wid = getNodeText(element, "id");
+	var wpali = getNodeText(element, "pali");
+	var sParent = getNodeText(element, "parent");
+	var wId = getNodeText(element, "id");
+	var wNote = getNodeText(element, "note");
+
+	wStyle = "v_" + getNodeText(element, "style");
+	if (wStyle == "v_bld") {
+		if (wpali.indexOf("{") >= 0) {
+			wpali = wpali.replace("{", "<span class='v_bld'>");
+			wpali = wpali.replace("}", "</span>");
+			wStyle = "";
+		}
+	}
+	if (wNote.indexOf("{{") >= 0 && wNote.indexOf("}}") >= 0) {
+		wStyle += " note_ref";
+	}
+
+	if (wNote.substring(0, 6) == "=term(") {
+		wStyle += " term_word_head";
+	} else {
+		if (sParent.length > 0) {
+			if (term_lookup_my(sParent) != false) {
+				wStyle += " term_my";
+			} else {
+				if (term_lookup_all(sParent) != null) {
+					wStyle += " term_other";
+				}
+			}
+		}
+	}
+
+	var sign_count = 0;
+	var letter_count = 0;
+	for (i_sign in local_sign_str) {
+		if (wpali.lastIndexOf(local_sign_str[i_sign].id) != -1) {
+			sign_count += 1;
+		} //如果是标点或数字
+		else if (wpali.lastIndexOf(local_letter_str[i_sign].id) != -1) {
+			letter_count += 1;
+		} //如果有字母
+	}
+	if (sign_count != 0 && letter_count == 0) {
+		output += "<a name='w" + wId + "'>";
+	} else {
+		output += "<a name='w" + wId + "' onclick='on_word_click(\"" + wId + "\")'>";
+	}
+	if (wpali) output += '<span id="whead1_' + wid + '" class="whead paliword1 ' + wStyle + '">';
+	output += wpali;
+	output += "</span>";
+	output += "</a>";
+	if (wNote.length > 0) {
+		output += '<span id="wnote_root_' + wid + '" onclick="show_pop_note(\'' + wid + '\')"><wnh wid="' + wid + '">[1]</wnh></span>';
+	} else {
+		output += '<span id="wnote_root_' + wid + '" onclick="show_pop_note(\'' + wid + '\')"></span>';
+	}
+	var newMsg = msg_word_msg_num(wid);
+	if (newMsg > 0) {
+		output += "<span class='word_msg' onclick=\"word_msg_counter_click('" + wid + "')\">" + newMsg + "</span>";
+	}
+	output += '<span id="whead2_' + wid + '" class="whead paliword2 ' + wStyle + '">';
+	output += "</span>";
+	return output;
+}
+
+function renderWordBodyInner(element) {
+	return renderWordDetailByElement(element);
+}
+
+//新的渲染单词块函数
+function renderWordDetailByElement_edit_a(xmlElement) {
+	if (xmlElement == null) {
+		return "";
+	}
+	var wordNode = xmlElement;
+	var sPali = getNodeText(wordNode, "pali");
+	var sId = getNodeText(wordNode, "id");
+	var sReal = getNodeText(wordNode, "real");
+	var sMean = getNodeText(wordNode, "mean");
+	var sOrg = getNodeText(wordNode, "org");
+	var sOm = getNodeText(wordNode, "om");
+	var sCase = getNodeText(wordNode, "case");
+	var sType = getNodeText(wordNode, "type");
+	var sGramma = getNodeText(wordNode, "gramma");
+	var sParent = getNodeText(wordNode, "parent");
+	var sParentGrammar = getNodeText(wordNode, "pg");
+	var sParent2 = getNodeText(wordNode, "parent2");
+	var sNote = getNodeText(wordNode, "note");
+	var sStatus = getNodeText(wordNode, "status");
+	if (sStatus == "") {
+		sStatus = 0;
+	}
+	var wordID = sId;
+
+	if (sCase == "") {
+		sCase = sType + "#" + sGramma;
+	}
+
+	var _txtOutDetail = "";
+	var _bgColor = "";
+	var status_bg_color = "status_bg_color_" + sStatus;
+	var _caseColor = "";
+	//标点符号
+	if (sReal.length <= 1) {
+		_txtOutDetail += "<div>";
+		/*id begin*/
+		_txtOutDetail += "<div class='ID'> </div>";
+		/*mean begin*/
+		_txtOutDetail += "<div class='mean'> </div>";
+		/*org begin*/
+		_txtOutDetail += "<div class='org'> </div>";
+		/*org mean begin*/
+		_txtOutDetail += "<div class='om'> </div>";
+		/*case begin*/
+		_txtOutDetail += "<div class='case'> </div>";
+
+		_txtOutDetail += "</div>";
+		return _txtOutDetail;
+	}
+
+	var strBookMarkColor = getNodeText(wordNode, "bmc");
+	if (strBookMarkColor.length > 2) {
+		var icolor = strBookMarkColor.substr(-1);
+		_bgColor = " class='bookmarkcolor" + icolor + "' ";
+	}
+
+	// Auto Match Begin
+
+	if (sCase == "?" && _bgColor == "") {
+		_caseColor = " class='bookmarkcolorx' ";
+	}
+	if (g_useMode == "read" || g_useMode == "translate") {
+		_bgColor = "";
+		_caseColor = "";
+		if (sOrg == "?") {
+			sOrg = " ";
+		}
+		if (sMean == "?") {
+			sMean = " ";
+		}
+		if (sCase == "?" || sCase == "?#?") {
+			sCase = " ";
+		}
+	}
+
+	//编辑模式开始
+	{
+		/*gramma*/
+		/*find in dict*/
+		var arrGramma = new Array();
+		var thisWord = sReal;
+		for (iDict = 0; iDict < g_DictWordList.length; iDict++) {
+			if (thisWord == g_DictWordList[iDict].Pali) {
+				if (
+					(g_DictWordList[iDict].Type != "" && g_DictWordList[iDict].Type != "?") ||
+					(g_DictWordList[iDict].Gramma != "" && g_DictWordList[iDict].Gramma != "?")
+				) {
+					var arrCase = g_DictWordList[iDict].Type + "#" + g_DictWordList[iDict].Gramma;
+					pushNewToList(arrGramma, arrCase);
+				}
+			}
+		}
+
+		if (sCase == "?" || sCase == "?#?") {
+			if (arrGramma.length > 0) {
+				setNodeText(xmlElement, "case", arrGramma[0]);
+				sCase = arrGramma[0];
+			} else {
+				setNodeText(xmlElement, "case", "?#?");
+				sCase = "?#?";
+			}
+		} else {
+			if (sCase.indexOf("#") == -1) {
+				sCase = "?#" + sCase;
+				setNodeText(xmlElement, "case", "?#" + sCase);
+			}
+		}
+
+		var currType = sCase.split("#")[0];
+		var currGramma = sCase.split("#")[1];
+
+		//end gramma
+
+		if (getNodeText(wordNode, "lock") == "true") {
+			_bgColor += "  style='box-shadow: 0 3px 0 0 #FF0000'";
+		} else {
+			_bgColor += " class='bookmarkcolor0' style='box-shadow: 0 0 0 0'";
+		}
+
+		//状态颜色
+		_txtOutDetail += "<div class='" + status_bg_color + "'>";
+		//书签颜色
+		_txtOutDetail += "<div " + _bgColor + ">";
+
+		/*id begin*/
+		/*
+		_txtOutDetail +=  "<p class='ID'>";
+		_txtOutDetail +=  sId + "&nbsp;"; 
+		_txtOutDetail +=  "</p>"; 	
+		*/
+		/*id end*/
+
+		/*meaning*/
+
+		//格位公式开始
+		//去除格位公式
+		var currMeaning = removeFormula(sMean);
+		//currMeaning = getLocalFormulaStr(currGramma,currMeaning);
+
+		var orgMeaning = sMean;
+		//切割过长意思
+		if (sReal.length < 4) {
+			currMeaning = getLocalFormulaStr(currGramma, cutString(currMeaning, 24));
+		} else {
+			currMeaning = getLocalFormulaStr(currGramma, cutString(currMeaning, sReal.length * 6));
+		}
+
+		currMeaning = currMeaning.replace(/ /g, "&nbsp;");
+		renderMeaning = currMeaning.replace(/{/g, "<span class='grm_add_mean'>");
+		renderMeaning = renderMeaning.replace(/}/g, "</span>");
+		renderMeaning = renderMeaning.replace(/\[/g, "<span class='grm_add_mean_user'>");
+		renderMeaning = renderMeaning.replace(/\]/g, "</span>");
+		//格位公式结束
+		if (sMean.length == 0) {
+			renderMeaning = "<span class='word_space_holder'>"+gLocal.gui.meaning+"</span>";
+		}
+		//渲染下拉菜单
+		_txtOutDetail += "<div class='mean'>";
+		_txtOutDetail += '<div class="case_dropdown">';
+		_txtOutDetail += "<p class='case_dropbtn' >";
+		_txtOutDetail += renderMeaning;
+		_txtOutDetail += "</p>";
+		_txtOutDetail += "<div id='mean_" + wordID + '\' class="case_dropdown-content">';
+		_txtOutDetail += "</div>";
+		_txtOutDetail += "</div>";
+
+		//render formula menu
+
+		arrFormula = getFormulaList(currGramma);
+		_txtOutDetail += '<div class="case_dropdown">';
+		_txtOutDetail += "<svg class='edit_icon'><use xlink:href='svg/icon.svg#ic_more'></use></svg>";
+		_txtOutDetail += '<div class="case_dropdown-content">';
+		newWord = removeFormula_B(orgMeaning);
+		_txtOutDetail +=
+			"<a onclick='fieldListChanged(\"" +
+			wordID +
+			'","mean","[]' +
+			newWord +
+			"\")'>[" +
+			gLocal.gui.none +
+			"]</a>";
+		_txtOutDetail +=
+			"<a onclick='fieldListChanged(\"" + wordID + '","mean","' + newWord + "\")'>[" + gLocal.gui.auto + "]</a>";
+		for (var i in arrFormula) {
+			newWord = removeFormula_B(orgMeaning);
+			newWord = arrFormula[i].replace("~", newWord);
+			newWord = newWord.replace(/{/g, "[");
+			newWord = newWord.replace(/}/g, "]");
+			_txtOutDetail +=
+				"<a onclick='fieldListChanged(\"" + wordID + '","mean","' + newWord + "\")'>" + arrFormula[i] + "</a>";
+		}
+
+		_txtOutDetail += "</div>";
+		_txtOutDetail += "</div>";
+		_txtOutDetail += "</div> ";
+		/*end of meaning*/
+
+		/*org begin 拆分*/
+
+		_txtOutDetail += "<div class='org'  name='w_org'>";
+		_txtOutDetail += '<div class="case_dropdown">';
+		_txtOutDetail += "<p class='case_dropbtn' >";
+		let currOrg;
+		if (sOrg.length == 0) {
+			currOrg = "<span class='word_space_holder'>parts</span>";
+		} else {
+			currOrg = sOrg;
+		}
+		_txtOutDetail += currOrg;
+		_txtOutDetail += "</p>";
+		_txtOutDetail += '<div class="case_dropdown-content">';
+		_txtOutDetail += "<div id='parts_" + sId + "'>Loading</div>";
+		_txtOutDetail += "</div>";
+		_txtOutDetail += "</div>";
+		_txtOutDetail += "</div> ";
+		/*end of factors*/
+
+		/*part meaning begin*/
+
+		_txtOutDetail += "<div class='om'  name='w_om'>";
+		_txtOutDetail += '<div class="case_dropdown">';
+		_txtOutDetail += "<p class='case_dropbtn' >";
+		sOm = sOm.replace("_un_auto_factormean_", getLocalGrammaStr("_un_auto_factormean_"));
+
+		if (sOm == "?" || sOm.substring(0, 3) == "[a]") {
+			var currDefualtFM = "";
+			var listFactorForFactorMean = sOrg.split("+");
+			for (iFactor in listFactorForFactorMean) {
+				currDefualtFM += findFirstMeanInDict(listFactorForFactorMean[iFactor]) + "+"; //拆分元素加号分隔
+			}
+			currDefualtFM = currDefualtFM.replace(/"  "/g, " ");
+			currDefualtFM = currDefualtFM.replace(/"+ "/g, "+");
+			currDefualtFM = currDefualtFM.replace(/" +"/g, "+");
+			currDefualtFM = currDefualtFM.substring(0, currDefualtFM.length - 1); //去掉尾部的加号 kosalla
+			if (currDefualtFM.slice(-1, -2) == "+") {
+				currDefualtFM = currDefualtFM.substring(0, currDefualtFM.length - 1);
+			}
+			currOM = "[a]" + currDefualtFM;
+			setNodeText(wordNode, "om", currOM);
+		} else {
+			currOM = sOm;
+		}
+		if (currOM.length == 0) {
+			currOM = "<span class='word_space_holder''>"+gLocal.gui.partmeaning+"</span>";
+		}
+
+		_txtOutDetail += currOM;
+		_txtOutDetail += "</p>";
+		_txtOutDetail += '<div class="case_dropdown-content">';
+		_txtOutDetail += "<div id='partmean_" + sId + "'></div>";
+		_txtOutDetail += "</div>";
+		_txtOutDetail += "</div>";
+		_txtOutDetail += "</div> ";
+
+		/*org meaning end*/
+
+		/*begin gramma*/
+
+		_txtOutDetail += "<div class='case'>";
+		_txtOutDetail += '<div class="case_dropdown">';
+		_txtOutDetail += "<p class='case_dropbtn' >";
+		var sLocalCase = getLocalGrammaStr(sCase);
+		var mArrGramma = sCase.split("#");
+		if (mArrGramma.length >= 2) {
+			mType = mArrGramma[0];
+			mGramma = mArrGramma[1];
+			mLocalType = sLocalCase.split("#")[0];
+			mLocalGramma = sLocalCase.split("#")[1];
+		} else {
+			mType = "";
+			mGramma = mArrGramma[0];
+			mLocalType = "";
+			mLocalGramma = sLocalCase.split("#")[0];
+		}
+
+		if (mType != "") {
+			_txtOutDetail += "<span class='cell'>" + mLocalType + "</span>";
+		}
+
+		_txtOutDetail += cutString(mLocalGramma, 30);
+		if (mLocalType.length + mLocalGramma.length == 0) {
+			_txtOutDetail += "&nbsp;";
+		}
+		_txtOutDetail += "</p>";
+		_txtOutDetail += '<div class="case_dropdown-content">';
+		_txtOutDetail += "<div id='gramma_" + sId + "'></div>";
+		_txtOutDetail += "</div>";
+		_txtOutDetail += "</div>";
+
+		if(sParentGrammar && sParentGrammar!="" && sParentGrammar!=" "){
+			_txtOutDetail += "<span class='cell' style='outline: unset;background-color: wheat;' title='"+sParent2+"'>" + getLocalGrammaStr(sParentGrammar) + "</span>";
+		}
+		
+
+		//连读词按钮
+		if (mType == ".un." || mType == ".comp.") {
+			nextElement = com_get_nextsibling(xmlElement);
+			if (nextElement != null) {
+				//下一个元素存在
+				if (getNodeText(nextElement, "un") == sId) {
+					//若有孩子則显示收起按鈕
+					_txtOutDetail += "<button class='in_word_button' onclick='edit_un_remove(\"" + wordID + "\")'>";
+					_txtOutDetail +=
+						'<svg class="icon" ><use xlink="http://www.w3.org/1999/xlink" href="svg/icon.svg#ic_join "></use></svg>';
+					_txtOutDetail += "</button>";
+					var parentElement = document.getElementById("wb" + sId);
+					if (parentElement) {
+						parentElement.classList.add("un_parent");
+					}
+				} else {
+					//無kid展開按鈕
+					_txtOutDetail += "<button class='in_word_button' onclick='edit_un_split(\"" + wordID + "\")'>";
+					_txtOutDetail +=
+						'<svg class="icon" ><use xlink="http://www.w3.org/1999/xlink" href="svg/icon.svg#ic_split "></use></svg>';
+					_txtOutDetail += "</button> ";
+				}
+			} else {
+				//下一个元素不存在
+				_txtOutDetail += "<button class='in_word_button' onclick='edit_un_split(\"" + wordID + "\")'>";
+				_txtOutDetail +=
+					'<svg class="icon" ><use xlink="http://www.w3.org/1999/xlink" href="svg/icon.svg#ic_split "></use></svg>';
+				_txtOutDetail += "</button> ";
+			}
+		}
+		//连读词按钮 结束
+		//爷爷和父亲的关系 如pp
+		/*
+		if(wordGranfatherGramma.length>0 && wordGranfatherGramma.length<6){
+			_txtOutDetail  += "<span  class=\"tooltip\">«"+getLocalGrammaStr(wordGranfatherGramma)+"<span class=\"tooltiptext tooltip-bottom\">"+wordGranfather+"</span>"+"</span> ";
+		}
+		*/
+		_txtOutDetail += "</div> ";
+		/*end of gramma*/
+
+		_txtOutDetail += "</div>";
+
+		_txtOutDetail += "</div>";
+	}
+	return _txtOutDetail;
+}
+
+function renderWordDetailByElement(xmlElement) {
+	return renderWordDetailByElement_edit_a(xmlElement);
+
+	if (xmlElement == null) {
+		return "";
+	}
+	wordNode = xmlElement;
+	var sPali = getNodeText(wordNode, "pali");
+	var sId = getNodeText(wordNode, "id");
+	var sReal = getNodeText(wordNode, "real");
+	var sMean = getNodeText(wordNode, "mean");
+	var sOrg = getNodeText(wordNode, "org");
+	var sOm = getNodeText(wordNode, "om");
+	var sCase = getNodeText(wordNode, "case");
+	var sType = getNodeText(wordNode, "type");
+	var sGramma = getNodeText(wordNode, "gramma");
+	var sParent = getNodeText(wordNode, "parent");
+	var sNote = getNodeText(wordNode, "note");
+	wordID = sId;
+
+	if (sCase == "") {
+		sCase = sType + "#" + sGramma;
+	}
+
+	var _txtOutDetail = "";
+	var _bgColor = "";
+	var _caseColor = "";
+	//标点符号
+	if (sReal.length <= 1) {
+		_txtOutDetail += "<div>";
+		/*id begin*/
+		_txtOutDetail += "<div class='ID'> </div>";
+		/*mean begin*/
+		_txtOutDetail += "<div class='mean'> </div>";
+		/*org begin*/
+		_txtOutDetail += "<div class='org'> </div>";
+		/*org mean begin*/
+		_txtOutDetail += "<div class='om'> </div>";
+		/*case begin*/
+		_txtOutDetail += "<div class='case'> </div>";
+
+		_txtOutDetail += "</div>";
+		return _txtOutDetail;
+	}
+
+	if (sMean == "?") {
+		_bgColor = " class='bookmarkcolorx' ";
+	}
+
+	strBookMarkColor = getNodeText(wordNode, "bmc");
+	if (strBookMarkColor.length > 2) {
+		var icolor = strBookMarkColor.substr(-1);
+		_bgColor = " class='bookmarkcolor" + icolor + "' ";
+	}
+
+	// Auto Match Begin
+
+	if (sCase == "?" && _bgColor == "") {
+		_caseColor = " class='bookmarkcolorx' ";
+	}
+	if (g_useMode == "read" || g_useMode == "translate") {
+		_bgColor = "";
+		_caseColor = "";
+		if (sOrg == "?") {
+			sOrg = " ";
+		}
+		if (sMean == "?") {
+			sMean = " ";
+		}
+		if (sCase == "?" || sCase == "?#?") {
+			sCase = " ";
+		}
+	}
+
+	if (g_useMode == "read") {
+		_txtOutDetail += "<div " + _bgColor + ">";
+
+		/*id begin*/
+		_txtOutDetail += "<p class='ID'>";
+		_txtOutDetail += sId + "&nbsp;";
+		_txtOutDetail += "</p>";
+		/*id end*/
+
+		/*meaning begin*/
+		var showMean = sMean.replace(/{/g, "<span class='grm_add_mean'>");
+		showMean = showMean.replace(/}/g, "</span>");
+		showMean = showMean.replace(/\[/g, "<span class='grm_add_mean_user'>");
+		showMean = showMean.replace(/\]/g, "</span>");
+		_txtOutDetail += "<p class='mean'>";
+		_txtOutDetail += showMean + "&nbsp;";
+		_txtOutDetail += "</p>";
+		/*meaning end*/
+
+		/*org begin*/
+		_txtOutDetail += "<p class='org'>";
+		_txtOutDetail += sOrg + "&nbsp;";
+		_txtOutDetail += "</p>";
+		/*org end*/
+
+		/*org meaning begin*/
+		_txtOutDetail += "<p class='om'>";
+		_txtOutDetail += sOm + "&nbsp;";
+		_txtOutDetail += "</p>";
+		/*org meaning end*/
+
+		/*grmma begin*/
+		_txtOutDetail += "<p class='case'>";
+		sCase = getLocalGrammaStr(sCase);
+		var mGramma = sCase.split("#");
+		if (mGramma.length >= 2) {
+			mType = sCase.split("#")[0];
+			mGramma = sCase.split("#")[1];
+		} else {
+			mType = "";
+			mGramma = sCase.split("#")[0];
+		}
+		//_txtOutDetail += ("<span class='type'>"+mType+"</span> "+mGramma);
+		if (mType != "") {
+			_txtOutDetail += "<span class='type'>" + mType + "</span>";
+		}
+		_txtOutDetail += mGramma;
+		_txtOutDetail = _txtOutDetail + "&nbsp;" + "</p>";
+		/*grmma end*/
+
+		_txtOutDetail += "</div>";
+	}
+
+	//编辑模式开始
+	if (g_useMode == "edit") {
+		if (getNodeText(wordNode, "lock") == "true") {
+			_bgColor += "  style='box-shadow: 0 3px 0 0 #FF0000'";
+		} else {
+			_bgColor += " class='bookmarkcolor0' style='box-shadow: 0 0 0 0'";
+		}
+
+		_txtOutDetail += "<div " + _bgColor + ">";
+
+		/*id begin*/
+		_txtOutDetail += "<p class='ID'>";
+		_txtOutDetail += sId + "&nbsp;";
+		_txtOutDetail += "</p>";
+		/*id end*/
+
+		/*gramma*/
+		/*find in dict*/
+		var arrGramma = new Array();
+		var thisWord = getNodeText(wordNode, "real");
+		for (iDict = 0; iDict < g_DictWordList.length; iDict++) {
+			if (thisWord == g_DictWordList[iDict].Pali) {
+				if (
+					(g_DictWordList[iDict].Type != "" && g_DictWordList[iDict].Type != "?") ||
+					(g_DictWordList[iDict].Gramma != "" && g_DictWordList[iDict].Gramma != "?")
+				) {
+					var arrCase = g_DictWordList[iDict].Type + "#" + g_DictWordList[iDict].Gramma;
+					pushNewToList(arrGramma, arrCase);
+				}
+			}
+		}
+
+		if (sCase == "?" || sCase == "?#?") {
+			if (arrGramma.length > 0) {
+				setNodeText(xmlElement, "case", arrGramma[0]);
+				sCase = arrGramma[0];
+			} else {
+				setNodeText(xmlElement, "case", "?#?");
+				sCase = "?#?";
+			}
+		} else {
+			if (sCase.indexOf("#") == -1) {
+				sCase = "?#" + sCase;
+				setNodeText(xmlElement, "case", "?#" + sCase);
+			}
+		}
+
+		var currType = sCase.split("#")[0];
+		var currGramma = sCase.split("#")[1];
+
+		//end gramma
+
+		/*meaning*/
+		/*find in dict*/
+		var arrMeaning = new Array();
+
+		var currMeaning = "";
+		var currGrammaMeaning = "";
+		var wordParent = "";
+		var wordGramma0 = "";
+		//self meaning
+		var thisWord = getNodeText(wordNode, "real");
+		for (iDict = 0; iDict < g_DictWordList.length; iDict++) {
+			if (
+				thisWord == g_DictWordList[iDict].Pali &&
+				g_DictWordList[iDict].Type != ".root." &&
+				g_DictWordList[iDict].Type != ".suf." &&
+				g_DictWordList[iDict].Type != ".prf."
+			) {
+				if (
+					wordParent == "" &&
+					g_DictWordList[iDict].Parent.length > 0 &&
+					g_DictWordList[iDict].Parent != thisWord
+				) {
+					wordParent = g_DictWordList[iDict].Parent;
+					wordGramma0 = g_DictWordList[iDict].Gramma;
+				}
+				var tempCase = g_DictWordList[iDict].Type + "#" + g_DictWordList[iDict].Gramma;
+				if (sCase == tempCase && g_DictWordList[iDict].Mean.length > 0) {
+					if (currGrammaMeaning == "") {
+						if (dict_language_enable.indexOf(g_DictWordList[iDict].Language) >= 0) {
+							currGrammaMeaning = g_DictWordList[iDict].Mean.split("$")[0];
+						}
+					}
+				}
+				var arrMean = g_DictWordList[iDict].Mean.split("$");
+				for (var i = 0; i < arrMean.length; i++) {
+					if (arrMean[i].length > 0 && arrMean[i] != "?") {
+						//pushNewToList(arrMeaning,g_DictWordList[iDict].dictID+'$'+arrMeaning.length+'$$'+arrMean[i]);
+						if (dict_language_enable.indexOf(g_DictWordList[iDict].Language) >= 0) {
+							arrMeaning.push(
+								g_DictWordList[iDict].dictID +
+									"$" +
+									arrMeaning.length +
+									"$$" +
+									arrMean[i] +
+									"$" +
+									g_DictWordList[iDict].Language
+							);
+						}
+					}
+				}
+			}
+		}
+
+		var wordGramma1 = "";
+		//find in father
+		if (wordParent != "") {
+			//add parent infomation
+			if (sParent == "" || sParent == " ") {
+				setNodeText(wordNode, "parent", wordParent);
+				sParent = wordParent;
+			}
+			thisWord = wordParent;
+			wordParent = "";
+			wordGramma1 = "";
+			for (iDict = 0; iDict < g_DictWordList.length; iDict++) {
+				if (
+					thisWord == g_DictWordList[iDict].Pali &&
+					g_DictWordList[iDict].Type != ".v." &&
+					g_DictWordList[iDict].Type != ".n." &&
+					g_DictWordList[iDict].Type != ".ti." &&
+					g_DictWordList[iDict].Type != ".adj." &&
+					g_DictWordList[iDict].Type != ".pron." &&
+					g_DictWordList[iDict].Type != ".num."
+				) {
+					if (g_DictWordList[iDict].Parent.length > 0 && g_DictWordList[iDict].Parent != thisWord) {
+						if (wordParent == "") {
+							wordParent = g_DictWordList[iDict].Parent;
+						}
+						if (wordGramma1 == "") {
+							wordGramma1 = g_DictWordList[iDict].Gramma;
+						}
+					}
+					var arrMean = g_DictWordList[iDict].Mean.split("$");
+					for (var i = 0; i < arrMean.length; i++) {
+						if (arrMean[i].length > 0 && arrMean[i] != "?") {
+							//pushNewToList(arrMeaning,g_DictWordList[iDict].dictID+'$'+"*$"+getLocalParentFormulaStr(wordGramma0,arrMean[i]));
+							if (dict_language_enable.indexOf(g_DictWordList[iDict].Language) >= 0) {
+								arrMeaning.push(
+									g_DictWordList[iDict].dictID +
+										"$" +
+										arrMeaning.length +
+										"$*$" +
+										getLocalParentFormulaStr(wordGramma0, arrMean[i]) +
+										"$" +
+										g_DictWordList[iDict].Language
+								);
+							}
+						}
+					}
+				}
+			}
+		}
+
+		//爷爷跟父亲的关系 比如 pp
+		wordGranfatherGramma = wordGramma1;
+		wordGranfather = wordParent;
+
+		//grandfather
+		var wordGramma2 = "";
+		if (wordParent != "") {
+			thisWord = wordParent;
+			wordParent = "";
+			wordGramma2 = "";
+			for (iDict = 0; iDict < g_DictWordList.length; iDict++) {
+				if (
+					thisWord == g_DictWordList[iDict].Pali &&
+					g_DictWordList[iDict].Type != ".v." &&
+					g_DictWordList[iDict].Type != ".n." &&
+					g_DictWordList[iDict].Type != ".ti." &&
+					g_DictWordList[iDict].Type != ".adj." &&
+					g_DictWordList[iDict].Type != ".pron." &&
+					g_DictWordList[iDict].Type != ".num."
+				) {
+					if (g_DictWordList[iDict].Parent.length > 0 && g_DictWordList[iDict].Parent != thisWord) {
+						if (wordParent == "") {
+							wordParent = g_DictWordList[iDict].Parent;
+						}
+						if (wordGramma2 == "") {
+							wordGramma2 = g_DictWordList[iDict].Gramma;
+						}
+					}
+					var arrMean = g_DictWordList[iDict].Mean.split("$");
+					for (var i = 0; i < arrMean.length; i++) {
+						if (arrMean[i].length > 0 && arrMean[i] != "?") {
+							//pushNewToList(arrMeaning,g_DictWordList[iDict].dictID+'$'+"**"+getLocalParentFormulaStr(wordGramma1,arrMean[i]));
+							if (dict_language_enable.indexOf(g_DictWordList[iDict].Language) >= 0) {
+								arrMeaning.push(
+									g_DictWordList[iDict].dictID +
+										"$" +
+										arrMeaning.length +
+										"$**$" +
+										getLocalParentFormulaStr(wordGramma1, arrMean[i]) +
+										"$" +
+										g_DictWordList[iDict].Language
+								);
+							}
+						}
+					}
+				}
+			}
+		}
+
+		arrMeaning.sort(sortMeanByDictOrder);
+		//arrMeaning.sort(sortMeanByLanguageOrder);
+		newMeanList = removeSameWordInArray(arrMeaning);
+
+		sMean = sMean.replace("_un_auto_mean_", getLocalGrammaStr("_un_auto_mean_"));
+
+		if (sMean == "?") {
+			//自动匹配一个意思
+			//currGrammaMeaning是与语法信息最匹配的一个意思 如果使用这个 与语言排序冲突
+			if (currGrammaMeaning.length > 0 && currGrammaMeaning != "?") {
+				currMeaning = currGrammaMeaning;
+			} else {
+				if (newMeanList.length > 0) {
+					currMeaning = newMeanList[0].word;
+				} else {
+					currMeaning = sMean;
+				}
+			}
+		} else {
+			currMeaning = removeFormula(sMean);
+			currMeaning = getLocalFormulaStr(currGramma, currMeaning);
+		}
+
+		orgMeaning = removeFormula(currMeaning);
+		if (sReal.length < 4) {
+			currMeaning = getLocalFormulaStr(currGramma, cutString(orgMeaning, 24));
+		} else {
+			currMeaning = getLocalFormulaStr(currGramma, cutString(orgMeaning, sReal.length * 6));
+		}
+		setNodeText(wordNode, "mean", currMeaning);
+
+		renderMeaning = currMeaning.replace(/{/g, "<span class='grm_add_mean'>");
+		renderMeaning = renderMeaning.replace(/}/g, "</span>");
+		renderMeaning = renderMeaning.replace(/\[/g, "<span class='grm_add_mean_user'>");
+		renderMeaning = renderMeaning.replace(/\]/g, "</span>");
+
+		//渲染下拉菜单
+
+		_txtOutDetail += "<div class='mean'>";
+
+		_txtOutDetail += render_word_mean_menu(wordNode);
+
+		//render formula menu
+
+		arrFormula = getFormulaList(currGramma);
+		_txtOutDetail += '<div class="case_dropdown">';
+		_txtOutDetail += "<svg class='edit_icon'><use xlink:href='svg/icon.svg#ic_more'></use></svg>";
+		_txtOutDetail += '<div class="case_dropdown-content">';
+		newWord = removeFormula_B(orgMeaning);
+		_txtOutDetail +=
+			"<a onclick='fieldListChanged(\"" +
+			wordID +
+			'","mean","[]' +
+			newWord +
+			"\")'>[" +
+			gLocal.gui.none +
+			"]</a>";
+		_txtOutDetail +=
+			"<a onclick='fieldListChanged(\"" + wordID + '","mean","' + newWord + "\")'>[" + gLocal.gui.auto + "]</a>";
+		for (var i in arrFormula) {
+			newWord = removeFormula_B(orgMeaning);
+			newWord = arrFormula[i].replace("~", newWord);
+			newWord = newWord.replace(/{/g, "[");
+			newWord = newWord.replace(/}/g, "]");
+			_txtOutDetail +=
+				"<a onclick='fieldListChanged(\"" + wordID + '","mean","' + newWord + "\")'>" + arrFormula[i] + "</a>";
+		}
+
+		_txtOutDetail += "</div>";
+		_txtOutDetail += "</div>";
+		_txtOutDetail += "</div> ";
+		/*end of meaning*/
+
+		/*org begin 拆分*/
+		/*
+	=======
+		return renderWordDetailByElement_edit_a(xmlElement);
+	
+		if (xmlElement == null) {
+			return "";
+		}
+		wordNode = xmlElement;
+		var sPali = getNodeText(wordNode, "pali");
+		var sId = getNodeText(wordNode, "id");
+		var sReal = getNodeText(wordNode, "real");
+		var sMean = getNodeText(wordNode, "mean");
+		var sOrg = getNodeText(wordNode, "org");
+		var sOm = getNodeText(wordNode, "om");
+		var sCase = getNodeText(wordNode, "case");
+		var sType = getNodeText(wordNode, "type");
+		var sGramma = getNodeText(wordNode, "gramma");
+		var sParent = getNodeText(wordNode, "parent");
+		var sNote = getNodeText(wordNode, "note");
+		wordID = sId;
+	
+		if (sCase == "") {
+			sCase = sType + "#" + sGramma;
+		}
+	
+		var _txtOutDetail = "";
+		var _bgColor = "";
+		var _caseColor = "";
+		//标点符号
+		if (sReal.length <= 1) {
+			_txtOutDetail += "<div>";
+			/*id begin*/
+		_txtOutDetail += "<div class='ID'> </div>";
+		/*mean begin*/
+		_txtOutDetail += "<div class='mean'> </div>";
+		/*org begin*/
+		_txtOutDetail += "<div class='org'> </div>";
+		/*org mean begin*/
+		_txtOutDetail += "<div class='om'> </div>";
+		/*case begin*/
+		_txtOutDetail += "<div class='case'> </div>";
+
+		_txtOutDetail += "</div>";
+		return _txtOutDetail;
+	}
+
+	if (sMean == "?") {
+		_bgColor = " class='bookmarkcolorx' ";
+	}
+
+	strBookMarkColor = getNodeText(wordNode, "bmc");
+	if (strBookMarkColor.length > 2) {
+		var icolor = strBookMarkColor.substr(-1);
+		_bgColor = " class='bookmarkcolor" + icolor + "' ";
+	}
+
+	// Auto Match Begin
+
+	if (sCase == "?" && _bgColor == "") {
+		_caseColor = " class='bookmarkcolorx' ";
+	}
+	if (g_useMode == "read" || g_useMode == "translate") {
+		_bgColor = "";
+		_caseColor = "";
+		if (sOrg == "?") {
+			sOrg = " ";
+		}
+		if (sMean == "?") {
+			sMean = " ";
+		}
+		if (sCase == "?" || sCase == "?#?") {
+			sCase = " ";
+		}
+	}
+
+	if (g_useMode == "read") {
+		_txtOutDetail += "<div " + _bgColor + ">";
+
+		/*id begin*/
+		_txtOutDetail += "<p class='ID'>";
+		_txtOutDetail += sId + "&nbsp;";
+		_txtOutDetail += "</p>";
+		/*id end*/
+
+		/*meaning begin*/
+		var showMean = sMean.replace(/{/g, "<span class='grm_add_mean'>");
+		showMean = showMean.replace(/}/g, "</span>");
+		showMean = showMean.replace(/\[/g, "<span class='grm_add_mean_user'>");
+		showMean = showMean.replace(/\]/g, "</span>");
+		_txtOutDetail += "<p class='mean'>";
+		_txtOutDetail += showMean + "&nbsp;";
+		_txtOutDetail += "</p>";
+		/*meaning end*/
+
+		/*org begin*/
+		_txtOutDetail += "<p class='org'>";
+		_txtOutDetail += sOrg + "&nbsp;";
+		_txtOutDetail += "</p>";
+		/*org end*/
+
+		/*org meaning begin*/
+		_txtOutDetail += "<p class='om'>";
+		_txtOutDetail += sOm + "&nbsp;";
+		_txtOutDetail += "</p>";
+		/*org meaning end*/
+
+		/*grmma begin*/
+		_txtOutDetail += "<p class='case'>";
+		sCase = getLocalGrammaStr(sCase);
+		var mGramma = sCase.split("#");
+		if (mGramma.length >= 2) {
+			mType = sCase.split("#")[0];
+			mGramma = sCase.split("#")[1];
+		} else {
+			mType = "";
+			mGramma = sCase.split("#")[0];
+		}
+		//_txtOutDetail += ("<span class='type'>"+mType+"</span> "+mGramma);
+		if (mType != "") {
+			_txtOutDetail += "<span class='type'>" + mType + "</span>";
+		}
+		_txtOutDetail += mGramma;
+		_txtOutDetail = _txtOutDetail + "&nbsp;" + "</p>";
+		/*grmma end*/
+
+		_txtOutDetail += "</div>";
+	}
+
+	//编辑模式开始
+	if (g_useMode == "edit") {
+		if (getNodeText(wordNode, "lock") == "true") {
+			_bgColor += "  style='box-shadow: 0 3px 0 0 #FF0000'";
+		} else {
+			_bgColor += " class='bookmarkcolor0' style='box-shadow: 0 0 0 0'";
+		}
+
+		_txtOutDetail += "<div " + _bgColor + ">";
+
+		/*id begin*/
+		_txtOutDetail += "<p class='ID'>";
+		_txtOutDetail += sId + "&nbsp;";
+		_txtOutDetail += "</p>";
+		/*id end*/
+
+		/*gramma*/
+		/*find in dict*/
+		var arrGramma = new Array();
+		var thisWord = getNodeText(wordNode, "real");
+		for (iDict = 0; iDict < g_DictWordList.length; iDict++) {
+			if (thisWord == g_DictWordList[iDict].Pali) {
+				if (
+					(g_DictWordList[iDict].Type != "" && g_DictWordList[iDict].Type != "?") ||
+					(g_DictWordList[iDict].Gramma != "" && g_DictWordList[iDict].Gramma != "?")
+				) {
+					var arrCase = g_DictWordList[iDict].Type + "#" + g_DictWordList[iDict].Gramma;
+					pushNewToList(arrGramma, arrCase);
+				}
+			}
+		}
+
+		if (sCase == "?" || sCase == "?#?") {
+			if (arrGramma.length > 0) {
+				setNodeText(xmlElement, "case", arrGramma[0]);
+				sCase = arrGramma[0];
+			} else {
+				setNodeText(xmlElement, "case", "?#?");
+				sCase = "?#?";
+			}
+		} else {
+			if (sCase.indexOf("#") == -1) {
+				sCase = "?#" + sCase;
+				setNodeText(xmlElement, "case", "?#" + sCase);
+			}
+		}
+
+		var currType = sCase.split("#")[0];
+		var currGramma = sCase.split("#")[1];
+
+		//end gramma
+
+		/*meaning*/
+		/*find in dict*/
+		var arrMeaning = new Array();
+
+		var currMeaning = "";
+		var currGrammaMeaning = "";
+		var wordParent = "";
+		var wordGramma0 = "";
+		//self meaning
+		var thisWord = getNodeText(wordNode, "real");
+		for (iDict = 0; iDict < g_DictWordList.length; iDict++) {
+			if (
+				thisWord == g_DictWordList[iDict].Pali &&
+				g_DictWordList[iDict].Type != ".root." &&
+				g_DictWordList[iDict].Type != ".suf." &&
+				g_DictWordList[iDict].Type != ".prf."
+			) {
+				if (
+					wordParent == "" &&
+					g_DictWordList[iDict].Parent.length > 0 &&
+					g_DictWordList[iDict].Parent != thisWord
+				) {
+					wordParent = g_DictWordList[iDict].Parent;
+					wordGramma0 = g_DictWordList[iDict].Gramma;
+				}
+				var tempCase = g_DictWordList[iDict].Type + "#" + g_DictWordList[iDict].Gramma;
+				if (sCase == tempCase && g_DictWordList[iDict].Mean.length > 0) {
+					if (currGrammaMeaning == "") {
+						if (dict_language_enable.indexOf(g_DictWordList[iDict].Language) >= 0) {
+							currGrammaMeaning = g_DictWordList[iDict].Mean.split("$")[0];
+						}
+					}
+				}
+				var arrMean = g_DictWordList[iDict].Mean.split("$");
+				for (var i = 0; i < arrMean.length; i++) {
+					if (arrMean[i].length > 0 && arrMean[i] != "?") {
+						//pushNewToList(arrMeaning,g_DictWordList[iDict].dictID+'$'+arrMeaning.length+'$$'+arrMean[i]);
+						if (dict_language_enable.indexOf(g_DictWordList[iDict].Language) >= 0) {
+							arrMeaning.push(
+								g_DictWordList[iDict].dictID +
+									"$" +
+									arrMeaning.length +
+									"$$" +
+									arrMean[i] +
+									"$" +
+									g_DictWordList[iDict].Language
+							);
+						}
+					}
+				}
+			}
+		}
+
+		var wordGramma1 = "";
+		//find in father
+		if (wordParent != "") {
+			//add parent infomation
+			if (sParent == "" || sParent == " ") {
+				setNodeText(wordNode, "parent", wordParent);
+				sParent = wordParent;
+			}
+			thisWord = wordParent;
+			wordParent = "";
+			wordGramma1 = "";
+			for (iDict = 0; iDict < g_DictWordList.length; iDict++) {
+				if (
+					thisWord == g_DictWordList[iDict].Pali &&
+					g_DictWordList[iDict].Type != ".v." &&
+					g_DictWordList[iDict].Type != ".n." &&
+					g_DictWordList[iDict].Type != ".ti." &&
+					g_DictWordList[iDict].Type != ".adj." &&
+					g_DictWordList[iDict].Type != ".pron." &&
+					g_DictWordList[iDict].Type != ".num."
+				) {
+					if (g_DictWordList[iDict].Parent.length > 0 && g_DictWordList[iDict].Parent != thisWord) {
+						if (wordParent == "") {
+							wordParent = g_DictWordList[iDict].Parent;
+						}
+						if (wordGramma1 == "") {
+							wordGramma1 = g_DictWordList[iDict].Gramma;
+						}
+					}
+					var arrMean = g_DictWordList[iDict].Mean.split("$");
+					for (var i = 0; i < arrMean.length; i++) {
+						if (arrMean[i].length > 0 && arrMean[i] != "?") {
+							//pushNewToList(arrMeaning,g_DictWordList[iDict].dictID+'$'+"*$"+getLocalParentFormulaStr(wordGramma0,arrMean[i]));
+							if (dict_language_enable.indexOf(g_DictWordList[iDict].Language) >= 0) {
+								arrMeaning.push(
+									g_DictWordList[iDict].dictID +
+										"$" +
+										arrMeaning.length +
+										"$*$" +
+										getLocalParentFormulaStr(wordGramma0, arrMean[i]) +
+										"$" +
+										g_DictWordList[iDict].Language
+								);
+							}
+						}
+					}
+				}
+			}
+		}
+
+		//爷爷跟父亲的关系 比如 pp
+		wordGranfatherGramma = wordGramma1;
+		wordGranfather = wordParent;
+
+		//grandfather
+		var wordGramma2 = "";
+		if (wordParent != "") {
+			thisWord = wordParent;
+			wordParent = "";
+			wordGramma2 = "";
+			for (iDict = 0; iDict < g_DictWordList.length; iDict++) {
+				if (
+					thisWord == g_DictWordList[iDict].Pali &&
+					g_DictWordList[iDict].Type != ".v." &&
+					g_DictWordList[iDict].Type != ".n." &&
+					g_DictWordList[iDict].Type != ".ti." &&
+					g_DictWordList[iDict].Type != ".adj." &&
+					g_DictWordList[iDict].Type != ".pron." &&
+					g_DictWordList[iDict].Type != ".num."
+				) {
+					if (g_DictWordList[iDict].Parent.length > 0 && g_DictWordList[iDict].Parent != thisWord) {
+						if (wordParent == "") {
+							wordParent = g_DictWordList[iDict].Parent;
+						}
+						if (wordGramma2 == "") {
+							wordGramma2 = g_DictWordList[iDict].Gramma;
+						}
+					}
+					var arrMean = g_DictWordList[iDict].Mean.split("$");
+					for (var i = 0; i < arrMean.length; i++) {
+						if (arrMean[i].length > 0 && arrMean[i] != "?") {
+							//pushNewToList(arrMeaning,g_DictWordList[iDict].dictID+'$'+"**"+getLocalParentFormulaStr(wordGramma1,arrMean[i]));
+							if (dict_language_enable.indexOf(g_DictWordList[iDict].Language) >= 0) {
+								arrMeaning.push(
+									g_DictWordList[iDict].dictID +
+										"$" +
+										arrMeaning.length +
+										"$**$" +
+										getLocalParentFormulaStr(wordGramma1, arrMean[i]) +
+										"$" +
+										g_DictWordList[iDict].Language
+								);
+							}
+						}
+					}
+				}
+			}
+		}
+
+		arrMeaning.sort(sortMeanByDictOrder);
+		//arrMeaning.sort(sortMeanByLanguageOrder);
+		newMeanList = removeSameWordInArray(arrMeaning);
+
+		sMean = sMean.replace("_un_auto_mean_", getLocalGrammaStr("_un_auto_mean_"));
+
+		if (sMean == "?") {
+			//自动匹配一个意思
+			//currGrammaMeaning是与语法信息最匹配的一个意思 如果使用这个 与语言排序冲突
+			if (currGrammaMeaning.length > 0 && currGrammaMeaning != "?") {
+				currMeaning = currGrammaMeaning;
+			} else {
+				if (newMeanList.length > 0) {
+					currMeaning = newMeanList[0].word;
+				} else {
+					currMeaning = sMean;
+				}
+			}
+		} else {
+			currMeaning = removeFormula(sMean);
+			currMeaning = getLocalFormulaStr(currGramma, currMeaning);
+		}
+
+		orgMeaning = removeFormula(currMeaning);
+		if (sReal.length < 4) {
+			currMeaning = getLocalFormulaStr(currGramma, cutString(orgMeaning, 24));
+		} else {
+			currMeaning = getLocalFormulaStr(currGramma, cutString(orgMeaning, sReal.length * 6));
+		}
+		setNodeText(wordNode, "mean", currMeaning);
+
+		renderMeaning = currMeaning.replace(/{/g, "<span class='grm_add_mean'>");
+		renderMeaning = renderMeaning.replace(/}/g, "</span>");
+		renderMeaning = renderMeaning.replace(/\[/g, "<span class='grm_add_mean_user'>");
+		renderMeaning = renderMeaning.replace(/\]/g, "</span>");
+
+		//渲染下拉菜单
+
+		_txtOutDetail += "<div class='mean'>";
+
+		_txtOutDetail += render_word_mean_menu(wordNode);
+
+		//render formula menu
+
+		arrFormula = getFormulaList(currGramma);
+		_txtOutDetail += '<div class="case_dropdown">';
+		_txtOutDetail += "<svg class='edit_icon'><use xlink:href='svg/icon.svg#ic_more'></use></svg>";
+		_txtOutDetail += '<div class="case_dropdown-content">';
+		newWord = removeFormula_B(orgMeaning);
+		_txtOutDetail +=
+			"<a onclick='fieldListChanged(\"" +
+			wordID +
+			'","mean","[]' +
+			newWord +
+			"\")'>[" +
+			gLocal.gui.none +
+			"]</a>";
+		_txtOutDetail +=
+			"<a onclick='fieldListChanged(\"" + wordID + '","mean","' + newWord + "\")'>[" + gLocal.gui.auto + "]</a>";
+		for (var i in arrFormula) {
+			newWord = removeFormula_B(orgMeaning);
+			newWord = arrFormula[i].replace("~", newWord);
+			newWord = newWord.replace(/{/g, "[");
+			newWord = newWord.replace(/}/g, "]");
+			_txtOutDetail +=
+				"<a onclick='fieldListChanged(\"" + wordID + '","mean","' + newWord + "\")'>" + arrFormula[i] + "</a>";
+		}
+
+		_txtOutDetail += "</div>";
+		_txtOutDetail += "</div>";
+		_txtOutDetail += "</div> ";
+		/*end of meaning*/
+
+		/*org begin 拆分*/
+		/*
+>>>>>>> bc16896ae743d21de32c24d5ffe63b6be00a315c
+		_txtOutDetail +=  "<p class='org' name='w_org'>";
+		_txtOutDetail +=   sOrg  + "&nbsp;";
+		_txtOutDetail +=  "</p> ";
+		*/
+		/*find in dict*/
+
+		var currOrg = "";
+		var wordParent = "";
+		var arrOrg = new Array();
+		var thisWord = getNodeText(wordNode, "real");
+		for (iDict = 0; iDict < g_DictWordList.length; iDict++) {
+			if (thisWord == g_DictWordList[iDict].Pali) {
+				if (g_DictWordList[iDict].Parent.length > 0 && g_DictWordList[iDict].Parent != thisWord) {
+					wordParent = g_DictWordList[iDict].Parent;
+				}
+				var currOrg = g_DictWordList[iDict].Factors;
+				if (currOrg.length > 0 && currOrg != "?") {
+					pushNewToList(arrOrg, currOrg);
+					//arrOrg.push(currOrg);
+				}
+			}
+		}
+		//father
+		if (wordParent != "") {
+			thisWord = wordParent;
+			wordParent = "";
+			wordGramma1 = "";
+			for (iDict = 0; iDict < g_DictWordList.length; iDict++) {
+				if (thisWord == g_DictWordList[iDict].Pali) {
+					if (g_DictWordList[iDict].Parent.length > 0 && g_DictWordList[iDict].Parent != thisWord) {
+						if (wordParent == "") {
+							wordParent = g_DictWordList[iDict].Parent;
+						}
+					}
+					var currOrg = g_DictWordList[iDict].Factors;
+					if (currOrg.length > 0 && currOrg != "?") {
+						pushNewToList(arrOrg, currOrg);
+						//arrOrg.push(currOrg);
+					}
+				}
+			}
+		}
+		//grandfather
+		if (wordParent != "") {
+			thisWord = wordParent;
+			wordParent = "";
+			wordGramma2 = "";
+			for (iDict = 0; iDict < g_DictWordList.length; iDict++) {
+				if (thisWord == g_DictWordList[iDict].Pali) {
+					if (g_DictWordList[iDict].Parent.length > 0 && g_DictWordList[iDict].Parent != thisWord) {
+						if (wordParent == "") {
+							wordParent = g_DictWordList[iDict].Parent;
+						}
+					}
+					var currOrg = g_DictWordList[iDict].Factors;
+					if (currOrg.length > 0 && currOrg != "?") {
+						pushNewToList(arrOrg, currOrg);
+						//arrOrg.push(currOrg);
+					}
+				}
+			}
+		}
+
+		_txtOutDetail += "<div class='org'  name='w_org'>";
+
+		_txtOutDetail += '<div class="case_dropdown">';
+		_txtOutDetail += "<p class='case_dropbtn' >";
+
+		if (sOrg == "?") {
+			if (arrOrg.length > 0) {
+				currOrg = arrOrg[0];
+			} else {
+				currOrg = sOrg;
+			}
+			setNodeText(wordNode, "org", currOrg);
+		} else {
+			currOrg = sOrg;
+		}
+
+		_txtOutDetail += currOrg;
+		if (arrOrg.length > 0) {
+			_txtOutDetail += "<svg class='edit_icon'>";
+			_txtOutDetail += "<use xlink:href='svg/icon.svg#ic_down'></use>";
+			_txtOutDetail += "</svg>";
+		}
+		_txtOutDetail += "</p>";
+		_txtOutDetail += '<div class="case_dropdown-content">';
+		_txtOutDetail +=
+			"<button style='font-size:100%;display:inline-flex; padding:0.1em 0.5em' onclick='fieldListChanged(\"" +
+			wordID +
+			'","org","")\'>' +
+			gLocal.gui.empty1 +
+			"</button>";
+		_txtOutDetail +=
+			"<button style='font-size:100%;display:inline-flex; padding:0.1em 0.5em' onclick='show_word_map(\"" +
+			wordID +
+			"\")'>" +
+			gLocal.gui.wordmap +
+			"</button>";
+		//新加 base 信息 vn
+		_txtOutDetail += '<div class="case_dropdown-org">';
+		_txtOutDetail += '<div class="case_dropdown-first">';
+
+		_txtOutDetail += "<a style='z-index:250; position:absolute; margin-right:2em;'>";
+		_txtOutDetail += sParent + "</a>";
+		_txtOutDetail += "<span style='z-index:220' class='case_dropdown-title'>";
+		_txtOutDetail += gLocal.gui.more + "»</span>";
+		_txtOutDetail += "</div>";
+
+		for (i in arrOrg) {
+			_txtOutDetail +=
+				"<a onclick='fieldListChanged(\"" + wordID + '","org","' + arrOrg[i] + "\")'>" + arrOrg[i] + "</a>";
+		}
+		_txtOutDetail += "</div>";
+		_txtOutDetail += "</div>";
+		_txtOutDetail += "</div>";
+		_txtOutDetail += "</div> ";
+		/*end of factors*/
+
+		/*part meaning begin*/
+		listFactorForFactorMean = currOrg.split("+");
+		currDefualtFM = "";
+		for (iFactor in listFactorForFactorMean) {
+			currDefualtFM += findFirstMeanInDict(listFactorForFactorMean[iFactor]) + "+"; //拆分元素加号分隔
+		}
+		currDefualtFM = currDefualtFM.replace(/"  "/g, " ");
+		currDefualtFM = currDefualtFM.replace(/"+ "/g, "+");
+		currDefualtFM = currDefualtFM.replace(/" +"/g, "+");
+		currDefualtFM = currDefualtFM.substring(0, currDefualtFM.length - 1); //去掉尾部的加号 kosalla
+
+		if (currDefualtFM.slice(-1, -2) == "+") {
+			currDefualtFM = currDefualtFM.substring(0, currDefualtFM.length - 1);
+		}
+
+		/*find in dict*/
+
+		var currOM = "";
+		var wordParent = "";
+		var arrOM = new Array();
+		var thisWord = getNodeText(wordNode, "real");
+		for (iDict = 0; iDict < g_DictWordList.length; iDict++) {
+			if (thisWord == g_DictWordList[iDict].Pali) {
+				if (g_DictWordList[iDict].Parent.length > 0 && g_DictWordList[iDict].Parent != thisWord) {
+					wordParent = g_DictWordList[iDict].Parent;
+				}
+				var currOM = g_DictWordList[iDict].FactorMean;
+				if (currOM.length > 0 && currOM != "?") {
+					pushNewToList(arrOM, currOM);
+					//arrOM.push(currOM);
+				}
+			}
+		}
+
+		/*	
+			//father
+			if(wordParent!=""){
+				thisWord=wordParent;
+				wordParent="";
+				for(iDict=0;iDict<g_DictWordList.length;iDict++){
+					if(thisWord==g_DictWordList[iDict].Pali){
+						if(g_DictWordList[iDict].Parent.length>0 && g_DictWordList[iDict].Parent!=thisWord){
+							if(wordParent==""){
+								wordParent=g_DictWordList[iDict].Parent;
+							}
+						}
+						var currOM=g_DictWordList[iDict].FactorMean;
+						if(currOM.length>0 && currOM!="?"){
+							pushNewToList(arrOM,currOM);
+						}
+					}
+				}	
+			}
+			//grandfather
+			if(wordParent!=""){
+				thisWord=wordParent;
+				wordParent="";
+				wordGramma2="";
+				for(iDict=0;iDict<g_DictWordList.length;iDict++){
+					if(thisWord==g_DictWordList[iDict].Pali){
+						if(g_DictWordList[iDict].Parent.length>0 && g_DictWordList[iDict].Parent!=thisWord){
+							if(wordParent==""){
+								wordParent=g_DictWordList[iDict].Parent;
+							}
+						}
+						var currOM=g_DictWordList[iDict].FactorMean;
+						if(currOM.length>0 && currOM!="?"){
+							pushNewToList(arrOM,currOM);
+						}
+					}
+				}	
+			}
+		*/
+		_txtOutDetail += "<div class='om'  name='w_om'>";
+
+		_txtOutDetail += '<div class="case_dropdown">';
+		_txtOutDetail += "<p class='case_dropbtn' >";
+		sOm = sOm.replace("_un_auto_factormean_", getLocalGrammaStr("_un_auto_factormean_"));
+
+		if (sOm == "?" || sOm.substring(0, 3) == "[a]") {
+			if (arrOM.length > 0) {
+				currOM = arrOM[0];
+			} else {
+				currOM = "[a]" + currDefualtFM;
+			}
+			setNodeText(wordNode, "om", currOM);
+		} else {
+			currOM = sOm;
+		}
+
+		_txtOutDetail += currOM;
+		if (arrOM.length > 0) {
+			_txtOutDetail += " ▾";
+		}
+		_txtOutDetail += "</p>";
+		_txtOutDetail += '<div class="case_dropdown-content">';
+		_txtOutDetail +=
+			"<button style='font-size:100%;display:inline-flex; padding:0.1em 0.5em' onclick='fieldListChanged(\"" +
+			wordID +
+			'","om","")\'>' +
+			gLocal.gui.empty1 +
+			"</button>";
+		_txtOutDetail +=
+			"<a onclick='fieldListChanged(\"" +
+			wordID +
+			'","om","[a]' +
+			currDefualtFM +
+			"\")'>[" +
+			gLocal.gui.auto +
+			"]" +
+			currDefualtFM +
+			"</a>";
+		for (i in arrOM) {
+			_txtOutDetail +=
+				"<a onclick='fieldListChanged(\"" + wordID + '","om","' + arrOM[i] + "\")'>" + arrOM[i] + "</a>";
+		}
+		_txtOutDetail += "</div>";
+		_txtOutDetail += "</div>";
+		_txtOutDetail += "</div> ";
+
+		/*org meaning end*/
+
+		/*begin gramma*/
+
+		_txtOutDetail += "<div class='case'>";
+
+		_txtOutDetail += '<div class="case_dropdown">';
+		_txtOutDetail += "<p class='case_dropbtn' >";
+		sLocalCase = getLocalGrammaStr(sCase);
+		var mArrGramma = sCase.split("#");
+		if (mArrGramma.length >= 2) {
+			mType = mArrGramma[0];
+			mGramma = mArrGramma[1];
+			mLocalType = sLocalCase.split("#")[0];
+			mLocalGramma = sLocalCase.split("#")[1];
+		} else {
+			mType = "";
+			mGramma = mArrGramma[0];
+			mLocalType = "";
+			mLocalGramma = sLocalCase.split("#")[0];
+		}
+
+		if (mType != "") {
+			_txtOutDetail += "<span class='cell'>" + mLocalType + "</span>";
+		}
+		_txtOutDetail += cutString(mLocalGramma, 30);
+
+		_txtOutDetail += "</p>";
+
+		_txtOutDetail += '<div class="case_dropdown-content">';
+		for (i in arrGramma) {
+			_txtOutDetail +=
+				"<a onclick='fieldListChanged(\"" +
+				wordID +
+				'","case","' +
+				arrGramma[i] +
+				"\")'>" +
+				cutString(getLocalGrammaStr(arrGramma[i]), 30) +
+				"</a>";
+		}
+		_txtOutDetail += "</div>";
+		_txtOutDetail += "</div>";
+
+		//连读词按钮
+		if (mType == ".un." || mType == ".comp.") {
+			nextElement = com_get_nextsibling(xmlElement);
+			if (nextElement != null) {
+				//下一个元素存在
+				if (getNodeText(nextElement, "un") == sId) {
+					//若有孩子則显示收起按鈕
+					_txtOutDetail += "<button class='in_word_button' onclick='edit_un_remove(\"" + wordID + "\")'>";
+					_txtOutDetail +=
+						'<svg class="icon" ><use xlink="http://www.w3.org/1999/xlink" href="svg/icon.svg#ic_join "></use></svg>';
+					_txtOutDetail += "</button>";
+					var parentElement = document.getElementById("wb" + sId);
+					if (parentElement) {
+						parentElement.classList.add("un_parent");
+					}
+				} else {
+					//無kid展開按鈕
+					_txtOutDetail += "<button class='in_word_button' onclick='edit_un_split(\"" + wordID + "\")'>";
+					_txtOutDetail +=
+						'<svg class="icon" ><use xlink="http://www.w3.org/1999/xlink" href="svg/icon.svg#ic_split "></use></svg>';
+					_txtOutDetail += "</button> ";
+				}
+			} else {
+				//下一个元素不存在
+				_txtOutDetail += "<button class='in_word_button' onclick='edit_un_split(\"" + wordID + "\")'>";
+				_txtOutDetail +=
+					'<svg class="icon" ><use xlink="http://www.w3.org/1999/xlink" href="svg/icon.svg#ic_split "></use></svg>';
+				_txtOutDetail += "</button> ";
+			}
+		}
+		//连读词按钮 结束
+		//爷爷和父亲的关系 如pp
+		if (wordGranfatherGramma.length > 0 && wordGranfatherGramma.length < 6) {
+			_txtOutDetail +=
+				'<span  class="tooltip">«' +
+				getLocalGrammaStr(wordGranfatherGramma) +
+				'<span class="tooltiptext tooltip-bottom">' +
+				wordGranfather +
+				"</span>" +
+				"</span> ";
+		}
+
+		_txtOutDetail += "</div> ";
+		/*end of gramma*/
+
+		//Auto Match Finished
+
+		_txtOutDetail += "</div>";
+	}
+
+	return _txtOutDetail;
+}
+
+function renderWordNoteDivByParaNo(book, paragraph) {}
+/*
+paragraph word note
+*/
+function renderWordNoteDivByElement(elementBlock) {
+	let output = "";
+	let xmlParInfo = elementBlock.getElementsByTagName("info")[0];
+	let book = getNodeText(xmlParInfo, "book");
+	let paragraph = getNodeText(xmlParInfo, "paragraph");
+	let bId = getNodeText(xmlParInfo, "id");
+
+	let type = getNodeText(xmlParInfo, "type");
+	let allWord = elementBlock.getElementsByTagName("word");
+	let iNoteCounter = 0;
+	for (iWord = 0; iWord < allWord.length; iWord++) {
+		let oneNote = "";
+		let pali = getNodeText(allWord[iWord], "pali");
+		let sNote = getNodeText(allWord[iWord], "note");
+		if (sNote != "") {
+			oneNote += note_init(sNote);
+		}
+		let sRela = getNodeText(allWord[iWord], "rela");
+		if (sRela != "") {
+			oneNote += "<div>" + renderWordRelation(allWord[iWord]) + "</div>";
+		}
+		id = getNodeText(allWord[iWord], "id");
+		if (oneNote == "") {
+			//有内容
+			$("#wnote_root_" + id).html("");
+		} else {
+			$("#wnote_root_" + id).html("<wnh wid='" + id + "'></wnh>");
+			output += "<div>";
+			output += "<wnc wid='" + id + "'></wnc>";
+			output += "<strong>" + pali + ":</strong>";
+			output += oneNote;
+			output += "</div>";
+		}
+	}
+	return output;
+}
+function refreshWordNoteDiv(elementBlock) {
+	let html = renderWordNoteDivByElement(elementBlock);
+	let xmlParInfo = elementBlock.getElementsByTagName("info")[0];
+	let book = getNodeText(xmlParInfo, "book");
+	let paragraph = parseInt(getNodeText(xmlParInfo, "paragraph"));
+	let noteid = "wnote_" + book + "_" + (paragraph - 1);
+	try {
+		if (html == "") {
+			$("#" + noteid).hide();
+		} else {
+			$("#" + noteid).html(html);
+			$("#" + noteid).show();
+		}
+	} catch (e) {
+		console.error(e.message + noteid);
+	}
+}
+
+function refreshWordNote(elementBlock) {
+	var output = "";
+	xmlParInfo = elementBlock.getElementsByTagName("info")[0];
+	book = getNodeText(xmlParInfo, "book");
+	paragraph = getNodeText(xmlParInfo, "paragraph");
+	bId = getNodeText(xmlParInfo, "id");
+
+	type = getNodeText(xmlParInfo, "type");
+	var allWord = elementBlock.getElementsByTagName("word");
+	var iNoteCounter = 0;
+	for (iWord = 0; iWord < allWord.length; iWord++) {
+		pali = getNodeText(allWord[iWord], "pali");
+		wnote = note_init(getNodeText(allWord[iWord], "note"));
+		id = getNodeText(allWord[iWord], "id");
+		var note = wnote;
+		if (note.length > 0 && note != "?") {
+			iNoteCounter++;
+			if (wnote.substring(0, 6) == "=term(") {
+				var termId = wnote.slice(6, -1);
+				//alert(arrTerm.length);
+				if (arrTerm[note]) {
+					note = "<term guid='" + termId + "' pos='wbw'>" + arrTerm[termId].note + "</term>";
+				} else {
+					note = "<term guid='" + termId + "' pos='wbw'></term>";
+				}
+			}
+
+			output += '<p><a href="#word_note_root_' + id + '" name="word_note_' + id + '">[' + iNoteCounter + "]</a>";
+			if (note.match("{") && note.match("}")) {
+				note = note.replace("{", "<strong>");
+				note = note.replace("}", "</strong>");
+				if (note.length > 100) {
+					shortNote = note.substring(0, 99);
+					otherNode = note.substring(100);
+					output +=
+						shortNote +
+						'<span class="full_note_handle">...<span class="full_note">' +
+						otherNode +
+						"</span></span>";
+				} else {
+					output += note;
+				}
+			} else {
+				if (note.length > 100) {
+					shortNote = note.substring(0, 99);
+					otherNode = note.substring(100);
+					output +=
+						shortNote +
+						'<span class="full_note_handle">...<span class="full_note">' +
+						otherNode +
+						"</span></span>";
+				} else {
+					output += "<strong>" + pali + ":</strong>" + note;
+				}
+			}
+
+			output += "</p>";
+			if (termId) {
+				document.getElementById("wnote_root_" + id).innerHTML =
+					"<a onclick=\"term_show_win('" +
+					termId +
+					'\')" name="word_note_root_' +
+					id +
+					'">[' +
+					iNoteCounter +
+					"]</a>";
+			} else {
+				document.getElementById("wnote_root_" + id).innerHTML =
+					'<a href="#word_note_' + id + '" name="word_note_root_' + id + '">[' + iNoteCounter + "]</a>";
+			}
+		} else {
+			noteRootObj = document.getElementById("wnote_root_" + id);
+			if (noteRootObj) {
+				document.getElementById("wnote_root_" + id).innerHTML = "";
+			}
+		}
+	}
+	if (output == "") {
+		document.getElementById("wnote_" + book + "_" + (paragraph - 1)).style.display = "none";
+	} else {
+		document.getElementById("wnote_" + book + "_" + (paragraph - 1)).style.display = "block";
+	}
+	document.getElementById("wnote_" + book + "_" + (paragraph - 1)).innerHTML = output;
+}
+
+function updateWordNote(element) {
+	let paliword = getNodeText(element, "real");
+	let wnote = getNodeText(element, "note");
+	wnote = note_init(wnote);
+	let id = getNodeText(element, "id");
+
+	if (wnote == "") {
+		$("#wnote_root_" + id).html("");
+		$("#wnn_" + id).html("");
+	} else {
+		$("#wnote_root_" + id).html("<wnh wid='" + id + "'></wnh>");
+		let output = "";
+		output += "<wnc wid='" + id + "'></wnc>";
+		let head = "";
+		let content = "";
+		if (wnote.match("{") && wnote.match("}")) {
+			wnote = wnote.replace("{", "<strong>");
+			wnote = wnote.replace("}", "</strong>");
+		} else {
+			output += "<strong>" + paliword + ":</strong>";
+		}
+		output += wnote;
+		$("#wnn_" + id).html(output);
+	}
+}
+
+function updateWordCommentary(element) {}
+
+//根据xmlDocument 对象中的单词序号修改单词块的显示(不含Pali)
+//返回 无
+function updataWordBodyByElement(element) {
+	try {
+		var sId = getNodeText(wordNode, "id");
+		var sDetail = "detail" + sId;
+		var cDetail = document.getElementById(sDetail);
+		if (cDetail != null) {
+			cDetail.innerHTML = renderWordDetailByElement(element);
+		}
+	} catch (error) {
+		var_dump(error);
+	}
+}
+
+//根据xmlDocument 对象中的单词序号修改单词块的显示(不含Pali)
+//返回 无
+function modifyWordDetailByWordId(wordId) {
+	try {
+		var sDetail = "detail" + wordId;
+		var cDetail = document.getElementById(sDetail);
+		if (cDetail != null) {
+			cDetail.innerHTML = renderWordDetailById(wordId);
+		}
+	} catch (error) {
+		var_dump(error);
+	}
+}
+
+//根据xmlDocument 对象中的单词GUID返回单词块字符串(不含Pali)
+//返回 字符串
+
+function renderWordDetailById(wordID) {
+	var mXML = gXmlBookDataBody.getElementsByTagName("word");
+	var wordIndex = getWordIndex(wordID);
+
+	return renderWordDetailByElement(mXML[wordIndex]);
+}
+
+function reloadPar(parIndex) {
+	bookId = gArrayDocParagraph[parIndex].book;
+	parNo = gArrayDocParagraph[parIndex].paragraph;
+
+	var htmlBlock = document.getElementById("par_" + bookId + "_" + (parNo - 1));
+	if (htmlBlock.style.display != "none") {
+		return false;
+	}
+
+	allBlock = gXmlBookDataBody.getElementsByTagName("block");
+	for (var iBlock = 0; iBlock < allBlock.length; iBlock++) {
+		xmlParInfo = allBlock[iBlock].getElementsByTagName("info")[0];
+		xmlParData = allBlock[iBlock].getElementsByTagName("data")[0];
+
+		currBookId = getNodeText(xmlParInfo, "book");
+		currParNo = getNodeText(xmlParInfo, "paragraph");
+		if (bookId == currBookId && currParNo == parNo) {
+			insertBlockToHtml(allBlock[iBlock]);
+		}
+	}
+	return true;
+}
+
+function removePar(parIndex) {
+	bookId = gArrayDocParagraph[parIndex].book;
+	parNo = gArrayDocParagraph[parIndex].paragraph;
+	if (gCurrModifyWindowParNo == parIndex) {
+		//关闭单词修改窗口
+		closeModifyWindow();
+	}
+
+	var htmlBlock = document.getElementById("par_" + bookId + "_" + (parNo - 1));
+	if (htmlBlock) {
+		htmlBlock.style.display = "none";
+		document.getElementById("heading_" + bookId + "_" + (parNo - 1)).innerHTML = "";
+		document.getElementById("wblock_" + bookId + "_" + (parNo - 1)).innerHTML = "";
+		document.getElementById("tran_" + bookId + "_" + (parNo - 1)).innerHTML = "";
+		document.getElementById("wnote_" + bookId + "_" + (parNo - 1)).innerHTML = "";
+		document.getElementById("note_" + bookId + "_" + (parNo - 1)).innerHTML = "";
+	}
+}
+
+function setView(topParIndex) {
+	var parInOnePage = 3;
+	gCurrTopParagraph = topParIndex;
+	gVisibleParBegin = topParIndex - parInOnePage;
+	gVisibleParEnd = parInOnePage * 2;
+	if (gVisibleParBegin < 0) {
+		gVisibleParBegin = 0;
+	}
+	if (gVisibleParEnd >= gArrayDocParagraph.length) {
+		gVisibleParEnd = gArrayDocParagraph.length - 1;
+	}
+}
+
+function isParInView(parIndex) {
+	if (parIndex >= gVisibleParBegin && parIndex <= gVisibleParEnd) {
+		return true;
+	} else {
+		return false;
+	}
+}
+function refresh_Dispaly_Cap() {
+	var new_par_length = gPalitext_length / gtext_max_length;
+
+	for (refresh_i in allTextLen_array) {
+		gNewArrayDocParagraph.push(allTextLen_array[refresh_i].length / gtext_max_length);
+	}
+}
+function prev_page() {
+	//向上翻页
+	gVisibleParBeginOld = gVisibleParBegin;
+	gVisibleParEndOld = gVisibleParEnd;
+	if (g_allparlen_array[gVisibleParEnd - 1] - g_allparlen_array[gVisibleParBegin - 1] <= gDisplayCapacity) {
+		gVisibleParBegin -= 1;
+	} else if (g_allparlen_array[gVisibleParEnd + 1] - g_allparlen_array[gVisibleParBegin - 1] > gDisplayCapacity) {
+		gVisibleParBegin -= 1;
+		gVisibleParEnd -= 1;
+	}
+
+	if (gVisibleParBegin < 0) {
+		//如果到顶,则恢复原始值
+		gVisibleParBegin = 0;
+		//gVisibleParEnd=gDisplayCapacity;
+		if (gVisibleParEnd >= gArrayDocParagraph.length) {
+			//如果到底,则锁死最大值
+			gVisibleParEnd = gArrayDocParagraph.length - 1;
+		}
+	}
+
+	updataView();
+}
+
+function next_page() {
+	//向下翻页
+	gVisibleParBeginOld = gVisibleParBegin;
+	gVisibleParEndOld = gVisibleParEnd;
+
+	if (g_allparlen_array[gVisibleParEnd + 1] - g_allparlen_array[gVisibleParBegin + 1] <= gDisplayCapacity) {
+		gVisibleParEnd += 1;
+	} else if (g_allparlen_array[gVisibleParEnd + 1] - g_allparlen_array[gVisibleParBegin + 1] > gDisplayCapacity) {
+		gVisibleParBegin += 1;
+		gVisibleParEnd += 1;
+	}
+
+	if (gVisibleParEnd >= gArrayDocParagraph.length) {
+		//如果到底
+		gVisibleParEnd = gArrayDocParagraph.length - 1;
+		//gVisibleParBegin=gVisibleParEnd-gDisplayCapacity;
+		if (gVisibleParBegin < 0) {
+			gVisibleParBegin = 0;
+		}
+	}
+	updataView();
+}
+
+function setNewView(newBegin, newEnd) {
+	gVisibleParBeginOld = gVisibleParBegin;
+	gVisibleParEndOld = gVisibleParEnd;
+
+	gVisibleParBegin = newBegin;
+	gVisibleParEnd = newEnd;
+
+	if (gVisibleParBegin < 0) {
+		gVisibleParBegin = 0;
+		//gVisibleParEnd=gDisplayCapacity;
+		if (gVisibleParEnd >= gArrayDocParagraph.length) {
+			gVisibleParEnd = gArrayDocParagraph.length - 1;
+		}
+	}
+
+	if (gVisibleParEnd >= gArrayDocParagraph.length) {
+		gVisibleParEnd = gArrayDocParagraph.length - 1;
+		//gVisibleParBegin=gVisibleParEnd-gDisplayCapacity;
+		if (gVisibleParBegin < 0) {
+			gVisibleParBegin = 0;
+		}
+	}
+	updataView();
+}
+
+function updataView() {
+	var topNewDivArray = Array(); //在顶端新加入的块列表
+	for (var iPar = 0; iPar < gArrayDocParagraph.length; iPar++) {
+		if (isParInView(iPar)) {
+			isLoadNew = reloadPar(iPar);
+			if (isLoadNew) {
+				if (iPar < gVisibleParBeginOld) {
+					topNewDivArray.push(iPar);
+				}
+			}
+		} else {
+			removePar(iPar);
+		}
+	}
+	word_mouse_event();
+	//console.log("updataview");
+	//console.log(topNewDivArray.toString());
+}
+
+function render_word_mean_menu2(spell) {
+	var wReal = spell;
+
+	var output = "<div>";
+	for (var iDict = 0; iDict < mDict[spell].length; iDict++) {
+		output += "<div>";
+		output += "<span>dict_name</span>";
+		var meanGroup = partList2[i].mean.split("$");
+		for (var iMean = 0; iMean < meanGroup.length; iMean++) {
+			output +=
+				"<span class='wm_one_mean' onclick='fieldListChanged(\"" +
+				wId +
+				'","mean","' +
+				meanGroup[iMean] +
+				"\")'>" +
+				meanGroup[iMean] +
+				"</span>";
+		}
+		output += "</div>";
+	}
+	output += "</div>";
+
+	return;
+
+	var sWord = new Array(wReal);
+	sWord = sWord.concat(render_get_word_parent_list(wReal));
+	for (var iWord in sWord) {
+		output += '<div class="case_dropdown-first">';
+		output +=
+			'<a style="z-index:250; position:absolute; margin-right:2em;" onclick=\'dict_search("' +
+			sWord[iWord] +
+			"\")'>";
+		output += sWord[iWord] + "</a>";
+		output += '<span style="z-index:220" class="case_dropdown-title" onclick="submenu_show_detail(this)">';
+		output += '<svg class="icon" style="fill:var(--main-color)"><use xlink:href="svg/icon.svg#ic_add"></use></svg>';
+		output += '</span><div class="case_dropdown-detail">';
+		var partList = render_get_word_mean_list(sWord[iWord]);
+		var L_width_mean = 0;
+
+		var partList2 = repeat_combine(partList);
+		//计算字符长度并控制
+		for (var i in partList2) {
+			var L_width = getLocalDictname(partList2[i].mean).replace(/[\u0391-\uFFE5]/g, "aa").length;
+			if (L_width_mean < L_width / 1.7) {
+				L_width_mean = L_width / 1.7;
+			}
+		}
+		for (var i in partList2) {
+			var meanGroup = partList2[i].mean.split("$");
+			var htmlMean = "";
+			output += "<a style='display:flex; flex-wrap: wrap;'>";
+			output +=
+				"<div id='div_dictname_" + wId + "_" + iWord + "_" + i + "' style='margin-right: auto; display:flex;'>";
+			//output  += "<a ><div id='div_dictname_"+wId+"_"+iWord+"_"+i+"' style='width: "+L_width_dictname+"em; display:flex'>"
+			output += "<span id='span_dictname_" + wId + "_" + iWord + "_" + i + "'";
+			output += "style='height: 1.5em;' class='wm_dictname' >"; //onclick='fieldListChanged1(\""+wId+"\",\"mean\",\""+partList2[i].mean+"\")'
+			output += getLocalDictname(partList2[i].dict) + "</span>";
+			output += "</div>";
+			output +=
+				"<div id='div_type_" + wId + "_" + iWord + "_" + i + "' style='margin-left: 0.4em; display:flex'>";
+			//output  += "<div id='div_type_"+wId+"_"+iWord+"_"+i+"' style='width: "+L_width_type+"em; display:flex'>"
+			output +=
+				"<span id='span_type_" +
+				wId +
+				"_" +
+				iWord +
+				"_" +
+				i +
+				"' style='height: 1.5em;' class='wm_wordtype'>" +
+				getLocalGrammaStr(partList2[i].type) +
+				"</span>";
+
+			for (var iMean in meanGroup) {
+				if (meanGroup[iMean] != "") {
+					htmlMean +=
+						"<span class='wm_one_mean' onclick='fieldListChanged(\"" +
+						wId +
+						'","mean","' +
+						meanGroup[iMean] +
+						"\")'>" +
+						meanGroup[iMean] +
+						"</span>";
+				}
+			}
+			output += "</div><div style='width:15em; display:flex; flex-wrap: wrap;'>" + htmlMean + "</div>";
+			output += "</a>";
+		}
+		output += "</div></div>";
+	}
+	output += "</div></div></div>";
+	return output;
+}
+
+/**
+ * 渲染单词意思下拉菜单
+ * @param {xmlnode} xElement 单词xml节点
+ * @returns 
+ */
+function render_word_mean_menu(xElement) {
+	var wMean = getNodeText(xElement, "mean");
+	var wReal = getNodeText(xElement, "real");
+	var wId = getNodeText(xElement, "id");
+	var renderMeaning = wMean.replace(/{/g, "<span class='grm_add_mean'>");
+	renderMeaning = renderMeaning.replace(/}/g, "</span>");
+	renderMeaning = renderMeaning.replace(/\[/g, "<span class='grm_add_mean_user'>");
+	renderMeaning = renderMeaning.replace(/\]/g, "</span>");
+
+	var output = "";
+	output += '<div class="case_dropdown">';
+	output += "<p class='case_dropbtn' >";
+	output += renderMeaning;
+	output += "</p>";
+	output += '<div class="case_dropdown-content">';
+	output += "<button ";
+	output += "style='font-size:100%;display:inline-flex; padding:0.1em 0.5em' ";
+	output += "onclick='fieldListChanged(\"" + wId + '","mean","")\'>' ;
+	output +=  gLocal.gui.empty1 ;
+	output += '</button>';
+	
+	output += '<div class="case_dropdown-org">';
+
+	var sWord = new Array(wReal);
+	sWord = sWord.concat(render_get_word_parent_list(wReal));
+	for (var iWord in sWord) {
+		output += '<div class="case_dropdown-first">';
+		output +=
+			'<a style="z-index:250; position:absolute; margin-right:2em;" onclick=\'dict_search("' +
+			sWord[iWord] +
+			"\")'>";
+		output += sWord[iWord] + "</a>";
+		output += '<span style="z-index:220" class="case_dropdown-title" onclick="submenu_show_detail(this)">';
+		output += '<svg class="icon" style="fill:var(--main-color)"><use xlink:href="svg/icon.svg#ic_add"></use></svg>';
+		output += "</span>";
+		output += '<div class="case_dropdown-detail">';
+
+		var partList = render_get_word_mean_list(sWord[iWord]);
+		var L_width_mean = 0;
+
+		var partList2 = repeat_combine(partList);
+
+		for (var i in partList2) {
+			var L_width = getLocalDictname(partList2[i].mean).replace(/[\u0391-\uFFE5]/g, "aa").length;
+			if (L_width_mean < L_width / 1.7) {
+				L_width_mean = L_width / 1.7;
+			}
+		}
+		for (var i in partList2) {
+			var meanGroup = partList2[i].mean.split("$");
+			var htmlMean = "";
+			output += "<a style='display:flex; flex-wrap: wrap;'>";
+			output +=
+				"<div id='div_dictname_" + wId + "_" + iWord + "_" + i + "' style='margin-right: auto; display:flex;'>";
+			output += "<span id='span_dictname_" + wId + "_" + iWord + "_" + i + "'";
+			output += "style='height: 1.5em;' class='wm_dictname' >"; //onclick='fieldListChanged1(\""+wId+"\",\"mean\",\""+partList2[i].mean+"\")'
+			output += getLocalDictname(partList2[i].dict) + "</span>";
+			output += "</div>";
+			output +=
+				"<div id='div_type_" + wId + "_" + iWord + "_" + i + "' style='margin-left: 0.4em; display:flex'>";
+			output +=
+				"<span id='span_type_" + wId + "_" + iWord + "_" + i + "' style='height: 1.5em;' class='wm_wordtype'>";
+			if (partList2[i].type == ".n:base.") {
+				output += getLocalGrammaStr(partList2[i].gramma);
+			} else {
+				output += getLocalGrammaStr(partList2[i].type);
+			}
+
+			output += "</span>";
+
+			for (var iMean in meanGroup) {
+				if (meanGroup[iMean] != "") {
+					htmlMean +=
+						"<span class='wm_one_mean' onclick='fieldListChanged(\"" +
+						wId +
+						'","mean","' +
+						meanGroup[iMean] +
+						"\")'>" +
+						meanGroup[iMean] +
+						"</span>";
+				}
+			}
+			output += "</div>";
+			output += "<div style='width:15em; display:flex; flex-wrap: wrap;'>" + htmlMean + "</div>";
+			output += "</a>";
+		}
+		output += "</div></div>";
+	}
+	output += "</div></div></div>";
+	return output;
+}
+
+/**
+ * 获取单词意思列表
+ * @param {string} sWord 
+ * @returns 
+ */
+function render_get_word_mean_list(sWord) {
+	var wReal = sWord;
+
+	var output = Array();
+
+	for (var x in g_DictWordList) {
+		if (g_DictWordList[x].Pali == wReal || g_DictWordList[x].Real == wReal) {
+			//用用户设置的语言过滤结果
+			if (dict_language_enable.indexOf(g_DictWordList[x].Language) >= 0) {
+				if (
+					g_DictWordList[x].Mean != "" &&
+					g_DictWordList[x].Type != ".part." &&
+					g_DictWordList[x].Type != ".root." &&
+					g_DictWordList[x].Type != ".suf." &&
+					g_DictWordList[x].Type != ".pfx."
+				) {
+					var newPart = Object();
+					newPart.dict = g_DictWordList[x].dictname;
+					newPart.mean = g_DictWordList[x].Mean;
+					newPart.type = g_DictWordList[x].Type;
+					var bIsExist = false;
+					for (var iBuffer in output) {
+						if (
+							output[iBuffer].dict == newPart.dict &&
+							output[iBuffer].type == newPart.type &&
+							output[iBuffer].mean == newPart.mean
+						) {
+							bIsExist = true;
+							break;
+						}
+						if (newPart.dict == "wbw") {
+							if (output[iBuffer].dict == newPart.dict && output[iBuffer].type == newPart.type) {
+								output[iBuffer].mean += "$" + newPart.mean;
+								bIsExist = true;
+								break;
+							}
+						}
+					}
+					if (!bIsExist) {
+						output.push(newPart);
+					}
+				}
+			}
+		}
+	}
+	return output;
+}
+
+function render_get_word_parent_list(sWord) {
+	var wReal = sWord;
+
+	var output = Array();
+
+	for (var x in g_DictWordList) {
+		if (g_DictWordList[x].Pali == wReal) {
+			{
+				if (g_DictWordList[x].Parent != "" && g_DictWordList[x].Parent != sWord) {
+					var newPart = g_DictWordList[x].Parent;
+					var bIsExist = false;
+					for (var iBuffer in output) {
+						if (output[iBuffer] == newPart) {
+							bIsExist = true;
+							break;
+						}
+					}
+					if (!bIsExist) {
+						output.push(newPart);
+					}
+				}
+			}
+		}
+	}
+	return output;
+}
+function repeat_combine(list) {
+	var list_new = new Array();
+
+	for (var repeat_combine_i = 0; repeat_combine_i < list.length; repeat_combine_i++) {
+		var repeat_string = new Object();
+		var repeat_combine_j = 0;
+		repeat_string.dict = list[repeat_combine_i].dict;
+		repeat_string.type = list[repeat_combine_i].type;
+		repeat_string.mean = list[repeat_combine_i].mean;
+		for (repeat_combine_j = repeat_combine_i + 1; repeat_combine_j < list.length; repeat_combine_j++) {
+			if (
+				list[repeat_combine_j].dict == list[repeat_combine_i].dict &&
+				list[repeat_combine_j].type == list[repeat_combine_i].type
+			) {
+				repeat_string.mean = repeat_string.mean + "$" + list[repeat_combine_j].mean;
+				repeat_string.mean = repeat_string.mean.replace(/\$\$/g, "$");
+				repeat_string.mean = repeat_string.mean.replace(/\$ /g, "$");
+				repeat_string.mean = repeat_string.mean.replace(/ \$/g, "$");
+				repeat_combine_i = repeat_combine_j;
+			}
+		}
+		repeat_string.mean = "#" + repeat_string.mean + "#";
+		repeat_string.mean = repeat_string.mean.replace(/ #/g, "");
+		repeat_string.mean = repeat_string.mean.replace(/# /g, "");
+		repeat_string.mean = repeat_string.mean.replace(/\$#/g, "");
+		repeat_string.mean = repeat_string.mean.replace(/#\$/g, "");
+		repeat_string.mean = repeat_string.mean.replace(/  /g, "");
+		repeat_string.mean = repeat_string.mean.replace(/#/g, "");
+		list_new.push(repeat_string);
+	}
+
+	return list_new;
+}
+
+function show_pop_note(wordid) {
+	let html = $("wnc[wid='" + wordid + "']")
+		.parent()
+		.html();
+	$("#word_note_pop_content").html(
+		html
+		/*note_init(doc_word("#" + wordid).val("note"))*/
+	);
+	$("#word_note_pop").show("500");
+}
+
+function refreshNoteNumber() {
+	$("wnh").each(function (index, element) {
+		let id = $(this).attr("wid");
+		//$(this).html("<a href='#word_note_"+id+"'  name=\"word_note_root_"+id+"\">"+(index+1)+"</a>");
+		$(this).html("<span>" + (index + 1) + "</span>");
+	});
+
+	$("wnc").each(function (index, element) {
+		let id = $(this).attr("wid");
+		$(this).html("<a href='#word_note_root_" + id + "' name=\"word_note_" + id + '">[' + (index + 1) + "]</a>");
+	});
+
+	note_refresh_new();
+}

+ 1180 - 0
public/app/studio/js/xml copy.js

@@ -0,0 +1,1180 @@
+var nWord = 0;
+
+var suttaWordList = new Array();
+var tranParagraph = new Array();
+var g_useMode;
+var g_countWordList = 0;
+var g_wordListOrderby = "count";
+var g_wordListOrder = false;
+var g_isDictFavo = false;
+var g_autoUpdataDB = true;
+
+var gTextEditMediaType = "";
+var gSutta = 0;
+var gPar = 0;
+var gTran = 0;
+var g_bookMark_array = ["a", "x", "1", "2", "3", "4", "5"];
+
+var wordList = new Array();
+
+function getNodeText(inNode, subTagName) {
+	try {
+		if (inNode && inNode.getElementsByTagName(subTagName).length > 0) {
+			if (inNode.getElementsByTagName(subTagName)[0].childNodes.length > 0) {
+				var mValue = inNode.getElementsByTagName(subTagName)[0].childNodes[0].nodeValue;
+				mValue = mValue.replace("&lt;", "<");
+				mValue = mValue.replace("&gt;", ">");
+				return mValue;
+			} else {
+				return "";
+			}
+		} else {
+			return "";
+		}
+	} catch (error) {
+		console.warn(error);
+		return "";
+	}
+	return "";
+}
+
+function setNodeText(inNode, subTagName, strValue) {
+	if (strValue == null) {
+		return;
+	}
+	var mValue = strValue.toString();
+	mValue = mValue.replace("<", "&lt;");
+	mValue = mValue.replace(">", "&gt;");
+	try {
+		if (inNode && inNode.getElementsByTagName(subTagName).length == 0) {
+			var newNode = gXmlBookData.createElement(subTagName);
+			var textnode = gXmlBookData.createTextNode(" ");
+			newNode.appendChild(textnode);
+			inNode.appendChild(newNode);
+		}
+		if (inNode.getElementsByTagName(subTagName).length > 0) {
+			if (inNode.getElementsByTagName(subTagName)[0].childNodes.length == 0) {
+				var textnode = gXmlBookData.createTextNode(" ");
+				inNode.getElementsByTagName(subTagName)[0].appendChild(textnode);
+			}
+			if (inNode.getElementsByTagName(subTagName)[0].childNodes.length > 0) {
+				inNode.getElementsByTagName(subTagName)[0].childNodes[0].nodeValue = strValue;
+			} else {
+				throw "can't accese text node";
+			}
+		} else {
+			throw subTagName + ":not a sub Taget";
+		}
+	} catch (error) {
+		var_dump(error);
+		return false;
+	}
+	return true;
+}
+
+function getNodeAttr(inNode, subTagName, attr) {
+	try {
+		return inNode.getElementsByTagName(subTagName)[0].getAttribute(attr);
+	} catch (error) {
+		console.warn(error);
+		return "";
+	}
+}
+
+function setNodeAttr(inNode, subTagName, attr, strValue) {
+	if ( inNode == null || subTagName === "" || attr === "") {
+		return;
+	}
+	let mValue = strValue.toString();
+	try {
+		if (inNode.getElementsByTagName(subTagName).length == 0) {
+			let newNode = gXmlBookData.createElement(subTagName);
+			let textnode = gXmlBookData.createTextNode(" ");
+			newNode.appendChild(textnode);
+			inNode.appendChild(newNode);
+		}
+		try {
+			inNode.getElementsByTagName(subTagName)[0].setAttribute(attr, mValue);
+		} catch (e) {
+			newatt = gXmlBookData.createAttribute(attr);
+			newatt.nodeValue = mValue;
+			inNode.getElementsByTagName(subTagName)[0].setAttributeNode(newatt);
+			return true;
+		}
+	} catch (error) {
+		console.error(error);
+		return false;
+	}
+	return true;
+}
+//根据xmlDocument 对象中的单词序号和单词节点创建单词块
+//返回 字符串
+function createWordBlockByNode(id, wordNode) {}
+
+function pushNewToList(inArray, strNew) {
+	//var isExist=false;
+	for (x in inArray) {
+		if (inArray[x] == strNew) {
+			return;
+		}
+	}
+	inArray.push(strNew);
+}
+function findFirstCaseInDict(inWord) {
+	var output = "?";
+	var pali = com_getPaliReal(inWord);
+	if (mDict[pali]) {
+		for (var iWord in mDict[pali]) {
+			{
+				if (mDict[pali][iWord].parts) {
+					if (mDict[pali][iWord].parts.length > 0) {
+						return mDict[pali][iWord].type + "#" + mDict[pali][iWord].gramma;
+					}
+				}
+			}
+		}
+	}
+	return output;
+}
+
+function findFirstPartInDict(inWord) {
+	var output = "?";
+	var pali = com_getPaliReal(inWord);
+	if (mDict[pali]) {
+		for (var iWord in mDict[pali]) {
+			{
+				if (mDict[pali][iWord].parts) {
+					if (mDict[pali][iWord].parts.length > 0) {
+						return mDict[pali][iWord].parts;
+					}
+				}
+			}
+		}
+	}
+	return output;
+}
+
+
+
+function LangInclude(lang,testLang){
+	if(lang.length>0){
+		return lang.includes(testLang);
+	}else{
+		return true;
+	}
+}
+
+
+/**
+ * 查找某单词的意思
+ * @param {string} inWord 要查找的单词拼写
+ * @returns 
+ */
+function findFirstMeanInDict(inWord) {
+	let output = "?";
+	let pali = com_getPaliReal(inWord);
+	if (mDict[pali]) {
+		for (const iterator of mDict[pali]) {
+			//if(dict_language_enable.indexOf(mDict[pali][iWord].language)>=0)
+			{
+				if (!isEmpty(iterator.mean)) {
+					return iterator.mean.split("$")[0];
+				}
+			}
+		}
+	}
+	return output;
+}
+/**
+ * 查找某单词在复合词中的意思
+ * @param {string} inWord 要查找的单词拼写
+ * @returns 
+ */
+function findFirstPartMeanInDict(inWord) {
+	let pali = inWord;
+	if (Object.hasOwnProperty.call(mDict, pali)) {
+		for (const iterator of mDict[pali]) {
+			if(LangInclude(setting['dict.lang'],iterator.language))
+			{
+				if (iterator.type == ".part." && !isEmpty(iterator.mean)) {
+					return iterator.mean.split("$")[0];
+				}
+			}
+		}
+		for (const iterator of mDict[pali]) {
+			if(LangInclude(setting['dict.lang'],iterator.language))
+			{
+				if (!isEmpty(iterator.mean)) {
+					return iterator.mean.split("$")[0];
+				}
+			}
+		}
+	}
+	return "?";
+}
+
+function findAllMeanInDict(inWord, limit) {
+	output = new Array();
+	for (var iCurrWord = 0; iCurrWord < g_DictWordList.length; iCurrWord++) {
+		if (g_DictWordList[iCurrWord].Pali == inWord) {
+			meanList = g_DictWordList[iCurrWord].Mean.split("$");
+			for (iMean in meanList) {
+				if (meanList[iMean].length > 0) {
+					output.push(meanList[iMean]);
+					if (output.length > limit) {
+						return output;
+					}
+				}
+			}
+		}
+	}
+	return output;
+}
+
+//确认对单个词的修改
+function modifyApply(sWordId, update_user_dict) {
+	let wordIndex = getWordIndex(sWordId);
+
+	let arr_id_word = sWordId.split("-");
+	let book = arr_id_word[0].slice(1);
+	let paragraph = arr_id_word[1];
+	let wId = arr_id_word[2];
+
+	let strApplyTo;
+	if (document.getElementById("checkbox_apply_same").checked) {
+		strApplyTo = "all";
+	} else {
+		strApplyTo = "current";
+	}
+
+	let wordCurrStatus = 9; //草稿
+	if (update_user_dict) {
+		wordCurrStatus = 7; //保存为正式
+	}
+
+	//关闭单词修改窗口
+	closeModifyWindow();
+	let x = gXmlBookDataBody.getElementsByTagName("word");
+
+	let msg_data = new Object();
+	msg_data.id = sWordId;
+
+	//原来的值
+	let sPaliReal = getNodeText(x[wordIndex], "real");
+	let sPaliParent = getNodeText(x[wordIndex], "parent");
+
+	//new value
+	let sPali = document.getElementById("id_text_pali").value;
+	let oldPali = getNodeText(x[wordIndex], "pali");
+	if (sPali != oldPali) {
+		setNodeText(x[wordIndex], "pali", sPali);
+		msg_data.pali = sPali;
+	}
+	setNodeAttr(x[wordIndex], "pali", "status", wordCurrStatus);
+
+	let sReal = document.getElementById("id_text_real").value;
+	let oldReal = getNodeText(x[wordIndex], "real");
+	if (sReal != oldReal) {
+		setNodeText(x[wordIndex], "real", sReal);
+		msg_data.real = sReal;
+	}
+	setNodeAttr(x[wordIndex], "real", "status", wordCurrStatus);
+
+	let sMeaning = document.getElementById("input_meaning").value;
+	let oldMean = getNodeText(x[wordIndex], "mean");
+	if (sMeaning != oldMean) {
+		setNodeText(x[wordIndex], "mean", sMeaning);
+		msg_data.mean = sMeaning;
+	}
+	setNodeAttr(x[wordIndex], "mean", "status", wordCurrStatus);
+
+	let sParent = document.getElementById("id_text_parent").value;
+	let oldParent = getNodeText(x[wordIndex], "parent");
+	if (sParent != oldParent) {
+		setNodeText(x[wordIndex], "parent", sParent);
+		msg_data.parent = sParent;
+	}
+	setNodeAttr(x[wordIndex], "parent", "status", wordCurrStatus);
+
+	let sParentGrammar = document.getElementById("input_parent_grammar").value;
+	let oldParentGrammar = getNodeText(x[wordIndex], "pg");
+	if (sParentGrammar != oldParentGrammar) {
+		setNodeText(x[wordIndex], "pg", sParentGrammar);
+		msg_data.pg = sParentGrammar;
+	}
+	setNodeAttr(x[wordIndex], "pg", "status", wordCurrStatus);
+
+	let sParentParent = document.getElementById("id_text_prt_prt").value;
+	let oldParentParent = getNodeText(x[wordIndex], "parent2");
+	if (sParentParent != oldParentParent) {
+		setNodeText(x[wordIndex], "parent2", sParentParent);
+		msg_data.parent2 = sParentParent;
+	}
+	setNodeAttr(x[wordIndex], "parent2", "status", wordCurrStatus);
+
+	let sOrg = document.getElementById("input_org").value;
+	let oldOrg = getNodeText(x[wordIndex], "org");
+	if (sOrg != oldOrg) {
+		setNodeText(x[wordIndex], "org", sOrg);
+		msg_data.org = sOrg;
+	}
+	setNodeAttr(x[wordIndex], "org", "status", wordCurrStatus);
+
+	let sOm = document.getElementById("input_om").value;
+	let oldOm = getNodeText(x[wordIndex], "om");
+	if (oldOm != sOm) {
+		setNodeText(x[wordIndex], "om", sOm);
+		msg_data.om = sOm;
+	}
+	setNodeAttr(x[wordIndex], "om", "status", wordCurrStatus);
+
+	let sCase = document.getElementById("input_case").value;
+	let oldCase = getNodeText(x[wordIndex], "case");
+	if (oldCase != sCase) {
+		setNodeText(x[wordIndex], "case", sCase);
+		msg_data.case = sCase;
+	}
+	setNodeAttr(x[wordIndex], "case", "status", wordCurrStatus);
+
+	let bLocked = document.getElementById("input_lock").checked;
+	let oldLock = getNodeText(x[wordIndex], "lock");
+	if (bLocked != oldLock) {
+		setNodeText(x[wordIndex], "lock", bLocked);
+		msg_data.lock = bLocked;
+	}
+	setNodeAttr(x[wordIndex], "lock", "status", wordCurrStatus);
+
+	let txtBookMark = document.getElementById("id_text_bookmark").value;
+	let oldBookMarkText = getNodeText(x[wordIndex], "bmt");
+	if (oldBookMarkText != txtBookMark) {
+		setNodeText(x[wordIndex], "bmt", txtBookMark);
+		msg_data.bmt = txtBookMark;
+	}
+	setNodeAttr(x[wordIndex], "bmt", "status", wordCurrStatus);
+
+	let oldBookMarkColor = getNodeText(x[wordIndex], "bmc");
+	if (oldBookMarkColor == "") {
+		oldBookMarkColor = "bmc0";
+	}
+	if (oldBookMarkColor != g_currBookMarkColor) {
+		setNodeText(x[wordIndex], "bmc", g_currBookMarkColor);
+		msg_data.bmc = g_currBookMarkColor;
+		g_currBookMarkColor = "";
+	}
+	setNodeAttr(x[wordIndex], "bmc", "status", wordCurrStatus);
+
+	let updateNoteNum = false;
+	let txtNote = document.getElementById("id_text_note").value;
+	let prevNote = getNodeText(x[wordIndex], "note");
+	if (prevNote != txtNote) {
+		setNodeText(x[wordIndex], "note", txtNote);
+		//refreshWordNote(x[wordIndex].parentNode.parentNode);
+		msg_data.note = txtNote;
+		//updateWordNote(x[wordIndex]);
+		updateNoteNum = true;
+	}
+
+	let sRalation = $("#id_relation_text").val();
+	let oldRalation = getNodeText(x[wordIndex], "rala");
+	if (oldRalation != sRalation) {
+		setNodeText(x[wordIndex], "rela", sRalation);
+		msg_data.rela = sRalation;
+		//updateWordRelation(x[wordIndex]);
+		updateNoteNum = true;
+	}
+
+	{
+		setNodeText(x[wordIndex], "status", wordCurrStatus); //自己手动 或 草稿
+		msg_data.status = wordCurrStatus;
+	}
+
+	user_wbw_push_word(sWordId);
+
+	modifyWordDetailByWordIndex(wordIndex);
+	updataWordHeadByIndex(wordIndex);
+	if (updateNoteNum) {
+		refreshWordNoteDiv(x[wordIndex].parentNode.parentNode);
+		refreshNoteNumber();
+	}
+
+	//send message
+	let d = new Date();
+	let msg_doc_id;
+	if (doc_info.sendmsg) {
+		if (doc_info.parent_id != "") {
+			msg_doc_id = doc_info.parent_id;
+		} else {
+			msg_doc_id = doc_info.doc_id;
+		}
+
+		msg_push(1, JSON.stringify(msg_data), msg_doc_id, d.getTime(), book, paragraph);
+	}
+	//The end of send message
+
+	let objWord = new Object();
+	objWord.Pali = getNodeText(x[wordIndex], "real");
+	sCase = getNodeText(x[wordIndex], "case");
+	let mGramma = sCase.split("#");
+	if (mGramma.length >= 2) {
+		mType = sCase.split("#")[0];
+		mGramma = sCase.split("#")[1];
+	} else {
+		mType = "";
+		mGramma = sCase.split("#")[0];
+	}
+
+	//将单词加入内存字典
+	var objDictItem = new Object(); /*一个字典元素*/
+	objDictItem.id = 0;
+	objDictItem.guid = "";
+	objDictItem.pali = getNodeText(x[wordIndex], "pali");
+	objDictItem.type = mType;
+	objDictItem.gramma = mGramma;
+	objDictItem.parent = getNodeText(x[wordIndex], "parent");
+	objDictItem.mean = getNodeText(x[wordIndex], "mean");
+	objDictItem.note = getNodeText(x[wordIndex], "note");
+	objDictItem.parts = getNodeText(x[wordIndex], "org");
+	objDictItem.partmean = getNodeText(x[wordIndex], "om");
+	objDictItem.status = 0;
+	objDictItem.dict_name = "Memo";
+	objDictItem.language = "zh";
+	objDictItem.confidence = 100;
+	if (objDictItem.type == "" || objDictItem.type.indexOf("?") != -1) {
+		objDictItem.confidence = objDictItem.confidence * 0.9;
+	}
+	if (objDictItem.type != ".un." && objDictItem.type != ".comp.") {
+		if (objDictItem.gramma == "" || objDictItem.gramma.indexOf("?") != -1 || objDictItem.gramma.indexOf("$") != 0) {
+			objDictItem.confidence = objDictItem.confidence * 0.9;
+		}
+		if (objDictItem.mean == "" || objDictItem.mean.indexOf("?") != -1) {
+			objDictItem.confidence = objDictItem.confidence * 0.9;
+		}
+		if (objDictItem.partmean == "" || objDictItem.partmean.indexOf("?") != -1) {
+			objDictItem.confidence = objDictItem.confidence * 0.9;
+		}
+	}
+	if (objDictItem.parts == "" || objDictItem.parts.indexOf("?") != -1) {
+		objDictItem.confidence = objDictItem.confidence * 0.9;
+	}
+	if (!mDict[objDictItem.pali]) {
+		mDict[objDictItem.pali] = new Array();
+	}
+	//insert to top of memory dict
+	mDict[objDictItem.pali].unshift(objDictItem);
+
+	let parts = getNodeText(x[wordIndex], "org");
+	let partmean = getNodeText(x[wordIndex], "om");
+
+	//add parent infomation
+
+	switch (mType) {
+		case ".n.":
+			mType = ".n:base.";
+			mGramma = mGramma.split("$")[0];
+			if (mGramma == ".m." || mGramma == ".f." || mGramma == ".nt.") {
+			} else {
+				mGramma = "";
+			}
+			break;
+		case ".adj.":
+			mType = ".adj:base.";
+			mGramma = "";
+			break;
+		case ".ti.":
+			mType = ".ti:base.";
+			mGramma = "";
+			break;
+		case ".pron.":
+			d_parentType = ".pron:base.";
+			d_parentGramma = "";
+			break;
+		case ".num.":
+			d_parentType = ".num:base.";
+			d_parentGramma = "";
+			break;
+		case ".v.":
+			mType = ".v:base.";
+			mGramma = "";
+			break;
+	}
+
+	//将单词base加入内存字典
+	if (getNodeText(x[wordIndex], "parent") != "") {
+		var objDictItem = new Object(); /*一个字典元素*/
+		objDictItem.id = 0;
+		objDictItem.guid = "";
+		objDictItem.pali = getNodeText(x[wordIndex], "parent");
+		objDictItem.type = mType;
+		objDictItem.gramma = mGramma;
+		objDictItem.parent = "";
+		objDictItem.mean = removeFormulaB(getNodeText(x[wordIndex], "mean"), "[", "]");
+		objDictItem.mean = removeFormulaB(objDictItem.mean, "{", "}");
+		objDictItem.note = getNodeText(x[wordIndex], "note");
+
+		//remove the "[***]" in the end
+		let d_factors = getNodeText(x[wordIndex], "org");
+		let fc = d_factors.split("+");
+		if (fc.length > 0 && fc[fc.length - 1].slice(0, 1) == "[" && fc[fc.length - 1].slice(-1) == "]") {
+			fc.pop();
+		}
+		objDictItem.parts = fc.join("+");
+		let fm = getNodeText(x[wordIndex], "om").split("+");
+		fm.length = fc.length;
+		objDictItem.partmean = fm.join("+");
+
+		objDictItem.status = 0;
+		objDictItem.confidence = 100;
+		if (objDictItem.type == "" || objDictItem.gramma.indexOf("?") != -1) {
+			objDictItem.confidence = objDictItem.confidence * 0.9;
+		}
+		if (objDictItem.gramma == "" || objDictItem.gramma.indexOf("?") != -1 || objDictItem.gramma.indexOf("$") != 0) {
+			objDictItem.confidence = objDictItem.confidence * 0.9;
+		}
+		if (objDictItem.mean == "" || objDictItem.gramma.indexOf("?") != -1) {
+			objDictItem.confidence = objDictItem.confidence * 0.9;
+		}
+		if (objDictItem.parts == "" || objDictItem.gramma.indexOf("?") != -1) {
+			objDictItem.confidence = objDictItem.confidence * 0.9;
+		}
+		if (objDictItem.partmean == "" || objDictItem.gramma.indexOf("?") != -1) {
+			objDictItem.confidence = objDictItem.confidence * 0.9;
+		}
+		if (!mDict[objDictItem.pali]) {
+			mDict[objDictItem.pali] = new Array();
+		}
+		objDictItem.dict_name = "Memo";
+		objDictItem.language = "zh";
+		if (!mDict[objDictItem.pali]) {
+			mDict[objDictItem.pali] = new Array();
+		}
+		mDict[objDictItem.pali].unshift(objDictItem);
+	}
+	// The end of memory dictionary
+
+	//apply all
+	let searchBegin = 0;
+	let searchEnd = 0;
+	switch (strApplyTo) {
+		case "all":
+			searchBegin = 0;
+			searchEnd = x.length;
+			break;
+		case "up":
+			searchBegin = 0;
+			searchEnd = wordIndex;
+			break;
+		case "down":
+			searchBegin = wordIndex;
+			searchEnd = x.length;
+			break;
+	}
+	if (strApplyTo != "current") {
+		//sPaliWord = x[sWordId].getElementsByTagName("pali")[0].childNodes[0].nodeValue;
+		let iSameWordCount = 0;
+		setNodeText(x[wordIndex], "pali", sPali); //拼寫顯示修改僅僅應用當前詞——Kosalla
+
+		for (iSearch = searchBegin; iSearch < searchEnd; iSearch++) {
+			if (sWordId != iSearch) {
+				//xmlNotePali = x[i].getElementsByTagName("pali")[0].childNodes[0].nodeValue;
+				xmlNotePali = getNodeText(x[iSearch], "real");
+				if (xmlNotePali == sPaliReal) {
+					if (getNodeText(x[iSearch], "lock") != "true") {
+						setNodeText(x[iSearch], "real", sReal);
+						setNodeText(x[iSearch], "parent", sParent);
+						setNodeText(x[iSearch], "mean", sMeaning);
+						setNodeText(x[iSearch], "org", sOrg);
+						setNodeText(x[iSearch], "om", sOm);
+						setNodeText(x[iSearch], "case", sCase);
+						setNodeText(x[iSearch], "bmc", g_currBookMarkColor);
+						setNodeText(x[iSearch], "note", txtNote);
+						switch (editor_word_status(x[iSearch])) {
+							case 0:
+							case 1:
+							case 2:
+							case 3:
+							case 4:
+							case 6:
+								editor_word_status(x[iSearch], 5);
+								break;
+						}
+						user_wbw_push_word(getNodeText(x[iSearch], "id"));
+						modifyWordDetailByWordIndex(iSearch);
+						updataWordHeadByIndex(iSearch);
+						console.log("updata:" + iSearch + "<br />", 0);
+						iSameWordCount = iSameWordCount + 1;
+					}
+				}
+				xmlNoteParent = getNodeText(x[iSearch], "parent");
+				if (
+					xmlNotePali != sPaliReal &&
+					xmlNoteParent == sPaliParent &&
+					xmlNoteParent != "" &&
+					xmlNoteParent != " "
+				) {
+					if (getNodeText(x[iSearch], "lock") != "true") {
+						setNodeText(x[iSearch], "mean", sMeaning);
+						user_wbw_push_word(getNodeText(x[iSearch], "id"));
+						modifyWordDetailByWordIndex(iSearch);
+						updataWordHeadByIndex(iSearch);
+						iSameWordCount = iSameWordCount + 1;
+					}
+				}
+			}
+		}
+		var_dump("same word:" + (iSameWordCount - 1));
+	}
+	refreshBookMark();
+	user_wbw_commit();
+	refreshNoteNumber();
+	//上传到用户字典
+	if (update_user_dict) {
+		upload_to_my_dict();
+	}
+}
+
+function getWordIndex(GUID) {
+	var xAllWord = gXmlBookDataBody.getElementsByTagName("word");
+	for (var iWord = 0; iWord < xAllWord.length; iWord++) {
+		if (getNodeText(xAllWord[iWord], "id") == GUID) {
+			return iWord;
+		}
+	}
+	return -1;
+}
+
+function addFavorite() {
+	g_isDictFavo = !g_isDictFavo;
+	if (g_isDictFavo) {
+		document.getElementById("temp").innerHTML = "★";
+	} else {
+		document.getElementById("temp").innerHTML = "☆";
+	}
+}
+//用单词表中的一个记录更改经文中的单词
+function updataWord(id) {
+	var debugstr;
+	try {
+		sPali = document.getElementById("wlpali" + id).value;
+		sReal = document.getElementById("wlreal" + id).value;
+		sOrg = document.getElementById("wlorg" + id).value;
+		sMean = document.getElementById("wlmean" + id).value;
+		sCase = document.getElementById("wlcase" + id).value;
+
+		var m_WordIdList = new Array();
+		m_WordIdList = wordList[id].wordid.toString().split("$");
+		var xAllWord = gXmlBookDataBody.getElementsByTagName("word");
+
+		for (indexWordList = 0; indexWordList < m_WordIdList.length; indexWordList++) {
+			//将修改结果保存到xml DOM中
+			if (m_WordIdList[indexWordList] >= 0) {
+				setNodeText(xAllWord[m_WordIdList[indexWordList]], "pali", sPali);
+				setNodeText(xAllWord[m_WordIdList[indexWordList]], "real", sReal);
+				setNodeText(xAllWord[m_WordIdList[indexWordList]], "org", sOrg);
+				setNodeText(xAllWord[m_WordIdList[indexWordList]], "mean", sMean);
+				setNodeText(xAllWord[m_WordIdList[indexWordList]], "case", sCase);
+				var sId = getNodeText(xAllWord[m_WordIdList[indexWordList]], "id");
+				var wordDetail = renderWordDetailById(sId);
+				var strDetailName = "detail" + sId;
+				document.getElementById(strDetailName).innerHTML = wordDetail;
+				updataWordHeadById(sId);
+			}
+		}
+		var_dump("" + m_WordIdList.length + "");
+		document.getElementById("wlApply" + id).disabled = true;
+	} catch (e) {
+		var_dump(e);
+	}
+}
+
+//比较两个词是否一样
+function compareWordInList(word1, word2) {
+	var sItems1 = new Array();
+	sItem1 = word1.split(";");
+	var sItems2 = new Array();
+	sItem2 = word2.split(";");
+	var sConcat1 = sItem1[0] + sItem1[1] + sItem1[2] + sItem1[3];
+	var sConcat2 = sItem2[0] + sItem1[1] + sItem1[2] + sItem1[3];
+	if (sConcat1 == sConcat2) {
+		return true;
+	} else {
+		return false;
+	}
+}
+
+function sortWordList(strOrderby) {
+	g_wordListOrderby = strOrderby;
+	g_wordListOrder = !g_wordListOrder;
+	refreshWordList();
+}
+function CountVocabulary() {
+	var sPali = "";
+	var sOrg = "";
+	var sMean = "";
+	var sCase = "";
+	var wordList1 = new Array();
+	var arrCombinWord = new Array();
+	var arrCombinWordOrder = new Array();
+
+	var arrCount = new Array();
+	var iCount = 0;
+	var sTableWordList = "";
+	var arrowCount = "";
+	var arrowPali = "";
+	var arrowReal = "";
+
+	//提取所有词
+	var xAllWord = gXmlBookDataBody.getElementsByTagName("word");
+	if (xAllWord.length == 0) {
+		return "no word data.";
+	}
+	var outWordList = "";
+	for (iword = 0; iword < xAllWord.length; iword++) {
+		var objWord = new Object();
+		objWord.id = getNodeText(xAllWord[iword], "id");
+		objWord.pali = getNodeText(xAllWord[iword], "pali");
+		objWord.real = getNodeText(xAllWord[iword], "real");
+		objWord.mean = getNodeText(xAllWord[iword], "mean");
+		objWord.org = getNodeText(xAllWord[iword], "org");
+		objWord.om = getNodeText(xAllWord[iword], "om");
+		objWord.case = getNodeText(xAllWord[iword], "case");
+		objWord.index = iword;
+		objWord.count = 1;
+		objWord.wordid = iword;
+		if (objWord.real != "") {
+			addWordToWordList(wordList1, objWord);
+		}
+	}
+	return wordList1.length;
+}
+//生成单词列表
+function makeWordList() {
+	var sPali = "";
+	var sOrg = "";
+	var sMean = "";
+	var sCase = "";
+
+	var arrCombinWord = new Array();
+	var arrCombinWordOrder = new Array();
+
+	var arrCount = new Array();
+	var iCount = 0;
+	var sTableWordList = "";
+	var arrowCount = "";
+	var arrowPali = "";
+	var arrowReal = "";
+
+	//提取所有词
+	var xAllWord = gXmlBookDataBody.getElementsByTagName("word");
+	if (xAllWord.length == 0) {
+		return "no word data.";
+	}
+	var outWordList = "";
+	for (iword = 0; iword < xAllWord.length; iword++) {
+		var objWord = new Object();
+		objWord.id = getNodeText(xAllWord[iword], "id");
+		objWord.pali = getNodeText(xAllWord[iword], "pali");
+		objWord.real = getNodeText(xAllWord[iword], "real");
+		objWord.mean = getNodeText(xAllWord[iword], "mean");
+		objWord.org = getNodeText(xAllWord[iword], "org");
+		objWord.om = getNodeText(xAllWord[iword], "om");
+		objWord.case = getNodeText(xAllWord[iword], "case");
+		objWord.index = iword;
+		objWord.count = 1;
+		objWord.wordid = iword;
+		if (objWord.real != "") {
+			addWordToWordList(wordList, objWord);
+		}
+	}
+	switch (g_wordListOrderby) {
+		case "count":
+			if (g_wordListOrder) {
+				wordList.sort(sortCountDesc);
+				arrowCount = "↓";
+			} else {
+				wordList.sort(sortCountAsc);
+				arrowCount = "↑";
+			}
+			break;
+		case "pali":
+			if (g_wordListOrder) {
+				wordList.sort(sortPaliDesc);
+				arrowPali = "↓";
+			} else {
+				wordList.sort(sortPaliAsc);
+				arrowPali = "↑";
+			}
+			break;
+		case "real":
+			if (g_wordListOrder) {
+				wordList.sort(sortRealDesc);
+				arrowReal = "↓";
+			} else {
+				wordList.sort(sortRealAsc);
+				arrowReal = "↑";
+			}
+			break;
+	}
+
+	sTableWordList = sTableWordList + "<table border='0' cellpadding='3' ><tr  class='h'>";
+	sTableWordList = sTableWordList + "<th>序号</th>";
+	sTableWordList =
+		sTableWordList + '<th><a herf="" onclick="sortWordList(\'count\')">计数' + arrowCount + "</a></th>";
+	sTableWordList = sTableWordList + '<th><a herf="" onclick="sortWordList(\'pali\')">Pali' + arrowPali + "</a></th>";
+	sTableWordList = sTableWordList + '<th><a herf="" onclick="sortWordList(\'real\')">Real' + arrowReal + "</a></th>";
+	sTableWordList = sTableWordList + "<th>原型</th>";
+	sTableWordList = sTableWordList + "<th>译文</th>";
+	sTableWordList = sTableWordList + "<th>语法</th>";
+	sTableWordList =
+		sTableWordList +
+		"<th><button type='button' id='btnApplyAll' onclick=\"applyAllWordInList(this)\" disabled>Apply All</button></th></tr>";
+
+	for (var i = 0; i < wordList.length; i++) {
+		objWord = wordList[i];
+		sTableWordList += "<tr><td>" + i + "</td>";
+		sTableWordList += "<td id='tablepali" + i + "'>" + objWord.count + "</td>";
+		//sTableWordList += "<td>" +objWord.pali + "</td>";
+		//sTableWordList += "<td>" +objWord.real + "</td>";
+		sTableWordList +=
+			'<td><input id="wlpali' +
+			i +
+			'" onkeyup="wordListItemChanged(\'wlApply' +
+			i +
+			"')\" value = '" +
+			objWord.pali +
+			"' />";
+		sTableWordList +=
+			'<td><input id="wlreal' +
+			i +
+			'" onkeyup="wordListItemChanged(\'wlApply' +
+			i +
+			"')\" value = '" +
+			objWord.real +
+			"' /></td>";
+		sTableWordList +=
+			'<td><input id="wlorg' +
+			i +
+			'" onkeyup="wordListItemChanged(\'wlApply' +
+			i +
+			"')\" value = '" +
+			objWord.org +
+			"' />";
+		sTableWordList +=
+			'<td><input id="wlmean' +
+			i +
+			'" onkeyup="wordListItemChanged(\'wlApply' +
+			i +
+			"')\" value = '" +
+			objWord.mean +
+			"' /></td>";
+		sTableWordList +=
+			'<td><input id="wlcase' +
+			i +
+			'" onkeyup="wordListItemChanged(\'wlApply' +
+			i +
+			"')\" value = '" +
+			objWord.case +
+			"' /></td>";
+		sTableWordList +=
+			'<td><button id="wlApply' +
+			i +
+			'" onclick="updataWord(\'' +
+			i +
+			"')\" type='button' disabled >Apply</button></td></tr>";
+	}
+
+	sTableWordList = sTableWordList + "</table>";
+	g_countWordList = wordList.length;
+	return sTableWordList;
+}
+function sortCountDesc(a, b) {
+	return a.count - b.count;
+}
+function sortCountAsc(a, b) {
+	return b.count - a.count;
+}
+
+function sortPaliDesc(a, b) {
+	return a.pali.localeCompare(b.pali);
+}
+function sortPaliAsc(a, b) {
+	return b.pali.localeCompare(a.pali);
+}
+
+function sortRealDesc(a, b) {
+	return a.real.localeCompare(b.real);
+}
+function sortRealAsc(a, b) {
+	return b.real.localeCompare(a.real);
+}
+
+function addWordToWordList(wordArray, newWord) {
+	var index = -1;
+
+	for (var i = 0; i < wordArray.length; i++) {
+		if (wordArray[i].pali == newWord.pali) {
+			if (wordArray[i].real == newWord.real) {
+				if (wordArray[i].mean == newWord.mean) {
+					if (wordArray[i].org == newWord.org) {
+						if (wordArray[i].om == newWord.om) {
+							if (wordArray[i].case == newWord.case) {
+								index = i;
+								break;
+							}
+						}
+					}
+				}
+			}
+		}
+	}
+	if (index >= 0) {
+		wordArray[index].count++;
+		wordArray[index].wordid += "$" + newWord.index;
+	} else {
+		wordArray.push(newWord);
+	}
+}
+
+function refreshWordList() {
+	document.getElementById("word_table_inner").innerHTML = makeWordList();
+}
+
+function wordListItemChanged(btnApplyId) {
+	try {
+		document.getElementById(btnApplyId).disabled = false;
+		document.getElementById("btnApplyAll").disabled = false;
+	} catch (e) {
+		alert(e);
+	}
+}
+
+function applyAllWordInList() {
+	for (var i = 0; i < g_countWordList; i++) {
+		if (document.getElementById("wlApply" + i).disabled == false) {
+			updataWord(i);
+		}
+	}
+	document.getElementById("btnApplyAll").disabled = true;
+}
+
+function tran_edit(iSutta, iPar, iTran) {
+	gTextEditMediaType = "translate";
+	gSutta = iSutta;
+	gPar = iPar;
+	gTran = iTran;
+	var tranText = getTranText(iSutta, iPar, iTran);
+	document.getElementById("id_text_edit_area").value = tranText;
+	document.getElementById("id_text_edit_form").style.display = "block";
+}
+
+/*make book mark*/
+function bookMark() {
+	var colorStyle = "";
+	var strBookMark = "";
+	var iWordCount = 0;
+
+	xWord = gXmlBookDataBody.getElementsByTagName("word");
+	/*遍历所有单词*/
+	var xBlock = gXmlBookDataBody.getElementsByTagName("block");
+	var iWordCount = 0;
+	for (iBlock = 0; iBlock < xBlock.length; iBlock++) {
+		var xData = xBlock[iBlock].getElementsByTagName("data")[0];
+		parInfo = xBlock[iBlock].getElementsByTagName("info")[0];
+		book = getNodeText(parInfo, "book");
+		parNo = getNodeText(parInfo, "paragraph");
+
+		xWord = xData.getElementsByTagName("word");
+		for (k = 0; k < xWord.length; k++) {
+			strWordPali = getNodeText(xWord[k], "pali");
+			strWordMean = getNodeText(xWord[k], "mean");
+			strWordId = getNodeText(xWord[k], "id");
+			strWordBookMarkColor = getNodeText(xWord[k], "bmc");
+			if (strWordBookMarkColor.length > 0) {
+				if (strWordBookMarkColor.substr(3, 1) != 0) {
+					/*屏蔽显示注释的Bug*/
+					var markString = strWordBookMarkColor.substr(3, 1);
+					colorStyle = "bookmarkcolor" + markString;
+					var bookMarkId = "w" + strWordId;
+					strBookMark +=
+						'<p class="bm' +
+						markString +
+						"\"><span class='bookmarkcolorblock , " +
+						colorStyle +
+						"'>" +
+						markString +
+						"</span>";
+					//strBookMark += "<a href=\"#"+bookMarkId+"\">"+strWordPali+":"+strWordMean.substr(3,10)+"</a></p>";
+					strBookMark +=
+						"<a onclick=\"editor_goto_link('" +
+						book +
+						"'," +
+						parNo +
+						",'" +
+						bookMarkId +
+						"')\">" +
+						strWordPali +
+						":" +
+						strWordMean.substr(3, 10) +
+						"</a></p>";
+				}
+			}
+			iWordCount++;
+		}
+	}
+
+	return strBookMark;
+}
+function setBookmarkVisibility_all() {
+	var book_MarkId_array = new Array();
+	var book_MarkClass_array = new Array();
+	for (bookMark_i in g_bookMark_array) {
+		book_MarkId_array.push("B_Bookmark_" + g_bookMark_array[bookMark_i]);
+		book_MarkClass_array.push("bm" + g_bookMark_array[bookMark_i]);
+	}
+	var isVisible = document.getElementById("B_Bookmark_All").checked;
+	for (bookMark_j in book_MarkId_array) {
+		eval("document.getElementById('" + book_MarkId_array[bookMark_j] + "').checked=isVisible");
+		getStyleClass(book_MarkClass_array[bookMark_j]).style.display = isVisible ? "block" : "none";
+		var book_mark_spanId = "";
+		book_mark_spanId = book_MarkId_array[bookMark_j] + "_span";
+		if (isVisible == true) {
+			eval("lock_key(" + book_mark_spanId + ".id,'on','" + book_MarkId_array[bookMark_j] + "','bookmark')");
+		} else {
+			eval("lock_key(" + book_mark_spanId + ".id,'off','" + book_MarkId_array[bookMark_j] + "','bookmark')");
+		}
+	}
+}
+function setBookmarkVisibility(className, controlID) {
+	var isVisible = document.getElementById(controlID).checked;
+	getStyleClass(className).style.display = isVisible ? "flex" : "none";
+}
+/*刷新书签*/
+function refreshBookMark() {
+	document.getElementById("navi_bookmark_inner").innerHTML = bookMark();
+}
+/*Apply all system match words*/
+function applyAllSysMatch() {
+	var iWordCount = 0;
+	var iModified = 0;
+
+	xWord = gXmlBookDataBody.getElementsByTagName("word");
+	/*遍历此经中所有单词*/
+	for (k = 0; k < xWord.length; k++) {
+		{
+			if (getNodeText(xWord[k], "bmc") == "bmca") {
+				setNodeText(xWord[k], "bmc", "bmc0");
+				updataWordBodyByElement(xWord[k]);
+				iModified++;
+			}
+		}
+		iWordCount++;
+	}
+
+	if (iWordCount > 0) {
+		document.getElementById("navi_bookmark_inner").innerHTML = bookMark();
+	}
+	var_dump(iModified + "个单词被确认。");
+}
+
+function setUseMode(strUseMode) {
+	var multi_trans_strUseMode = gLocal.gui.edit;
+	if (strUseMode == "Read") {
+		multi_trans_strUseMode =
+			'<svg class="icon"><use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="svg/icon.svg#ic_reader_mode"></use></svg>';
+	} else {
+		multi_trans_strUseMode =
+			'<svg class="icon"><use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="svg/icon.svg#ic_mode_edit"></use></svg>';
+	}
+	document.getElementById("use_mode").innerHTML =
+		multi_trans_strUseMode + '<svg class="small_icon"><use xlink:href="svg/icon.svg#ic_down"></use></svg>';
+	switch (strUseMode) {
+		case "Read":
+			g_useMode = "read";
+			getStyleClass("edit_tran_button").style.display = "none";
+			getStyleClass("edit_tool").style.display = "none";
+			getStyleClass("tran_input").style.display = "none";
+			break;
+		case "Edit":
+			g_useMode = "edit";
+			getStyleClass("edit_tran_button").style.display = "inline";
+			getStyleClass("edit_tool").style.display = "inline";
+			getStyleClass("tran_input").style.display = "none";
+			break;
+		case "Translate":
+			g_useMode = "translate";
+			getStyleClass("edit_tran_button").style.display = "inline";
+			getStyleClass("tran_input").style.display = "block";
+			break;
+	}
+
+	if (gXmlBookDataBody != null) {
+		var mWordNode = gXmlBookDataBody.getElementsByTagName("word");
+		/*遍历所有单词*/
+		for (k = 0; k < mWordNode.length; k++) {
+			modifyWordDetailByWordIndex(k);
+		}
+	}
+
+	document.getElementById("menuUseMode").style.display = "none";
+}
+
+function setUseMode_Static(strUseMode) {
+	if (strUseMode == "chanting") {
+		document.getElementById("use_mode").innerHTML = "Chanting";
+		g_useMode = "chanting";
+		getStyleClass("chanting_enter").style.display = "block";
+	} else {
+		document.getElementById("use_mode").innerHTML = "Read";
+		g_useMode = "read";
+		getStyleClass("chanting_enter").style.display = "none";
+	}
+
+	dropbtnClick("menu01");
+}
+
+function hiddenMenu() {
+	getStyleClass("dropdown-content").style.display = "none";
+}
+
+function sortMeanByDictOrder(wa, wb) {
+	var w1 = wa.split("$")[0];
+	var w2 = wb.split("$")[0];
+	var index1 = wa.split("$")[1];
+	var index2 = wb.split("$")[1];
+	//order by dictionary index
+	order = w1 - w2;
+	if (order == 0) {
+		//if dictionay is same order by index of meaning array
+		order = index1 - index2;
+	}
+
+	return order;
+}
+
+function sortMeanByLanguageOrder(wa, wb) {
+	var w1 = wa.split("$")[4];
+	var w2 = wb.split("$")[4];
+	//order by dictionary index
+	order = w1 - w2;
+	return order;
+}
+
+function removeSameWordInArray(wordList) {
+	var output = new Array();
+
+	for (indexWord in wordList) {
+		oneWord = wordList[indexWord].split("$");
+		var isExist = false;
+		for (x in output) {
+			if (output[x].word == oneWord[3]) {
+				isExist = true;
+			}
+		}
+		if (!isExist) {
+			var objWord = new Object();
+			objWord.word = oneWord[3];
+			objWord.parent = oneWord[2];
+			output.push(objWord);
+		}
+	}
+	return output;
+}