Bläddra i källkod

阅读器中加句子功能下拉菜单

visuddhinanda 5 år sedan
förälder
incheckning
1027c26506

+ 0 - 0
app/like/get.php


+ 18 - 0
app/like/like.css

@@ -0,0 +1,18 @@
+.like_icon {
+  position: relative;
+  display: inline-block;
+  width: auto;
+  min-width: 14px;
+  height: auto;
+  min-height: 14px;
+  cursor: pointer;
+  background: url(like.svg);
+  background-repeat: no-repeat;
+  background-size: contain;
+  margin: 0 6px;
+  color: var(--tool-color);
+}
+
+.i_like {
+  background: url(like1.svg);
+}

+ 9 - 0
app/like/like.js

@@ -0,0 +1,9 @@
+function like_init() {
+  $("like").each(function () {
+    if ($(this).html().length == 0) {
+      $(this).append(
+        "<span class='like_icon'></span></span><span class='like_count'>0</span>"
+      );
+    }
+  });
+}

+ 1 - 0
app/like/like.svg

@@ -0,0 +1 @@
+<?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="1602127746076" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3073" xmlns:xlink="http://www.w3.org/1999/xlink" width="32" height="32"><defs><style type="text/css"></style></defs><path d="M667.786667 117.333333C832.864 117.333333 938.666667 249.706667 938.666667 427.861333c0 138.250667-125.098667 290.506667-371.573334 461.589334a96.768 96.768 0 0 1-110.186666 0C210.432 718.368 85.333333 566.112 85.333333 427.861333 85.333333 249.706667 191.136 117.333333 356.213333 117.333333c59.616 0 100.053333 20.832 155.786667 68.096C567.744 138.176 608.170667 117.333333 667.786667 117.333333z m0 63.146667c-41.44 0-70.261333 15.189333-116.96 55.04-2.165333 1.845333-14.4 12.373333-17.941334 15.381333a32.32 32.32 0 0 1-41.770666 0c-3.541333-3.018667-15.776-13.536-17.941334-15.381333-46.698667-39.850667-75.52-55.04-116.96-55.04C230.186667 180.48 149.333333 281.258667 149.333333 426.698667 149.333333 537.6 262.858667 675.242667 493.632 834.826667a32.352 32.352 0 0 0 36.736 0C761.141333 675.253333 874.666667 537.6 874.666667 426.698667c0-145.44-80.853333-246.218667-206.88-246.218667z" p-id="3074"></path></svg>

+ 1 - 0
app/like/like1.svg

@@ -0,0 +1 @@
+<?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="1602127733716" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2928" xmlns:xlink="http://www.w3.org/1999/xlink" width="32" height="32"><defs><style type="text/css"></style></defs><path d="M667.786667 117.333333C832.864 117.333333 938.666667 249.706667 938.666667 427.861333c0 138.250667-125.098667 290.506667-371.573334 461.589334a96.768 96.768 0 0 1-110.186666 0C210.432 718.368 85.333333 566.112 85.333333 427.861333 85.333333 249.706667 191.136 117.333333 356.213333 117.333333c59.616 0 100.053333 20.832 155.786667 68.096C567.744 138.176 608.170667 117.333333 667.786667 117.333333z" p-id="2929"></path></svg>

+ 0 - 0
app/like/put.php


+ 11 - 1
app/pcdl/js/reader.js

@@ -194,7 +194,7 @@ function reader_init() {
     window.location.assign("../wiki/wiki.php?op=get&word=" + word);
   });
 
