Просмотр исходного кода

Merge pull request #551 from visuddhinanda/master

词源信息下拉菜单及清空 查字典
visuddhinanda 4 лет назад
Родитель
Сommit
e9e5b6fc2e

+ 7 - 6
app/article/index.php

@@ -238,12 +238,7 @@ function set_toc_visible(isVisible){
 
 	<div style="margin: auto 0;">
 		<span id="head_span">
-			<select id="select_lang" onchange="lang_changed(this)">
-					<option>全部语言</option>
-					<option>简体中文</option>
-					<option>繁体中文</option>
-					<option>英文</option>
-			</select>
+
 		<?php
 		
 		if(isset($_GET["view"]) && $_GET["view"]=="article"){
@@ -317,6 +312,12 @@ function set_toc_visible(isVisible){
 				<div id="article_path_title"></div>
 			</div>
 			<div id="head_nav_right" >
+				<select id="select_lang" onchange="lang_changed(this)">
+						<option>全部语言</option>
+						<option>简体中文</option>
+						<option>繁体中文</option>
+						<option>英文</option>
+				</select>
 				<div id="article_edition" style="display:flex;">
 					<span  style='font-weight: 700;'>文章版本 </span>
 					<div id="edition_dropdown" class="case_dropdown">

+ 9 - 0
app/article/mobile.css

@@ -75,4 +75,13 @@ note:hover .ref {
     left: 0;
     width: 100%;
     height: 70%;
+}
+#head_nav_right{
+	flex-direction: column;
+}
+
+#select_lang {
+    border: unset;
+    border-radius: unset;
+    border-bottom: 1px solid var(--border-line-color);
 }

+ 10 - 3
app/article/style.css

@@ -199,11 +199,14 @@ img {
 #article_edition {
     padding: 8px;
     margin: 0 4px;
-    border: 1px solid var(--border-line-color);
-    border-radius: 5px;
+    border-bottom: 1px solid var(--border-line-color);
+	display: flex;
+	min-width: 18em;
 }
 
-
+#edition_dropdown {
+    margin-left: 1em;
+}
 #head_nav {
     display: flex;
     justify-content: space-between;
@@ -267,4 +270,8 @@ img {
 	fill: var(--bg-color);
 	height: 2em;
 	width: 2em;
+}
+
+#head_nav_right{
+	display: flex;
 }

+ 0 - 38
app/reader/right_tool_bar.php

@@ -1,45 +1,7 @@
 
 	<script src="../reader/right_tool_bar.js"></script>
 <style>
-	#right_float_pannal {
-	position: fixed;
-	height: calc(100% - 7.3em);
-	top: 7.3em;
-	left: 100%;
-	width: calc(30vw - 0.6em);
-	min-width: 20vw;
-	color: var(--btn-color);
-	background-color: var(--tool-bg-color);
-	z-index: 20;
-	-webkit-transition-duration: 0.4s;
-	transition-duration: 0.4s;
-	-webkit-contain: strict;
-	contain: strict;
-	z-index: 51;
-}
-#right_float_pannal > iframe {
-	width: 100%;
-	height: 100%;
-}
-.right_float_max #right_float_pannal {
-	left: 50%;
-	width: 50%;
-}
 
-.right_float_min #right_float_pannal {
-	left: calc(100% - 30vw + 0.6em);
-}
-#right_float_pannal > #tool_bar {
-	/*position: absolute;*/
-	display: flex;
-	width: 100%;
-	justify-content: space-between;
-}
-#right_float_pannal > #tool_bar svg {
-	fill: var(--bg-color);
-	height: 2em;
-	width: 2em;
-}
 #min_right_float {
 	display: none;
 }

+ 9 - 9
app/studio/editor.php

@@ -93,12 +93,12 @@ else{$currDevice="computer";}
 			html += "<li><input type='checkbox' checked channel_id='0' onclick=\"channelDisplay(this)\" />其他</li>"
 
 			if (_my_channal != null) {
-			for (const iterator of _my_channal) {
-				html += "<li><input type='checkbox' checked channel_id='"+iterator.id+"' onclick=\"channelDisplay(this)\" />"+iterator.name+"</li>"
-			}
-			html +="</ul>";
-			$("#layout_channel").html(html);
-		}		
+				for (const iterator of _my_channal) {
+					html += "<li><input type='checkbox' checked channel_id='"+iterator.id+"' onclick=\"channelDisplay(this)\" />"+iterator.name+"</li>"
+				}
+				html +="</ul>";
+				$("#layout_channel").html(html);
+			}		
 		}
 	</script>	
 	
