visuddhinanda 5 роки тому
батько
коміт
adacc53337

+ 2 - 2
app/article/article.js

@@ -24,7 +24,7 @@ function articel_load(id) {
 					let result = JSON.parse(data);
 					if (result) {
 						$("#article_title").html(result.title);
-						$("#page_title").html(result.title);
+						$("#page_title").text(result.title);
 						$("#article_subtitle").html(result.subtitle);
 						$("#article_author").html(result.username.nickname + "@" + result.username.username);
 						$("#contents").html(note_init(result.content));
@@ -56,7 +56,7 @@ function collect_load(id) {
 					let result = JSON.parse(data);
 					if (result) {
 						$("#article_title").html(result.title);
-						$("#page_title").html(result.title);
+						$("#page_title").text(result.title);
 						if (result.subtitle) {
 							$("#article_subtitle").html(result.subtitle);
 						}

+ 109 - 106
app/course/course.js

@@ -1,109 +1,112 @@
 function course_load(course_id) {
-    $.get(
-        "../course/course_get.php", {
-            id: course_id,
-        },
-        function(data, status) {
-            let html = "";
-            let course_info = JSON.parse(data);
-            if (course_info) {
-                //head
-                html += "<div id='course_info_head' class='course_info_block'>";
-                html += "<div id='course_info_head_1'>";
-                html += "<div id='course_info_head_face'>";
-                html += "<img src='../../tmp/images/course/" + course_info.id + ".jpg' />";
-                html += "</div>";
-                html += "<div id='course_info_head_title'>";
-                html += "<div id='course_title'>" + course_info.title + "</div>";
-                html += "<div id='course_subtitle'>" + course_info.subtitle + "</div>";
-                html += "<div id='course_button'>";
-                html += "<button class='disable'>" + gLocal.gui.watch + "</button>";
-                html += "<button disabled class='disable'>" + gLocal.gui.sign_up + "</button>";
-                html += "</div>";
-                html += "</div>";
-                html += "</div>";
+	$.get(
+		"../course/course_get.php",
+		{
+			id: course_id,
+		},
+		function (data, status) {
+			let html = "";
+			let course_info = JSON.parse(data);
+			if (course_info) {
+				//head
+				html += "<div id='course_info_head' class='course_info_block'>";
+				html += "<div id='course_info_head_1'>";
+				html += "<div id='course_info_head_face'>";
+				html += "<img src='../../tmp/images/course/" + course_info.id + ".jpg' />";
+				html += "</div>";
+				html += "<div id='course_info_head_title'>";
+				html += "<div id='course_title'>" + course_info.title + "</div>";
+				html += "<div id='course_subtitle'>" + course_info.subtitle + "</div>";
+				html += "<div id='course_button'>";
+				html += "<button class='disable'>" + gLocal.gui.watch + "</button>";
+				html += "<button disabled class='disable'>" + gLocal.gui.sign_up + "</button>";
+				html += "</div>";
+				html += "</div>";
+				html += "</div>";
 
-                html += "<div id='course_info_head_2'>";
-                html += "<span><span>" + gLocal.gui.speaker + ": </span>";
-                html +=
-                    "<a href='../uhome/course.php?userid=" +
-                    course_info.teacher +
-                    "'>" +
-                    course_info.teacher_info.nickname +
-                    "</a>";
-                html += "</span>";
-                //html += "<span>地区:缅甸</span>";
-                html += "</div>";
-                // end of course_info_head_2
-                html += "</div>";
-                //end of head
-                //summary
-                if (course_info.summary.length > 0) {
-                    html += "<div id='course_info_summary' class='course_info_block'>";
-                    html += "<h2>" + gLocal.gui.introduction + "</h2>";
-                    try {
-                        html += marked(course_info.summary);
-                    } catch (e) {
-                        html += e.message;
-                    }
-                    html += "</div>";
-                }
-                //end of summary
-                //attachment
-                if (course_info.attachment.length > 0) {
-                    html += "<div id='course_info_attachment' class='course_info_block'>";
-                    html += "<h2>" + gLocal.gui.attachment + "</h2>";
-                    try {
-                        html += marked(course_info.attachment);
-                    } catch (e) {
-                        html += e.message;
-                    }
-                    html += "</div>";
-                }
-                //end of attachment
+				html += "<div id='course_info_head_2'>";
+				html += "<span><span>" + gLocal.gui.speaker + ": </span>";
+				html +=
+					"<a href='../uhome/course.php?userid=" +
+					course_info.teacher +
+					"'>" +
+					course_info.teacher_info.nickname +
+					"</a>";
+				html += "</span>";
+				//html += "<span>地区:缅甸</span>";
+				html += "</div>";
+				// end of course_info_head_2
+				html += "</div>";
+				//end of head
+				//summary
+				if (course_info.summary.length > 0) {
+					html += "<div id='course_info_summary' class='course_info_block'>";
+					html += "<h2>" + gLocal.gui.introduction + "</h2>";
+					try {
+						html += marked(course_info.summary);
+					} catch (e) {
+						html += e.message;
+					}
+					html += "</div>";
+				}
+				//end of summary
+				//attachment
+				if (course_info.attachment.length > 0) {
+					html += "<div id='course_info_attachment' class='course_info_block'>";
+					html += "<h2>" + gLocal.gui.attachment + "</h2>";
+					try {
+						html += marked(course_info.attachment);
+					} catch (e) {
+						html += e.message;
+					}
+					html += "</div>";
+				}
+				//end of attachment
 
-                $("#course_info").html(html);
-                $("img").one("error", function() {
-                    $(this).attr("src", "../course/img/default.jpg");
-                });
-            }
-        }
-    );
+				$("#course_info").html(html);
+				$("#page_title").text(course_info.title);
+				$("img").one("error", function () {
+					$(this).attr("src", "../course/img/default.jpg");
+				});
+			}
+		}
+	);
 
-    $.get(
-        "../course/lesson_list.php", {
-            id: course_id,
-        },
-        function(data, status) {
-            let arrLesson = JSON.parse(data);
-            let html = "";
-            for (const lesson of arrLesson) {
-                //计算课程是否已经开始
-                let now = new Date();
-                let class_lesson_time = "";
-                let dt = lesson["duration"] / 60;
-                if (now < lesson["date"]) {
-                    class_lesson_time = "not_started";
-                } else if (now > lesson["date"] && now < lesson["date"] + dt * 1000) {
-                    class_lesson_time = "in_progress";
-                } else {
-                    class_lesson_time = "already_over";
-                }
+	$.get(
+		"../course/lesson_list.php",
+		{
+			id: course_id,
+		},
+		function (data, status) {
+			let arrLesson = JSON.parse(data);
+			let html = "";
+			for (const lesson of arrLesson) {
+				//计算课程是否已经开始
+				let now = new Date();
+				let class_lesson_time = "";
+				let dt = lesson["duration"] / 60;
+				if (now < lesson["date"]) {
+					class_lesson_time = "not_started";
+				} else if (now > lesson["date"] && now < lesson["date"] + dt * 1000) {
+					class_lesson_time = "in_progress";
+				} else {
+					class_lesson_time = "already_over";
+				}
 
-                html += '<div class="lesson_card" >';
-                let d = new Date();
-                d.setTime(lesson["date"]);
-                let strData = d.toLocaleDateString();
-                let strTime = d.toLocaleTimeString();
-                html += "<div class='datatime " + class_lesson_time + "'>" + strData + " " + strTime + "</div>";
-                html +=
-                    '<div class="title" ><a href="../course/lesson.php?id=' +
-                    lesson["id"] +
-                    '" style="color:var(--main-color);">' +
-                    lesson["title"] +
-                    "</a></div>";
+				html += '<div class="lesson_card" >';
+				let d = new Date();
+				d.setTime(lesson["date"]);
+				let strData = d.toLocaleDateString();
+				let strTime = d.toLocaleTimeString();
+				html += "<div class='datatime " + class_lesson_time + "'>" + strData + " " + strTime + "</div>";
+				html +=
+					'<div class="title" ><a href="../course/lesson.php?id=' +
+					lesson["id"] +
+					'" style="color:var(--main-color);">' +
+					lesson["title"] +
+					"</a></div>";
 
-                /*
+				/*
 				let dt = lesson["duration"] / 60;
 				let sdt = "";
 				if (dt > 59) {
@@ -119,9 +122,9 @@ function course_load(course_id) {
 				html += '<div ><span class="lesson_status">' + lesson_time + "</span></div>";
 */
 
-                html += "</div>";
-            }
-            $("#lesson_list").html(html);
-        }
-    );
-}
+				html += "</div>";
+			}
+			$("#lesson_list").html(html);
+		}
+	);
+}

+ 1 - 0
app/course/lesson.js

@@ -191,6 +191,7 @@ function lesson_load(lesson_id) {
 				}
 				//end of attachment
 				$("#lesson_info").html(html);
+				$("#page_title").text(lesson_info.title);
 				note_refresh_new();
 				render_course_info(lesson_info.course_id);
 				render_lesson_list(lesson_info.course_id, lesson_info.id);

+ 1 - 1
app/reader/index.php

@@ -240,7 +240,7 @@ require_once "../pcdl/html_head.php";
 	}
 </style>
 
-
+<link type="text/css" rel="stylesheet" href="print.css" media="print" />
 <?php
     require_once("../pcdl/head_bar.php");
 ?>

+ 35 - 0
app/reader/print.css

@@ -0,0 +1,35 @@
+header {
+	display: none;
+}
+#head_bar {
+	display: none;
+}
+#right_pannal {
+	display: none;
+}
+.other_tran_div {
+	display: none;
+}
+
+.ref chapter {
+	display: none;
+}
+.ref > chapter:first-child {
+	display: none;
+}
+.ref > para {
+	display: none;
+}
+note {
+	padding: 0;
+}
+#contents_div {
+	padding: 0;
+}
+note > .tran {
+	color: #000000;
+}
+
+#contents_foot {
+	display: none;
+}

