visuddhinanda 5 лет назад
Родитель
Сommit
5ff23f0ff5
4 измененных файлов с 90 добавлено и 78 удалено
  1. 4 2
      app/article/my_article_put.php
  2. 3 1
      app/term/add.svg
  3. 74 61
      app/term/note.js
  4. 9 14
      app/term/term.css

+ 4 - 2
app/article/my_article_put.php

@@ -1,5 +1,7 @@
 <?php
-
+/*
+新建文章
+*/
 require_once "../path.php";
 require_once "../public/_pdo.php";
 require_once '../public/function.php';
@@ -7,7 +9,7 @@ require_once '../hostsetting/function.php';
 require_once "../ucenter/active.php";
 
 $respond=array("status"=>0,"message"=>"");
-PDO_Connect(""._FILE_DB_USER_ARTICLE_);
+PDO_Connect(_FILE_DB_USER_ARTICLE_);
 
 $query="INSERT INTO article ( id,  title  , subtitle  , summary , content   , tag  , owner, setting  , status  , create_time , modify_time , receive_time   )  VALUES  ( ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? ) ";
 $sth = $PDO->prepare($query);

+ 3 - 1
app/term/add.svg

@@ -1 +1,3 @@
-<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1605399923175" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1947" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><defs><style type="text/css"></style></defs><path d="M873.753974 149.961384A511.715358 511.715358 0 1 0 149.676742 874.038616 511.715358 511.715358 0 0 0 873.753974 149.961384zM831.537457 828.623878a447.750939 447.750939 0 1 1-633.247756-633.247756 447.750939 447.750939 0 0 1 633.247756 633.247756z" fill="" p-id="1948"></path><path d="M767.573037 480.01779H543.697568V256.142321a31.98221 31.98221 0 0 0-63.96442 0v223.875469H255.857679a31.98221 31.98221 0 0 0 0 63.96442h223.875469V767.857679a31.98221 31.98221 0 0 0 63.96442 0V543.98221H767.573037a31.98221 31.98221 0 0 0 0-63.96442z" fill="" p-id="1949"></path></svg>
+<?xml version="1.0" standalone="no"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg t="1605399923175" id="add" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1947" xmlns:xlink="http://www.w3.org/1999/xlink" ><path d="M873.753974 149.961384A511.715358 511.715358 0 1 0 149.676742 874.038616 511.715358 511.715358 0 0 0 873.753974 149.961384zM831.537457 828.623878a447.750939 447.750939 0 1 1-633.247756-633.247756 447.750939 447.750939 0 0 1 633.247756 633.247756z" fill="" p-id="1948"></path><path d="M767.573037 480.01779H543.697568V256.142321a31.98221 31.98221 0 0 0-63.96442 0v223.875469H255.857679a31.98221 31.98221 0 0 0 0 63.96442h223.875469V767.857679a31.98221 31.98221 0 0 0 63.96442 0V543.98221H767.573037a31.98221 31.98221 0 0 0 0-63.96442z" fill="" p-id="1949"></path></svg>

+ 74 - 61
app/term/note.js

