note.js 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739
  1. var _display = "";
  2. var _word = "";
  3. var _channal = "";
  4. var _lang = "";
  5. var _author = "";
  6. var _arrData = new Array();
  7. var _channalData;
  8. var MAX_NOTE_NEST = 2;
  9. /*
  10. {{203-1654-23-45@11@en@*}}
  11. <note>203-1654-23-45@11@en@*</note>
  12. <note id=guid book=203 para=1654 begin=23 end=45 author=11 lang=en tag=*></note>
  13. <note id=guid book=203 para=1654 begin=23 end=45 author=11 lang=en tag=*>
  14. <div class=text>
  15. pali text
  16. </div>
  17. <tran>
  18. </tran>
  19. <ref>
  20. </ref>
  21. </note>
  22. */
  23. /*
  24. 解析百科字符串
  25. {{203-1654-23-45@11@en@*}}
  26. <note id=12345 info="203-1654-23-45@11@en@*"><note>
  27. <note id="guid" book=203 para=1654 begin=23 end=45 author=11 lang=en tag=*></note>
  28. */
  29. function note_create() {
  30. wbw_channal_list_init();
  31. note_sent_edit_dlg_init();
  32. term_edit_dlg_init();
  33. }
  34. function note_sent_edit_dlg_init() {
  35. $("body").append('<div id="note_sent_edit_dlg" title="Edit"><div id="edit_dialog_content"></div></div>');
  36. $("#note_sent_edit_dlg").dialog({
  37. autoOpen: false,
  38. width: 550,
  39. buttons: [
  40. {
  41. text: "Save",
  42. click: function () {
  43. note_sent_save();
  44. $(this).dialog("close");
  45. },
  46. },
  47. {
  48. text: "Cancel",
  49. click: function () {
  50. $(this).dialog("close");
  51. },
  52. },
  53. ],
  54. });
  55. }
  56. function note_init(input) {
  57. let newString = input.replace(/\{\{/g, '<note info="');
  58. newString = newString.replace(/\}\}/g, '"></note>');
  59. let output = "<div>";
  60. output += marked(newString);
  61. output += "</div>";
  62. return output;
  63. }
  64. function note_update_background_style() {
  65. var mSentsBook = new Array();
  66. var mBgIndex = 1;
  67. $("note[info]").each(function () {
  68. let info = $(this).attr("info").split("-");
  69. if (info.length >= 2) {
  70. let book = info[0];
  71. $(this).attr("book", book);
  72. if (!mSentsBook[book]) {
  73. mSentsBook[book] = mBgIndex;
  74. mBgIndex++;
  75. }
  76. $(this).addClass("bg_color_" + mSentsBook[book]);
  77. }
  78. });
  79. }
  80. //
  81. function note_refresh_new() {
  82. note_update_background_style();
  83. let objNotes = document.querySelectorAll("note");
  84. let arrSentInfo = new Array();
  85. for (const iterator of objNotes) {
  86. let id = iterator.id;
  87. if (id == null || id == "") {
  88. //查看这个节点是第几层note嵌套。大于预定层数退出。
  89. let layout = 1;
  90. let parent = iterator.parentNode;
  91. while (parent.nodeType == 1) {
  92. if (parent.nodeName == "NOTE") {
  93. layout++;
  94. if (layout > MAX_NOTE_NEST) {
  95. return false;
  96. }
  97. } else if (parent.nodeName == "BODY") {
  98. break;
  99. }
  100. parent = parent.parentNode;
  101. }
  102. id = com_guid();
  103. iterator.id = id;
  104. if (iterator.hasAttribute("info")) {
  105. let info = iterator.getAttribute("info");
  106. if (info != null || info != "") {
  107. /*
  108. let arrInfo = info.split("-");
  109. if (arrInfo.length >= 2) {
  110. let book = arrInfo[0];
  111. let para = arrInfo[1];
  112. }
  113. */
  114. arrSentInfo.push({ id: id, data: info });
  115. }
  116. }
  117. }
  118. }
  119. if (arrSentInfo.length > 0) {
  120. let setting = new Object();
  121. setting.lang = "";
  122. setting.channal = _channal;
  123. $.post(
  124. "../term/note.php",
  125. {
  126. setting: JSON.stringify(setting),
  127. data: JSON.stringify(arrSentInfo),
  128. },
  129. function (data, status) {
  130. if (status == "success") {
  131. try {
  132. let sentData = JSON.parse(data);
  133. for (const iterator of sentData) {
  134. let id = iterator.id;
  135. let strHtml = "<a name='" + id + "'></a>";
  136. if (_display && _display == "para") {
  137. //段落模式
  138. let strPalitext =
  139. "<pali book='" +
  140. iterator.book +
  141. "' para='" +
  142. iterator.para +
  143. "' begin='" +
  144. iterator.begin +
  145. "' end='" +
  146. iterator.end +
  147. "' >" +
  148. iterator.palitext +
  149. "</pali>";
  150. let divPali = $("#" + id)
  151. .parent()
  152. .children(".palitext");
  153. if (divPali.length == 0) {
  154. if (_channal != "") {
  155. let arrChannal = _channal.split(",");
  156. for (let index = arrChannal.length - 1; index >= 0; index--) {
  157. const iChannal = arrChannal[index];
  158. $("#" + id)
  159. .parent()
  160. .prepend("<div class='tran_div' channal='" + iChannal + "'></div>");
  161. }
  162. }
  163. $("#" + id)
  164. .parent()
  165. .prepend("<div class='palitext'></div>");
  166. }
  167. $("#" + id)
  168. .parent()
  169. .children(".palitext")
  170. .first()
  171. .append(strPalitext);
  172. let htmlTran = "";
  173. for (const oneTran of iterator.translation) {
  174. let html =
  175. "<span class='tran' lang='" +
  176. oneTran.lang +
  177. "' channal='" +
  178. oneTran.channal +
  179. "'>";
  180. html += marked(
  181. term_std_str_to_tran(
  182. oneTran.text,
  183. oneTran.channal,
  184. oneTran.editor,
  185. oneTran.lang
  186. )
  187. );
  188. html += "</span>";
  189. if (_channal == "") {
  190. htmlTran += html;
  191. } else {
  192. $("#" + id)
  193. .siblings(".tran_div[channal='" + oneTran.channal + "']")
  194. .append(html);
  195. }
  196. }
  197. $("#" + id).html(htmlTran);
  198. } else {
  199. //句子模式
  200. strHtml += note_json_html(iterator);
  201. $("#" + id).html(strHtml);
  202. }
  203. }
  204. //刷新句子链接递归,有加层数限制。
  205. note_refresh_new();
  206. _arrData = _arrData.concat(sentData);
  207. note_ref_init();
  208. term_get_dict();
  209. note_channal_list();
  210. } catch (e) {
  211. console.error(e);
  212. }
  213. }
  214. }
  215. );
  216. } else {
  217. //term_get_dict();
  218. }
  219. }
  220. //生成channel列表
  221. function note_channal_list() {
  222. console.log("note_channal_list start");
  223. let arrSentInfo = new Array();
  224. $("note").each(function () {
  225. let info = $(this).attr("info");
  226. if (info && info != "") {
  227. arrSentInfo.push({ id: "", data: info });
  228. }
  229. });
  230. if (arrSentInfo.length > 0) {
  231. $.post(
  232. "../term/channal_list.php",
  233. {
  234. setting: "",
  235. data: JSON.stringify(arrSentInfo),
  236. },
  237. function (data, status) {
  238. if (status == "success") {
  239. try {
  240. let active = JSON.parse(data);
  241. _channalData = active;
  242. for (const iterator of _my_channal) {
  243. let found = false;
  244. for (const one of active) {
  245. if (iterator.id == one.id) {
  246. found = true;
  247. break;
  248. }
  249. }
  250. if (found == false) {
  251. _channalData.push(iterator);
  252. }
  253. }
  254. let strHtml = "";
  255. strHtml += "<div class='channel_select'>";
  256. strHtml += "<button onclick='onChannelChange()'>确定</button>";
  257. strHtml += "<button onclick='onChannelMultiSelectCancel()'>取消</button>";
  258. strHtml += "</div>";
  259. for (const iterator of _channalData) {
  260. if (_channal.indexOf(iterator.id) >= 0) {
  261. strHtml += render_channal_list(iterator);
  262. }
  263. }
  264. for (const iterator of _channalData) {
  265. if (_channal.indexOf(iterator.id) == -1) {
  266. strHtml += render_channal_list(iterator);
  267. }
  268. }
  269. $("#channal_list").html(strHtml);
  270. set_more_button_display();
  271. } catch (e) {
  272. console.error(e);
  273. }
  274. }
  275. }
  276. );
  277. }
  278. }
  279. function find_channal(id) {
  280. for (const iterator of _channalData) {
  281. if (id == iterator.id) {
  282. return iterator;
  283. }
  284. }
  285. return false;
  286. }
  287. function render_channal_list(channalinfo) {
  288. let output = "";
  289. let checked = "";
  290. let selected = "noselect";
  291. if (_channal.indexOf(channalinfo.id) >= 0) {
  292. checked = "checked";
  293. selected = "selected";
  294. }
  295. output += "<div class='list_with_head " + selected + "'>";
  296. output +=
  297. '<div class="channel_select"><input type="checkbox" ' + checked + " channal_id='" + channalinfo.id + "'></div>";
  298. output += "<div class='head'>";
  299. output += "<span class='head_img'>";
  300. output += channalinfo.nickname.slice(0, 2);
  301. output += "</span>";
  302. output += "</div>";
  303. output += "<div style='width: 100%;overflow-x: hidden;'>";
  304. output += "<div>";
  305. // output += "<a href='../wiki/wiki.php?word=" + _word;
  306. // output += "&channal=" + channalinfo.id + "' >";
  307. output += "<a onclick=\"set_channal('" + channalinfo.id + "')\">";
  308. output += channalinfo["name"];
  309. output += "</a>";
  310. output += "</div>";
  311. output += "<div>";
  312. output += channalinfo["nickname"] + "/";
  313. output += "@" + channalinfo["username"];
  314. output += "</div>";
  315. if (channalinfo["final"]) {
  316. //进度
  317. output += "<div>";
  318. let article_len = channalinfo["article_len"];
  319. let svg_width = article_len;
  320. let svg_height = parseInt(article_len / 10);
  321. output += '<svg viewBox="0 0 ' + svg_width + " " + svg_height + '" width="100%" >';
  322. let curr_x = 0;
  323. let allFinal = 0;
  324. for (const iterator of channalinfo["final"]) {
  325. let stroke_width = parseInt(iterator.len);
  326. output += "<rect ";
  327. output += ' x="' + curr_x + '"';
  328. output += ' y="0"';
  329. output += ' height="' + svg_height + '"';
  330. output += ' width="' + stroke_width + '"';
  331. if (iterator.final == true) {
  332. allFinal += stroke_width;
  333. output += ' class="progress_bar_done" ';
  334. } else {
  335. output += ' class="progress_bar_undone" ';
  336. }
  337. output += "/>";
  338. curr_x += stroke_width;
  339. }
  340. output +=
  341. "<rect x='0' y='0' width='" + svg_width + "' height='" + svg_height / 5 + "' class='progress_bar_bg' />";
  342. output +=
  343. "<rect x='0' y='0' width='" +
  344. allFinal +
  345. "' height='" +
  346. svg_height / 5 +
  347. "' class='progress_bar_percent' style='stroke-width: 0; fill: rgb(100, 228, 100);'/>";
  348. output += '<text x="0" y="' + svg_height + '" font-size="' + svg_height * 0.8 + '">';
  349. output += channalinfo["count"] + "/" + channalinfo["all"];
  350. output += "</text>";
  351. output += "<svg>";
  352. output += "</div>";
  353. //进度结束
  354. }
  355. output += "</div>";
  356. output += "</div>";
  357. return output;
  358. }
  359. function onChannelMultiSelectStart() {
  360. $(".channel_select").show();
  361. }
  362. function onChannelMultiSelectCancel() {
  363. $(".channel_select").hide();
  364. }
  365. function onChannelChange() {
  366. let channal_list = new Array();
  367. $("[channal_id]").each(function () {
  368. if (this.checked) {
  369. channal_list.push($(this).attr("channal_id"));
  370. }
  371. });
  372. set_channal(channal_list.join());
  373. }
  374. //点击引用 需要响应的事件
  375. function note_ref_init() {
  376. $("chapter").click(function () {
  377. let bookid = $(this).attr("book");
  378. let para = $(this).attr("para");
  379. window.open("../reader/?view=chapter&book=" + bookid + "&para=" + para, "_blank");
  380. });
  381. $("para").click(function () {
  382. let bookid = $(this).attr("book");
  383. let para = $(this).attr("para");
  384. window.open("../reader/?view=para&book=" + bookid + "&para=" + para, "_blank");
  385. });
  386. }
  387. /*
  388. id
  389. palitext
  390. tran
  391. ref
  392. */
  393. function note_json_html(in_json) {
  394. let output = "";
  395. output += '<div class="note_tool_bar" style=" position: relative;">';
  396. output +=
  397. '<div class="case_dropdown note_tool_context" style="position: absolute; right: 0;width:1.5em;text-align: right;">';
  398. output += "<svg class='icon' >";
  399. output += "<use xlink:href='../studio/svg/icon.svg#ic_more'></use>";
  400. output += "</svg>";
  401. output += "<div class='case_dropdown-content sent_menu'>";
  402. if (typeof _reader_view != "undefined" && _reader_view != "sent") {
  403. output += "<a onclick='junp_to(this)'>跳转至此句</a>";
  404. }
  405. output +=
  406. "<a onclick=\"copy_ref('" +
  407. in_json.book +
  408. "','" +
  409. in_json.para +
  410. "','" +
  411. in_json.begin +
  412. "','" +
  413. in_json.end +
  414. "')\">" +
  415. gLocal.gui.copy_link +
  416. "</a>";
  417. output += "<a onclick='copy_text(this)'>" + gLocal.gui.copy + "“" + gLocal.gui.pāli + "”</a>";
  418. output +=
  419. "<a onclick=\"edit_in_studio('" +
  420. in_json.book +
  421. "','" +
  422. in_json.para +
  423. "','" +
  424. in_json.begin +
  425. "','" +
  426. in_json.end +
  427. "')\">" +
  428. gLocal.gui.edit_now +
  429. "</a>";
  430. output += "<a onclick='add_to_list()'>" + gLocal.gui.add_to_edit_list + "</a>";
  431. output += "</div>";
  432. output += "</div>";
  433. output += " </div>";
  434. output += "<div class='palitext'>" + in_json.palitext + "</div>";
  435. for (const iterator of in_json.translation) {
  436. output += "<div class='tran' lang='" + iterator.lang + "'>";
  437. output +=
  438. "<div class='text' id='tran_text_" +
  439. in_json.book +
  440. "_" +
  441. in_json.para +
  442. "_" +
  443. in_json.begin +
  444. "_" +
  445. in_json.end +
  446. "_" +
  447. iterator.channal +
  448. "'>";
  449. if (iterator.text == "") {
  450. output +=
  451. "<span style='color:var(--border-line-color);'>" +
  452. iterator.channalinfo.name +
  453. "-" +
  454. iterator.channalinfo.lang +
  455. "</span>";
  456. } else {
  457. //note_init处理句子链接 marked不处理
  458. //output += marked(term_std_str_to_tran(iterator.text, iterator.channal, iterator.editor, iterator.lang));
  459. output += note_init(term_std_str_to_tran(iterator.text, iterator.channal, iterator.editor, iterator.lang));
  460. }
  461. output += "</div>";
  462. //句子工具栏
  463. output += "<div class='tran_text_tool_bar'>";
  464. output += "<span class = 'tip_buttom' ";
  465. output +=
  466. " onclick=\"note_edit_sentence('" +
  467. in_json.book +
  468. "' ,'" +
  469. in_json.para +
  470. "' ,'" +
  471. in_json.begin +
  472. "' ,'" +
  473. in_json.end +
  474. "' ,'" +
  475. iterator.channal +
  476. "')\"";
  477. output += ">" + gLocal.gui.edit + "</span>";
  478. output += "<span class = 'tip_buttom' ";
  479. output += " onclick=\"history_show('" + iterator.id + "')\"";
  480. output += ">" + gLocal.gui.timeline + "</span>";
  481. output += "<span class = 'tip_buttom'>" + gLocal.gui.extension + "</span>";
  482. output += "<span class = 'tip_buttom'>" + gLocal.gui.like + "</span>";
  483. output += "<span class = 'tip_buttom'>" + gLocal.gui.comment + "</span>";
  484. output += "<span class = 'tip_buttom'>" + gLocal.gui.copy + "</span>";
  485. output += "<span class = 'tip_buttom'>" + gLocal.gui.digest + "</span>";
  486. output += "<span class = 'tip_buttom'>" + gLocal.gui.share_to + "</span>";
  487. output += "</div>";
  488. //句子工具栏结束
  489. output += "</div>";
  490. }
  491. output += "<div class='other_tran' sent='";
  492. output += in_json.book + "-" + in_json.para + "-" + in_json.begin + "-" + in_json.end;
  493. output += "'></div>";
  494. output += "<div class='ref'>" + in_json.ref;
  495. output +=
  496. "<span class='sent_no'>" +
  497. in_json.book +
  498. "-" +
  499. in_json.para +
  500. "-" +
  501. in_json.begin +
  502. "-" +
  503. in_json.end +
  504. "<span>" +
  505. "</div>";
  506. output += "<div class='bottm_tool_button ' ";
  507. output += "book='" + in_json.book + "' ";
  508. output += "para='" + in_json.para + "' ";
  509. output += "begin='" + in_json.begin + "' ";
  510. output += "end='" + in_json.end + "' ";
  511. output += " style='left:0;'>";
  512. output += "<div class='add_new icon_add'></div>";
  513. output += "<div class='more_tran icon_expand'></div>";
  514. output += "</div>";
  515. return output;
  516. }
  517. function set_more_button_display() {
  518. $(".more_tran").each(function () {
  519. let book = $(this).parent().attr("book");
  520. let para = $(this).parent().attr("para");
  521. let begin = $(this).parent().attr("begin");
  522. let end = $(this).parent().attr("end");
  523. let count = 0;
  524. for (const iterator of _channalData) {
  525. if (iterator.final) {
  526. for (const onesent of iterator.final) {
  527. let id = onesent.id.split("-");
  528. if (book == id[0] && para == id[1] && begin == id[2] && end == id[3] && onesent.final) {
  529. if (_channal.indexOf(iterator.id) == -1) {
  530. count++;
  531. }
  532. }
  533. }
  534. }
  535. }
  536. if (count > 0) {
  537. $(this).click(function () {
  538. let book = $(this).parent().attr("book");
  539. let para = $(this).parent().attr("para");
  540. let begin = $(this).parent().attr("begin");
  541. let end = $(this).parent().attr("end");
  542. let sentId = book + "-" + para + "-" + begin + "-" + end;
  543. $(".other_tran[sent='" + sentId + "']").slideToggle();
  544. $.get(
  545. "../usent/get.php",
  546. {
  547. book: book,
  548. para: para,
  549. begin: begin,
  550. end: end,
  551. },
  552. function (data, status) {
  553. let arrSent = JSON.parse(data);
  554. let html = "";
  555. for (const iterator of arrSent) {
  556. if (_channal.indexOf(iterator.channal) == -1) {
  557. html += "<div>" + marked(iterator.text) + "</div>";
  558. }
  559. }
  560. let sentId =
  561. arrSent[0].book +
  562. "-" +
  563. arrSent[0].paragraph +
  564. "-" +
  565. arrSent[0].begin +
  566. "-" +
  567. arrSent[0].end;
  568. $(".other_tran[sent='" + sentId + "']").html(html);
  569. }
  570. );
  571. });
  572. }
  573. //$(this).html("[" + count + "]");
  574. });
  575. }
  576. function note_edit_sentence(book, para, begin, end, channal) {
  577. let channalInfo;
  578. for (const iterator of _channalData) {
  579. if (iterator.id == channal) {
  580. channalInfo = iterator;
  581. break;
  582. }
  583. }
  584. for (const iterator of _arrData) {
  585. if (iterator.book == book && iterator.para == para && iterator.begin == begin && iterator.end == end) {
  586. for (const tran of iterator.translation) {
  587. if (tran.channal == channal) {
  588. let html = "";
  589. html += "<div style='color:blue;'>" + channalInfo.nickname + "/" + channalInfo.name + "</div>";
  590. html +=
  591. "<textarea id='edit_dialog_text' sent_id='" +
  592. tran.id +
  593. "' book='" +
  594. iterator.book +
  595. "' para='" +
  596. iterator.para +
  597. "' begin='" +
  598. iterator.begin +
  599. "' end='" +
  600. iterator.end +
  601. "' channal='" +
  602. tran.channal +
  603. "' style='width:100%;min-height:260px;'>" +
  604. tran.text +
  605. "</textarea>";
  606. $("#edit_dialog_content").html(html);
  607. $("#note_sent_edit_dlg").dialog("open");
  608. return;
  609. }
  610. }
  611. }
  612. }
  613. alert("未找到句子");
  614. }
  615. function note_sent_save() {
  616. let id = $("#edit_dialog_text").attr("sent_id");
  617. let book = $("#edit_dialog_text").attr("book");
  618. let para = $("#edit_dialog_text").attr("para");
  619. let begin = $("#edit_dialog_text").attr("begin");
  620. let end = $("#edit_dialog_text").attr("end");
  621. let channal = $("#edit_dialog_text").attr("channal");
  622. let text = $("#edit_dialog_text").val();
  623. $.post(
  624. "../usent/sent_post.php",
  625. {
  626. id: id,
  627. book: book,
  628. para: para,
  629. begin: begin,
  630. end: end,
  631. channal: channal,
  632. text: text,
  633. lang: "zh",
  634. },
  635. function (data) {
  636. let result = JSON.parse(data);
  637. if (result.status > 0) {
  638. alert("error" + result.message);
  639. } else {
  640. ntf_show("success");
  641. if (result.text == "") {
  642. let channel_info = "Empty";
  643. let thisChannel = find_channal(result.channal);
  644. if (thisChannel) {
  645. channel_info = thisChannel.name + "-" + thisChannel.nickname;
  646. }
  647. $(
  648. "#tran_text_" +
  649. result.book +
  650. "_" +
  651. result.para +
  652. "_" +
  653. result.begin +
  654. "_" +
  655. result.end +
  656. "_" +
  657. result.channal
  658. ).html("<span style='color:var(--border-line-color);'>" + channel_info + "</span>");
  659. } else {
  660. $(
  661. "#tran_text_" +
  662. result.book +
  663. "_" +
  664. result.para +
  665. "_" +
  666. result.begin +
  667. "_" +
  668. result.end +
  669. "_" +
  670. result.channal
  671. ).html(marked(term_std_str_to_tran(result.text, result.channal, result.editor, result.lang)));
  672. term_updata_translation();
  673. for (const iterator of _arrData) {
  674. if (
  675. iterator.book == result.book &&
  676. iterator.para == result.para &&
  677. iterator.begin == result.begin &&
  678. iterator.end == result.end
  679. ) {
  680. for (const tran of iterator.translation) {
  681. if (tran.channal == result.channal) {
  682. tran.text = result.text;
  683. break;
  684. }
  685. }
  686. }
  687. }
  688. }
  689. }
  690. }
  691. );
  692. }
  693. function copy_ref(book, para, begin, end) {
  694. let strRef = "{{" + book + "-" + para + "-" + begin + "-" + end + "}}";
  695. copy_to_clipboard(strRef);
  696. }
  697. function edit_in_studio(book, para, begin, end) {
  698. wbw_channal_list_open(book, [para]);
  699. }