Prechádzať zdrojové kódy

自动拆分优化 加连音预处理

visuddhinanda 5 rokov pred
rodič
commit
d518f5bf79

+ 1 - 0
app/dict/css/style.css

@@ -244,6 +244,7 @@ input[type="submit"] {
 	font-weight: 700;
 	margin-top: 15px;
 	padding-bottom: 0;
+	overflow-wrap: anywhere;
 }
 #main_view {
 	display: flex;

+ 1 - 1
app/dict/dict.js

@@ -39,7 +39,7 @@ function dict_search(word, autoSplit = true) {
 			$("#search_result_shell").append($("#search_summary"));
 
 			guide_init();
-			if (_autoSplit == true) {
+			if (_autoSplit == true && word.length > 10) {
 				get_comp_data(word);
 			}
 

+ 5 - 2
app/dict/dict_lookup.php

@@ -8,6 +8,7 @@ require_once "../public/load_lang.php"; //语言文件
 require_once "../public/function.php";
 require_once "../search/word_function.php";
 require_once "../ucenter/active.php";
+require_once "../ucenter/function.php";
 require_once "../dict/p_ending.php";
 
 _load_book_index();
@@ -56,9 +57,11 @@ $right_word_list = "";
             foreach ($userdict as $key => $value) {
                 echo "<div class='mean'>{$key}:{$value["mean"]}</div>";
             }
-            echo "<div><span>{$_local->gui->contributor}:</span>";
+			echo "<div><span>{$_local->gui->contributor}:</span>";
+			$userinfo = new UserInfo();
             foreach ($userlist as $key => $value) {
-                echo $key . "[" . $value . "]";
+				$user = $userinfo->getName($key);
+                echo $user["nickname"] . "[" . $value . "]";
             }
             echo "</div>";
             echo "</div>";

+ 10 - 24
app/dict/split.php

@@ -99,7 +99,7 @@ foreach ($arrWords as $currword) {
 				$word_part["word"] = $new2;
 				$word_part["confidence"] = $value;
 				$wordlist[] = $word_part;					
-			}	
+			}
 			$needDeep = false;
 		}
 		else{
@@ -138,8 +138,14 @@ foreach ($arrWords as $currword) {
 
 
 		if($needDeep){
-			mySplit2($oneword, 0, false, 0, 0.5, 0.95, true, false);
-			if(count($result) < 2){
+			if(mb_strlen($oneword,"UTF-8")>35){
+				mySplit2($oneword, 0, true, 0, 0.9, 0.95, true, false);
+			}
+			else{
+				mySplit2($oneword, 0, false, 0, 0.5, 0.95, true, false);
+			}
+			
+			if(count($result) < 1){
 				mySplit2($oneword, 0, $_express, 0, 0.4, 0.8, true, true);
 			}
 			if (isset($_POST["debug"])) {
@@ -151,27 +157,7 @@ foreach ($arrWords as $currword) {
 			if (isset($_POST["debug"])) {
 				echo "反切:" . count($result) . "<br>\n";
 			}
-			/*
-			if (count($result) < 5) {
-			#sandhi advance
-			mySplit2($oneword, 0, $_express, 0, 0.8, 0.8, false, true);
-			if (isset($_POST["debug"])) {
-			echo "反切:" . count($result) . "\n";
-			}
-			}
-			if (count($result) < 5) {
-			#反向
-			mySplit2($oneword, 0, $_express, 0, 0.8, 0.8, false);
-			}
-			if (count($result) < 5) {
-			#正向
-			mySplit2($oneword, 0, $_express, 0, 0.8, 0, true);
-			}
-			if (count($result) < 5) {
-			#反向
-			mySplit2($oneword, 0, $_express, 0, 0.8, 0, false);
-			}
-			*/
+
 			arsort($result); //按信心指数排序
 
 

+ 4 - 3
app/dict/turbo_split.php

@@ -577,6 +577,7 @@ $sandhi2[] = array("a" => "ṃ", "b" => "iti", "c" => "nti", "len" => 3, "adj_le
 
 $sandhi2[] = array("a" => "ī", "b" => "eva", "c" => "iyeva", "len" => 5, "adj_len" => 0, "advance" => false,"cf"=>0.9999);
 $sandhi2[] = array("a" => "ī", "b" => "eva", "c" => "īyeva", "len" => 5, "adj_len" => 0, "advance" => false,"cf"=>0.9999);
+$sandhi2[] = array("a" => "u", "b" => "eva", "c" => "uyeva", "len" => 5, "adj_len" => 0, "advance" => false,"cf"=>0.9999);
 $sandhi2[] = array("a" => "i", "b" => "eva", "c" => "yeva", "len" => 4, "adj_len" => 0, "advance" => false,"cf"=>0.9999);
 $sandhi2[] = array("a" => "o", "b" => "eva", "c" => "ova", "len" => 3, "adj_len" => 0, "advance" => false,"cf"=>0.9999);
 $sandhi2[] = array("a" => "ṃ", "b" => "eva", "c" => "meva", "len" => 4, "adj_len" => 0, "advance" => false,"cf"=>0.9999);
@@ -584,14 +585,14 @@ $sandhi2[] = array("a" => "u", "b" => "eva", "c" => "veva", "len" => 4, "adj_len
 $sandhi2[] = array("a" => "a", "b" => "eva", "c" => "eva", "len" => 3, "adj_len" => 0, "advance" => false,"cf"=>0.9999);
 $sandhi2[] = array("a" => "e", "b" => "eva", "c" => "eva", "len" => 3, "adj_len" => 0, "advance" => false,"cf"=>0.9999);
 
-$sandhi2[] = array("a" => "ā", "b" => "api", "c" => "āpi", "len" => 3, "adj_len" => 0, "advance" => false,"cf"=>0.9999);
 $sandhi2[] = array("a" => "a", "b" => "api", "c" => "āpi", "len" => 3, "adj_len" => 0, "advance" => false,"cf"=>0.9999);
+$sandhi2[] = array("a" => "ā", "b" => "api", "c" => "āpi", "len" => 3, "adj_len" => 0, "advance" => false,"cf"=>0.9999);
 $sandhi2[] = array("a" => "e", "b" => "api", "c" => "epi", "len" => 3, "adj_len" => 0, "advance" => false,"cf"=>0.9999);
-$sandhi2[] = array("a" => "ī", "b" => "api", "c" => "īpi", "len" => 3, "adj_len" => 0, "advance" => false,"cf"=>0.9999);
 $sandhi2[] = array("a" => "i", "b" => "api", "c" => "īpi", "len" => 3, "adj_len" => 0, "advance" => false,"cf"=>0.9999);
+$sandhi2[] = array("a" => "ī", "b" => "api", "c" => "īpi", "len" => 3, "adj_len" => 0, "advance" => false,"cf"=>0.9999);
 $sandhi2[] = array("a" => "o", "b" => "api", "c" => "opi", "len" => 3, "adj_len" => 0, "advance" => false,"cf"=>0.9999);
-$sandhi2[] = array("a" => "ū", "b" => "api", "c" => "ūpi", "len" => 3, "adj_len" => 0, "advance" => false,"cf"=>0.9999);
 $sandhi2[] = array("a" => "u", "b" => "api", "c" => "ūpi", "len" => 3, "adj_len" => 0, "advance" => false,"cf"=>0.9999);
+$sandhi2[] = array("a" => "ū", "b" => "api", "c" => "ūpi", "len" => 3, "adj_len" => 0, "advance" => false,"cf"=>0.9999);
 $sandhi2[] = array("a" => "u", "b" => "api", "c" => "upi", "len" => 3, "adj_len" => 0, "advance" => false,"cf"=>0.9999);
 $sandhi2[] = array("a" => "ṃ", "b" => "api", "c" => "mpi", "len" => 3, "adj_len" => 0, "advance" => false,"cf"=>0.9999);
 

+ 22 - 230
app/reader/index.php

@@ -7,9 +7,11 @@ require_once "../pcdl/html_head.php";
 
 	<script src="../channal/channal.js"></script>
 	<script src="./reader.js"></script>
-
 	<script src="../widget/click_dropdown.js"></script>
 	<link type="text/css" rel="stylesheet" href="../widget/click_dropdown.css"/>
+	<link type="text/css" rel="stylesheet" href="style.css"  />
+	<link type="text/css" rel="stylesheet" href="mobile.css" media="screen and (max-width:800px)" />
+	<link type="text/css" rel="stylesheet" href="print.css" media="print" />
 
 	<script>
 	<?php
@@ -49,234 +51,8 @@ require_once "../pcdl/html_head.php";
 	}
 	?>
 	</script>
-	<style>
-
-
-	#search_result{
-		position: absolute;
-		background: wheat;
-		max-width: 95%;
-		width: 24em;
-	}
-
-	.icon{
-		width: 15px;
-		height: 15px;
-	}
-	.submenu_title{
-		font-size: 120%;
-		font-weight: 700;		
-	}
-
-	#head_bar{
-		display: flex;
-		justify-content: space-between;
-		/*height: 5em;*/
-		background-color: var(--tool-bg-color1);
-		border-bottom: 1px solid var(--tool-line-color);
-		padding:10px;
-		margin-top: 50px;
-		position: fixed;
-		top: 0;
-		left: 0;
-		width: 100%;
-		z-index: 100;
-		
-	}
-
-	.main_view{
-		padding: 0 1em;
-		padding-top: 7em;
-		max-width: 1280px;
-		margin-left: auto;
-		margin-right: auto;
-	}
-
-	.fun_frame {
-		border-bottom: 1px solid gray;
-		margin-right: 10px;
-		margin-bottom: 10px;
-	}
-	.fun_frame .title{
-		padding:6px;
-		font-weight: 700;
-	}
-	.fun_frame>.content{
-		padding:6px;
-		max-height:6em;
-		overflow-y: scroll;
-	}
-	
-	.fixed{
-		position:fixed;
-		right: 0;
-    	top: 0;
-	}
-	.when_right_fixed{
-		padding-right:20em;
-	}
-
-
-	#contents_view{
-		display:flex;
-	}
-	#contents_div{
-		flex:7;
-	}
-	#contents{
-
-	}
-	#contents li{
-		white-space: normal;
-	}
-	#right_pannal{
-		flex:3;
-		max-width:20em;
-	}
-
-	#contents_foot{
-		margin-bottom: 70vh;
-	}
-
-
-#toc_content .level_2{
-	padding-left:0.5em;
-}
-#toc_content .level_3{
-	padding-left:1em;
-}
-#toc_content .level_4{
-	padding-left:1.5em;
-}
-#toc_content .level_5{
-	padding-left:2em;
-}
-.ui-dialog-titlebar{
-		display: flex;
-    justify-content: space-between;
-	background-color: var(--btn-bg-color);
-    padding: 5px;
-	}
-	.ui-widget-content{
-		background-color: var(--bg-color);
-	}
-	.ui-dialog{
-		box-shadow:  8px 8px 20px var(--border-shadow);
-	}
-	.active{
-		background-color: var(--btn-hover-bg-color);
-		
-	}
-
-	.icon_btn a {
-	color: var(--main-color);
-	}
-	.icon_btn:hover a {
-		color: var(--btn-hover-color);
-	}
-	.active a{
-		color:var(--btn-hover-color);
-	}
-	chapter{
-	display:inline-block;
-	}
-
-.language-para {
-    padding: 2px 2px;
-    position: absolute;
-    margin-top: 7px;
-    border-bottom: 3px solid var(--link-color);
-	margin-left: -60px;
-	font-family: 'Noto Sans', 'Noto Sans SC', 'Noto Sans TC','Padauk', Arial, Verdana;
-}
-
-.level_0{
-	margin-left:0;
-}
-.level_1{
-	margin-left:1em;
-}
-.level_2{
-	margin-left:2em;
-}
-.level_3{
-	margin-left:3em;
-}
-.level_4{
-	margin-left:4em;
-}
-.level_5{
-	margin-left:5em;
-}
-.level_6{
-	margin-left:6em;
-}
-.channal_list{
-		white-space: nowrap;
-		overflow-x: hidden;
-	}
-	.userinfo_channal{
-		display:none;
-	}
-	.userinfo_channal:hover{
-		display:block;
-	}
-	
-	#para_path chapter{
-		color: var(--link-color);
-		font-size: 120%;
-	}
-
-	#para_path_next_level{
-		display:inline-block;
-	}
 
 
-	#right_float_pannal{
-		position: fixed;
-		height: calc(100% - 7.3em);
-		top: 7.3em;
-		left: 100%;
-		width: 30em;
-		min-width:20em;
-		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_min #right_float_pannal{
-		left: calc(100% - 30em);
-	}
-	</style>
-
-<style media="screen and (max-width:800px)">
-	#right_pannal{
-		display:none;
-	}
-	.when_right_fixed{
-		padding-right:0;
-	}
-	.index_toolbar{
-		position:unset;
-	}
-	#pali_pedia{
-		font-size: 200%;
-		margin-top: auto;
-		margin-bottom: auto;
-		padding-left: 0.5em;
-	}
-</style>
-
-<link type="text/css" rel="stylesheet" href="print.css" media="print" />
 <?php
     require_once("../pcdl/head_bar.php");
 ?>