@@ -542,57 +542,67 @@ function note_json_html(in_json) {
 	//未选择的其他译文开始
 	output += "<div class='other_tran_div' sent='";
 	output += in_json.book + "-" + in_json.para + "-" + in_json.begin + "-" + in_json.end + "' >";
-	output += "<div class='tool_bar' sent='";
+	output += "<div class='tool_bar' style='display:flex;' sent='";
 	output += in_json.book + "-" + in_json.para + "-" + in_json.begin + "-" + in_json.end + "' >";
+	output += "<span class='tool_left'>";
+	//第一个按钮
+	//新增译文按钮开始
+	output += "<span class='' ";
+	output += "book='" + in_json.book + "' ";
+	output += "para='" + in_json.para + "' ";
+	output += "begin='" + in_json.begin + "' ";
+	output += "end='" + in_json.end + "' ";
+	output += " >";
+	output += "<span class='' onclick='add_new_tran_button_click(this)'>+添加译文</span>";
+	output += "<div class='tran_text_tool_bar'>";
+	output += "</div>";
+	output += "</span>";
+	//新增译文按钮结束
+	output += "<span class='separate_line'></span>";
+	//第二个按钮
 	output += "<span class='more_tran icon_expand'></span>";
 	//其他译文工具条
 	output += "<span class='other_bar'  >";
 	output += "<span class='other_tran_span' >" + gLocal.gui.other + gLocal.gui.translation + "</span>";
 	output += "<span class='other_tran_num'></span>";
 	output += "</span>";
+
 	output += "<span class='separate_line'></span>";
-	//相似句工具条
-	output += "<span class='other_bar' >";
-	output +=
-		"<span class='similar_sent_span' onclick=\"note_show_pali_sim('" +
-		in_json.pali_sent_id +
-		"')\">" +
-		gLocal.gui.similar_sentences +
-		"</span>";
-	output += "<span class='similar_sent_num'>" + in_json.sim + "</span>";
+	//第三个按钮 相似句
+	if (parseInt(in_json.sim) > 0) {
+		output += "<span class='other_bar' >";
+		output +=
+			"<span class='similar_sent_span' onclick=\"note_show_pali_sim('" +
+			in_json.pali_sent_id +
+			"')\">" +
+			gLocal.gui.similar_sentences +
+			"</span>";
+		output += "<span class='similar_sent_num'>" + in_json.sim + "</span>";
+		output += "</span>";
+	}
+
+	//第三个按钮 相似句结束
+	output += "</span>";
+
+	output += "<span class='tool_right'>";
+	//出处路径开始
+	output += "<span class='ref'>" + in_json.ref;
+	output += "<span class='sent_no'>";
+	output += in_json.book + "-" + in_json.para + "-" + in_json.begin + "-" + in_json.end;
+	output += "<span>";
+	output += "</span>";
+	//出处路径结束
 	output += "</span>";
-	output += "</div>";
-	output += "<div class='other_tran'>";
 
 	output += "</div>";
-	output += "</div>";
+	//工具栏结束
+
 	//未选择的其他译文开始
-	//新增译文按钮开始
-	output += "<div class='add_new icon_add' ";
-	output += "book='" + in_json.book + "' ";
-	output += "para='" + in_json.para + "' ";
-	output += "begin='" + in_json.begin + "' ";
-	output += "end='" + in_json.end + "' ";
-	output += " >";
-	output += "<div class='icon_add' onclick='add_new_tran_button_click(this)'></div>";
-	output += "<div class='tran_text_tool_bar'>";
+	output += "<div class='other_tran'>";
 	output += "</div>";
+
 	output += "</div>";
-	//新增译文按钮结束
-	//出处路径开始
-	output += "<div class='ref'>" + in_json.ref;
-	output +=
-		"<span class='sent_no'>" +
-		in_json.book +
-		"-" +
-		in_json.para +
-		"-" +
-		in_json.begin +
-		"-" +
-		in_json.end +
-		"<span>" +
-		"</div>";
-	//出处路径结束
+
 	return output;
 }
 function sent_tran_edit(obj) {
@@ -998,14 +1008,38 @@ function add_new_tran_button_click(obj) {
 	}
 	html += "</ul>";
 	$(obj).parent().children(".tran_text_tool_bar").first().html(html);
+
 	if ($(obj).parent().children(".tran_text_tool_bar").css("display") == "block") {
 		$(obj).parent().children(".tran_text_tool_bar").first().hide();
 	} else {
 		$(obj).parent().children(".tran_text_tool_bar").first().show();
+		$(document).one("click", function () {
+			$(obj).parent().children(".tran_text_tool_bar").first().hide();
+		});
+		event.stopPropagation();
 		$(obj).parent().show();
 	}
 }
