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

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

Bhikkhu-Kosalla 5 лет назад
Родитель
Сommit
fb518dd2bc

+ 4 - 0
.gitignore

@@ -3,3 +3,7 @@
 /dicttext/rich/*.db
 /font
 /appdata
+/log
+/palicsv
+/palihtml
+/temp

+ 6 - 0
.vscode/launch.json

@@ -10,6 +10,12 @@
             "name": "Launch Chrome against localhost",
             "url": "http://localhost:80",
             "webRoot": "${workspaceFolder}"
+        },
+        {
+            "name": "Listen for XDebug",
+            "type": "php",
+            "request": "launch",
+            "port": 9000
         }
     ]
 }

+ 4 - 38
app/dict/index.php

@@ -1,5 +1,5 @@
 <?PHP
-include "../pcdl/html_head.php";
+require_once "../pcdl/html_head.php";
 ?>
 <body>
 
@@ -113,23 +113,7 @@ include "../pcdl/html_head.php";
 			border-radius: 99px;
 			cursor: pointer;
 		}
-		guide{
-			display:inline-block;
-			width:1.4em;
-			height:1.4em;
-			cursor: pointer;
-			background-color:gray;
-		}
-		#guide {
-			width:18em;
-			min-height:30em;
-			background-color:white;
-			box-shadow: 0 0 10px rgba(0,0,0,0.15);
-		}		
-		#guide h1{
-			font-size:2em;
-			font-weight:700;
-		}
+
 	</style>
 	<!-- tool bar begin-->
 	<div id='search_toolbar' class="search_toolbar">
@@ -138,7 +122,7 @@ include "../pcdl/html_head.php";
 				<div>
 					<div>
 						<div>
-							<input id="dict_ref_search_input" type="input" placeholder="<?php echo $_local->gui->search;?>" onkeyup="dict_input_keyup(event,this)" style="    margin-left: 0.5em;width: 40em;max-width: 100%;font-size:140%;padding: 0.6em;color: var(--btn-hover-bg-color);background-color: var(--btn-color);" onfocus="dict_input_onfocus()" />
+						<guide gid="dict_search_input"></guide><input id="dict_ref_search_input" type="input" placeholder="<?php echo $_local->gui->search;?>" onkeyup="dict_input_keyup(event,this)" style="    margin-left: 0.5em;width: 40em;max-width: 100%;font-size:140%;padding: 0.6em;color: var(--btn-hover-bg-color);background-color: var(--btn-color);" onfocus="dict_input_onfocus()" />
 						</div>
 						<div id="word_parts">
 							<div id="input_parts" style="font-size: 1.1em;padding: 2px 1em;"></div>
@@ -247,26 +231,8 @@ function GetPageScroll()
         echo "</script>";
     }
 	?>
-	<div id="guide" style="position:absolute;"></div>
-	<script>
-		$("guide").mouseenter(function(){
-			let id = $(this).attr("gid");
-			var guideObj = $(this);
-			$.get("../../documents/users_guide/en/"+id+".md",
-				{
-				},
-			function(data,status){
-				$("#guide").html(marked(data));
-				$("#guide").appendTo(guideObj);
-				//$("#guide").show();
-			});
-		});
-
-		$("guide").mouseout(function(){
-			//$("#guide").hide();
-		});
+	
 
-	</script>
 <?php
 include "../pcdl/html_foot.php";
 ?>

+ 33 - 0
app/guide/get.php

@@ -0,0 +1,33 @@
+<?php
+require_once "../path.php";
+
+//获取用户界面语言
+if(isset($_COOKIE["language"])){
+    $lang = $_COOKIE["language"];
+}
+else{
+    $lang = "en";
+}
+//查找用户界面语言对应的文件
+$filename = _DIR_USERS_GUIDE_."/{$lang}/".$_GET["id"].".md";
+if(file_exists($filename)){
+    $output["data"]  =  file_get_contents($filename) ;
+    $output["id"]  =$_GET["id"];
+}
+else{
+    //如果用户界面不是英语,尝试使用英语文件
+    $filename = _DIR_USERS_GUIDE_."/en/".$_GET["id"].".md";
+    if($lang != "en" && file_exists($filename)){
+        $output["data"]  =  file_get_contents($filename) ;
+        $output["id"]  =$_GET["id"];
+    }
+    else{
+        //尝试使用英语文件不成功,报错
+        $output["data"]  =  "Error: Can't Find Item In Server. Item Id:{$_GET["id"]}  Language:{$lang}";
+        $output["id"]  =$_GET["id"];
+    }
+}
+
+echo json_encode($output,JSON_UNESCAPED_UNICODE);
+
+?>

+ 43 - 0
app/guide/guide.css

@@ -0,0 +1,43 @@
+guide{
+    position: relative;
+    display:inline-block;
+    width:14px;
+    height:14px;
+    cursor: pointer;
+    background: url(guide_icon.svg);
+    background-repeat: no-repeat;
+    background-size: contain;
+    margin: 0 6px;
+}
+guide:hover  .guide_contence{
+    display:inline-block;
+}
+.guide_contence {
+    position: absolute;
+    top:100%;
+    width:18em;
+    min-height:30em;
+    padding:10px;
+    background-color:white;
+    box-shadow: 0 0 10px rgba(0,0,0,0.15);
+    font-size:10pt;
+    text-align:left;
+    display:none;
+}
+
+.guide_contence  h1{
+    font-size:1.5em;
+    font-weight:700;
+}
+.guide_contence  h2{
+    font-size:1.3em;
+    font-weight:700;
+}
+.guide_contence  h3{
+    font-size:1.1em;
+    font-weight:700;
+}
+.guide_contence  h4{
+    font-size:1em;
+    font-weight:700;
+}

+ 32 - 0
app/guide/guide.js

@@ -0,0 +1,32 @@
+function guide_init() {
+    $("guide").each(function () {
+        if ($(this).offset().left < $(document.body).width() / 2) {
+            $(this).append('<div  class="guide_contence" style="left: 0;"></div>');
+        }
+        else {
+            $(this).append('<div  class="guide_contence" style="right: 0;"></div>');
+        }
+    });
+
+    $("guide").mouseenter(function () {
+        if ($(this).children(".guide_contence").first().html().length > 0) {
+            return;
+        }
+        let gid = $(this).attr("gid");
+        let guideObj = $(this);
+        $.get("../guide/get.php",
+            {
+                id: gid
+            },
+            function (data, status) {
+                try {
+                    let jsonGuide = JSON.parse(data);
+                    $("guide[gid='" + jsonGuide.id + "']").find(".guide_contence").html(marked(jsonGuide.data));
+                }
+                catch (e) {
+                    console.error(e);
+                }
+            });
+    });
+
+}

+ 8 - 0
app/guide/guide_icon.svg

@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0)  -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+	 width="14px" height="14px" viewBox="0 0 14 14" style="enable-background:new 0 0 14 14;" xml:space="preserve">
+<path d="M7,0C3.134,0,0,3.134,0,7s3.134,7,7,7s7-3.134,7-7S10.866,0,7,0z M7,2c0.552,0,1,0.447,1,1S7.552,4,7,4S6,3.553,6,3
+	S6.448,2,7,2z M9,11H5v-1h1V6H5V5h3v5h1V11z"/>
+</svg>

+ 3 - 0
app/path.php

@@ -14,6 +14,9 @@ define("_DIR_DICT_SYSTEM_" , __DIR__."/../appdata/dict/system");
 define("_DIR_DICT_3RD_" , __DIR__."/../appdata/dict/3rd");
 define("_DIR_DICT_REF_" , __DIR__."/../appdata/dict/ref");
 
+define("_DIR_USERS_GUIDE_" , __DIR__."/../documents/users_guide");
+
+
 define("_FILE_DB_REF_"  , __DIR__."/../appdata/dict/system/ref.db");
 define("_FILE_DB_REF_INDEX_"  , __DIR__."/../appdata/dict/system/ref1.db");
 define("_FILE_DB_part_"  , __DIR__."/../appdata/dict/system/part.db3");

+ 6 - 1
app/pcdl/html_foot.php

@@ -48,7 +48,12 @@
 </div>S
 	
 <div class="foot_div">
-wikipali @2020
+	<div>wikipali @2020</div>
+	<div>Powered by PCD Suite</div>
 </div>
+
+<script>
+	guide_init();
+</script>
 </body>
 </html>

+ 5 - 0
app/pcdl/html_head.php

@@ -27,11 +27,16 @@ else{
     <link type="text/css" rel="stylesheet" href="../pcdl/css/basic_style.css"/>
     <link type="text/css" rel="stylesheet" href="../pcdl/css/color_day.css" id="colorchange" />
     <link type="text/css" rel="stylesheet" href="../pcdl/css/style_mobile.css" media="screen and (max-width:767px)">
+
+	<link type="text/css" rel="stylesheet" href="../guide/guide.css"/>
+
     <title>圣典</title>
 
 	<script src="../public/js/jquery.js"></script>
 	<script src="../public/js/comm.js"></script>
 	<script src="../studio/js/fixedsticky.js"></script>
+	<script src="../guide/guide.js"></script>
+	
 	<script >
 	<?php require_once '../public/load_lang_js.php';?>
 	</script>

+ 2 - 1
app/ucenter/user.php

@@ -31,10 +31,11 @@
 		text-align:right;
 	}
 	#user_bar{
-		border: 2px solid var(--btn-border-color);
+		border: 1px solid var(--btn-border-color);
 		border-radius: 99px;
 		color: var(--btn-color);
 		padding: 2px 2px 2px 15px;
+		height: min-content;
 	}
 	</style>
 		<div style="margin:auto;" class="dropdown" onmouseover="switchMenu(this,'user_info')" onmouseout="hideMenu()">

+ 3 - 2
documents/users_guide/en/comp_split.md

@@ -1,2 +1,3 @@
-# 强力复合词拆分
-这是基于语料库的复合词自动拆分程序。点击数字选择更多选项。
+# 强大的复合词拆分
+
+这是基于语料库的复合词自动拆分程序。程序会进行深度切分和搜索,给出可能性比较高的一些可能。点击组分后面的数字选择其他的可能。

+ 6 - 0
documents/users_guide/en/dict_search_input.md

@@ -0,0 +1,6 @@
+## Smart Dictionary
+
+You can put the plus(+)between parts in the compone word, and than click one part(under the search input) lookup dictionary.
+
+### Example:
+citta+kamma

+ 3 - 0
documents/users_guide/zh-cn/comp_split.md

@@ -0,0 +1,3 @@
+# 强大的复合词拆分
+
+这是基于语料库的复合词自动拆分程序。程序会进行深度切分和搜索,给出可能性比较高的一些可能。点击组分后面的数字选择其他的可能。

+ 6 - 0
documents/users_guide/zh-cn/dict_search_input.md

@@ -0,0 +1,6 @@
+## 聪明的单词搜索
+
+您可以在输入框中的复合词中加入加号(+)用以分隔单词的各个组成部分。利用搜索框下方的组分列表查询组分的意思。
+
+### 例如:
+citta+kamma

+ 3 - 0
documents/users_guide/zh-tw/comp_split.md

@@ -0,0 +1,3 @@
+# 强大的复合词拆分
+
+这是基于语料库的复合词自动拆分程序。程序会进行深度切分和搜索,给出可能性比较高的一些可能。点击组分后面的数字选择其他的可能。

+ 3 - 0
documents/users_guide/zh-tw/dict_search_input.md

@@ -0,0 +1,3 @@
+## 聪明的单词搜索
+
+您可以在输入的复合词中加入加号(+)。利用搜索框下方的组分列表查询组分的意思。