@@ -767,11 +767,11 @@ foreach($plugin_list as $info){
 				<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: 2em;width: 6em;display: flex;">
+						<div class="case_dropdown" style="padding-left: 0.5em;width: 6em;display: flex;">
 							<span style="padding-right: 4px;">┕</span>
-							<span id="parent_grammar">.ppa.</span>
+							<span id="parent_grammar" style="display: inline-block;min-width: 2em;border-radius: 4px;padding: 0 4px;background-color: #8484843d;">.ppa.</span>
 							<input type="hidden" id="input_parent_grammar" />
-							<div id="word_mdf_prt_prt_grammar_dropdown" class="case_dropdown-content">
+							<div id="word_mdf_prt_prt_grammar_dropdown" style="margin-top: 22px;" class="case_dropdown-content">
 								<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>

+ 67 - 4
app/studio/js/editor.js

@@ -3153,7 +3153,7 @@ function showModifyWin(sWordId) {
 			document.getElementById("edit_detail_prt_prt").style.display = "none";
 			document.getElementById("svg_parent2").style.transform = "rotate(0deg)";
 		}
-		document.getElementById("parent_grammar").innerHTML = sParentGrammar;
+		document.getElementById("parent_grammar").innerHTML = getLocalGrammaStr(sParentGrammar);
 		$("#id_text_prt_prt").val(sParent2);
 
 		//右侧修改菜单
@@ -3161,6 +3161,7 @@ function showModifyWin(sWordId) {
 		$("#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) {
@@ -4742,7 +4743,7 @@ function render_word_menu_parent(id) {
 	if (!str_in_array(word_real, sWord)) {
 		sWord.push(word_real);
 	}
-	output += "<a onclick=\"ParentLookup()\">🔍" +gLocal.gui.dict +"</a>";
+	output += "<a onclick=\"ParentLookup('"+$("#id_text_parent").val()+"')\">🔍" +gLocal.gui.dict +"</a>";
 
 	for (var iWord in sWord) {
 		var pali = sWord[iWord];
@@ -4756,8 +4757,70 @@ function render_word_menu_parent(id) {
 	}
 	return output;
 }
-function ParentLookup(){
-	window.open("../dict/index.php?builtin=true&theme=dark&key="+$("#id_text_parent").val(),target="dict");
+/*
+渲染单词语基下拉菜单
+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);

+ 35 - 19
app/term/note.js

@@ -362,33 +362,38 @@ function note_channal_list() {
 						set_more_button_display();
 
 						let lang=new Object();
+						let currLang=_lang;
+						let firstChannel="";
+						if(_channal!=""){
+							firstChannel = _channal.split(",")[0];
+						}										
 						for (const iterator of _channalData) {
 							lang[iterator.lang]=1;
+							if(iterator.id==firstChannel){
+								currLang = iterator.lang;
+							}
 						}
-						let htmlLangSelect="<option value='*'>全部语言</option>";
-						let currLang = getCookie("language");
-						if(currLang == "zh-cn"){
-							currLang = "zh-hans";
-						}
-						if(currLang == "zh-tw"){
-							currLang = "zh-hant";
-						}
+						let htmlLangSelect="<option value=''>全部语言</option>";
 						let isLangMatched=false;
 						for (const key in lang) {
 							if (lang.hasOwnProperty.call(lang, key)) {
+								let strLang = key;
+								if(gLocal.language.hasOwnProperty.call(gLocal.language, key)){
+									strLang = gLocal.language[key];
+								}
 								htmlLangSelect += "<option value='"+key+"' ";
 								if(currLang==key){
 									htmlLangSelect += "selected ";
 									isLangMatched = true;
 								}
-								htmlLangSelect +=">"+gLocal.language[key]+"</option>";	
+								htmlLangSelect +=">"+strLang+"</option>";	
 							}
 						}
 						$("#select_lang").html(htmlLangSelect);
 						if(isLangMatched){
 							render_edition_list(currLang);
 						}else{
-							render_edition_list("all");
+							render_edition_list("");
 						}
 					} catch (e) {
 						console.error(e);
@@ -399,25 +404,36 @@ function note_channal_list() {
 	}
 }
 function lang_changed(obj){
-	render_edition_list($(obj).val());
+	_lang = $(obj).val();
+	render_edition_list(_lang);
 }
-function render_edition_list(lang,index=0){
+function render_edition_list(lang=""){
+	let firstChannel="";
+	if(_channal!=""){
+		firstChannel = _channal.split(",")[0];
+	}	
 	let html = "";
 	html += "<div class='case_dropdown-content'>";
-	let firstChannel;
+	let currChannel="选择一个版本";
 	for (const iterator of _channalData) {
-		if(lang=="all" || (lang!="all" && lang==iterator.lang)){
-			if(typeof firstChannel == "undefined"){
-				firstChannel = "<span>"+iterator.name+"</span>";
+		if(iterator.id==firstChannel){
+			currChannel = iterator.name;
+		}
+		if(lang=="" || (lang!="" && lang==iterator.lang)){
+			if (iterator["final"]){
+				html += "<a onclick=\"edition_list_changed('"+iterator.id+"')\">"+iterator.name+"</a>";
 			}
-			html += "<a onclick=\"set_channal('"+iterator.id+"')\">"+iterator.name+"</a>";
 		}
 	}
 	html +="</div>";
-	html = firstChannel + html;
+	html = "<span>"+currChannel+"▼</span>" + html;
 	$("#edition_dropdown").html(html);
 }
-
+function edition_list_changed(channelId){
+	_channal = channelId;
+	render_edition_list(_lang);
+	set_channal(channelId);
+}
 function find_channal(id) {
 	for (const iterator of _channalData) {
 		if (id == iterator.id) {