@@ -357,13 +133,13 @@ require_once "../pcdl/html_head.php";
 		}
 
 		?>
-			<button class='icon_btn'><a href="#"><?php echo $_local->gui->help; ?></a></button>
-			<button class='icon_btn' onclick="show_dict(this)"><a href="#"><?php echo $_local->gui->dict; ?></a></button>
+			<button class='icon_btn'><a><?php echo $_local->gui->help; ?></a></button>
+			<button id="btn_show_dict" class='icon_btn' onclick="show_dict(this)"><a ><?php echo $_local->gui->dict; ?></a></button>
 		</span>
 	</div>
 </div>
 
-<div id="main_view_shell">
+
 	<div id="main_view" class="main_view">
 		<div id="article_head" style="border-bottom: 1px solid gray;">
 			<div id="article_title" class="term_word_head_pali"><?php echo $_local->gui->title; ?></div>
@@ -424,7 +200,23 @@ require_once "../pcdl/html_head.php";
 		</div>
 	</div>
 
+<div id="main_view_shell">
 	<div id="right_float_pannal">
+		<div id="tool_bar">
+			<span>
+			<button id="max_right_float" class="icon_btn" onclick="max_right_float(this)">
+				<svg class='icon'><use xlink:href='../studio/svg/icon.svg#eye_disable'></use></svg>
+			</button>
+			<button id="min_right_float" class="icon_btn" onclick="min_right_float(this)">
+				<svg class='icon'><use xlink:href='../studio/svg/icon.svg#eye_disable'></use></svg>
+			</button>
+			</span>
+			<span>
+			<button id="close_right_float" class="icon_btn" onclick="close_right_float()">
+			<svg class='icon'><use xlink:href='../studio/svg/icon.svg#eye_disable'></use></svg>
+			</button>
+			</span>
+		</div>
 		<iframe id="dict" src="../dict/index.php?builtin=true" name="dict" title="wikipali"></iframe>
 	</div>
 </div>

