Răsfoiți Sursa

切换文章,保持阅读模式和channel不变

visuddhinanda 4 ani în urmă
părinte
comite
56bdf84c81
2 a modificat fișierele cu 27 adăugiri și 20 ștergeri
  1. 24 20
      app/article/article.js
  2. 3 0
      app/term/note.js

+ 24 - 20
app/article/article.js

@@ -124,25 +124,11 @@ function render_article_list(article_list, collection_id) {
 		if (element.article == _articel_id) {
 			if (index > 0) {
 				const prev = article_list[index - 1];
-				prevArticle =
-					"<a href='../article/index.php?id=" +
-					prev.article +
-					display +
-					urlCollection +
-					"'>" +
-					prev.title +
-					"</a>";
+				prevArticle = "<a onclick=\"gotoArticle('" + prev.article + "')\">" + prev.title + "</a>";
 			}
 			if (index < article_list.length - 1) {
 				const next = article_list[index + 1];
-				nextArticle =
-					"<a href='../article/index.php?id=" +
-					next.article +
-					display +
-					urlCollection +
-					"'>" +
-					next.title +
-					"</a>";
+				nextArticle = "<a onclick=\"gotoArticle('" + next.article + "')\">" + next.title + "</a>";
 			}
 			$("#contents_nav_left").html(prevArticle);
 			$("#contents_nav_right").html(nextArticle);
@@ -151,11 +137,9 @@ function render_article_list(article_list, collection_id) {
 			"<li class='level_" +
 			element.level +
 			"'>" +
-			"<a href='../article/index.php?id=" +
+			"<a onclick=\"gotoArticle('" +
 			element.article +
-			display +
-			urlCollection +
-			"'>" +
+			"')\">" +
 			element.title +
 			"</a></li>";
 	}
@@ -196,5 +180,25 @@ function setMode(mode = "read") {
 	if (mode != "") {
 		url += "&mode=" + mode;
 	}
+	if (_direction != "") {
+		url += "&direction=" + _direction;
+	}
+	location.assign(url);
+}
+//跳转到另外一个文章
+function gotoArticle(articleId) {
+	let url = "../article/index.php?id=" + articleId;
+	if (_channal != "") {
+		url += "&channal=" + _channal;
+	}
+	if (_display != "") {
+		url += "&display=" + _display;
+	}
+	if (_mode != "") {
+		url += "&mode=" + _mode;
+	}
+	if (_direction != "") {
+		url += "&direction=" + _direction;
+	}
 	location.assign(url);
 }

+ 3 - 0
app/term/note.js

@@ -363,6 +363,9 @@ function find_channal(id) {
 	}
 	return false;
 }
+
+//生成版本列表
+//选择列表中的版本切换页面
 function render_channal_list(channalinfo) {
 	let output = "";
 	let checked = "";