-  $("sent").click(function (e) {
+  $("palitext").click(function (e) {
     let book = $(this).attr("book");
     let para = $(this).attr("para");
     let begin = $(this).attr("begin");
@@ -440,3 +440,13 @@ function sent_apply(sentId) {
     );
   }
 }
+
+function copy_ref(obj) {
+  let pali_sent_node = obj.parentNode.parentNode.parentNode.parentNode;
+  let book = pali_sent_node.getAttributeNode("book").value;
+  let para = pali_sent_node.getAttributeNode("para").value;
+  let begin = pali_sent_node.getAttributeNode("begin").value;
+  let end = pali_sent_node.getAttributeNode("end").value;
+  let strRef = "{{" + book + "-" + para + "-" + begin + "-" + end + "}}";
+  copy_to_clipboard(strRef);
+}

+ 19 - 13
app/pcdl/reader.php

@@ -272,9 +272,14 @@ note{
 more{
     position: absolute;
     display: none;
-    width: 1em;
-    height: 1em;
-    background-color: gray;
+    width: 1.4em;
+    height: 1.4em;
+}
+more .icon{
+	display: inline-block;
+    width: 1.4em;
+    height: 1.4em;
+    background: url(../public/images/svg/more.svg);
 }
 sent:hover more{
 	display: inline-block;
@@ -683,7 +688,9 @@ else{
 			foreach ($FetchSent as $key => $value) {
 				echo "<div id='sent-pali-b$book-$iPar-{$value["begin"]}' class='par_pali_div'>";
 				$pali_sent=$value["html"];
-				echo "<sent  class='{$sentClass}' book='{$book}' para='{$iPar}' begin='{$value["begin"]}' end='{$value["end"]}' >".$pali_sent."</sent>";
+				echo "<sent  class='{$sentClass}' book='{$book}' para='{$iPar}' begin='{$value["begin"]}' end='{$value["end"]}' >";
+				echo "<palitext book='{$book}' para='{$iPar}' begin='{$value["begin"]}' end='{$value["end"]}' >".$pali_sent."</palitext>";
+				echo "</sent>";
 				echo "</div>";
 				echo "<div id='sent-wbwdiv-b$book-$iPar-{$value["begin"]}' class='par_wbw_div'>";
 				echo "</div>";
@@ -716,7 +723,9 @@ else{
 			}
 			foreach ($FetchSent as $key => $value) {
 				$pali_sent=$value["html"];
-				echo "<sent class='{$sentClass}'  book='{$book}' para='{$iPar}' begin='{$value["begin"]}' end='{$value["end"]}' >{$pali_sent}</sent>";
+				echo "<sent class='{$sentClass}'  book='{$book}' para='{$iPar}' begin='{$value["begin"]}' end='{$value["end"]}' >";
+				echo "<palitext book='{$book}' para='{$iPar}' begin='{$value["begin"]}' end='{$value["end"]}' >{$pali_sent}</palitext>";
+				echo "</sent>";
 			}
 			echo "</div>";
 			echo "<div id='par-wbwdiv-b$book-$iPar' class='par_wbw_div'>";
@@ -1276,22 +1285,19 @@ function render_sent($sent_data,$sn,$display_mode,$sent_count,$class=""){
 <script>
 reader_init();
 var htmlDropdown  = "<div class='case_dropdown'>";
-htmlDropdown  +="<svg class='edit_icon' >";
+htmlDropdown  +="<svg class='icon' >";
 htmlDropdown  +="<use xlink:href='svg/icon.svg#ic_more'></use>";
 htmlDropdown  +="</svg>";
 htmlDropdown  +="<div class='case_dropdown-content'>";
-htmlDropdown  +="<a onclick='copy_ref()'>复制引用</a>";
+htmlDropdown  +="<a onclick='copy_ref(this)'>复制引用</a>";
+htmlDropdown  +="<a onclick='copy_text(this)'>复制纯文本</a>";
 htmlDropdown  +="<a onclick='add_to_list()'>添加到选择列表</a>";
 htmlDropdown  +="</div>";
 htmlDropdown  +="</div>";
 $("sent").each(function(){
-	$(this).append("<more>"+htmlDropdown+"</more>")
+	$(this).prepend("<more>"+htmlDropdown+"</more>")
 })
-function copy_ref(){
-	let pali_sent = $(this).parent().parent().parent().prev();
-	let strRef = "{{"+pali_sent.attr("book")+"-"+pali_sent.attr("para")+"-"+pali_sent.attr("begin")+"-"+pali_sent.attr("end")+"}}";
-	alert(strRef);
-}
+
 </script>
 	
 </body>

+ 6 - 0
app/public/images/svg/more.svg

@@ -0,0 +1,6 @@
+<?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="1602127459811" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5274"  xmlns:xlink="http://www.w3.org/1999/xlink">
+<defs><style type="text/css"></style></defs>
+<path d="M1024 512C1024 229.236 794.764 0 512 0S0 229.236 0 512s229.236 512 512 512 512-229.236 512-512z m-232.727-93.09c51.386 0 93.09 41.704 93.09 93.09s-41.704 93.09-93.09 93.09c-51.433 0-93.091-41.657-93.091-93.09s41.658-93.09 93.09-93.09zM232.727 605.09c-51.432 0-93.09-41.657-93.09-93.09s41.658-93.09 93.09-93.09c51.386 0 93.091 41.704 93.091 93.09s-41.705 93.09-93.09 93.09zM418.91 512c0-51.433 41.658-93.09 93.091-93.09 51.386 0 93.09 41.704 93.09 93.09s-41.704 93.09-93.09 93.09c-51.433 0-93.09-41.657-93.09-93.09z" p-id="5275" fill="#515151"></path>
+</svg>

+ 15 - 0
app/public/js/comm.js

@@ -133,3 +133,18 @@ function setCookie(c_name, value, expiredays) {
     escape(value) +
     (expiredays == null ? "" : "; expires=" + exdate.toGMTString() + ";path=/");
 }
+
+function copy_to_clipboard(strInput) {
+  const input = document.createElement("input");
+  input.setAttribute("readonly", "readonly");
+  input.setAttribute("value", strInput);
+  document.body.appendChild(input);
+  //	input.setSelectionRange(0, strInput.length);
+  //	input.focus();
+  input.select();
+  if (document.execCommand("copy")) {
+    document.execCommand("copy");
+    console.log("复制成功");
+  }
+  document.body.removeChild(input);
+}

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 475 - 471
app/studio/js/common.js


Vissa filer visades inte eftersom för många filer har ändrats