2
0
Эх сурвалжийг харах

最近打开 页面 增加标题修改 和拷贝链接到剪贴板

Bhikkhu-Kosalla 5 жил өмнө
parent
commit
edfd404edb

+ 117 - 12
app/calendar/index.html

@@ -636,7 +636,80 @@ function show_time() {
 				result.lunar = pali_nakkhatta_name[lunar_num]; //27星宿月站名称
 				return result;
 			}
-			function getLocation() {
+			function show_position(){
+	curr_position = localStorage.getItem("local_position");
+			if (curr_position) {
+				g_coordinate_this.AT = curr_position.split("#")[0];
+				g_coordinate_this.LT = curr_position.split("#")[1];
+				g_coordinate_this.height = curr_position.split("#")[2];
+				if (g_coordinate_this.AT >= 0) {
+					var AT_string = angle_trans(g_coordinate_this.AT)[0]+"°" +angle_trans(g_coordinate_this.AT)[1] +
+					"’" +
+					angle_trans(g_coordinate_this.AT)[2] +
+					"” N";
+
+				} else {
+					var AT_string = angle_trans(0-g_coordinate_this.AT)[0]+"°" +angle_trans(0-g_coordinate_this.AT)[1] +
+					"’" +
+					angle_trans(0-g_coordinate_this.AT)[2] +
+					"” S";
+				}
+
+				if (g_coordinate_this.LT >= 0) {
+					var LT_string = angle_trans(g_coordinate_this.LT)[0]+"°" +angle_trans(g_coordinate_this.LT)[1] +
+					"’" +
+					angle_trans(g_coordinate_this.LT)[2] +
+					"” E";
+
+				} else {
+					var LT_string = angle_trans(0-g_coordinate_this.LT)[0]+"°" +angle_trans(0-g_coordinate_this.LT)[1] +
+					"’" +
+					angle_trans(0-g_coordinate_this.LT)[2] +
+					"” W";
+				}
+
+				if (g_coordinate_this.height != "null") {
+					var height_string = g_coordinate_this.height + "M";
+				} else {
+					var height_string = localString[g_language].unknown;
+				}
+			} else {
+				getLocation();
+			}
+			$("#AT_str").html(AT_string);
+			$("#LT_str").html(LT_string);
+			$("#altitude_string").html(height_string);
+		if(g_coordinate_this.AT<0){
+			$("#AT_°")[0].value = angle_trans(0-g_coordinate_this.AT)[0];
+			$("#AT_’")[0].value = angle_trans(0-g_coordinate_this.AT)[1];
+			$("#AT_”")[0].value = angle_trans(0-g_coordinate_this.AT)[2];
+			$("#NS")[0].value="-";
+		}
+		else{
+			$("#AT_°")[0].value = angle_trans(g_coordinate_this.AT)[0];
+			$("#AT_’")[0].value = angle_trans(g_coordinate_this.AT)[1];
+			$("#AT_”")[0].value = angle_trans(g_coordinate_this.AT)[2];
+			$("#NS")[0].value="+";
+
+		}
+		if(g_coordinate_this.LT<0){
+			$("#LT_°")[0].value = angle_trans(0-g_coordinate_this.LT)[0];
+			$("#LT_’")[0].value = angle_trans(0-g_coordinate_this.LT)[1];
+			$("#LT_”")[0].value = angle_trans(0-g_coordinate_this.LT)[2];
+			$("#WE")[0].value="-";
+
+		}
+		else{
+			$("#LT_°")[0].value = angle_trans(g_coordinate_this.LT)[0];
+			$("#LT_’")[0].value = angle_trans(g_coordinate_this.LT)[1];
+			$("#LT_”")[0].value = angle_trans(g_coordinate_this.LT)[2];
+			$("#WE")[0].value="+";
+		}
+		$("#HT_M")[0].value = g_coordinate_this.height;
+		$("#city_str").html(find_city(g_coordinate_this.AT,g_coordinate_this.LT).name);
+}
+show_position();
+function getLocation() {
 				//自动定位
 				if (navigator.geolocation) {
 					navigator.geolocation.getCurrentPosition(showPosition, showError);
@@ -644,6 +717,17 @@ function show_time() {
 					$("#selected_position_string").html("Geolocation is not supported by this browser.");
 				}
 			}
+			function showPosition(position) {
+				alert("get cordinate success");
+				g_coordinate_this.AT = position.coords.latitude; //纬度
+				g_coordinate_this.LT = position.coords.longitude; //经度
+				g_coordinate_this.height = position.coords.altitude; //海拔高度
+
+				let position_string = g_coordinate_this.AT + "#" + g_coordinate_this.LT + "#" + g_coordinate_this.height;
+				localStorage.setItem("local_position", position_string);
+
+			}
+
 			function position_input() {
 				//手动输入
 				var LT = Number($("#LT_°")[0].value);
@@ -675,17 +759,31 @@ function show_time() {
 						break;
 				}
 			}
-			function angle_trans(angle) {
-				var angle_str = new Array();
-				var num_d = Math.floor(angle);
-				var num_m = Math.floor((angle - num_d) * 60);
-				var num_s = Math.round((angle - num_d) * 60 - num_m);
-				angle_str.push(num_d);
-				angle_str.push(num_m);
-				angle_str.push(num_s);
+function angle_trans(angle,type) {
+	var angle_str = new Object;
+	if(type=="L"){
+		if(angle>=0){
+			angle_str.suf="E";
+		}else{
+			angle_str.suf="W";
+		}
+	}
+	else{
+		if(angle>=0){
+			angle_str.suf="N";
+		}else{
+			angle_str.suf="S";
+		}
+	}
+	angle=Math.abs(angle);
+	angle_str.d = Math.floor(angle);
+	angle_str.m = Math.floor((angle - num_d) * 60);
+	angle_str.s = Math.round((angle - num_d) * 60 - num_m);
 
-				return angle_str;
-			}
+	angle_str.str=angle_str.d+"°"+angle_str.m+"’"+angle_str.s+"”"+angle_str.suf;
+
+	return angle_str;
+}
 			function input_position() {
 				$("#position_input").show();
 			}
@@ -1025,7 +1123,7 @@ function show_time() {
 			AT += Number($("#AT_’")[0].value) / 60;
 			AT += Number($("#AT_”")[0].value) / 3600;
 			AT = Number($("#NS")[0].value + AT);
-			if (AT != 0) {
+			if (AT != 0 || LT!=0) {
 				g_coordinate_this.LT = LT;
 				g_coordinate_this.AT = AT;
 			}
@@ -1057,6 +1155,13 @@ function show_time() {
 				$("#selected_position_string").html("Geolocation is not supported by this browser.");
 			}
 		}
+		function showPosition(position) {
+				alert("get cordinate success");
+				g_coordinate_this.AT = position.coords.latitude; //纬度
+				g_coordinate_this.LT = position.coords.longitude; //经度
+				g_coordinate_this.height = position.coords.altitude; //海拔高度
+			}
+
 		function position_input() {
 			//手动输入
 			var LT = Number($("#LT_°")[0].value);

+ 1 - 0
app/public/lang/default.json

@@ -531,6 +531,7 @@
 		"public": "public",
 		"public_note": "Can share URL,Shows in Subscriber feed, search & related",
 		"copy_link": "copy the Link",
+		"copy_share_link": "copy share link",
 		"saved": "saved ",
 		"title_necessary": "title is necessary",
 		"example": "for example ",

+ 1 - 0
app/public/lang/en.json

@@ -530,6 +530,7 @@
 		"public": "public",
 		"public_note": "Can share URL,Shows in Subscriber feed, search & related",
 		"copy_link": "copy the Link",
+		"copy_share_link": "copy share link",
 		"saved": "saved ",
 		"title_necessary": "title is necessary",
 		"example": "for example ",

+ 1 - 0
app/public/lang/my.json

@@ -530,6 +530,7 @@
 		"public": "public",
 		"public_note": "Can share URL,Shows in Subscriber feed, search & related",
 		"copy_link": "copy the Link",
+		"copy_share_link": "copy share link",
 		"saved": "saved ",
 		"title_necessary": "title is necessary",
 		"example": "for example ",

+ 1 - 0
app/public/lang/si.json

@@ -535,6 +535,7 @@
 		"public": "public",
 		"public_note": "Can share URL,Shows in Subscriber feed, search & related",
 		"copy_link": "copy the Link",
+		"copy_share_link": "copy share link",
 		"saved": "saved ",
 		"title_necessary": "title is necessary",
 		"example": "for example ",

+ 1 - 0
app/public/lang/zh-cn.json

@@ -532,6 +532,7 @@
 		"public": "公开",
 		"public_note": "可通过链接访问,支持订阅,可搜索",
 		"copy_link": "复制链接",
+		"copy_share_link": "复制分享链接",
 		"saved": "已保存",
 		"title_necessary": "必须填写标题",
 		"example": "例如",

+ 1 - 0
app/public/lang/zh-tw.json

@@ -532,6 +532,7 @@
 		"public": "公開",
 		"public_note": "可通過連結訪問,推訂閱,可搜尋",
 		"copy_link": "複製連結",
+		"copy_share_link": "複製分享連結",
 		"saved": "已儲存",
 		"title_necessary": "必須填寫標題",
 		"example": "例如",

+ 2 - 2
app/studio/file_index.php

@@ -56,14 +56,14 @@ switch($op){
 			$value=mTime();
 		}
 		$doc_id=$_POST["doc_id"];
-		$query="UPDATE fileindex SET $field='$value' where user_id='$uid' AND   id='{$doc_id}'";
+		$query="UPDATE fileindex SET $field='$value' where user_id='$uid' AND  id='{$doc_id}'";
 		$stmt = @PDO_Execute($query);
 		if (!$stmt || ($stmt && $stmt->errorCode() != 0)) {
 			$error = PDO_ErrorInfo();
 			echo json_encode(array("error"=>$error[2],"message"=>$query), JSON_UNESCAPED_UNICODE);
 		}
 		else{
-			echo json_encode(array("error"=>"","message"=>$query), JSON_UNESCAPED_UNICODE);
+			echo json_encode(array("error"=>false,"message"=>$query), JSON_UNESCAPED_UNICODE);
 		}
 	break;
 	case "share":

+ 9 - 2
app/studio/index_recent.php

@@ -15,8 +15,15 @@ require_once '../studio/index_head.php';
 		color: var(--btn-color);
 		cursor:auto;
 	}
+	.file_list_row .hidden_function{
+		visibility: hidden;
+	}
+	.file_list_row:hover .hidden_function{
+		visibility: visible;
+	}
 	</style>
 	<script language="javascript" src="js/index_mydoc.js"></script>
+	<script language="javascript" src="js/data.js"></script>
 	<script src="../doc/coop.js"></script>
 
 	<?php
@@ -64,7 +71,7 @@ require_once '../studio/index_head.php';
 				
 				<span class="icon_btn_div">
 					<span class="icon_btn_tip"><?php echo $_local->gui->add_to_folder;?></span>
-					<button id="move_to_folder" type="button" class="icon_btn" onclick="setNaviVisibility('')" title=" ">
+					<button id="move_to_folder" type="button" class="icon_btn" onclick="" title=" ">
 						<svg class="icon">
 							<use xlink:href="./svg/icon.svg#ic_folder_move"></use>
 						</svg>
@@ -73,7 +80,7 @@ require_once '../studio/index_head.php';
 				
 				<span class="icon_btn_div">				
 					<span class="icon_btn_tip"><?php echo $_local->gui->rename;?></span>
-					<button id="edit_title" type="button" class="icon_btn" onclick="setNaviVisibility('')" title=" ">
+					<button id="edit_title" type="button" class="icon_btn" onclick="" title=" ">
 						<svg class="icon">
 							<use xlink:href="./svg/icon.svg#ic_rename"></use>
 						</svg>

+ 18 - 0
app/studio/js/data.js

@@ -243,6 +243,24 @@ function doc_info_title_change(obj) {
 		}
 	);
 }
+
+function _doc_info_title_change(id,title,callback=null){
+	if(callback==null){
+		callback=function (data, status) {
+			console.error("Data: " + data + "\nStatus: " + status);
+		}
+	}
+	$.post(
+		"file_index.php",
+		{
+			op: "set",
+			doc_id: id,
+			field: "title",
+			value: title,
+		},
+		callback
+	);
+}
 function getTranslateText(id) {
 	var xBlock = gXmlBookDataBody.getElementsByTagName("block");
 	for (var iBlock = 0; iBlock < xBlock.length; iBlock++) {

+ 59 - 10
app/studio/js/index_mydoc.js

@@ -38,7 +38,7 @@ function time_standardize(date) {
 
 }
 
-
+//显示最近查看列表
 function file_list_refresh() {
 	var d = new Date();
 	$.get("getfilelist.php",
@@ -55,17 +55,14 @@ function file_list_refresh() {
 				let file_list = JSON.parse(data);
 				let html = "";
 				for (x in file_list) {
+					
 					html += "<div class=\"file_list_row\">";
+
 					html += "<div class=\"file_list_col_1\">";
 					html += "<input id='file_check_" + x + "' type=\"checkbox\" />";
 					html += "<input id='file_id_" + x + "' value='" + file_list[x].id + "' type=\"hidden\" />";
 					html += "</div>";
-					if (file_list[x].doc_info && file_list[x].doc_info.length > 1) {
-						$link = "<a href='editor.php?op=opendb&fileid=" + file_list[x].id + "' target='_blank'>[db]";
-					}
-					else {
-						$link = "<a href='editor.php?op=open&fileid=" + file_list[x].id + "' target='_blank'>";
-					}
+
 					html += "<div class=\"file_list_col_2\">";
 					if ((file_list[x].parent_id == null || file_list[x].parent_id == "") && parseInt(file_list[x].share) == 1) {
 						//shared
@@ -92,12 +89,32 @@ function file_list_refresh() {
 					}
 					html += "</svg>";
 					html += "</span>";
+
 					html += "<div id='coop_show_" + file_list[x].id + "' style='display:inline;'></div>";
-					html += $link + file_list[x].title;
-					html += "</a>";
+					
+					let $link;
+					if (file_list[x].doc_info && file_list[x].doc_info.length > 1) {
+						$link = "<a href='editor.php?op=opendb&fileid=" + file_list[x].id + "' target='_blank'>[db]";
+					}
+					else {
+						$link = "<a href='editor.php?op=open&fileid=" + file_list[x].id + "' target='_blank'>";
+					}
 
+					html += $link +"<span id='title_"+file_list[x].id+"'>"+ file_list[x].title;
+					html += "</span></a>";
+					
+					//html +="<input type='input' style='diaplay:none;' id='input_title_"+file_list[x].id+"' value='"+file_list[x].title+"' />"
+					html +='<span class="icon_btn_div hidden_function">';	
+					html +='<span class="icon_btn_tip" style="margin-top: 0.7em;margin-left: 2.5em;">'+gLocal.gui.rename+'</span>';
+					html +="<button id='edit_title' type='button' class='icon_btn' onclick=\"title_change('"+file_list[x].id+"','"+file_list[x].title+"')\" >";
+					html +='	<svg class="icon">';
+					html +='		<use xlink:href="./svg/icon.svg#ic_rename"></use>';
+					html +='	</svg>';
+					html +='</button>';
+					html +='</span>	';
 
 					html += "</div>";
+
 					html += "<div class=\"file_list_col_3\">";
 
 					if ((file_list[x].parent_id && file_list[x].parent_id.length > 10) || parseInt(file_list[x].share) == 1) {
@@ -150,7 +167,23 @@ function file_list_refresh() {
 					if (!(file_list[x].doc_info && file_list[x].doc_info.length > 1)) {
 						html += "<a href='../doc/pcs2db.php?doc_id=" + file_list[x].id + "' target='_blank'>转数据库格式</a>";
 					}
+
+
+
+					html += "</div>";
+
+					html+="<div>";
+					html +='<span class="icon_btn_div hidden_function">';	
+					html +='<span class="icon_btn_tip">'+gLocal.gui.copy_share_link+'</span>';
+					html +="<button id='edit_title' type='button' class='icon_btn' onclick=\"share_link_copy_to_clipboard('"+file_list[x].id+"')\" >";
+					//html +='	<svg class="icon">';
+					//html +='		<use xlink:href="./svg/icon.svg#ic_rename"></use>';
+					//html +='	</svg>';
+					html +='<svg  t="1611985739555" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="6173" width="200" height="200"><path d="M423.198 640a83.84 83.84 0 0 1-64-28.8 259.84 259.84 0 0 1-26.88-308.48L441.118 128a261.12 261.12 0 1 1 448 272l-35.2 57.6a83.84 83.84 0 1 1-145.92-90.24l35.2-57.6a92.8 92.8 0 0 0-158.72-96.64l-107.52 176.64a92.8 92.8 0 0 0 9.6 109.44 83.84 83.84 0 0 1-64 139.52z" p-id="6174"></path><path d="M357.918 1024a261.12 261.12 0 0 1-222.72-397.44l31.36-50.56a83.84 83.84 0 1 1 144 87.68l-31.36 51.2a92.8 92.8 0 0 0 30.72 128 91.52 91.52 0 0 0 70.4 10.88 92.16 92.16 0 0 0 57.6-41.6l107.52-177.92a93.44 93.44 0 0 0-6.4-105.6 83.84 83.84 0 1 1 134.4-103.68 262.4 262.4 0 0 1 17.28 296.96L581.278 896a259.84 259.84 0 0 1-163.84 120.32 263.68 263.68 0 0 1-59.52 7.68z" p-id="6175"></path></svg>';
+					html +='</button>';
+					html +='</span>	';					
 					html += "</div>";
+
 					html += "</div>";
 				}
 				html += "<input id='file_count' type='hidden' value='" + file_list.length + "'/>"
@@ -166,7 +199,23 @@ function showUserFilaList() {
 	file_list_refresh();
 }
 
-
+function title_change(id,title){
+	let newTitle = prompt("新的标题",title);
+	if(newTitle){
+		_doc_info_title_change(id,newTitle,function(data,status){
+		let result = JSON.parse(data);
+		if(result.error==false){
+			$("#title_"+id).text(newTitle);
+		}
+		else{
+			alert(result.message);
+		}
+	});
+	}
+}
+function share_link_copy_to_clipboard(id){
+	copy_to_clipboard("https://www.wikipali.org/app/studio/project.php?op=open&doc_id="+id)
+}
 function mydoc_file_select(doSelect) {
 	if (doSelect) {
 		$("#file_tools").show();