-
+function tool_bar_show(element) {
+	if ($(element).find(".tran_text_tool_bar").css("display") == "none") {
+		$(element).find(".tran_text_tool_bar").css("display", "flex");
+		$(element).find(".icon_expand").css("transform", "rotate(-180deg)");
+		$(element).css("background-color", "var(--btn-bg-color)");
+		$(element).css("visibility", "visible");
+		$(document).one("click", function () {
+			$(element).find(".tran_text_tool_bar").hide();
+			$(element).css("background-color", "var(--nocolor)");
+			$(element).find(".icon_expand").css("transform", "unset");
+			$(element).css("visibility", "");
+		});
+		event.stopPropagation();
+	} else {
+		$(element).find(".tran_text_tool_bar").hide();
+		$(element).css("background-color", "var(--nocolor)");
+		$(element).find(".icon_expand").css("transform", "unset");
+		$(element).css("visibility", "");
+	}
+}
 function new_sentence(book, para, begin, end, channel, obj) {
 	let newsent = { id: "", text: "", lang: "", channal: channel };
 
@@ -1058,13 +1092,13 @@ function set_more_button_display() {
 			$(this)
 				.find(".other_bar")
 				.click(function () {
-					const sentid = $(this).parent().attr("sent").split("-");
+					const sentid = $(this).parent().parent().attr("sent").split("-");
 					const book = sentid[0];
 					const para = sentid[1];
 					const begin = sentid[2];
 					const end = sentid[3];
 					let sentId = book + "-" + para + "-" + begin + "-" + end;
-					if ($(this).parent().siblings(".other_tran").first().css("display") == "none") {
+					if ($(this).parent().parent().siblings(".other_tran").first().css("display") == "none") {
 						$(".other_tran_div[sent='" + sentId + "']")
 							.children(".other_tran")
 							.slideDown();
@@ -1372,27 +1406,6 @@ function edit_in_studio(book, para, begin, end) {
 	wbw_channal_list_open(book, [para]);
 }
 
-function tool_bar_show(element) {
-	if ($(element).find(".tran_text_tool_bar").css("display") == "none") {
-		$(element).find(".tran_text_tool_bar").css("display", "flex");
-		$(element).find(".icon_expand").css("transform", "rotate(-180deg)");
-		$(element).css("background-color", "var(--btn-bg-color)");
-		$(element).css("visibility", "visible");
-		$(document).one("click", function () {
-			$(element).find(".tran_text_tool_bar").hide();
-			$(element).css("background-color", "var(--nocolor)");
-			$(element).find(".icon_expand").css("transform", "unset");
-			$(element).css("visibility", "");
-		});
-		event.stopPropagation();
-	} else {
-		$(element).find(".tran_text_tool_bar").hide();
-		$(element).css("background-color", "var(--nocolor)");
-		$(element).find(".icon_expand").css("transform", "unset");
-		$(element).css("visibility", "");
-	}
-}
-
 //显示和隐藏某个内容 如 巴利文
 function setVisibility(key, value) {
 	switch (key) {

+ 9 - 14
app/term/term.css

@@ -189,13 +189,12 @@ note > .tran > .text {
 }
 note > .tran .tran_text_tool_bar,
 .tran_text_tool_bar {
-	padding: 0 0.1em;
+	padding: 0.5em 1em;
 	position: absolute;
 	display: none;
 	color: var(--border-line-color);
 	z-index: 40;
 	width: auto;
-	left: -2em;
 	font-size: 14px;
 	height: auto;
 	line-height: 28px;
@@ -293,17 +292,10 @@ note n {
 }
 
 note .ref {
-	text-align: right;
 	font-size: 75%;
 	white-space: nowrap;
 	overflow-x: scroll;
-	margin-left: auto;
-	border-top: solid 1px var(--nocolor);
-	position: absolute;
-	bottom: -1.3em;
-	right: 0;
 	max-width: 100%;
-	right: 1.3em;
 }
 note:hover .ref {
 	/*border-top: solid 1px var(--border-line-color);*/
@@ -335,7 +327,7 @@ r {
 }
 
 note {
-	padding: 0.5em 2em;
+	padding: 0.5em 0 0 0;
 	margin-bottom: 0.4em;
 	border-radius: 5px;
 	line-height: 1.3em;
@@ -405,13 +397,12 @@ note:hover .add_new {
 	border-top: 1px solid var(--border-line-color);
 }
 .other_tran_div > .tool_bar {
-	position: absolute;
-	margin-top: -0.7em;
 	background-color: var(--btn-bg-color);
 	padding: 0 6px;
-	border-radius: 4px;
+	border-radius: 0 0 4px 4px;
 	cursor: pointer;
 	display: flex;
+	justify-content: space-between;
 }
 .other_tran_div > .other_tran {
 	min-height: 1em;
@@ -500,7 +491,8 @@ note:hover .note_tool_bar {
 	padding: 5px;
 	border-radius: 5px;
 }
-.other_tran_num {
+.other_tran_num,
+.similar_sent_num {
 	-webkit-border-radius: 7px;
 	border-radius: 7px;
 	background-color: cornflowerblue;
@@ -515,6 +507,9 @@ note:hover .note_tool_bar {
 	margin: auto 2px;
 	color: whitesmoke;
 }
+.similar_sent_num {
+	display: unset;
+}
 .separate_line {
 	border: solid 1px #e8e8e8;
 	border-radius: 3px;