+ 15 - 0
app/reader/mobile.css

@@ -0,0 +1,15 @@
+#right_pannal {
+	display: none;
+}
+.when_right_fixed {
+	padding-right: 0;
+}
+.index_toolbar {
+	position: unset;
+}
+#pali_pedia {
+	font-size: 200%;
+	margin-top: auto;
+	margin-bottom: auto;
+	padding-left: 0.5em;
+}

+ 33 - 0
app/reader/reader.js

@@ -253,6 +253,39 @@ function edit_wbw(book, para) {
 
 function show_dict(obj) {
 	$("#main_view_shell").toggleClass("right_float_min");
+	$("#main_view").toggleClass("main_view_right_float_min");
+
 	$(obj).toggleClass("active");
 	gBuildinDictIsOpen = $(obj).hasClass("active");
 }
+
+function close_right_float() {
+	$("#main_view_shell").removeClass("right_float_min");
+	$("#main_view_shell").removeClass("right_float_max");
+
+	$("#main_view").removeClass("main_view_right_float_min");
+	$("#main_view").removeClass("main_view_right_float_max");
+
+	$("#max_right_float").show();
+	$("#min_right_float").hide();
+	$("#btn_show_dict").removeClass("active");
+	gBuildinDictIsOpen = false;
+}
+function min_right_float(obj) {
+	$(obj).siblings().show();
+	$(obj).hide();
+	$("#main_view_shell").addClass("right_float_min");
+	$("#main_view_shell").removeClass("right_float_max");
+
+	$("#main_view").addClass("main_view_right_float_min");
+	$("#main_view").removeClass("main_view_right_float_max");
+}
+function max_right_float(obj) {
+	$(obj).siblings().show();
+	$(obj).hide();
+	$("#main_view_shell").addClass("right_float_max");
+	$("#main_view_shell").removeClass("right_float_min");
+
+	$("#main_view").addClass("main_view_right_float_max");
+	$("#main_view").removeClass("main_view_right_float_min");
+}

+ 226 - 0
app/reader/style.css

@@ -0,0 +1,226 @@
+#search_result {
+	position: absolute;
+	background: wheat;
+	max-width: 95%;
+	width: 24em;
+}
+
+.icon {
+	width: 15px;
+	height: 15px;
+}
+.submenu_title {
+	font-size: 120%;
+	font-weight: 700;
+}
+
+#head_bar {
+	display: flex;
+	justify-content: space-between;
+	/*height: 5em;*/
+	background-color: var(--tool-bg-color1);
+	border-bottom: 1px solid var(--tool-line-color);
+	padding: 10px;
+	margin-top: 50px;
+	position: fixed;
+	top: 0;
+	left: 0;
+	width: 100%;
+	z-index: 100;
+}
+
+.main_view {
+	padding: 0 1em;
+	padding-top: 7em;
+	max-width: 1280px;
+	margin-left: auto;
+	margin-right: auto;
+}
+
+.fun_frame {
+	border-bottom: 1px solid gray;
+	margin-right: 10px;
+	margin-bottom: 10px;
+}
+.fun_frame .title {
+	padding: 6px;
+	font-weight: 700;
+}
+.fun_frame > .content {
+	padding: 6px;
+	max-height: 6em;
+	overflow-y: scroll;
+}
+
+.fixed {
+	position: fixed;
+	right: 0;
+	top: 0;
+}
+.when_right_fixed {
+	padding-right: 20em;
+}
+
+#contents_view {
+	display: flex;
+}
+#contents_div {
+	flex: 7;
+}
+#contents {
+}
+#contents li {
+	white-space: normal;
+}
+#right_pannal {
+	flex: 3;
+	max-width: 20em;
+}
+
+#contents_foot {
+	margin-bottom: 70vh;
+}
+
+#toc_content .level_2 {
+	padding-left: 0.5em;
+}
+#toc_content .level_3 {
+	padding-left: 1em;
+}
+#toc_content .level_4 {
+	padding-left: 1.5em;
+}
+#toc_content .level_5 {
+	padding-left: 2em;
+}
+.ui-dialog-titlebar {
+	display: flex;
+	justify-content: space-between;
+	background-color: var(--btn-bg-color);
+	padding: 5px;
+}
+.ui-widget-content {
+	background-color: var(--bg-color);
+}
+.ui-dialog {
+	box-shadow: 8px 8px 20px var(--border-shadow);
+}
+.active {
+	background-color: var(--btn-hover-bg-color);
+}
+
+.icon_btn a {
+	color: var(--main-color);
+}
+.icon_btn:hover a {
+	color: var(--btn-hover-color);
+}
+.active a {
+	color: var(--btn-hover-color);
+}
+chapter {
+	display: inline-block;
+}
+
+.language-para {
+	padding: 2px 2px;
+	position: absolute;
+	margin-top: 7px;
+	border-bottom: 3px solid var(--link-color);
+	margin-left: -60px;
+	font-family: "Noto Sans", "Noto Sans SC", "Noto Sans TC", "Padauk", Arial, Verdana;
+}
+
+.level_0 {
+	margin-left: 0;
+}
+.level_1 {
+	margin-left: 1em;
+}
+.level_2 {
+	margin-left: 2em;
+}
+.level_3 {
+	margin-left: 3em;
+}
+.level_4 {
+	margin-left: 4em;
+}
+.level_5 {
+	margin-left: 5em;
+}
+.level_6 {
+	margin-left: 6em;
+}
+.channal_list {
+	white-space: nowrap;
+	overflow-x: hidden;
+}
+.userinfo_channal {
+	display: none;
+}
+.userinfo_channal:hover {
+	display: block;
+}
+
+#para_path chapter {
+	color: var(--link-color);
+	font-size: 120%;
+}
+
+#para_path_next_level {
+	display: inline-block;
+}
+
+#right_float_pannal {
+	position: fixed;
+	height: calc(100% - 7.3em);
+	top: 7.3em;
+	left: 100%;
+	width: 30em;
+	min-width: 20em;
+	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% - 30em);
+}
+#right_float_pannal > #tool_bar {
+	position: absolute;
+	display: flex;
+	width: 100%;
+	justify-content: space-between;
+}
+#right_float_pannal > #tool_bar svg {
+	fill: var(--box-bg-color1);
+}
+#min_right_float {
+	display: none;
+}
+.main_view_right_float_min {
+	margin-right: 29em;
+}
+.main_view_right_float_max {
+	margin-right: 50%;
+}
+.main_view_right_float_min #right_pannal {
+	display: none;
+}
+.main_view_right_float_max #right_pannal {
+	display: none;
+}

+ 2 - 2
app/ucenter/function.php

@@ -59,9 +59,9 @@ class UserInfo
             return $buffer[$id];
         }
         if ($this->dbh) {
-            $query = "SELECT nickname,username FROM user WHERE userid= ? ";
+            $query = "SELECT nickname,username FROM user WHERE id = ? or userid= ? ";
             $stmt = $this->dbh->prepare($query);
-            $stmt->execute(array($id));
+            $stmt->execute(array($id,$id));
             $user = $stmt->fetchAll(PDO::FETCH_ASSOC);
             if (count($user) > 0) {
                 $buffer[$id] = array("nickname" => $user[0]["nickname"], "username" => $user[0]["username"]);