reader.php 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864
  1. <?php
  2. require_once "../public/_pdo.php";
  3. require_once "../path.php";
  4. require_once '../public/load_lang.php';
  5. ?>
  6. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
  7. <html>
  8. <head>
  9. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
  10. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  11. <link type="text/css" rel="stylesheet" href="css/reader.css"/>
  12. <link type="text/css" rel="stylesheet" href="css/reader_mob.css" media="screen and (max-width:767px)">
  13. <title id="page_title">PCD Reader</title>
  14. <script src="js/jquery-3.3.1.min.js"></script>
  15. <script src="js/fixedsticky.js"></script>
  16. <script src="js/reader.js"></script>
  17. <script src="../public/js/comm.js"></script>
  18. <script src="../term/term.js"></script>
  19. <script src="../term/note.js"></script>
  20. <body class="reader_body" >
  21. <script type="text/javascript">
  22. $(document).ready(function(){
  23. $(".toc_1_title").click(function(){
  24. $(".toc_2").hide();
  25. $(this).siblings().slideDown("200");
  26. });
  27. });
  28. </script>
  29. <style>
  30. #para_nav {
  31. display: flex;
  32. justify-content: space-between;
  33. padding: 5px 1em;
  34. border-top: 1px solid gray;
  35. }
  36. .word{
  37. display:inline-block;
  38. padding: 1px 3px;
  39. }
  40. .mean{
  41. font-size: 65%;
  42. }
  43. /* 下拉内容 (默认隐藏) */
  44. #mean_menu {
  45. margin: 0.3em;
  46. position: absolute;
  47. background-color: white;
  48. min-width: 8em;
  49. max-width: 30em;
  50. margin: -1px 0px;
  51. box-shadow: 0px 3px 13px 0px black;
  52. color: var(--main-color);
  53. z-index: 200;
  54. }
  55. /* 下拉菜单的链接 */
  56. #mean_menu a {
  57. /*padding: 0.3em 0.4em;*/
  58. line-height: 160%;
  59. text-decoration: none;
  60. display: block;
  61. cursor: pointer;
  62. text-align: left;
  63. font-size:80%;
  64. }
  65. /* 鼠标移上去后修改下拉菜单链接颜色 */
  66. .mean_menu a:hover {
  67. background-color: blue;
  68. color: white;
  69. }
  70. .par_pali_div{
  71. margin-top:1em;
  72. }
  73. .par_pali_div{
  74. font-weight:700;
  75. }
  76. sent{
  77. font-weight:500;
  78. font-size:110%;
  79. line-height: 150%;
  80. }
  81. sent:hover{
  82. background-color:#fefec1;
  83. }
  84. para {
  85. color: white;
  86. background-color: #F1CA23;
  87. min-width: 2em;
  88. display: inline-block;
  89. text-align: center;
  90. padding: 3px 6px;
  91. border-radius: 99px;
  92. margin-right: 5px;
  93. cursor:pointer;
  94. font-size:80%;
  95. }
  96. para:hover{
  97. }
  98. .sent_count{
  99. font-size:80%;
  100. color: white;
  101. background-color: #1cb70985;
  102. min-width: 2em;
  103. display: inline-block;
  104. text-align: center;
  105. padding: 2px 0;
  106. border-radius: 99px;
  107. margin-left: 5px;
  108. cursor:pointer;
  109. }
  110. .toc_1{
  111. padding: 5px;
  112. cursor: pointer;
  113. }
  114. .toc_1_title{
  115. font-weight:700;
  116. }
  117. .toc_2{
  118. font-weight:500;
  119. padding-left:1em;
  120. display:none;
  121. }
  122. .curr_chapter{
  123. background-color:#e1e1e1;
  124. }
  125. .toc_curr_chapter2{
  126. display:block;
  127. }
  128. .toc_title2 a{
  129. color:black;
  130. line-height:1.4em;
  131. text-decoration: none;
  132. }
  133. .toc_title2 a:hover{
  134. text-decoration: underline;
  135. }
  136. .curr_chapter_title2{
  137. background-color:#F1CA23;
  138. }
  139. #leftmenuinner{
  140. width: 17em;
  141. }
  142. #leftmenuinnerinner{
  143. overflow-y: scroll;
  144. }
  145. .sent_toc{
  146. font-weight:700;
  147. font-size:120%;
  148. }
  149. </style>
  150. <!-- tool bar begin-->
  151. <div id="main_tool_bar" class='reader_toolbar'>
  152. <div id="index_nav">
  153. <button onclick="setNaviVisibility()">
  154. <svg t='1598084571450' class='icon' viewBox='0 0 1029 1024' version='1.1' xmlns='http://www.w3.org/2000/svg' p-id='6428' width='20px' height='20px'><path d='M159.744 69.632 53.248 69.632C28.672 69.632 4.096 90.112 4.096 118.784l0 94.208c0 28.672 24.576 49.152 53.248 49.152l102.4 0C184.32 266.24 208.896 241.664 208.896 212.992L208.896 118.784C208.896 90.112 184.32 69.632 159.744 69.632zM970.752 69.632 368.64 69.632c-28.672 0-57.344 24.576-57.344 49.152l0 94.208c0 28.672 32.768 49.152 57.344 49.152l598.016 0c28.672 0 57.344-24.576 57.344-49.152L1024 118.784C1028.096 94.208 999.424 69.632 970.752 69.632zM159.744 413.696 53.248 413.696c-28.672 0-53.248 24.576-53.248 49.152l0 94.208c0 28.672 24.576 49.152 53.248 49.152l102.4 0c28.672 0 53.248-24.576 53.248-49.152l0-94.208C208.896 438.272 184.32 413.696 159.744 413.696zM970.752 413.696 368.64 413.696c-28.672 0-57.344 24.576-57.344 49.152l0 94.208c0 28.672 32.768 49.152 57.344 49.152l598.016 0c28.672 0 57.344-24.576 57.344-49.152l0-94.208C1028.096 438.272 999.424 413.696 970.752 413.696zM159.744 757.76 53.248 757.76c-28.672 0-53.248 24.576-53.248 49.152l0 94.208c0 28.672 24.576 49.152 53.248 49.152l102.4 0c28.672 0 53.248-24.576 53.248-49.152l0-94.208C208.896 782.336 184.32 757.76 159.744 757.76zM970.752 761.856 368.64 761.856c-28.672 0-57.344 24.576-57.344 49.152l0 94.208c0 28.672 32.768 49.152 57.344 49.152l598.016 0c28.672 0 57.344-24.576 57.344-49.152l0-94.208C1028.096 782.336 999.424 761.856 970.752 761.856z' fill='#757AF7' p-id='6429'></path></svg>
  155. </button>
  156. </div>
  157. <div>
  158. <span id="tool_bar_title"><?php echo $_local->gui->title; ?></span>
  159. </div>
  160. <div style="display: flex;">
  161. <form action="../studio/project.php" method="post" onsubmit="return pali_canon_edit_now(this)" target="_blank" style="display: inline-block;">
  162. <div style="display:none;">
  163. <input type="input" name="op" value="create">
  164. <input type="hidden" name="view" value="<?php echo $_GET["view"]?>" />
  165. <input type="hidden" name="book" value="<?php echo $_GET["book"]?>" />
  166. <input type="hidden" id = "para" name="para" value="" />
  167. <input type="hidden" id = "para_end" name="para_end" value="" />
  168. <input type="hidden" id = "chapter_title" name="chapter_title" value="" />
  169. <textarea id="project_new_res_data" rows="3" cols="18" name="data"></textarea>
  170. </div>
  171. <input type="submit" value="<?php echo $_local->gui->edit_now; ?>">
  172. </form>
  173. <div class="case_dropdown">
  174. <p class="case_dropbtn"><button>
  175. <svg t='1598086376923' class='icon' viewBox='0 0 1024 1024' version='1.1' xmlns='http://www.w3.org/2000/svg' p-id='8426' width='20px' height='20px'><path d='M609.745455 453.818182v130.327273h69.818181V535.272727H744.727273v377.018182h95.418182V535.272727H907.636364v48.872728h69.818181V453.818182z' p-id='8427' fill='#757AF7'></path><path d='M677.236364 300.218182V111.709091H46.545455V300.218182h69.818181v-51.2h162.909091v663.272727h165.236364V249.018182h162.909091v51.2z' p-id='8428' fill='#757AF7'></path></svg>
  176. </button></p>
  177. <div class="case_dropdown-content" style="right: 0;width:10em;">
  178. <div ><button>A+</button><button>A-</button></div>
  179. <div ><button><?php echo $_local->gui->white;?></button><button><?php echo $_local->gui->dawn;//棕?></button><button><?php echo $_local->gui->night;//夜?></button></div>
  180. </div>
  181. </div>
  182. <div class="case_dropdown">
  183. <p class="case_dropbtn"><button>
  184. <svg t='1598086493824' class='icon' viewBox='0 0 1024 1024' version='1.1' xmlns='http://www.w3.org/2000/svg' p-id='9217' width='20px' height='20px'><path d='M912.695652 512m-111.304348 0a5 5 0 1 0 222.608696 0 5 5 0 1 0-222.608696 0Z' p-id='9218' fill='#757AF7'></path><path d='M512 512m-111.304348 0a5 5 0 1 0 222.608696 0 5 5 0 1 0-222.608696 0Z' p-id='9219' fill='#757AF7'></path><path d='M111.304348 512m-111.304348 0a5 5 0 1 0 222.608696 0 5 5 0 1 0-222.608696 0Z' p-id='9220' fill='#757AF7'></path></svg>
  185. </button></p>
  186. <div class="case_dropdown-content" style="right: 2em;min-width:6em;">
  187. <a onclick="tool_changed('dighest')"><?php echo $_local->gui->digest; //书摘?></a>
  188. <a onclick="tool_changed('comments')"><?php echo $_local->gui->comment; //批注?></a>
  189. <a onclick="tool_changed('target')"><?php echo $_local->gui->tag; //标签?></a>
  190. <a onclick="tool_changed('layout')"><?php echo $_local->gui->layout; //布局?></a>
  191. <a onclick="tool_changed('porpername')"><?php echo $_local->gui->dict_terms; //术语?></a>
  192. <a onclick="tool_changed('share')"><?php echo $_local->gui->share; //分享?></a>
  193. <a onclick="tool_changed('fix')"><?php echo $_local->gui->modify; //修改?></a>
  194. </div>
  195. </div>
  196. </div>
  197. </div>
  198. <div id="tool_bar_comments">
  199. <div class='reader_toolbar' style="height:auto;">
  200. <div>
  201. </div>
  202. <div>
  203. <span>单击段落文字添加批注</span>
  204. </div>
  205. <div>
  206. </div>
  207. </div>
  208. </div>
  209. <div id="tool_bar_dighest">
  210. <div class='reader_toolbar' style="height:auto;">
  211. <div>
  212. <button onclick="dighest_cancle()">取消</button>
  213. </div>
  214. <div>
  215. <span id="dighest_message">单击文字选择段落</span>
  216. </div>
  217. <div>
  218. <button onclick="dighest_ok()">完成</button>
  219. </div>
  220. </div>
  221. </div>
  222. <div id="tool_bar_fix">
  223. <div class='reader_toolbar' style="height:auto;">
  224. <div>
  225. <button onclick="fix_cancle()">取消</button>
  226. </div>
  227. <div>
  228. <span id="fix_message">单击按钮调整段落</span>
  229. </div>
  230. <div>
  231. <button onclick="fix_ok()">完成</button>
  232. </div>
  233. </div>
  234. </div>
  235. <!--tool bar end -->
  236. <div id="main_text_view" style="padding-bottom: 10em;">
  237. <?php
  238. $tocHtml="";
  239. if(isset($_GET["album"])){
  240. $album=$_GET["album"];
  241. }
  242. if(isset($_GET["book"])){
  243. $book=$_GET["book"];
  244. }
  245. else{
  246. echo "no book id";
  247. }
  248. if(substr($book,0,1)=='p'){
  249. $book=substr($book,1);
  250. }
  251. if(isset($_GET["paragraph"])){
  252. $paragraph = $_GET["paragraph"];
  253. }
  254. else if(isset($_GET["para"])){
  255. $paragraph = $_GET["para"];
  256. }
  257. else{
  258. $paragraph = -1;
  259. }
  260. if(isset($_GET["view"])){
  261. $_view = $_GET["view"];
  262. }
  263. else{
  264. echo "Error : 未定义必要的参数view";
  265. exit;
  266. }
  267. if(isset($_GET["display"])){
  268. $_display = $_GET["display"];
  269. }
  270. else{
  271. if($_view=="para" || $_view=="sent"){
  272. $_display = "sent";//默认值
  273. }
  274. else{
  275. $_display = "para";
  276. }
  277. }
  278. $tocList = array();
  279. if($_view=="chapter" || $_view=="para" || $_view=="sent" ){
  280. PDO_Connect("sqlite:"._FILE_DB_PALITEXT_);
  281. //生成目录
  282. $htmlToc2 = "";
  283. //找到该位置对应的书
  284. $query = "select paragraph,level,chapter_len,parent from 'pali_text' where book='$book' and paragraph='$paragraph'";
  285. $FetchParInfo = PDO_FetchAll($query);
  286. $deep = 0;
  287. if(count($FetchParInfo)>0){
  288. $para = $FetchParInfo[0]["paragraph"];
  289. $level = $FetchParInfo[0]["level"];
  290. $chapter_len = $FetchParInfo[0]["chapter_len"];
  291. $parent = $FetchParInfo[0]["parent"];
  292. $currParaBegin = $para;
  293. $currParaEnd = $para + $chapter_len;
  294. //循环查找父标题 得到整条路径
  295. while($parent>-1){
  296. $query = "select paragraph,level,parent,chapter_len from pali_text where \"book\" = '{$book}' and \"paragraph\" = '{$parent}' limit 0,1";
  297. $FetParent = PDO_FetchAll($query);
  298. if(count($FetParent)>0){
  299. $para = $FetParent[0]["paragraph"];
  300. $level = $FetParent[0]["level"];
  301. $chapter_len = $FetParent[0]["chapter_len"];
  302. $parent = $FetParent[0]["parent"];
  303. }
  304. $deep++;
  305. if($deep>8){
  306. break;
  307. }
  308. }
  309. $paraBegin = $para+1;
  310. $paraEnd = $para+$chapter_len;
  311. $query = "SELECT toc,paragraph,level,chapter_len,parent FROM 'pali_text' WHERE book='$book' AND (paragraph BETWEEN '$paraBegin' AND '$paraEnd') and level<100";
  312. $chapter_toc = PDO_FetchAll($query);
  313. $tocMaxLevel = 0;
  314. $tocMinLevel = 0;
  315. echo "<div><div>";
  316. foreach ($chapter_toc as $key => $value) {
  317. $classCurrToc="";
  318. $classCurrToc2 = "";
  319. $classCurrTocTitle2="";
  320. if($paragraph>=$value["paragraph"] && $paragraph<$value["paragraph"]+$value["chapter_len"]){
  321. $classCurrToc = " curr_chapter";
  322. $classCurrToc2 = " toc_curr_chapter2";
  323. $classCurrTocTitle2=" curr_chapter_title2";
  324. }
  325. if($tocMaxLevel==0){
  326. $tocMaxLevel =$value["level"];
  327. }
  328. if($tocMinLevel==0){
  329. if($value["level"]>$tocMaxLevel){
  330. $tocMinLevel = $value["level"];
  331. $tocHtml .= "<div class='toc_title2 {$classCurrToc}{$classCurrTocTitle2}'><a href='reader.php?view=chapter&book={$book}&para={$value["paragraph"]}'>{$value["toc"]}</a></div>";
  332. }
  333. else{
  334. $tocHtml .= "</div></div><div class='toc_1 {$classCurrToc}'>";
  335. $tocHtml .= "<div class='toc_1_title'>{$value["toc"]}</div><div class='toc_2 $classCurrToc2'>";
  336. }
  337. }
  338. else{
  339. if($value["level"] == $tocMaxLevel){
  340. $tocHtml .= "</div></div><div class='toc_1 {$classCurrToc}'>";
  341. $tocHtml .= "<div class='toc_1_title'>{$value["toc"]}</div><div class='toc_2 $classCurrToc2' >";
  342. }
  343. else if($value["level"] == $tocMinLevel){
  344. $tocHtml .= "<div class='toc_title2 {$classCurrToc}{$classCurrTocTitle2}'><a href='reader.php?view=chapter&book={$book}&para={$value["paragraph"]}'>{$value["toc"]}</a></div>";
  345. }
  346. }
  347. //右侧目录
  348. if($value["paragraph"]>$currParaBegin && $value["paragraph"]<$currParaEnd){
  349. $tocList[$value["paragraph"]] = $value["level"];
  350. $htmlToc2 .= "<div><a href='#para_{$value["paragraph"]}'>{$value["toc"]}</a></div>";
  351. }
  352. }
  353. echo " </div></div>";
  354. }
  355. //获取段落信息 如 父段落 下一个段落等
  356. $query = "select * from 'pali_text' where book='$book' and paragraph='$paragraph'";
  357. $FetchParInfo = PDO_FetchAll($query);
  358. if(count($FetchParInfo)==0){
  359. echo "Error:no paragraph info";
  360. echo $query;
  361. }
  362. $currLevel = $FetchParInfo[0]["level"];
  363. $par_begin=$paragraph+1-1;
  364. if($_view=="para"){
  365. $par_end = $par_begin;
  366. }
  367. else{
  368. $par_end=$par_begin+$FetchParInfo[0]["chapter_len"]-1;
  369. }
  370. $par_next=$FetchParInfo[0]["next_chapter"];
  371. $par_prev=$FetchParInfo[0]["prev_chapter"];
  372. $par_parent=$FetchParInfo[0]["parent"];
  373. if($par_parent >= 0){
  374. $query = "select toc from 'pali_text' where book='$book' and paragraph='$par_parent'";
  375. $FetchToc = PDO_FetchAll($query);
  376. if(count($FetchToc)>0){
  377. $_parent_title = $FetchToc[0]["toc"];
  378. }
  379. }
  380. //查询标题
  381. if($_view=="chapter"){
  382. $par_title = $FetchParInfo[0]["toc"];
  383. }
  384. else{
  385. $par_title = $_parent_title;
  386. }
  387. //导航按钮
  388. if($_view=="sent"){
  389. $next_para_link = "";
  390. $prev_para_link = "";
  391. }
  392. else{
  393. if($par_next != -1){
  394. $query = "select paragraph , toc from 'pali_text' where book='$book' and paragraph='$par_next' ";
  395. $FetchPara = PDO_FetchAll($query);
  396. if(count($FetchPara)>0){
  397. $next_para_link = "<a href='reader.php?view={$_view}&book={$book}&para={$par_next}'><span id='para_nav_next'>{$FetchPara[0]["toc"]}</span><span id='para_nav_next_a'>";
  398. $next_para_link .= "<svg t='1598093121925' class='icon' viewBox='0 0 1024 1024' version='1.1' xmlns='http://www.w3.org/2000/svg' p-id='4451' width='32px' height='32px'><path d='M540.5696 102.4c-225.83296 0-409.6 183.74656-409.6 409.6s183.76704 409.6 409.6 409.6c225.85344 0 409.6-183.74656 409.6-409.6s-183.74656-409.6-409.6-409.6z m180.14208 439.84896l-109.19936 128.59392a46.65344 46.65344 0 0 1-65.86368 5.36576 46.71488 46.71488 0 0 1-5.38624-65.8432l43.86816-51.63008h-188.12928a46.6944 46.6944 0 1 1 0-93.42976h188.12928l-43.86816-51.63008a46.75584 46.75584 0 0 1 71.24992-60.47744l109.19936 128.59392c14.82752 17.408 14.82752 43.008 0 60.45696z' p-id='4452' fill='#757AF7'></path></svg>";
  399. $next_para_link .= "</span></a>";
  400. }
  401. else{
  402. $next_para_link = "没有查询到标题";
  403. }
  404. }
  405. else{
  406. $next_para_link = "没了";
  407. }
  408. if($par_prev != -1){
  409. $query = "select paragraph , toc from 'pali_text' where book='$book' and paragraph='$par_prev' ";
  410. $FetchPara = PDO_FetchAll($query);
  411. if(count($FetchPara)>0){
  412. $prev_para_link = "<a href='reader.php?view={$_view}&book={$book}&para={$par_prev}'><span id='para_nav_prev_a'>";
  413. $prev_para_link .= "<svg t='1598093521111' class='icon' viewBox='0 0 1024 1024' version='1.1' xmlns='http://www.w3.org/2000/svg' p-id='4644' width='32' height='32'><path d='M540.5696 102.4c-225.83296 0-409.6 183.74656-409.6 409.6s183.76704 409.6 409.6 409.6c225.85344 0 409.6-183.74656 409.6-409.6s-183.74656-409.6-409.6-409.6z m144.54784 456.31488h-188.12928l43.84768 51.63008a46.6944 46.6944 0 0 1-35.59424 76.96384 46.55104 46.55104 0 0 1-35.61472-16.4864l-109.24032-128.59392a46.71488 46.71488 0 0 1 0-60.47744l109.24032-128.59392a46.6944 46.6944 0 1 1 71.20896 60.47744l-43.84768 51.63008h188.12928a46.6944 46.6944 0 1 1 0 93.45024z' p-id='4645' fill='#757AF7'></path></svg>";
  414. $prev_para_link .= "</span><span id='para_nav_prev'>{$FetchPara[0]["toc"]}</span></a>";
  415. }
  416. else{
  417. $prev_para_link = "没有查询到标题";
  418. }
  419. }
  420. else{
  421. $prev_para_link = "没了";
  422. }
  423. }
  424. //设置标题栏的经文名称
  425. echo "<script>";
  426. echo "document.getElementById('tool_bar_title').innerHTML='".$par_title."';\n";
  427. echo "$('#chapter_title').val('".$par_title."');\n";
  428. echo "$('#para_end').val('".$par_end."');\n";
  429. echo "$('#para').val('".$par_begin."');\n";
  430. echo "</script>";
  431. }
  432. if($currLevel<$tocMinLevel){
  433. echo "请选择章节";
  434. }
  435. else{
  436. //上一级
  437. echo "<div>";
  438. switch($_view){
  439. case 1 :
  440. break;
  441. case 2:
  442. break;
  443. case 3:
  444. break;
  445. case 4:
  446. break;
  447. case 5:
  448. break;
  449. case 5:
  450. break;
  451. case 6:
  452. break;
  453. case "chapter":
  454. if($par_parent >= 0 && $currLevel>$tocMinLevel){
  455. echo "<a href='reader.php?view={$_view}&book={$book}&paragraph={$par_parent}'>";
  456. echo "<svg t='1598083209786' class='icon' style='fill:#666666;' height='30px' viewBox='0 0 1024 1024' version='1.1' xmlns='http://www.w3.org/2000/svg' p-id='4926'><path d='M446.464 118.784l-254.976 256c-13.312 13.312-4.096 35.84 15.36 35.84H716.8c18.432 0 28.672-22.528 15.36-35.84l-254.976-256c-9.216-8.192-22.528-8.192-30.72 0zM563.2 796.672V533.504c0-11.264-9.216-21.504-21.504-21.504H379.904c-11.264 0-21.504 9.216-21.504 21.504v366.592c0 11.264 9.216 21.504 21.504 21.504h467.968c11.264 0 21.504-9.216 21.504-21.504V839.68c0-11.264-9.216-21.504-21.504-21.504H584.704c-12.288 0-21.504-9.216-21.504-21.504z m0 21.504' p-id='4927'></path></svg>";
  457. echo "{$_parent_title}</a>";
  458. }
  459. break;
  460. case "para":
  461. if($par_parent >= 0){
  462. echo "<a href='reader.php?view=chapter&book={$book}&paragraph={$par_parent}'>";
  463. echo "<svg t='1598083209786' class='icon' style='fill:#666666;' height='30px' viewBox='0 0 1024 1024' version='1.1' xmlns='http://www.w3.org/2000/svg' p-id='4926'><path d='M446.464 118.784l-254.976 256c-13.312 13.312-4.096 35.84 15.36 35.84H716.8c18.432 0 28.672-22.528 15.36-35.84l-254.976-256c-9.216-8.192-22.528-8.192-30.72 0zM563.2 796.672V533.504c0-11.264-9.216-21.504-21.504-21.504H379.904c-11.264 0-21.504 9.216-21.504 21.504v366.592c0 11.264 9.216 21.504 21.504 21.504h467.968c11.264 0 21.504-9.216 21.504-21.504V839.68c0-11.264-9.216-21.504-21.504-21.504H584.704c-12.288 0-21.504-9.216-21.504-21.504z m0 21.504' p-id='4927'></path></svg>";
  464. echo "{$_parent_title}</a>";
  465. }
  466. break;
  467. case "sent":
  468. echo "<a href='reader.php?view=para&book={$book}&paragraph={$paragraph}'>";
  469. echo "<svg t='1598083209786' class='icon' style='fill:#666666;' height='30px' viewBox='0 0 1024 1024' version='1.1' xmlns='http://www.w3.org/2000/svg' p-id='4926'><path d='M446.464 118.784l-254.976 256c-13.312 13.312-4.096 35.84 15.36 35.84H716.8c18.432 0 28.672-22.528 15.36-35.84l-254.976-256c-9.216-8.192-22.528-8.192-30.72 0zM563.2 796.672V533.504c0-11.264-9.216-21.504-21.504-21.504H379.904c-11.264 0-21.504 9.216-21.504 21.504v366.592c0 11.264 9.216 21.504 21.504 21.504h467.968c11.264 0 21.504-9.216 21.504-21.504V839.68c0-11.264-9.216-21.504-21.504-21.504H584.704c-12.288 0-21.504-9.216-21.504-21.504z m0 21.504' p-id='4927'></path></svg>";
  470. echo "{$paragraph}</a>";
  471. break;
  472. case 10:
  473. break;
  474. }
  475. echo "</div>";
  476. //生成一个段落空壳 等会儿查询数据,按照不同数据类型填充进去
  477. PDO_Connect("sqlite:"._FILE_DB_PALI_SENTENCE_);
  478. if($_display=="sent"){
  479. //逐句显示
  480. for($iPar=$par_begin;$iPar<=$par_end;$iPar++){
  481. if($_view=="sent"){
  482. $query = "select text, begin, end from 'pali_sent' where book='$book' and paragraph='$paragraph' and begin='{$_GET["begin"]}' and end ='{$_GET["end"]}'";
  483. }
  484. else{
  485. $query = "select text, begin, end from 'pali_sent' where book='$book' and paragraph='$iPar'";
  486. }
  487. if(isset($tocList[$iPar])){
  488. $sentClass = " sent_toc";
  489. }
  490. else{
  491. $sentClass = "";
  492. }
  493. $FetchSent = PDO_FetchAll($query);
  494. echo "<div id='par-b$book-$iPar' class='par_div'>";
  495. echo "<para book='$book' para='$iPar'>$iPar</para><a name='para_{$iPar}'></a>";
  496. foreach ($FetchSent as $key => $value) {
  497. echo "<div id='sent-pali-b$book-$iPar-{$value["begin"]}' class='par_pali_div'>";
  498. $pali_sent = str_replace("{","<b>",$value["text"]);
  499. $pali_sent = str_replace("}","</b>",$pali_sent);
  500. echo "<sent class='{$sentClass}' book='{$book}' para='{$iPar}' begin='{$value["begin"]}' end='{$value["end"]}' >".$pali_sent."</sent>";
  501. echo "</div>";
  502. echo "<div id='sent-wbwdiv-b$book-$iPar-{$value["begin"]}' class='par_translate_div'>";
  503. echo "</div>";
  504. echo "<div id='sent-translate-b$book-$iPar-{$value["begin"]}' class='par_translate_div'>";
  505. echo "</div>";
  506. }
  507. echo "</div>";
  508. }
  509. }
  510. else{
  511. //段落显示
  512. for($iPar=$par_begin;$iPar<=$par_end;$iPar++){
  513. if(isset($tocList[$iPar])){
  514. $sentClass = " sent_toc";
  515. }
  516. else{
  517. $sentClass = "";
  518. }
  519. $query = "select text , begin, end from 'pali_sent' where book='$book' and paragraph='$iPar'";
  520. $FetchSent = PDO_FetchAll($query);
  521. echo "<div id='par-b$book-$iPar' class='par_div'>";
  522. echo "<div id='par-pali-b$book-$iPar' class='par_pali_div'>";
  523. echo "<para book='$book' para='$iPar'>$iPar</para><a name='para_{$iPar}'></a>";
  524. foreach ($FetchSent as $key => $value) {
  525. $sent_text = str_replace("{","<b>",$value["text"]) ;
  526. $sent_text = str_replace("}","</b>",$sent_text) ;
  527. echo "<sent class='{$sentClass}' book='{$book}' para='{$iPar}' begin='{$value["begin"]}' end='{$value["end"]}' >{$sent_text}</sent>";
  528. }
  529. echo "</div>";
  530. echo "<div id='par-wbwdiv-b$book-$iPar' class='par_translate_div'>";
  531. echo "</div>";
  532. echo "<div id='par-translate-b$book-$iPar' class='par_translate_div'>";
  533. echo "</div>";
  534. echo "<div id='par-note-b$book-$iPar' class='par_translate_div'>";
  535. echo "</div>";
  536. echo "</div>";
  537. }
  538. }
  539. if(isset($_GET["sent_mode"])){
  540. }
  541. PDO_Connect("sqlite:"._FILE_DB_SENTENCE_);
  542. $dbh = new PDO("sqlite:"._FILE_DB_PALI_SENTENCE_, "", "");
  543. $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
  544. for($iPar=$par_begin;$iPar<=$par_end;$iPar++){
  545. if($_view=="sent"){
  546. $FetchPaliSent = array(array("begin" => $_GET["begin"] , "end" => $_GET["end"]));
  547. }
  548. else{
  549. $query = "select begin, end from 'pali_sent' where book='$book' and paragraph='$iPar'";
  550. $stmt = $dbh->query($query);
  551. $FetchPaliSent = $stmt->fetchAll(PDO::FETCH_ASSOC);
  552. }
  553. foreach ($FetchPaliSent as $key => $value) {
  554. $begin = $value["begin"];
  555. $end = $value["end"];
  556. if($_view=="sent"){
  557. $query="SELECT * FROM \"sentence\" WHERE (book = '{$book}' AND \"paragraph\" = ".$PDO->quote($iPar)." AND begin = '$begin' AND end = '$end' AND length(text)>0 ) order by modify_time DESC";
  558. }
  559. else{
  560. $query = "SELECT * FROM \"sentence\" WHERE book = '{$book}' AND \"paragraph\" = ".$PDO->quote($iPar)." AND begin = '$begin' AND end = '$end' AND length(text)>0 order by modify_time DESC limit 0, 1";
  561. }
  562. $query_count = "SELECT count(book) FROM \"sentence\" WHERE book = '{$book}' AND \"paragraph\" = ".$PDO->quote($iPar)." AND begin = '$begin' AND end = '$end' AND length(text)>0 ";
  563. $sent_count = PDO_FetchOne($query_count);
  564. if($sent_count>9){
  565. $sent_count = "9+";
  566. }
  567. $FetchText = PDO_FetchAll($query);
  568. $iFetchText=count($FetchText);
  569. if($iFetchText>0){
  570. for($i=0;$i<$iFetchText;$i++){
  571. $currParNo=$iPar;
  572. if($_display=="sent"){
  573. $sent_style = "display:block";
  574. }
  575. else{
  576. $sent_style = "";
  577. }
  578. $tran_text = str_replace("[[","<term status='0'>",$FetchText[$i]["text"]);
  579. $tran_text = str_replace("]]","</term>",$tran_text);
  580. echo "<sent_trans style='{$sent_style}' id='sent-tran-b{$book}-{$currParNo}-{$FetchText[$i]["begin"]}-{$i}' class='sent_trans ' book='$book' para='$currParNo' begin='{$FetchText[$i]["begin"]}'>".$tran_text;
  581. if($_view!="sent" && $_display=="sent"){
  582. echo "<span class='sent_count'>$sent_count</span>";
  583. }
  584. echo "</sent_trans>";
  585. echo "<script>";
  586. if($_display=="sent"){
  587. echo "document.getElementById('sent-translate-b{$book}-{$currParNo}-{$FetchText[$i]["begin"]}').appendChild(document.getElementById('sent-tran-b{$book}-{$currParNo}-{$FetchText[$i]["begin"]}-{$i}'));";
  588. }
  589. else{
  590. echo "document.getElementById('par-translate-b{$book}-{$currParNo}').appendChild(document.getElementById('sent-tran-b{$book}-{$currParNo}-{$FetchText[$i]["begin"]}-{$i}'));";
  591. }
  592. echo "</script>";
  593. }
  594. }
  595. }
  596. }
  597. //查询句子译文内容
  598. //查询句子译文内容结束
  599. echo "<div id='para_nav'>";
  600. echo "<div style='display:inline-flex;'>";
  601. echo "<svg t='1598094361320' class='icon' viewBox='0 0 1024 1024' version='1.1' xmlns='http://www.w3.org/2000/svg' p-id='4933' width='32' height='32'><path d='M698.75712 684.4416a81.92 81.92 0 0 1-124.88704 106.06592l-191.488-225.4848a81.89952 81.89952 0 0 1 0-106.06592l191.488-225.4848a81.92 81.92 0 0 1 124.88704 106.06592l-146.45248 172.46208 146.45248 172.4416z' p-id='4934' fill='#757AF7'></path></svg>";
  602. echo "$prev_para_link</div>";
  603. echo "<div style='display:inline-flex;'>$next_para_link";
  604. echo "<svg t='1598094021808' class='icon' viewBox='0 0 1024 1024' version='1.1' xmlns='http://www.w3.org/2000/svg' p-id='4451' width='32' height='32'><path d='M698.75712 565.02272l-191.488 225.4848a81.73568 81.73568 0 0 1-62.48448 28.89728 81.89952 81.89952 0 0 1-62.40256-134.94272l146.432-172.4416-146.432-172.4416a81.92 81.92 0 0 1 124.88704-106.06592l191.488 225.4848a81.87904 81.87904 0 0 1 0 106.02496z' p-id='4452' fill='#757AF7'></path></svg>";
  605. echo "</div>";
  606. echo "</div>";
  607. }
  608. ?>
  609. </div><!--main_text_view end-->
  610. <div id="new_comm_shell" style="display:none;">
  611. <div id="new_comm_div">
  612. <textarea id="new_comm_text"></textarea>
  613. <button onclick="new_comm_submit()">提交</button><button onclick="new_comm_cancel()">取消</button>
  614. </div>
  615. </div>
  616. <div id="dighest_edit_div" class="full_screen_window">
  617. <div class="win_caption">
  618. <div><button onclick="dighest_edit_cancle()">取消</button></div>
  619. <div><button onclick="dighest_edit_submit()">提交</button></div>
  620. </div>
  621. <div id="dighest_edit_body" class="win_body">
  622. <div>
  623. 标题:<input id="dighest_edit_title" />
  624. </div>
  625. <div>
  626. 简介:<textarea id="dighest_edit_summary"></textarea>
  627. </div>
  628. <div>
  629. 标签:<input id="dighest_edit_taget" />
  630. </div>
  631. <div id="dighest_text_preview">
  632. </div>
  633. </div>
  634. </div>
  635. <div id="right_panal_toc" style="position: fixed;top:3em;width:17em;left: calc(100% - 17em);height:auto; min-height:30em;border-left: 1px solid gray; font-size: 80%;padding: 2em 0.5em;">
  636. <?php
  637. if($currLevel>=$tocMinLevel){
  638. echo $htmlToc2;
  639. }
  640. ?>
  641. </div>
  642. </div>
  643. <!-- 全屏 黑色背景 -->
  644. <div id="BV" class="blackscreen" onclick="setNaviVisibility()"></div>
  645. <!-- nav begin-->
  646. <div id="leftmenuinner" class="viewswitch_off">
  647. <div class="win_caption">
  648. <div><button id="left_menu_hide" onclick="setNaviVisibility()">返回</button></div>
  649. <div id="menubartoolbar_New">
  650. <ul class="common-tab">
  651. <li id="content_menu_li" class="common-tab_li_act" onclick="menuSelected_2(menu_toc,'content_menu_li')">目录</li>
  652. <li id="palicanon_menu_li" class="common-tab_li" onclick="menuSelected_2(menu_pali_cannon,'palicanon_menu_li')">批注</li>
  653. <li id="bookmark_menu_li" class="common-tab_li" onclick="menuSelected_2(menu_bookmark,'bookmark_menu_li')">书签</li>
  654. </ul>
  655. </div>
  656. </div>
  657. <div class='toc' id='leftmenuinnerinner'>
  658. <!-- toc begin -->
  659. <div class="menu" id="menu_toc">
  660. <a name="_Content" ></a>
  661. <select name="menu" onchange="show_toc_level(this)" style="display:none;">
  662. <option value="1">1</option>
  663. <option value="2">2</option>
  664. <option value="3">3</option>
  665. <option value="4">4</option>
  666. <option value="5">5</option>
  667. <option value="6">6</option>
  668. <option value="7">7</option>
  669. </select>
  670. <div id="toc_content"><?php echo $tocHtml; ?></div>
  671. </div>
  672. <!-- toc end -->
  673. <!-- comments begin -->
  674. <div class="menu" id="menu_comments">
  675. <div id="navi_comments_inner"></div>
  676. </div>
  677. <!-- comments end -->
  678. <!-- book mark begin -->
  679. <div class="menu" id="menu_bookmark" style="display:none;">
  680. <div>
  681. <input id="B_Bookmark_All" onclick="setBookmarkVisibility('all')" type="checkbox" style="width: 20px; height: 20px" />
  682. <input id="B_Bookmark_A" onclick="setBookmarkVisibility('bma','B_Bookmark_A')" type="checkbox" style="width: 20px; height: 20px" /><span class="bookmarkcolora , bookmarkcolorblock" >a</span>
  683. <input id="B_Bookmark_X" onclick="setBookmarkVisibility('bmx','B_Bookmark_X')" type="checkbox" style="width: 20px; height: 20px" checked /><span class="bookmarkcolorx , bookmarkcolorblock" >?</span>
  684. <input id="B_Bookmark_1" onclick="setBookmarkVisibility('bm1','B_Bookmark_1')" type="checkbox" style="width: 20px; height: 20px" checked /><span class="bookmarkcolor1 , bookmarkcolorblock" >1</span>
  685. <input id="B_Bookmark_2" onclick="setBookmarkVisibility('bm2','B_Bookmark_2')" type="checkbox" style="width: 20px; height: 20px" checked /><span class="bookmarkcolor2 , bookmarkcolorblock" >2</span>
  686. <input id="B_Bookmark_3" onclick="setBookmarkVisibility('bm3','B_Bookmark_3')" type="checkbox" style="width: 20px; height: 20px" checked /><span class="bookmarkcolor3 , bookmarkcolorblock" >3</span>
  687. <input id="B_Bookmark_4" onclick="setBookmarkVisibility('bm4','B_Bookmark_4')" type="checkbox" style="width: 20px; height: 20px" checked /><span class="bookmarkcolor4 , bookmarkcolorblock" >4</span>
  688. <input id="B_Bookmark_5" onclick="setBookmarkVisibility('bm5','B_Bookmark_5')" type="checkbox" style="width: 20px; height: 20px" checked /><span class="bookmarkcolor5 , bookmarkcolorblock" >5</span>
  689. <input id="B_Bookmark_0" onclick="setBookmarkVisibility('bm0','B_Bookmark_0')" type="checkbox" style="width: 20px; height: 20px" checked /><span class="bookmarkcolor0 , bookmarkcolorblock" >0</span>
  690. </div>
  691. <div id="navi_bookmark_inner"></div>
  692. </div>
  693. <!-- book mark end -->
  694. </div>
  695. </div>
  696. <!-- nav end -->
  697. </div>
  698. <div id="mean_menu" ></div>
  699. <script>
  700. //lookup();
  701. $(".pali").mouseover(function(e){
  702. var targ
  703. if (!e) var e = window.event;
  704. if (e.target) targ = e.target;
  705. else if (e.srcElement) targ = e.srcElement;
  706. if (targ.nodeType == 3) // defeat Safari bug
  707. targ = targ.parentNode;
  708. var pali_word;
  709. pali_word=targ.innerHTML;
  710. objCurrMouseOverPaliMean=targ.nextSibling;
  711. $("#tool_bar_title").html(pali_word);
  712. $("#mean_menu").html(getWordMeanMenu(pali_word));
  713. targ.parentNode.appendChild(document.getElementById("mean_menu"));
  714. });
  715. $("sent").click(function(e){
  716. let book = $(this).attr("book");
  717. let para = $(this).attr("para");
  718. let begin = $(this).attr("begin");
  719. let end = $(this).attr("end");
  720. window.location.assign("reader.php?view=sent&book="+book+"&para="+para+"&begin="+begin+"&end="+end);
  721. });
  722. $("sent").mouseenter(function(e){
  723. let book = $(this).attr("book");
  724. let para = $(this).attr("para");
  725. let begin = $(this).attr("begin");
  726. $(this).css("background-color","#fefec1");
  727. $("sent_trans[book='"+book+"'][para='"+para+"'][begin='"+begin+"']").css("background-color","#fefec1");
  728. });
  729. $("sent").mouseleave(function(e){
  730. let book = $(this).attr("book");
  731. let para = $(this).attr("para");
  732. let begin = $(this).attr("begin");
  733. $(this).css("background-color","unset");
  734. $("sent_trans[book='"+book+"'][para='"+para+"'][begin='"+begin+"']").css("background-color","unset");
  735. });
  736. $("para").mouseenter(function(e){
  737. let book = $(this).attr("book");
  738. let para = $(this).attr("para");
  739. $("sent[book='"+book+"'][para='"+para+"']").css("background-color","#fefec1");
  740. });
  741. $("para").mouseleave(function(e){
  742. let book = $(this).attr("book");
  743. let para = $(this).attr("para");
  744. $("sent[book='"+book+"'][para='"+para+"']").css("background-color","unset");
  745. });
  746. $("sent_trans").mouseenter(function(e){
  747. let book = $(this).attr("book");
  748. let para = $(this).attr("para");
  749. let begin = $(this).attr("begin");
  750. $(this).css("background-color","#fefec1");
  751. $("sent[book='"+book+"'][para='"+para+"'][begin='"+begin+"']").css("background-color","#fefec1");
  752. });
  753. $("sent_trans").mouseleave(function(e){
  754. let book = $(this).attr("book");
  755. let para = $(this).attr("para");
  756. let begin = $(this).attr("begin");
  757. $(this).css("background-color","unset");
  758. $("sent[book='"+book+"'][para='"+para+"'][begin='"+begin+"']").css("background-color","unset");
  759. });
  760. $("para").click(function(e){
  761. let book = $(this).attr("book");
  762. let para = $(this).attr("para");
  763. window.location.assign("reader.php?view=para&book="+book+"&para="+para);
  764. });
  765. term_updata_translation();
  766. var wordlist = new Array();
  767. $("term").each(function(index,element){
  768. wordlist.push($(this).attr("pali"));
  769. }
  770. );
  771. function haha(){
  772. var wordquery ="('" + wordlist.join("','")+"')";
  773. $.post("../term/term.php",
  774. {
  775. op:"extract",
  776. words:wordquery
  777. },
  778. function(data,status){
  779. if(data.length>0){
  780. try{
  781. arrMyTerm = JSON.parse(data);
  782. term_updata_translation();
  783. }
  784. catch(e){
  785. console.error(e.error+" data:"+data);
  786. }
  787. }
  788. });
  789. }
  790. </script>
  791. </body>
  792. </html>