|
|
@@ -225,13 +225,18 @@ function note_refresh_new() {
|
|
|
}
|
|
|
//处理<code>标签作为气泡注释
|
|
|
popup_init();
|
|
|
+
|
|
|
//刷新句子链接递归,有加层数限制。
|
|
|
- note_refresh_new();
|
|
|
+ //note_refresh_new();
|
|
|
|
|
|
+ //将新的数据添加到数据总表
|
|
|
_arrData = _arrData.concat(sentData);
|
|
|
note_ref_init();
|
|
|
+ //获取术语字典
|
|
|
term_get_dict();
|
|
|
+ //刷新channel列表
|
|
|
note_channal_list();
|
|
|
+ //显示不同的巴利语脚本
|
|
|
refresh_pali_script();
|
|
|
//把巴利语单词用<w>分隔用于点词查询等
|
|
|
splite_pali_word();
|
|
|
@@ -326,7 +331,12 @@ function render_channal_list(channalinfo) {
|
|
|
'<div class="channel_select"><input type="checkbox" ' + checked + " channal_id='" + channalinfo.id + "'></div>";
|
|
|
output += "<div class='head'>";
|
|
|
output += "<span class='head_img'>";
|
|
|
- output += channalinfo.nickname.slice(0, 2);
|
|
|
+ if (parseInt(channalinfo.power) == 30) {
|
|
|
+ output += gLocal.gui.your.slice(0, 1);
|
|
|
+ } else {
|
|
|
+ output += channalinfo.nickname.slice(0, 1);
|
|
|
+ }
|
|
|
+
|
|
|
output += "</span>";
|
|
|
output += "</div>";
|
|
|
|
|
|
@@ -336,12 +346,36 @@ function render_channal_list(channalinfo) {
|
|
|
|
|
|
// output += "<a href='../wiki/wiki.php?word=" + _word;
|
|
|
// output += "&channal=" + channalinfo.id + "' >";
|
|
|
+ switch (parseInt(channalinfo.status)) {
|
|
|
+ case 10:
|
|
|
+ output += "🔐";
|
|
|
+ break;
|
|
|
+ case 20:
|
|
|
+ output += "🌐";
|
|
|
+ break;
|
|
|
+ case 30:
|
|
|
+ output += "🌐";
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ if (parseInt(channalinfo.power) >= 20) {
|
|
|
+ //if (parseInt(channalinfo.power) != 30)
|
|
|
+ {
|
|
|
+ output += "✏️";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //✋
|
|
|
output += "<a onclick=\"set_channal('" + channalinfo.id + "')\">";
|
|
|
|
|
|
output += channalinfo["name"];
|
|
|
|
|
|
output += "</a>";
|
|
|
- output += "@" + channalinfo["nickname"];
|
|
|
+ if (parseInt(channalinfo.power) == 30) {
|
|
|
+ output += "@" + gLocal.gui.your;
|
|
|
+ } else {
|
|
|
+ output += "@" + channalinfo["nickname"];
|
|
|
+ }
|
|
|
output += "</div>";
|
|
|
|
|
|
output += "<div class='userinfo_channal'>";
|
|
|
@@ -355,6 +389,7 @@ function render_channal_list(channalinfo) {
|
|
|
let svg_width = article_len;
|
|
|
let svg_height = parseInt(article_len / 10);
|
|
|
output += '<svg viewBox="0 0 ' + svg_width + " " + svg_height + '" width="100%" >';
|
|
|
+
|
|
|
let curr_x = 0;
|
|
|
let allFinal = 0;
|
|
|
for (const iterator of channalinfo["final"]) {
|
|
|
@@ -499,66 +534,364 @@ function note_json_html(in_json) {
|
|
|
|
|
|
//output += "<div id='translation_div'>";
|
|
|
for (const iterator of in_json.translation) {
|
|
|
- output += render_one_sent_tran(in_json.book, in_json.para, in_json.begin, in_json.end, iterator);
|
|
|
+ output += render_one_sent_tran_a(iterator);
|
|
|
+ //output += render_one_sent_tran(in_json.book, in_json.para, in_json.begin, in_json.end, iterator);
|
|
|
}
|
|
|
//所选全部译文结束
|
|
|
//output += "</div>";
|
|
|
//未选择的其他译文开始
|
|
|
output += "<div class='other_tran_div' sent='";
|
|
|
output += in_json.book + "-" + in_json.para + "-" + in_json.begin + "-" + in_json.end + "' >";
|
|
|
- output += "<div class='tool_bar' sent='";
|
|
|
+ output += "<div class='tool_bar' style='display:flex;' sent='";
|
|
|
output += in_json.book + "-" + in_json.para + "-" + in_json.begin + "-" + in_json.end + "' >";
|
|
|
+ output += "<span class='tool_left'>";
|
|
|
+ //第一个按钮
|
|
|
+ //新增译文按钮开始
|
|
|
+ output += "<span class='' ";
|
|
|
+ output += "book='" + in_json.book + "' ";
|
|
|
+ output += "para='" + in_json.para + "' ";
|
|
|
+ output += "begin='" + in_json.begin + "' ";
|
|
|
+ output += "end='" + in_json.end + "' ";
|
|
|
+ output += " >";
|
|
|
+ output += "<span class='' onclick='add_new_tran_button_click(this)'>+添加译文</span>";
|
|
|
+ output += "<div class='tran_text_tool_bar'>";
|
|
|
+ output += "</div>";
|
|
|
+ output += "</span>";
|
|
|
+ //新增译文按钮结束
|
|
|
+ output += "<span class='separate_line'></span>";
|
|
|
+ //第二个按钮
|
|
|
output += "<span class='more_tran icon_expand'></span>";
|
|
|
//其他译文工具条
|
|
|
output += "<span class='other_bar' >";
|
|
|
output += "<span class='other_tran_span' >" + gLocal.gui.other + gLocal.gui.translation + "</span>";
|
|
|
output += "<span class='other_tran_num'></span>";
|
|
|
output += "</span>";
|
|
|
+
|
|
|
output += "<span class='separate_line'></span>";
|
|
|
- //相似句工具条
|
|
|
- output += "<span class='other_bar' >";
|
|
|
- output +=
|
|
|
- "<span class='similar_sent_span' onclick=\"note_show_pali_sim('" +
|
|
|
- in_json.pali_sent_id +
|
|
|
- "')\">" +
|
|
|
- gLocal.gui.similar_sentences +
|
|
|
- "</span>";
|
|
|
- output += "<span class='similar_sent_num'>" + in_json.sim + "</span>";
|
|
|
+ //第三个按钮 相似句
|
|
|
+ if (parseInt(in_json.sim) > 0) {
|
|
|
+ output += "<span class='other_bar' >";
|
|
|
+ output +=
|
|
|
+ "<span class='similar_sent_span' onclick=\"note_show_pali_sim('" +
|
|
|
+ in_json.pali_sent_id +
|
|
|
+ "')\">" +
|
|
|
+ gLocal.gui.similar_sentences +
|
|
|
+ "</span>";
|
|
|
+ output += "<span class='similar_sent_num'>" + in_json.sim + "</span>";
|
|
|
+ output += "</span>";
|
|
|
+ }
|
|
|
+
|
|
|
+ //第三个按钮 相似句结束
|
|
|
+ output += "</span>";
|
|
|
+
|
|
|
+ output += "<span class='tool_right'>";
|
|
|
+ //出处路径开始
|
|
|
+ output += "<span class='ref'>" + in_json.ref;
|
|
|
+ output += "<span class='sent_no'>";
|
|
|
+ output += in_json.book + "-" + in_json.para + "-" + in_json.begin + "-" + in_json.end;
|
|
|
+ output += "<span>";
|
|
|
+ output += "</span>";
|
|
|
+ //出处路径结束
|
|
|
output += "</span>";
|
|
|
- output += "</div>";
|
|
|
- output += "<div class='other_tran'>";
|
|
|
|
|
|
output += "</div>";
|
|
|
- output += "</div>";
|
|
|
+ //工具栏结束
|
|
|
+
|
|
|
//未选择的其他译文开始
|
|
|
- //新增译文按钮开始
|
|
|
- output += "<div class='add_new icon_add' ";
|
|
|
- output += "book='" + in_json.book + "' ";
|
|
|
- output += "para='" + in_json.para + "' ";
|
|
|
- output += "begin='" + in_json.begin + "' ";
|
|
|
- output += "end='" + in_json.end + "' ";
|
|
|
- output += " >";
|
|
|
- output += "<div class='icon_add' onclick='add_new_tran_button_click(this)'></div>";
|
|
|
- output += "<div class='tran_text_tool_bar'>";
|
|
|
+ output += "<div class='other_tran'>";
|
|
|
output += "</div>";
|
|
|
+
|
|
|
output += "</div>";
|
|
|
- //新增译文按钮结束
|
|
|
- //出处路径开始
|
|
|
- output += "<div class='ref'>" + in_json.ref;
|
|
|
- output +=
|
|
|
- "<span class='sent_no'>" +
|
|
|
- in_json.book +
|
|
|
- "-" +
|
|
|
- in_json.para +
|
|
|
- "-" +
|
|
|
- in_json.begin +
|
|
|
- "-" +
|
|
|
- in_json.end +
|
|
|
- "<span>" +
|
|
|
- "</div>";
|
|
|
- //出处路径结束
|
|
|
+
|
|
|
return output;
|
|
|
}
|
|
|
+function sent_tran_edit(obj) {
|
|
|
+ let jqObj = $(obj);
|
|
|
+ while (!jqObj.hasClass("sent_tran")) {
|
|
|
+ jqObj = jqObj.parent();
|
|
|
+ if (!jqObj) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (jqObj.hasClass("edit_mode")) {
|
|
|
+ jqObj.removeClass("edit_mode");
|
|
|
+ } else {
|
|
|
+ $(".sent_tran").removeClass("edit_mode");
|
|
|
+ jqObj.addClass("edit_mode");
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+function sent_pr_merge(id) {
|
|
|
+ $.post(
|
|
|
+ "../usent/sent_pr_merge.php",
|
|
|
+ {
|
|
|
+ id: id,
|
|
|
+ },
|
|
|
+ function (data) {
|
|
|
+ let result = JSON.parse(data);
|
|
|
+ if (result.status > 0) {
|
|
|
+ alert("error" + result.message);
|
|
|
+ } else {
|
|
|
+ ntf_show("成功采纳");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ );
|
|
|
+}
|
|
|
+function sent_commit(src, id) {
|
|
|
+ commit_init({
|
|
|
+ src: src,
|
|
|
+ sent: [id],
|
|
|
+ express: true,
|
|
|
+ });
|
|
|
+}
|
|
|
+function render_one_sent_tran_a(iterator) {
|
|
|
+ let mChannel = get_channel_by_id(iterator.channal);
|
|
|
+
|
|
|
+ let tranText;
|
|
|
+ let sid = iterator.book + "-" + iterator.para + "-" + iterator.begin + "-" + iterator.end;
|
|
|
+ if (iterator.text == "") {
|
|
|
+ tranText =
|
|
|
+ "<span style='color:var(--border-line-color);'>" +
|
|
|
+ iterator.channalinfo.name +
|
|
|
+ "-" +
|
|
|
+ iterator.channalinfo.lang +
|
|
|
+ "</span>";
|
|
|
+ } else {
|
|
|
+ //note_init处理句子链接
|
|
|
+ tranText = note_init(term_std_str_to_tran(iterator.text, iterator.channal, iterator.editor, iterator.lang));
|
|
|
+ }
|
|
|
+ let html = "";
|
|
|
+ html += "<div class='sent_tran ";
|
|
|
+ if (typeof iterator.is_pr != "undefined" && iterator.is_pr == true) {
|
|
|
+ html += " pr ";
|
|
|
+ }
|
|
|
+ html += "' dbid='" + iterator.id + "' channel='" + iterator.channal + "' sid='" + sid + "'>";
|
|
|
+ html += "<div class='sent_tran_inner'>";
|
|
|
+ html += '<div class="tool_bar">';
|
|
|
+ html += ' <div class="right">';
|
|
|
+ //句子菜单
|
|
|
+ html += '<div class="pop_menu">';
|
|
|
+
|
|
|
+ if (typeof iterator.is_pr != "undefined" && iterator.is_pr == true) {
|
|
|
+ //在pr 列表中的译文
|
|
|
+ if (typeof iterator.is_pr_editor != "undefined" && iterator.is_pr_editor == true) {
|
|
|
+ //提交人
|
|
|
+ //修改按钮
|
|
|
+ html += "<button class='icon_btn tooltip' onclick='sent_tran_edit(this)'>";
|
|
|
+ html += '<svg class="icon" >';
|
|
|
+ html += '<use xlink="http://www.w3.org/1999/xlink" href="../studio/svg/icon.svg#ic_mode_edit"></use>';
|
|
|
+ html += "</svg>";
|
|
|
+ html += "<span class='tooltiptext tooltip-top'>";
|
|
|
+ html += gLocal.gui.modify;
|
|
|
+ html += "</span>";
|
|
|
+ html += "</button>";
|
|
|
+
|
|
|
+ //删除按钮
|
|
|
+ html += "<button class='icon_btn tooltip' onclick='sent_pr_del(this)'>";
|
|
|
+ html += '<svg class="icon" >';
|
|
|
+ html += '<use xlink="http://www.w3.org/1999/xlink" href="../studio/svg/icon.svg#ic_delete"></use>';
|
|
|
+ html += "</svg>";
|
|
|
+ html += "<span class='tooltiptext tooltip-top'>";
|
|
|
+ html += gLocal.gui.delete;
|
|
|
+ html += "</span>";
|
|
|
+ html += "</button>";
|
|
|
+ } else {
|
|
|
+ //非提交人
|
|
|
+ if (parseInt(iterator.mypower) >= 20) {
|
|
|
+ //有权限 采纳按钮
|
|
|
+ html += "<button class='icon_btn tooltip' onclick=\"sent_pr_merge('" + iterator.id + "')\">";
|
|
|
+ html += '<svg class="icon" >';
|
|
|
+ html += '<use xlink="http://www.w3.org/1999/xlink" href="../studio/svg/icon.svg#accept_copy"></use>';
|
|
|
+ html += "</svg>";
|
|
|
+ html += "<span class='tooltiptext tooltip-top'>";
|
|
|
+ html += gLocal.gui.accept_copy;
|
|
|
+ html += "</span>";
|
|
|
+ html += "</button>";
|
|
|
+ }
|
|
|
+ //点赞按钮
|
|
|
+ html += "<button class='icon_btn tooltip' onclick='sent_pr_like(this)'>";
|
|
|
+ html += '<svg class="icon" >';
|
|
|
+ html += '<use xlink="http://www.w3.org/1999/xlink" href="../studio/svg/icon.svg#like"></use>';
|
|
|
+ html += "</svg>";
|
|
|
+ html += "<span class='tooltiptext tooltip-top'>";
|
|
|
+ html += gLocal.gui.like;
|
|
|
+ html += "</span>";
|
|
|
+ html += "</button>";
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ //非pr列表里的句子
|
|
|
+ //编辑按钮
|
|
|
+ html += "<button class='icon_btn tooltip' onclick='sent_tran_edit(this)'>";
|
|
|
+ html += '<svg class="icon" >';
|
|
|
+ if (parseInt(iterator.mypower) < 20) {
|
|
|
+ html += '<use xlink="http://www.w3.org/1999/xlink" href="../studio/svg/icon.svg#my_idea"></use>';
|
|
|
+ } else {
|
|
|
+ html += '<use xlink="http://www.w3.org/1999/xlink" href="../studio/svg/icon.svg#ic_mode_edit"></use>';
|
|
|
+ }
|
|
|
+ html += "</svg>";
|
|
|
+ html += "<span class='tooltiptext tooltip-top'>";
|
|
|
+ if (parseInt(iterator.mypower) < 20) {
|
|
|
+ html += "建议";
|
|
|
+ } else {
|
|
|
+ html += gLocal.gui.edit;
|
|
|
+ }
|
|
|
+ html += "</span>";
|
|
|
+ html += "</button>";
|
|
|
+
|
|
|
+ //推送按钮
|
|
|
+ let commitIcon = "";
|
|
|
+ let commitTipText = "";
|
|
|
+ if (parseInt(iterator.mypower) >= 30 && parseInt(iterator.status) < 30) {
|
|
|
+ //我的私有资源 公开发布
|
|
|
+ commitIcon = "publish";
|
|
|
+ commitTipText = "公开发布";
|
|
|
+ } else {
|
|
|
+ if (parseInt(iterator.mypower) < 20) {
|
|
|
+ //只读资源 采纳
|
|
|
+ commitIcon = "accept_copy";
|
|
|
+ commitTipText = "采纳";
|
|
|
+ } else {
|
|
|
+ //其他资源 复制到
|
|
|
+ commitIcon = "copy";
|
|
|
+ commitTipText = "复制到";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ html += "<button class='icon_btn tooltip' ";
|
|
|
+ html += " onclick=\"sent_commit('" + iterator.channal + "','" + sid + "')\">";
|
|
|
+ html += '<svg class="icon" >';
|
|
|
+ html += '<use xlink="http://www.w3.org/1999/xlink" href="../studio/svg/icon.svg#' + commitIcon + '"></use>';
|
|
|
+ html += "</svg>";
|
|
|
+ html += "<span class='tooltiptext tooltip-top'>";
|
|
|
+ html += commitTipText;
|
|
|
+ html += "</span>";
|
|
|
+ html += "</button>";
|
|
|
+ //推送按钮结束
|
|
|
+
|
|
|
+ //更多按钮
|
|
|
+ html += '<div class="case_dropdown">';
|
|
|
+ html += "<button class='icon_btn'>";
|
|
|
+ html += '<svg class="icon" >';
|
|
|
+ html += '<use xlink="http://www.w3.org/1999/xlink" href="../studio/svg/icon.svg#ic_more"></use>';
|
|
|
+ html += "</svg>";
|
|
|
+ html += "</button>";
|
|
|
+ html += '<div class="case_dropdown-content menu_space_between" style="right:0;">';
|
|
|
+ //时间线
|
|
|
+ html += "<a onclick=\"history_show('" + iterator.id + "')\">";
|
|
|
+ html += "<span>" + gLocal.gui.timeline + "</span>";
|
|
|
+ html += '<svg class="icon" >';
|
|
|
+ html += '<use xlink="http://www.w3.org/1999/xlink" href="../studio/svg/icon.svg#recent_scan"></use>';
|
|
|
+ html += "</svg>";
|
|
|
+ html += "</a>";
|
|
|
+ //复制
|
|
|
+ html += "<a onclick=\"history_show('" + iterator.id + "')\">";
|
|
|
+ html += "<span>" + gLocal.gui.copy + "</span>";
|
|
|
+ html += '<svg class="icon" >';
|
|
|
+ html += '<use xlink="http://www.w3.org/1999/xlink" href="../studio/svg/icon.svg#copy"></use>';
|
|
|
+ html += "</svg>";
|
|
|
+ html += "</a>";
|
|
|
+ //点赞
|
|
|
+ html += "<a onclick=\"history_show('" + iterator.id + "')\">";
|
|
|
+ html += "<span>" + gLocal.gui.like + "</span>";
|
|
|
+ html += '<svg class="icon" >';
|
|
|
+ html += '<use xlink="http://www.w3.org/1999/xlink" href="../studio/svg/icon.svg#like"></use>';
|
|
|
+ html += "</svg>";
|
|
|
+ html += "</a>";
|
|
|
+ //分享
|
|
|
+ html += "<a onclick=\"history_show('" + iterator.id + "')\">";
|
|
|
+ html += "<span>" + gLocal.gui.share_to + "</span>";
|
|
|
+ html += '<svg class="icon" >';
|
|
|
+ html += '<use xlink="http://www.w3.org/1999/xlink" href="../studio/svg/icon.svg#share_to"></use>';
|
|
|
+ html += "</svg>";
|
|
|
+ html += "</a>";
|
|
|
+
|
|
|
+ html += "</div>";
|
|
|
+ html += "</div>";
|
|
|
+ //更多按钮结束
|
|
|
+ }
|
|
|
+
|
|
|
+ html += "</div>";
|
|
|
+ //句子菜单结束
|
|
|
+ html += "</div>";
|
|
|
+ html += "</div>";
|
|
|
+ //tool_bar 结束
|
|
|
+ html += '<div class="left_bar">';
|
|
|
+ html += ' <div class="face">';
|
|
|
+ if (iterator.id != "") {
|
|
|
+ html += '<span class="head_img">' + iterator.editor_name.nickname.slice(0, 1) + "</span>";
|
|
|
+ }
|
|
|
+ html += "</div>";
|
|
|
+ html += '<div class="date">' + getPassDataTime(iterator.update_time) + "</div>";
|
|
|
+ html += "</div>";
|
|
|
+ html += '<div class="body">';
|
|
|
+ html += '<div class="head_bar">';
|
|
|
+ html += '<div class="info">';
|
|
|
+ html += '<span class="name">' + iterator.editor_name.nickname + "</span>";
|
|
|
+ html += '<span class="date">' + getPassDataTime(iterator.update_time) + "</span>";
|
|
|
+ html += "</div>";
|
|
|
+ html += "<div class='preview'>" + tranText + "</div>";
|
|
|
+ html += "</div>";
|
|
|
+
|
|
|
+ html += '<div class="edit">';
|
|
|
+ html += '<div class="input">';
|
|
|
+ html += "<textarea dbid='" + iterator.id + "' ";
|
|
|
+ html += "sid='" + sid + "' ";
|
|
|
+ html += "channel='" + iterator.channal + "' ";
|
|
|
+ if (typeof iterator.is_pr != "undefined" && iterator.is_pr == true) {
|
|
|
+ html += 'onchange="note_pr_save(this)"';
|
|
|
+ } else {
|
|
|
+ html += 'onchange="note_sent_save_a(this)"';
|
|
|
+ }
|
|
|
+
|
|
|
+ html += ">" + iterator.text + "</textarea>";
|
|
|
+ html += "</div>";
|
|
|
+ html += '<div class="edit_tool">';
|
|
|
+ if (parseInt(iterator.mypower) < 20) {
|
|
|
+ html += "<b>提交修改建议</b> ";
|
|
|
+ }
|
|
|
+ html += "点击输入框外面自动<a onclick='sent_tran_edit(this)'>保存</a> 支持markdown语法";
|
|
|
+ html += "</div>";
|
|
|
+ html += "</div>";
|
|
|
+
|
|
|
+ html += '<div class="foot_bar">';
|
|
|
+
|
|
|
+ html += '<div class="info">';
|
|
|
+ if (iterator.id != "") {
|
|
|
+ html += '<span class="name">' + iterator.editor_name.nickname + "</span>";
|
|
|
+ }
|
|
|
+ if (iterator.id != "") {
|
|
|
+ html += '<span class="date"> 于' + getPassDataTime(iterator.update_time) + "</span>";
|
|
|
+ }
|
|
|
+ if (iterator.id != "") {
|
|
|
+ html += '<span class="channel">更新了 @' + iterator.channalinfo.name + "</span>";
|
|
|
+ } else {
|
|
|
+ html += '<span class="channel">无人更新 @' + iterator.channalinfo.name + "</span>";
|
|
|
+ }
|
|
|
+
|
|
|
+ html += '<ul class="tag_list">';
|
|
|
+ if (iterator.pr_all && parseInt(iterator.pr_all) > 0) {
|
|
|
+ html +=
|
|
|
+ " <li onclick=\"note_pr_show('" +
|
|
|
+ iterator.channal +
|
|
|
+ "','" +
|
|
|
+ sid +
|
|
|
+ "')\"><span class='icon'>✋</span><span class='num'>" +
|
|
|
+ iterator.pr_new +
|
|
|
+ "/" +
|
|
|
+ iterator.pr_all +
|
|
|
+ "</span></li>";
|
|
|
+ }
|
|
|
+ html += "</ul>";
|
|
|
+ html += "</div>"; //end of info
|
|
|
+
|
|
|
+ html += "</div>"; //end of foot bar
|
|
|
+
|
|
|
+ html += "</div>";
|
|
|
+ html += "</div>";
|
|
|
+ //sent_tran_inner结束
|
|
|
+ html += '<div class="pr_content"></div>';
|
|
|
+ html += "</div>";
|
|
|
+ return html;
|
|
|
+}
|
|
|
|
|
|
function render_one_sent_tran(book, para, begin, end, iterator) {
|
|
|
let output = "";
|
|
|
@@ -587,9 +920,8 @@ function render_one_sent_tran(book, para, begin, end, iterator) {
|
|
|
'<svg class="icon" ><use xlink="http://www.w3.org/1999/xlink" href="../studio/svg/icon.svg#ic_mode_edit"></use></svg>';
|
|
|
output += gLocal.gui.edit + "</li>";
|
|
|
output += "<li class = 'tip_buttom' ";
|
|
|
- output += " onclick=\"history_show('" + iterator.id + "')\"";
|
|
|
+ output += " onclick=\"history_show('" + iterator.id + "')\" >";
|
|
|
output +=
|
|
|
- ">" +
|
|
|
'<svg class="icon" ><use xlink="http://www.w3.org/1999/xlink" href="../studio/svg/icon.svg#recent_scan"></use></svg>';
|
|
|
output += gLocal.gui.timeline + "</li>";
|
|
|
output +=
|
|
|
@@ -651,33 +983,63 @@ function render_one_sent_tran(book, para, begin, end, iterator) {
|
|
|
function add_new_tran_button_click(obj) {
|
|
|
let html = "<ul>";
|
|
|
for (const iterator of _my_channal) {
|
|
|
- if (_channal.indexOf(iterator.id) < 0) {
|
|
|
- html += '<li onclick="';
|
|
|
- html +=
|
|
|
- "new_sentence('" +
|
|
|
- $(obj).parent().attr("book") +
|
|
|
- "' ,'" +
|
|
|
- $(obj).parent().attr("para") +
|
|
|
- "' ,'" +
|
|
|
- $(obj).parent().attr("begin") +
|
|
|
- "' ,'" +
|
|
|
- $(obj).parent().attr("end") +
|
|
|
- "' ,'" +
|
|
|
- iterator.id +
|
|
|
- "',this)";
|
|
|
- html += '">' + iterator.name + "</li>";
|
|
|
+ if (iterator.status > 0) {
|
|
|
+ if (_channal.indexOf(iterator.id) < 0) {
|
|
|
+ html += '<li onclick="';
|
|
|
+ html +=
|
|
|
+ "new_sentence('" +
|
|
|
+ $(obj).parent().attr("book") +
|
|
|
+ "' ,'" +
|
|
|
+ $(obj).parent().attr("para") +
|
|
|
+ "' ,'" +
|
|
|
+ $(obj).parent().attr("begin") +
|
|
|
+ "' ,'" +
|
|
|
+ $(obj).parent().attr("end") +
|
|
|
+ "' ,'" +
|
|
|
+ iterator.id +
|
|
|
+ "',this)";
|
|
|
+ html += '">' + iterator.name;
|
|
|
+ if (parseInt(iterator.power) < 20) {
|
|
|
+ html += "(建议)";
|
|
|
+ }
|
|
|
+ html += "</li>";
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
html += "</ul>";
|
|
|
$(obj).parent().children(".tran_text_tool_bar").first().html(html);
|
|
|
+
|
|
|
if ($(obj).parent().children(".tran_text_tool_bar").css("display") == "block") {
|
|
|
$(obj).parent().children(".tran_text_tool_bar").first().hide();
|
|
|
} else {
|
|
|
$(obj).parent().children(".tran_text_tool_bar").first().show();
|
|
|
+ $(document).one("click", function () {
|
|
|
+ $(obj).parent().children(".tran_text_tool_bar").first().hide();
|
|
|
+ });
|
|
|
+ event.stopPropagation();
|
|
|
$(obj).parent().show();
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+function tool_bar_show(element) {
|
|
|
+ if ($(element).find(".tran_text_tool_bar").css("display") == "none") {
|
|
|
+ $(element).find(".tran_text_tool_bar").css("display", "flex");
|
|
|
+ $(element).find(".icon_expand").css("transform", "rotate(-180deg)");
|
|
|
+ $(element).css("background-color", "var(--btn-bg-color)");
|
|
|
+ $(element).css("visibility", "visible");
|
|
|
+ $(document).one("click", function () {
|
|
|
+ $(element).find(".tran_text_tool_bar").hide();
|
|
|
+ $(element).css("background-color", "var(--nocolor)");
|
|
|
+ $(element).find(".icon_expand").css("transform", "unset");
|
|
|
+ $(element).css("visibility", "");
|
|
|
+ });
|
|
|
+ event.stopPropagation();
|
|
|
+ } else {
|
|
|
+ $(element).find(".tran_text_tool_bar").hide();
|
|
|
+ $(element).css("background-color", "var(--nocolor)");
|
|
|
+ $(element).find(".icon_expand").css("transform", "unset");
|
|
|
+ $(element).css("visibility", "");
|
|
|
+ }
|
|
|
+}
|
|
|
function new_sentence(book, para, begin, end, channel, obj) {
|
|
|
let newsent = { id: "", text: "", lang: "", channal: channel };
|
|
|
|
|
|
@@ -730,13 +1092,13 @@ function set_more_button_display() {
|
|
|
$(this)
|
|
|
.find(".other_bar")
|
|
|
.click(function () {
|
|
|
- const sentid = $(this).parent().attr("sent").split("-");
|
|
|
+ const sentid = $(this).parent().parent().attr("sent").split("-");
|
|
|
const book = sentid[0];
|
|
|
const para = sentid[1];
|
|
|
const begin = sentid[2];
|
|
|
const end = sentid[3];
|
|
|
let sentId = book + "-" + para + "-" + begin + "-" + end;
|
|
|
- if ($(this).parent().siblings(".other_tran").first().css("display") == "none") {
|
|
|
+ if ($(this).parent().parent().siblings(".other_tran").first().css("display") == "none") {
|
|
|
$(".other_tran_div[sent='" + sentId + "']")
|
|
|
.children(".other_tran")
|
|
|
.slideDown();
|
|
|
@@ -751,12 +1113,14 @@ function set_more_button_display() {
|
|
|
},
|
|
|
function (data, status) {
|
|
|
let arrSent = JSON.parse(data);
|
|
|
- let html = "";
|
|
|
+ let html = "<div class='compact'>";
|
|
|
for (const iterator of arrSent) {
|
|
|
if (_channal.indexOf(iterator.channal) == -1) {
|
|
|
- html += "<div>" + marked(iterator.text) + "</div>";
|
|
|
+ html += render_one_sent_tran_a(iterator);
|
|
|
+ //html += "<div>" + marked(iterator.text) + "</div>";
|
|
|
}
|
|
|
}
|
|
|
+ html += "</div>";
|
|
|
let sentId =
|
|
|
arrSent[0].book +
|
|
|
"-" +
|
|
|
@@ -828,16 +1192,48 @@ function note_edit_sentence(book, para, begin, end, channal) {
|
|
|
|
|
|
alert("未找到句子");
|
|
|
}
|
|
|
+function update_note_sent_tran(obj) {}
|
|
|
+//保存pr句子 新
|
|
|
+function note_pr_save(obj) {
|
|
|
+ let id = $(obj).attr("dbid");
|
|
|
+ let sid = $(obj).attr("sid").split("-");
|
|
|
+ let book = sid[0];
|
|
|
+ let para = sid[1];
|
|
|
+ let begin = sid[2];
|
|
|
+ let end = sid[3];
|
|
|
+ let channel = $(obj).attr("channel");
|
|
|
+ let text = $(obj).val();
|
|
|
+ let sent_tran_div = find_sent_tran_div(obj);
|
|
|
+ $.post(
|
|
|
+ "../usent/pr_post.php",
|
|
|
+ {
|
|
|
+ id: id,
|
|
|
+ book: book,
|
|
|
+ para: para,
|
|
|
+ begin: begin,
|
|
|
+ end: end,
|
|
|
+ channel: channel,
|
|
|
+ text: text,
|
|
|
+ },
|
|
|
+ sent_save_callback
|
|
|
+ );
|
|
|
|
|
|
-function note_sent_save() {
|
|
|
- let id = $("#edit_dialog_text").attr("sent_id");
|
|
|
- let book = $("#edit_dialog_text").attr("book");
|
|
|
- let para = $("#edit_dialog_text").attr("para");
|
|
|
- let begin = $("#edit_dialog_text").attr("begin");
|
|
|
- let end = $("#edit_dialog_text").attr("end");
|
|
|
- let channal = $("#edit_dialog_text").attr("channal");
|
|
|
- let text = $("#edit_dialog_text").val();
|
|
|
+ if (sent_tran_div) {
|
|
|
+ $(sent_tran_div).find(".preview").addClass("loading");
|
|
|
+ }
|
|
|
+}
|
|
|
|
|
|
+//保存译文句子 新
|
|
|
+function note_sent_save_a(obj) {
|
|
|
+ let id = $(obj).attr("dbid");
|
|
|
+ let sid = $(obj).attr("sid").split("-");
|
|
|
+ let book = sid[0];
|
|
|
+ let para = sid[1];
|
|
|
+ let begin = sid[2];
|
|
|
+ let end = sid[3];
|
|
|
+ let channal = $(obj).attr("channel");
|
|
|
+ let text = $(obj).val();
|
|
|
+ let sent_tran_div = find_sent_tran_div(obj);
|
|
|
$.post(
|
|
|
"../usent/sent_post.php",
|
|
|
{
|
|
|
@@ -850,44 +1246,41 @@ function note_sent_save() {
|
|
|
text: text,
|
|
|
lang: "zh",
|
|
|
},
|
|
|
- function (data) {
|
|
|
- let result = JSON.parse(data);
|
|
|
- if (result.status > 0) {
|
|
|
- alert("error" + result.message);
|
|
|
- } else {
|
|
|
- ntf_show("success");
|
|
|
+ sent_save_callback
|
|
|
+ );
|
|
|
+
|
|
|
+ if (sent_tran_div) {
|
|
|
+ $(sent_tran_div).find(".preview").addClass("loading");
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+function sent_save_callback(data) {
|
|
|
+ let result = JSON.parse(data);
|
|
|
+ if (result.status > 0) {
|
|
|
+ alert("error" + result.message);
|
|
|
+ } else {
|
|
|
+ let sid = result.book + "-" + result.para + "-" + result.begin + "-" + result.end;
|
|
|
+
|
|
|
+ let sent_tran_div = $(
|
|
|
+ ".sent_tran[dbid='" + result.id + "'][channel='" + result.channal + "'][sid='" + sid + "']"
|
|
|
+ );
|
|
|
+ if (result.commit_type == 1 || result.commit_type == 2) {
|
|
|
+ ntf_show("成功修改");
|
|
|
+ if (sent_tran_div) {
|
|
|
+ let divPreview = sent_tran_div.find(".preview").first();
|
|
|
if (result.text == "") {
|
|
|
let channel_info = "Empty";
|
|
|
let thisChannel = find_channal(result.channal);
|
|
|
if (thisChannel) {
|
|
|
channel_info = thisChannel.name + "-" + thisChannel.nickname;
|
|
|
}
|
|
|
- $(
|
|
|
- "#tran_text_" +
|
|
|
- result.book +
|
|
|
- "_" +
|
|
|
- result.para +
|
|
|
- "_" +
|
|
|
- result.begin +
|
|
|
- "_" +
|
|
|
- result.end +
|
|
|
- "_" +
|
|
|
- result.channal
|
|
|
- ).html("<span style='color:var(--border-line-color);'>" + channel_info + "</span>");
|
|
|
+ divPreview.html("<span style='color:var(--border-line-color);'>" + channel_info + "</span>");
|
|
|
} else {
|
|
|
- $(
|
|
|
- "#tran_text_" +
|
|
|
- result.book +
|
|
|
- "_" +
|
|
|
- result.para +
|
|
|
- "_" +
|
|
|
- result.begin +
|
|
|
- "_" +
|
|
|
- result.end +
|
|
|
- "_" +
|
|
|
- result.channal
|
|
|
- ).html(marked(term_std_str_to_tran(result.text, result.channal, result.editor, result.lang)));
|
|
|
+ divPreview.html(
|
|
|
+ marked(term_std_str_to_tran(result.text, result.channal, result.editor, result.lang))
|
|
|
+ );
|
|
|
term_updata_translation();
|
|
|
+ popup_init();
|
|
|
for (const iterator of _arrData) {
|
|
|
if (
|
|
|
iterator.book == result.book &&
|
|
|
@@ -904,6 +1297,98 @@ function note_sent_save() {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ sent_tran_div.find(".preview").removeClass("loading");
|
|
|
+ }
|
|
|
+ } else if (result.commit_type == 3) {
|
|
|
+ ntf_show("已经提交修改建议");
|
|
|
+ } else {
|
|
|
+ ntf_show("未提交");
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+//保存译文句子
|
|
|
+function note_sent_save() {
|
|
|
+ let id = $("#edit_dialog_text").attr("sent_id");
|
|
|
+ let book = $("#edit_dialog_text").attr("book");
|
|
|
+ let para = $("#edit_dialog_text").attr("para");
|
|
|
+ let begin = $("#edit_dialog_text").attr("begin");
|
|
|
+ let end = $("#edit_dialog_text").attr("end");
|
|
|
+ let channal = $("#edit_dialog_text").attr("channal");
|
|
|
+ let text = $("#edit_dialog_text").val();
|
|
|
+
|
|
|
+ $.post(
|
|
|
+ "../usent/sent_post.php",
|
|
|
+ {
|
|
|
+ id: id,
|
|
|
+ book: book,
|
|
|
+ para: para,
|
|
|
+ begin: begin,
|
|
|
+ end: end,
|
|
|
+ channal: channal,
|
|
|
+ text: text,
|
|
|
+ lang: "zh",
|
|
|
+ },
|
|
|
+ function (data) {
|
|
|
+ let result = JSON.parse(data);
|
|
|
+ if (result.status > 0) {
|
|
|
+ alert("error" + result.message);
|
|
|
+ } else {
|
|
|
+ if (result.commit_type == 1 || result.commit_type == 2) {
|
|
|
+ ntf_show("成功修改");
|
|
|
+ if (result.text == "") {
|
|
|
+ let channel_info = "Empty";
|
|
|
+ let thisChannel = find_channal(result.channal);
|
|
|
+ if (thisChannel) {
|
|
|
+ channel_info = thisChannel.name + "-" + thisChannel.nickname;
|
|
|
+ }
|
|
|
+ $(
|
|
|
+ "#tran_text_" +
|
|
|
+ result.book +
|
|
|
+ "_" +
|
|
|
+ result.para +
|
|
|
+ "_" +
|
|
|
+ result.begin +
|
|
|
+ "_" +
|
|
|
+ result.end +
|
|
|
+ "_" +
|
|
|
+ result.channal
|
|
|
+ ).html("<span style='color:var(--border-line-color);'>" + channel_info + "</span>");
|
|
|
+ } else {
|
|
|
+ $(
|
|
|
+ "#tran_text_" +
|
|
|
+ result.book +
|
|
|
+ "_" +
|
|
|
+ result.para +
|
|
|
+ "_" +
|
|
|
+ result.begin +
|
|
|
+ "_" +
|
|
|
+ result.end +
|
|
|
+ "_" +
|
|
|
+ result.channal
|
|
|
+ ).html(marked(term_std_str_to_tran(result.text, result.channal, result.editor, result.lang)));
|
|
|
+ term_updata_translation();
|
|
|
+ for (const iterator of _arrData) {
|
|
|
+ if (
|
|
|
+ iterator.book == result.book &&
|
|
|
+ iterator.para == result.para &&
|
|
|
+ iterator.begin == result.begin &&
|
|
|
+ iterator.end == result.end
|
|
|
+ ) {
|
|
|
+ for (const tran of iterator.translation) {
|
|
|
+ if (tran.channal == result.channal) {
|
|
|
+ tran.text = result.text;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else if (result.commit_type == 3) {
|
|
|
+ ntf_show("已经提交修改建议");
|
|
|
+ } else {
|
|
|
+ ntf_show("未提交");
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
);
|
|
|
@@ -921,27 +1406,7 @@ function edit_in_studio(book, para, begin, end) {
|
|
|
wbw_channal_list_open(book, [para]);
|
|
|
}
|
|
|
|
|
|
-function tool_bar_show(element) {
|
|
|
- if ($(element).find(".tran_text_tool_bar").css("display") == "none") {
|
|
|
- $(element).find(".tran_text_tool_bar").css("display", "flex");
|
|
|
- $(element).find(".icon_expand").css("transform", "rotate(-180deg)");
|
|
|
- $(element).css("background-color", "var(--btn-bg-color)");
|
|
|
- $(element).css("visibility", "visible");
|
|
|
- $(document).one("click", function () {
|
|
|
- $(element).find(".tran_text_tool_bar").hide();
|
|
|
- $(element).css("background-color", "var(--nocolor)");
|
|
|
- $(element).find(".icon_expand").css("transform", "unset");
|
|
|
- $(element).css("visibility", "");
|
|
|
- });
|
|
|
- event.stopPropagation();
|
|
|
- } else {
|
|
|
- $(element).find(".tran_text_tool_bar").hide();
|
|
|
- $(element).css("background-color", "var(--nocolor)");
|
|
|
- $(element).find(".icon_expand").css("transform", "unset");
|
|
|
- $(element).css("visibility", "");
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
+//显示和隐藏某个内容 如 巴利文
|
|
|
function setVisibility(key, value) {
|
|
|
switch (key) {
|
|
|
case "palitext":
|
|
|
@@ -1027,3 +1492,88 @@ function set_second_scrip(value) {
|
|
|
function slider_show(obj) {
|
|
|
$(obj).parent().parent().parent().parent().parent().toggleClass("slider_show_shell");
|
|
|
}
|
|
|
+
|
|
|
+function find_sent_tran_div(obj) {
|
|
|
+ let parent = obj.parentNode;
|
|
|
+ while (parent.nodeType == 1) {
|
|
|
+ if ($(parent).hasClass("sent_tran")) {
|
|
|
+ return parent;
|
|
|
+ } else if (parent.nodeName == "BODY") {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ parent = parent.parentNode;
|
|
|
+ }
|
|
|
+
|
|
|
+ return false;
|
|
|
+}
|
|
|
+//显示或隐藏pr数据
|
|
|
+function note_pr_show(channel, id) {
|
|
|
+ let obj = $(".sent_tran[channel='" + channel + "'][sid='" + id + "']").find(".pr_content");
|
|
|
+ let prHtml = obj.first().html();
|
|
|
+ if (prHtml == "") {
|
|
|
+ note_get_pr(channel, id);
|
|
|
+ } else {
|
|
|
+ obj.slideUp();
|
|
|
+ obj.html("");
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+//获取pr数据并显示
|
|
|
+function note_get_pr(channel, id) {
|
|
|
+ let sid = id.split("-");
|
|
|
+ let book = sid[0];
|
|
|
+ let para = sid[1];
|
|
|
+ let begin = sid[2];
|
|
|
+ let end = sid[3];
|
|
|
+ $.post(
|
|
|
+ "../usent/get_pr.php",
|
|
|
+ {
|
|
|
+ book: book,
|
|
|
+ para: para,
|
|
|
+ begin: begin,
|
|
|
+ end: end,
|
|
|
+ channel: channel,
|
|
|
+ },
|
|
|
+ function (data) {
|
|
|
+ let result = JSON.parse(data);
|
|
|
+ if (result.length > 0) {
|
|
|
+ let html = "<div class='compact'>";
|
|
|
+ for (const iterator of result) {
|
|
|
+ html += render_one_sent_tran_a(iterator);
|
|
|
+ }
|
|
|
+ html += "</div>";
|
|
|
+ $(".sent_tran[channel='" + channel + "'][sid='" + id + "']")
|
|
|
+ .find(".pr_content")
|
|
|
+ .html(html);
|
|
|
+ $(".sent_tran[channel='" + channel + "'][sid='" + id + "']")
|
|
|
+ .find(".pr_content")
|
|
|
+ .slideDown();
|
|
|
+ } else {
|
|
|
+ }
|
|
|
+ }
|
|
|
+ );
|
|
|
+ $(".sent_tran[channel='" + channel + "'][sid='" + id + "']")
|
|
|
+ .find(".pr_content")
|
|
|
+ .html("loading");
|
|
|
+ $(".sent_tran[channel='" + channel + "'][sid='" + id + "']")
|
|
|
+ .find(".pr_content")
|
|
|
+ .show();
|
|
|
+}
|
|
|
+
|
|
|
+function get_channel_by_id(id) {
|
|
|
+ if (typeof _channalData != "undefined") {
|
|
|
+ for (const iterator of _channalData) {
|
|
|
+ if (iterator.id == id) {
|
|
|
+ return iterator;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (typeof _my_channal != "undefined") {
|
|
|
+ for (const iterator of _my_channal) {
|
|
|
+ if (iterator.id == id) {
|
|
|
+ return iterator;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+}
|