visuddhinanda 4 роки тому
батько
коміт
a04b265350
2 змінених файлів з 18 додано та 3 видалено
  1. 6 0
      app/article/index.php
  2. 12 3
      app/reader/get_para1.php

+ 6 - 0
app/article/index.php

@@ -187,6 +187,12 @@ span.fancytree-node{
 	box-shadow: 0 0 10px var(--main-color);
 	z-index: 200;
 }
+
+#contents ul, li {
+    margin-block-start: 0.5em;
+    margin-block-end: 0.5em;
+    margin-left: 7px;
+}
 </style>
 
 <?php

+ 12 - 3
app/reader/get_para1.php

@@ -113,13 +113,22 @@ if ($FetchParInfo) {
 	}
 
 	if(count($toc)>1){
+		$currLevel = $toc[0]["level"];
+		$ulLevel = 0;
 		foreach ($toc as $key => $value) {
 			# code...
-			for ($i=2; $i < $value["level"]; $i++) { 
+			if($value["level"] > $currLevel  ){
+				$ulLevel++;
+			}
+			else if($value["level"] < $currLevel ){
+				$ulLevel--;		
+			}
+			$currLevel = $value["level"];
+			for ($i=0; $i < $ulLevel; $i++) { 
 				# code...
-				$output["content"] .= "  ";
+				$output["content"] .= "    ";
 			}
-			$output["content"] .= "- [{$value["toc"]}](../article/index.php?view=chapter&book={$_book}&par={$value["paragraph"]}) \n";
+			$output["content"] .= "- [{$value["toc"]}](../article/index.php?view=chapter&book={$_book}&par={$value["paragraph"]})\n";
 		}		
 	}