Pārlūkot izejas kodu

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

Bhikkhu-Kosalla 5 gadi atpakaļ
vecāks
revīzija
efc74dc517

+ 51 - 55
app/guide/guide.js

@@ -1,61 +1,57 @@
 function guide_init() {
-  $("guide").each(function () {
-    if ($(this).attr("init") != "1") {
-      if ($(this).text().length > 0) {
-        $(this).css("background", "unset");
-      }
-      if ($(this).offset().left < $(document.body).width() / 2) {
-        $(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: -5px;"></div>'
-        );
-        $(".guide_contence:after").css("right", "0");
-      }
-      $(this).attr("init", "1");
-    }
-  });
+	$("guide").each(function () {
+		if ($(this).attr("init") != "1") {
+			if ($(this).text().length > 0) {
+				$(this).css("background", "unset");
+			}
+			if ($(this).offset().left < $(document.body).width() / 2) {
+				$(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: -5px;"></div>');
+				$(".guide_contence:after").css("right", "0");
+			}
+			$(this).attr("init", "1");
+		}
+	});
 
-  $("guide").mouseenter(function () {
-    if ($(this).children(".guide_contence").first().html().length > 0) {
-      return;
-    }
-    let gid = $(this).attr("gid");
-    $.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);
-        }
-      }
-    );
-  });
+	$("guide").mouseenter(function () {
+		if ($(this).children(".guide_contence").first().html().length > 0) {
+			return;
+		}
+		let gid = $(this).attr("gid");
+		$.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);
+				}
+			}
+		);
+	});
 }
 
 function guide_get(guide_id) {
-  $.get(
-    "../guide/get.php",
-    {
-      id: guide_id,
-    },
-    function (data, status) {
-      try {
-        let jsonGuide = JSON.parse(data);
-        $("#guide_" + jsonGuide.id).html(marked(jsonGuide.data));
-      } catch (e) {
-        console.error(e);
-      }
-    }
-  );
+	$.get(
+		"../guide/get.php",
+		{
+			id: guide_id,
+		},
+		function (data, status) {
+			try {
+				let jsonGuide = JSON.parse(data);
+				$("#guide_" + jsonGuide.id).html(marked(jsonGuide.data));
+			} catch (e) {
+				console.error(e);
+			}
+		}
+	);
 }

+ 4 - 0
app/pcdl/html_head.php

@@ -56,6 +56,10 @@ else{
 			echo '<link type="text/css" rel="stylesheet" href="../term/term_para.css"/>';
 		}
 		?>
+	
+	<script src="../term/popup_note.js"></script>
+	<link type="text/css" rel="stylesheet" href="../term/popup_note.css"/>
+
 	<script src="../term/term_edit_dlg.js"></script>
 	<link type="text/css" rel="stylesheet" href="../term/term_edit_dlg.css"/>	
 	<script src="../uwbw/wbw_channal_list.js"></script>

+ 26 - 10
app/reader/index.php

@@ -210,8 +210,11 @@ require_once "../pcdl/html_head.php";
 	.userinfo_channal:hover{
 		display:block;
 	}
-
-
+	
+	#para_path chapter{
+		color: var(--link-color);
+		font-size: 120%;
+	}
 	</style>
 
 <style media="screen and (max-width:767px)">
@@ -242,12 +245,7 @@ require_once "../pcdl/html_head.php";
 <div id="head_bar" >
 	<div id="pali_pedia" style="display:flex;">
 		<span><?php echo $_local->gui->anthology; ?></span>
-		<span id="para_path"></span>
-		<span class="case_dropdown" id="para_path_next_level">
-		……
-		<div id="toc_next_menu" class="case_dropdown-content">
-		</div>
-		</span>
+
 	</div>
 
 	<div>
@@ -327,8 +325,26 @@ require_once "../pcdl/html_head.php";
 <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>
-	<div id="article_subtitle"><?php echo $_local->gui->sub_title; ?></div>
-	<div id="article_author"><?php echo $_local->gui->author; ?></div>
+	<div  id='path_div' style="display:flex;justify-content: space-between;">
+		<div id="article_path">
+		<span id="para_path"></span>
+		<span class="case_dropdown" id="para_path_next_level">
+		……
+		<div id="toc_next_menu" class="case_dropdown-content">
+		</div>
+		</span>
+		</div>
+		<div id="article_lang">
+			<div class="click_dropdown_div">
+				<div class="click_dropdown_button">语言</div>
+				<div class="click_dropdown_content">
+					<div class="click_dropdown_content_inner">
+						<a>简体中文</a>
+					</div>
+				</div>
+			</div>
+		</div>
+	</div>
 </div>
 <div id="contents_view">
 	<div id="contents_div" style="padding: 0 1em 0 30px;">

+ 7 - 0
app/term/guide_icon.svg

@@ -0,0 +1,7 @@
+<?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="fill: #6baaff;" 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>

+ 2 - 0
app/term/note.js

@@ -213,6 +213,8 @@ function note_refresh_new() {
 								$("#" + id).html(strHtml);
 							}
 						}
