Ver código fonte

Merge branch 'master' of https://github.com/visuddhinanda/mint

visuddhinanda 5 anos atrás
pai
commit
1b5aa52d0c

+ 149 - 140
app/dict/dict.js

@@ -1,200 +1,209 @@
-var dict_pre_searching=false;
-var dict_pre_search_curr_word="";
-var dict_search_xml_http=null;
-
-function dict_search(word){
-    $("#pre_search_result").hide();
-	if(!localStorage.searchword){
-		localStorage.searchword="";
+var dict_pre_searching = false;
+var dict_pre_search_curr_word = "";
+var dict_search_xml_http = null;
+
+function dict_search(word) {
+	$("#pre_search_result").hide();
+	if (!localStorage.searchword) {
+		localStorage.searchword = "";
 	}
-	let oldHistory=localStorage.searchword;
-	let arrOldHistory=oldHistory.split(",");
-	let isExist=false;
-	for(let i=0;i<arrOldHistory.length;i++){
-		if(arrOldHistory[i]==word){
-			isExist=true;
+	let oldHistory = localStorage.searchword;
+	let arrOldHistory = oldHistory.split(",");
+	let isExist = false;
+	for (let i = 0; i < arrOldHistory.length; i++) {
+		if (arrOldHistory[i] == word) {
+			isExist = true;
 		}
 	}
-	if(!isExist){
-		localStorage.searchword=word+","+oldHistory;
+	if (!isExist) {
+		localStorage.searchword = word + "," + oldHistory;
+	}
+	word = standardize(word);
+
+	$.get("dict_lookup.php",
+		{
+			op: "search",
+			word: word
+		},
+		function (data, status) {
+			$("#dict_search_result").html(data);
+			$("#dict_list").html($("#dictlist").html());
+			$("#dictlist").html("");
+		});
+}
+function standardize(word) {
+	let word_end = word.slice(-1);
+	if (word_end == "n" || word_end == "m") {
+		word_end = "ṃ";
+		word = word.slice(0, -1) + word_end;
 	}
-	
-    
-    $.get("dict_lookup.php",
-    {
-      op:"search",
-      word:word
-    },
-    function(data,status){
-        $("#dict_search_result").html(data);
-        $("#dict_list").html($("#dictlist").html());
-        $("#dictlist").html("");
-    });
+	return (word);
 }
 
+function dict_pre_search(word) {
+	if (dict_pre_searching == true) { return; }
+	dict_pre_searching = true;
+	dict_pre_search_curr_word = word;
+
+	$.get("dict_lookup.php",
+		{
+			op: "pre",
+			word: word
+		},
+		function (data, status) {
+			dict_pre_searching = false;
+			dict_pre_search_curr_word = "";
+			$("#pre_search_word_content").html(data);
+			$("#pre_search_result").css("display", "block");
+		});
 
-function dict_pre_search(word){
-	if(dict_pre_searching==true){return;}
-	dict_pre_searching=true;
-	dict_pre_search_curr_word=word;
-
-    $.get("dict_lookup.php",
-    {
-      op:"pre",
-      word:word
-    },
-    function(data,status){
-        dict_pre_searching=false;
-        dict_pre_search_curr_word="";
-        $("#pre_search_word_content").html(data);
-        $("#pre_search_result").css("display","block");
-    });
-	
 }
 
-function dict_pre_word_click(word){
-    $("#dict_ref_search_input").val(word);
-    $("#pre_search_result").hide();
+function dict_pre_word_click(word) {
+	$("#dict_ref_search_input").val(word);
+	$("#pre_search_result").hide();
 	dict_search(word);
 }
 
-function dict_input_change(obj){
+function dict_input_change(obj) {
 	dict_pre_search(obj.value);
 }
 
-function dict_input_onfocus(){
-	if($("#dict_ref_search_input").val()==""){
+function dict_input_onfocus() {
+	if ($("#dict_ref_search_input").val() == "") {
 		dict_show_history();
 	}
 }
 
 
-function dict_input_keyup(e,obj){
+function dict_input_keyup(e, obj) {
 	var keynum
 	var keychar
 	var numcheck
-	
-	if($("#dict_ref_search_input").val()==""){
+
+	if ($("#dict_ref_search_input").val() == "") {
 		dict_show_history();
 		return;
 	}
-	if(window.event) // IE
-	  {
-	  keynum = e.keyCode
-	  }
-	else if(e.which) // Netscape/Firefox/Opera
-	  {
-	  keynum = e.which
-	  }
+	if (window.event) // IE
+	{
+		keynum = e.keyCode
+	}
+	else if (e.which) // Netscape/Firefox/Opera
+	{
+		keynum = e.which
+	}
 	var keychar = String.fromCharCode(keynum)
-	if(keynum==13){
+	if (keynum == 13) {
 		dict_search(obj.value);
 	}
-	else{
-        dict_input_split(obj.value);
-        if(obj.value.indexOf("+")==-1){
-		
-		    dict_pre_search(obj.value); 
-        }
-        else{
-            dict_input_split(obj.value);
-            $("#pre_search_result").hide();
-        }
+	else {
+		dict_input_split(obj.value);
+		if (obj.value.indexOf("+") == -1) {
+
+			dict_pre_search(obj.value);
+		}
+		else {
+			dict_input_split(obj.value);
+			$("#pre_search_result").hide();
+		}
 
 	}
 }
 
-function dict_input_split(word){
-	if(word.indexOf("+")>=0){
-		var wordParts=word.split("+");
-		var strParts="";
-		for(var i in wordParts){
-			strParts+="<a onclick='dict_search(\""+wordParts[i]+"\")'>"+wordParts[i]+"</a>";
+function dict_input_split(word) {
+	if (word.indexOf("+") >= 0) {
+		var wordParts = word.split("+");
+		var strParts = "";
+		for (var i in wordParts) {
+			//strParts += "<div class='part_list'><a onclick='dict_search(\"" + wordParts[i] + "\")'>" + wordParts[i] + "</a></div>";
+			strParts += "<part><a onclick='dict_search(\"" + wordParts[i] + "\")'>" + wordParts[i] + "</a></part>";
 		}
+		strParts = "<div class='dropdown_ctl'><div class='content'><div class='main_view' >" + strParts + "</div></div></div>";
 		$("#input_parts").html(strParts);
 	}
-	else{
-        $("#input_parts").html("");
+	else {
+		$("#input_parts").html("");
 	}
-		
+
 }
 
-function dict_show_history(){
-	if(!localStorage.searchword){
-		localStorage.searchword="";
+function dict_show_history() {
+	if (!localStorage.searchword) {
+		localStorage.searchword = "";
 	}
-	var arrHistory=localStorage.searchword.split(",");
-	var strHistory="";
-	if(arrHistory.length>0){
-		strHistory+="<a onclick=\"cls_word_search_history()\">清空历史记录</a>";
+	var arrHistory = localStorage.searchword.split(",");
+	var strHistory = "";
+	if (arrHistory.length > 0) {
+		strHistory += "<a onclick=\"cls_word_search_history()\">清空历史记录</a>";
 	}
-	for(var i=0;i<arrHistory.length;i++){
-		var word=arrHistory[i];
-		strHistory+="<div class='dict_word_list'>";
-		strHistory+="<a onclick='dict_pre_word_click(\""+word+"\")'>"+word+"</a>";
-		strHistory+="</div>";
+	for (var i = 0; i < arrHistory.length; i++) {
+		var word = arrHistory[i];
+		strHistory += "<div class='dict_word_list'>";
+		strHistory += "<a onclick='dict_pre_word_click(\"" + word + "\")'>" + word + "</a>";
+		strHistory += "</div>";
 	}
-	$("#dict_ref_search_result").html(strHistory);	
+	$("#dict_ref_search_result").html(strHistory);
 }
 
-function cls_word_search_history(){
-	localStorage.searchword="";
+function cls_word_search_history() {
+	localStorage.searchword = "";
 	$("#dict_ref_search_result").html("");
 
 }
 
 
-function trubo_split(){
+function trubo_split() {
 	$("#pre_search_result").hide();
 	$.post("split.php",
-    {
-      word:$("#dict_ref_search_input").val()
-    },
-    function(data,status){
-        try{
-			let result= JSON.parse(data);
-			let html="<div>";
-			if(result.length>0){
-				for( const part of result[0]["data"]){
-					html += '<div class="dropdown_ctl">';
-					html += '<div class="content">';
-					html += '<div class="main_view">'+"<part>"+part[0].word.replace(/\+/g,"</part><part>")+"</part>"+'</div>';
-					html += '<div class="more_button">'+part.length+'</div>';
-					html += '</div>';
-					html += '<div class="menu" >';
-					for(const one_part of part){
-						html += '<div class="part_list">'+one_part.word+'</div>';				
+		{
+			word: $("#dict_ref_search_input").val()
+		},
+		function (data, status) {
+			try {
+				let result = JSON.parse(data);
+				let html = "<div>";
+				if (result.length > 0) {
+					for (const part of result[0]["data"]) {
+						html += '<div class="dropdown_ctl">';
+						html += '<div class="content">';
+						html += '<div class="main_view">' + "<part>" + part[0].word.replace(/\+/g, "</part><part>") + "</part>" + '</div>';
+						html += '<div class="more_button">' + part.length + '</div>';
+						html += '</div>';
+						html += '<div class="menu" >';
+						for (const one_part of part) {
+							html += '<div class="part_list">' + one_part.word + '</div>';
+						}
+						html += '</div>';
+						html += '</div>';
 					}
-					html += '</div>';
-					html += '</div>';
 				}
-			}
-			html += "</div>";
-			$("#input_parts").html(html);
+				html += "</div>";
+				$("#input_parts").html(html);
 
-			$(".more_button").click(function(){
-				$(this).parent().siblings(".menu").toggle();
-			}
-			);
+				$(".more_button").click(function () {
+					$(this).parent().siblings(".menu").toggle();
+				}
+				);
+
+				$(".part_list").click(function () {
+					let html = "<part>" + $(this).text().replace(/\+/g, "</part><part>") + "</part>";
+					$(this).parent().parent().find(".main_view").html(html);
+					$(this).parent().hide();
+					$("part").click(function () {
+						dict_search($(this).text());
+					});
+				}
+				);
 
-			$(".part_list").click(function(){
-				let html="<part>"+$(this).text().replace(/\+/g,"</part><part>")+"</part>";
-				$(this).parent().parent().find(".main_view").html(html);
-				$(this).parent().hide();
-				$("part").click(function(){
+				$("part").click(function () {
 					dict_search($(this).text());
-				});
-			}
-			);
+				}
+				);
 
-			$("part").click(function(){
-				dict_search($(this).text());
 			}
-			);
-
-		}
-		catch(e){
+			catch (e) {
 
-		}
-    });
+			}
+		});
 }

+ 14 - 15
app/dict/dict_lookup.php

@@ -361,19 +361,18 @@ switch($op){
 		echo "<div>";
 
 		$arrWords = countWordInPali($word,true);
-		echo "<div>".count($arrWords)."个相关单词</div>";
 		$weight = 0;
 		foreach($arrWords as $oneword){
 			$weight += $oneword["count"] * $oneword["len"];
 		}
-		echo "<div>单词总重量:$weight</div>";
-		echo "<div><a href='word_statistics.php?word={$word}' target='_blank'>单词分析</a></div>";
+		echo "<div>{$_local->gui->word_weight}:$weight {$_local->gui->characters}</div>";
+		echo "<div>{$_local->gui->real_declension}:".count($arrWords)." {$_local->gui->forms}</div>";
 		foreach($arrWords as $oneword){
 			if($oneword["bold"]>0){
-				echo "<div><b>{$oneword["word"]}</b>[{$oneword["count"]}]</div>";
+				echo "<div><b>{$oneword["word"]}</b> {$oneword["count"]} {$_local->gui->times}</div>";
 			}
 			else{
-				echo "<div>{$oneword["word"]}[{$oneword["count"]}]</div>";
+				echo "<div>{$oneword["word"]} {$oneword["count"]}{$_local->gui->times}</div>";
 			}
 		}		
 		echo "</div>";
@@ -384,8 +383,8 @@ switch($op){
 
 		//用户词典
 		echo "<div id='dict_user' >";	
-		echo "<div class='dict_word'>";
-		echo "<div class='' onclick=\"dict_show_edit()\">编辑并收藏</div>";		
+		echo "<div class='dict_word' ><b>{$_local->gui->undone_function}</b>";
+		echo "<div class='' onclick=\"dict_show_edit()\">{$_local->gui->edit}</div>";		
 		echo "<div class='pali'>{$word}</div>";
 
 		if($iFetch>0){
@@ -394,20 +393,20 @@ switch($op){
 		else{
 			echo "<div id='user_word_edit'>";
 		}
-		echo "<fieldset class='broder-1 broder-r'><legend>Type</legend>";
+		echo "<fieldset class='broder-1 broder-r'><legend>{$_local->gui->wordtype}</legend>";
 		echo "<select id=\"id_type\" name=\"type\" >";
 		foreach($_local->type_str as $type){
 			echo "<option value=\"{$type->id}\" >{$type->value}</option>";
 		}
 		echo "</select>";
 		echo "</fieldset>";
-		echo "<fieldset class='broder-1 broder-r'><legend>Gramma</legend><input type='input' value=''/></fieldset>";
-		echo "<fieldset class='broder-1 broder-r'><legend>语基</legend><input type='input' value=''/></fieldset>";
-		echo "<fieldset class='broder-1 broder-r'><legend>意思</legend><input type='input' value=''/></fieldset>";
-		echo "<fieldset class='broder-1 broder-r'><legend>注解</legend><textarea></textarea></fieldset>";
-		echo "<fieldset class='broder-1 broder-r'><legend>组分</legend><input type='input' value=''/></fieldset>";
-		echo "<fieldset class='broder-1 broder-r'><legend>组分意思</legend><input type='input' value=''/></fieldset>";
-		echo "<div class=''><button>添加到我的单词本</button></div>";
+		echo "<fieldset class='broder-1 broder-r'><legend>{$_local->gui->gramma}</legend><input type='input' value=''/></fieldset>";
+		echo "<fieldset class='broder-1 broder-r'><legend>{$_local->gui->parent}</legend><input type='input' value=''/></fieldset>";
+		echo "<fieldset class='broder-1 broder-r'><legend>{$_local->gui->g_mean}</legend><input type='input' value=''/></fieldset>";
+		echo "<fieldset class='broder-1 broder-r'><legend>{$_local->gui->note}</legend><textarea></textarea></fieldset>";
+		echo "<fieldset class='broder-1 broder-r'><legend>{$_local->gui->factor}</legend><input type='input' value=''/></fieldset>";
+		echo "<fieldset class='broder-1 broder-r'><legend>{$_local->gui->f_mean}</legend><input type='input' value=''/></fieldset>";
+		echo "<div class=''><button>{$_local->gui->add_to} {$_local->gui->my_dictionary}</button></div>";
 		echo "</div>";
 		echo "</div>";	
 		echo "</div>";			

+ 3 - 2
app/dict/index.php

@@ -40,9 +40,10 @@ require_once "../pcdl/html_head.php";
         #dict_ref{
             flex:6;
             padding:0.5em 1.5em;
-        }
+		}
+		
         #dict_user{
-            flex:2;
+			flex:2;
         }
 		.dict_word_card{
 		border-bottom: 1px solid var(--border-line-color);

+ 19 - 3
app/guide/guide.css

@@ -13,10 +13,11 @@ guide:hover  .guide_contence{
     display:inline-block;
 }
 .guide_contence {
+    border-top: 7px;
     position: absolute;
     top:100%;
-    width:18em;
-    min-height:30em;
+    min-width:18em;
+    min-height:15em;
     padding:10px;
     background-color:white;
     box-shadow: 0 0 10px rgba(0,0,0,0.15);
@@ -24,7 +25,20 @@ guide:hover  .guide_contence{
     text-align:left;
     display:none;
 }
+/*
+.guide_contence:after {
+    content: "\00a0";
+    width: 0;
+    height: 0;
+    display: block;
+    border-style: solid;
+    border-width: 10px;
+    border-color: transparent transparent white transparent;
+    position: absolute;
+    top: -20px;
+}
 
+*/
 .guide_contence  h1{
     font-size:1.5em;
     font-weight:700;
@@ -42,5 +56,7 @@ guide:hover  .guide_contence{
     font-weight:700;
 }
 .guide_contence  li{
-    display: contents;
+    display: block;
+    white-space: unset;
+    word-break: normal;
 }

+ 11 - 2
app/guide/guide.js

@@ -1,10 +1,12 @@
 function guide_init() {
     $("guide").each(function () {
         if ($(this).offset().left < $(document.body).width() / 2) {
-            $(this).append('<div  class="guide_contence" style="left: 0;"></div>');
+            $(this).append('<div  class="guide_contence" style="left: -5px;"></div>');
+            $(".guide_contence:after").css("left", "0");
         }
         else {
-            $(this).append('<div  class="guide_contence" style="right: 0;"></div>');
+            $(this).append('<div  class="guide_contence" style="right: -5px;"></div>');
+            $(".guide_contence:after").css("right", "0");
         }
     });
 
@@ -27,6 +29,13 @@ function guide_init() {
                     console.error(e);
                 }
             });
+        /*        if ($(this).offset().left < $(document.body).width() / 2) {
+                    $(".guide_contence:after").css("left", "0");
+                }
+                else {
+                    $(".guide_contence:after").css("right", "0");
+                }*/
+
     });
 
 }

+ 7 - 0
app/public/lang/default.json

@@ -422,6 +422,13 @@
 		"library": "Library",
 		"turbo_split": "Turbo Split",
 		"full_text": "full text",
+		"word_weight": "weightiness of this word",
+		"characters": "characters",
+		"real_declension": "reality of declensions",
+		"forms": "spelling forms",
+		"add_to": "add to",
+		"undone_function": "unfinished function",
+		"": "",
 		"": ""
 	},
 	"grammastr": [

+ 8 - 1
app/public/lang/en.json

@@ -188,7 +188,7 @@
 		"months": " month(s) ",
 		"more": "more",
 		"my_book": "My Book",
-		"my_dictionary": "My Dictionary",
+		"my_dictionary": "My Vocabulary",
 		"my_document": "My Document",
 		"my_loc": "my location",
 		"name": "Name",
@@ -422,6 +422,13 @@
 		"library": "Library",
 		"turbo_split": "Turbo Split",
 		"full_text": "full text",
+		"word_weight": "weightiness of this word",
+		"characters": "characters",
+		"real_declension": "reality of declensions",
+		"forms": "spelling forms",
+		"add_to": "add to",
+		"undone_function": "unfinished function",
+		"": "",
 		"": ""
 	},
 	"grammastr": [

+ 7 - 0
app/public/lang/my.json

@@ -422,6 +422,13 @@
 		"library": "Library",
 		"turbo_split": "Turbo Split",
 		"full_text": "full text",
+		"word_weight": "weightiness of this word",
+		"characters": "characters",
+		"real_declension": "reality of declensions",
+		"forms": "spelling forms",
+		"add_to": "add to",
+		"undone_function": "unfinished function",
+		"": "",
 		"": ""
 	},
 	"grammastr": [

+ 7 - 0
app/public/lang/si.json

@@ -427,6 +427,13 @@
 		"library": "Library",
 		"turbo_split": "Turbo Split",
 		"full_text": "full text",
+		"word_weight": "weightiness of this word",
+		"characters": "characters",
+		"real_declension": "reality of declensions",
+		"forms": "spelling forms",
+		"add_to": "add to",
+		"undone_function": "unfinished function",
+		"": "",
 		"": ""
 	},
 	"grammastr": [

+ 7 - 3
app/public/lang/zh-cn.json

@@ -189,7 +189,7 @@
 		"months": "个月 ",
 		"more": "更多",
 		"my_book": "自定义书籍",
-		"my_dictionary": "我的词典",
+		"my_dictionary": "我的单词表",
 		"my_document": "我的文档",
 		"my_loc": "我的位置",
 		"name": "名称",
@@ -423,8 +423,12 @@
 		"library": "藏经阁",
 		"turbo_split": "強力拆分",
 		"full_text": "全文",
-		"": "",
-		"": "",
+		"word_weight": "单词权重",
+		"characters": "个字符",
+		"real_declension": "实际变化",
+		"forms": "种形式",
+		"add_to": "添加到",
+		"undone_function": "未完成功能",
 		"": "",
 		"": "",
 		"": ""

+ 7 - 1
app/public/lang/zh-tw.json

@@ -189,7 +189,7 @@
 		"months": "個月",
 		"more": "更多",
 		"my_book": "自定義書籍",
-		"my_dictionary": "我的詞典",
+		"my_dictionary": "我的單詞表",
 		"my_document": "我的檔案",
 		"my_loc": "我的位置",
 		"name": "名稱",
@@ -423,6 +423,12 @@
 		"library": "藏經閣",
 		"turbo_split": "強力拆分",
 		"full_text": "全文",
+		"word_weight": "單詞權重",
+		"characters": "個字元",
+		"real_declension": "實際變化",
+		"forms": "種形式",
+		"add_to": "新增到",
+		"undone_function": "未完成功能",
 		"": ""
 	},
 	"grammastr": [