Просмотр исходного кода

:bug: 切换channel显示模式改变

visuddhinanda 4 лет назад
Родитель
Сommit
483a68378e
5 измененных файлов с 101 добавлено и 19 удалено
  1. 6 0
      app/article/article.js
  2. 42 9
      app/article/index.php
  3. 41 9
      app/reader/index.php
  4. 6 0
      app/reader/reader.js
  5. 6 1
      app/term/note.js

+ 6 - 0
app/article/article.js

@@ -173,6 +173,12 @@ function set_channal(channalid) {
 	if (_display != "") {
 		url += "&display=" + _display;
 	}
+	if (_mode != "") {
+		url += "&mode=" + _mode;
+	}
+	if (_direction != "") {
+		url += "&direction=" + _direction;
+	}
 	location.assign(url);
 }
 function setMode(mode = "read") {

+ 42 - 9
app/article/index.php

@@ -27,9 +27,7 @@ require_once "../pcdl/html_head.php";
 	if(isset($_GET["collection"])){
 		echo "_collection_id='".$_GET["collection"]."';";
 	}
-	if(isset($_GET["display"])){
-		echo "_display='".$_GET["display"]."';";
-	}
+
 	if(isset($_GET["channal"])){
 		echo "_channal='".$_GET["channal"]."';";
 	}
@@ -47,6 +45,35 @@ require_once "../pcdl/html_head.php";
 		$_mode = "read";
 		echo "_mode='read';";
 	}
+	if(isset($_GET["display"])){
+		$_display = $_GET["display"];
+		echo "_display='".$_GET["display"]."';";
+	}
+	else{
+		if($_mode=="read"){
+			$_display = "para";
+			echo "_display='para';";
+		}
+		else{
+			$_display = "sent";
+			echo "_display='sent';";			
+		}
+
+	}	
+	if(isset($_GET["direction"])){
+		$_direction = $_GET["direction"];
+		echo "_direction='".$_GET["direction"]."';";
+	}
+	else{
+		if($_mode=="read"){
+			$_direction = "row";
+			echo "_direction='row';";
+		}
+		else{
+			$_direction = "col";
+			echo "_direction='col';";
+		}
+	}
 	?>
 	</script>
 
@@ -94,16 +121,22 @@ require_once "../pcdl/html_head.php";
 </div>
 <div id="contents_view">
 	<div id="contents_div">
-		<div id="contents" 
-		<?php
-				if($_mode=="read"){
-					echo 'class="para_mode horizontal"';
+		<div id="contents" class="
+				<?php
+				if($_direction=="row"){
+					echo ' horizontal ';
+				}
+				else{
+					echo ' vertical ';
+				}
+				if($_display=="para"){
+					echo ' para_mode ';
 				}
 				else{
-					echo 'class="sent_mode vertical"';
+					echo ' sent_mode ';
 				}
 				?>
-		>
+		">
 		<?php echo $_local->gui->loading; ?>...
 		</div>
 		<div id="contents_foot">

+ 41 - 9
app/reader/index.php

@@ -35,10 +35,6 @@ require_once "../pcdl/html_head.php";
 	if(isset($_GET["end"])){
 		echo "_reader_end='".$_GET["end"]."';";
 	}
-
-	if(isset($_GET["display"])){
-		echo "_display='".$_GET["display"]."';";
-	}
 	
 	if(isset($_GET["channal"])){
 		echo "_channal='".$_GET["channal"]."';";
@@ -57,6 +53,35 @@ require_once "../pcdl/html_head.php";
 		$_mode = "read";
 		echo "_mode='read';";
 	}
+	if(isset($_GET["display"])){
+		$_display = $_GET["display"];
+		echo "_display='".$_GET["display"]."';";
+	}
+	else{
+		if($_mode=="read"){
+			$_display = "para";
+			echo "_display='para';";
+		}
+		else{
+			$_display = "sent";
+			echo "_display='sent';";			
+		}
+
+	}	
+	if(isset($_GET["direction"])){
+		$_direction = $_GET["direction"];
+		echo "_direction='".$_GET["direction"]."';";
+	}
+	else{
+		if($_mode=="read"){
+			$_direction = "row";
+			echo "_direction='row';";
+		}
+		else{
+			$_direction = "col";
+			echo "_direction='col';";
+		}
+	}
 	?>
 	</script>
 
@@ -108,16 +133,23 @@ require_once "../pcdl/html_head.php";
 		</div>
 		<div id="contents_view">
 			<div id="contents_div" >
-				<div id="contents" 
+			<div id="contents" class="
 				<?php
-				if($_mode=="read"){
-					echo 'class="para_mode horizontal"';
+				if($_direction=="row"){
+					echo ' horizontal ';
+				}
+				else{
+					echo ' vertical ';
+				}
+				if($_display=="para"){
+					echo ' para_mode ';
 				}
 				else{
-					echo 'class="sent_mode vertical"';
+					echo ' sent_mode ';
 				}
 				?>
-				><?php echo $_local->gui->loading; ?>...</div>
+		">
+				<?php echo $_local->gui->loading; ?>...</div>
 				<div id="contents_toc"></div>
 				<div id="contents_foot">
 					<div id="contents_nav" style="display:flex;justify-content: space-between;">

+ 6 - 0
app/reader/reader.js

@@ -249,6 +249,12 @@ function set_channal(channalid) {
 	if (_display != "") {
 		url += "&display=" + _display;
 	}
+	if (_mode != "") {
+		url += "&mode=" + _mode;
+	}
+	if (_direction != "") {
+		url += "&direction=" + _direction;
+	}
 	location.assign(url);
 }
 

+ 6 - 1
app/term/note.js

@@ -1,5 +1,6 @@
-var _display = "";
+var _display = "para";
 var _mode = "read";
+var _direction = "row";
 var _word = "";
 var _channal = "";
 var _lang = "";
@@ -1868,9 +1869,11 @@ function setDirection(obj) {
 	if (obj.value == "row") {
 		$("#contents").removeClass("vertical");
 		$("#contents").addClass("horizontal");
+		_direction = "row";
 	} else {
 		$("#contents").removeClass("horizontal");
 		$("#contents").addClass("vertical");
+		_direction = "col";
 	}
 }
 //设置逐段或逐句模式
@@ -1878,8 +1881,10 @@ function setDisplay(obj) {
 	if (obj.value == "para") {
 		$("#contents").removeClass("sent_mode");
 		$("#contents").addClass("para_mode");
+		_display = "para";
 	} else {
 		$("#contents").removeClass("para_mode");
 		$("#contents").addClass("sent_mode");
+		_display = "sent";
 	}
 }