+						//处理<code>标签作为气泡注释
+						popup_init();
 						//刷新句子链接递归,有加层数限制。
 						note_refresh_new();
 

+ 93 - 0
app/term/popup_note.css

@@ -0,0 +1,93 @@
+code {
+	position: relative;
+	display: inline-block;
+	width: auto;
+	min-width: 14px;
+	height: auto;
+	min-height: 14px;
+	cursor: pointer;
+	background: url(guide_icon.svg);
+	background-repeat: no-repeat;
+	background-size: contain;
+	margin: 0 6px;
+	color: var(--tool-color);
+}
+.language-para {
+	background: none;
+	color: unset;
+}
+code:hover .popup_contence {
+	display: inline-block;
+}
+code ul {
+	list-style-type: disc;
+	padding-left: 20px;
+}
+code ol {
+	list-style-type: decimal;
+	padding-left: 20px;
+}
+.popup_contence {
+	border-top: 7px;
+	position: absolute;
+	border: 1px solid var(--border-line-color);
+	border-radius: 5px;
+	top: 180%;
+	width: max-content;
+	min-width: 18em;
+	max-width: max(25vw, 100%);
+	min-height: 15em;
+	padding: 10px;
+	background-color: var(--drop-bg-color);
+	box-shadow: 0 0 10px rgba(0, 0, 0, 0.15);
+	font-size: 10pt;
+	text-align: left;
+	display: none;
+
+	margin: 0.3em;
+	margin: -1px 0px;
+	box-shadow: 0px 3px 13px 0px var(--shadow-color);
+	color: var(--main-color);
+	z-index: 200;
+}
+
+.popup_contence:after {
+	content: "\00a0";
+	width: 0;
+	height: 0;
+	display: block;
+	border-style: solid;
+	border-width: 10px;
+	border-color: transparent transparent var(--drop-bg-color) transparent;
+	position: absolute;
+	top: -20px;
+}
+
+.popup_contence h1 {
+	font-size: 1.5em;
+	font-weight: 700;
+}
+.popup_contence h2 {
+	font-size: 1.3em;
+	font-weight: 700;
+}
+.popup_contence h3 {
+	font-size: 1.1em;
+	font-weight: 700;
+}
+.popup_contence h4 {
+	font-size: 1em;
+	font-weight: 700;
+}
+.popup_contence li {
+	white-space: normal;
+	word-break: normal;
+}
+.popup_contence pre {
+	background-color: rgba(0, 0, 0, 0.1);
+}
+.popup_contence code {
+	white-space: normal;
+	word-break: normal;
+	font-family: arial;
+}

+ 19 - 0
app/term/popup_note.js

@@ -0,0 +1,19 @@
+function popup_init() {
+	$("code:not([class])").each(function () {
+		if ($(this).attr("init") != "1") {
+			if ($(this).text().length == 0) {
+				return;
+			}
+			const noteText = $(this).html();
+			$(this).html("");
+			if ($(this).offset().left < $(document.body).width() / 2) {
+				$(this).append('<div  class="popup_contence" style="left: -15px;">' + noteText + "</div>");
+				$(".popup_contence:after").css("left", "0");
+			} else {
+				$(this).append('<div  class="popup_contence" style="right: -15px;">' + noteText + "</div>");
+				$(".popup_contence:after").css("right", "0");
+			}
+			$(this).attr("init", "1");
+		}
+	});
+}

+ 11 - 10
app/widget/click_dropdown.css

@@ -1,16 +1,17 @@
 .click_dropdown_div {
-  position: relative;
+	position: relative;
 }
 .click_dropdown_content {
-  display: none;
-  position: absolute;
-  right: 0;
-  width: 19em;
-  border-radius: 4px;
-  background-color: var(--drop-bg-color);
+	display: none;
+	position: absolute;
+	right: 0;
+	min-width: 5em;
+	border-radius: 4px;
+	background-color: var(--drop-bg-color);
+}
+.click_dropdown_button {
 }
-
 .click_dropdown_content_inner {
-  max-height: 300px;
-  min-height: 10em;
+	max-height: 300px;
+	/*min-height: 10em;*/
 }

+ 12 - 6
app/widget/click_dropdown.js

@@ -1,9 +1,15 @@
+var currDropdownMenu;
 function click_dropdown_init() {
-  $(".click_dropdown_button").click(function () {
-    $(this).siblings(".click_dropdown_content").first().show();
-  });
+	$(".click_dropdown_button").click(function () {
+		currDropdownMenu = this;
+		$(this).siblings(".click_dropdown_content").first().show();
+		$(document).one("click", function () {
+			$(currDropdownMenu).parent().children(".click_dropdown_content").hide();
+		});
+		event.stopPropagation();
+	});
 
-  $(".click_dropdown_cancel").click(function () {
-    $(this).parent().parent().hide();
-  });
+	$(".click_dropdown_content_inner").click(function () {
+		$(this).hide();
+	});
 }