+ 1 - 0
app/reader/reader.js

@@ -204,6 +204,7 @@ function reader_get_path() {
 			});
 			let suttaTitle = $("chapter").last().html();
 			$("#article_title").html(suttaTitle);
+			$("#page_title").text(suttaTitle);
 			if (_reader_view == "chapter") {
 				//$("chapter").last().hide();
 			}

+ 14 - 8
app/term/note.js

@@ -41,9 +41,11 @@ function note_create() {
 }
 function note_sent_edit_dlg_init() {
 	$("body").append(
-		'<div id="note_sent_edit_dlg" title="' + gLocal.gui.edit + '"><guide gid="markdown_guide"></guide><div id="edit_dialog_content"></div></div>'
+		'<div id="note_sent_edit_dlg" title="' +
+			gLocal.gui.edit +
+			'"><guide gid="markdown_guide"></guide><div id="edit_dialog_content"></div></div>'
 	);
-guide_init();
+	guide_init();
 	$("#note_sent_edit_dlg").dialog({
 		autoOpen: false,
 		width: 550,
@@ -65,13 +67,17 @@ guide_init();
 	});
 }
 function note_init(input) {
-	let newString = input.replace(/\{\{/g, '<div class="note_shell"><note info="');
-	newString = newString.replace(/\}\}/g, '" ></note></div>');
+	if (input) {
+		let newString = input.replace(/\{\{/g, '<div class="note_shell"><note info="');
+		newString = newString.replace(/\}\}/g, '" ></note></div>');
 
-	let output = "<div>";
-	output += marked(newString);
-	output += "</div>";
-	return output;
+		let output = "<div>";
+		output += marked(newString);
+		output += "</div>";
+		return output;
+	} else {
+		return "";
+	}
 }
 
 function note_update_background_style() {

+ 1 - 0
app/term/term.js

@@ -141,6 +141,7 @@ function term_get_word_to_div(strWord, div, callback) {
 						html += "<div class='term_word_head'>";
 						html += "<div class='term_word_head_pali'>";
 						html += result[0].word;
+						$("#page_title").text(result[0].word + "-" + gLocal.gui.encyclopedia);
 						html += "</div>";
 						for (y in type) {
 							html += "<div class='term_word_head_mean'>";