|
|
@@ -212,7 +212,8 @@ function note_refresh_new(callback = null) {
|
|
|
splite_pali_word();
|
|
|
//处理编辑框消息
|
|
|
tran_sent_textarea_event_init();
|
|
|
-
|
|
|
+ //处理鼠标移入显示菜单消息
|
|
|
+ setSentToolBarEvent();
|
|
|
//初始化mermaid
|
|
|
mermaid.initialize({startOnLoad:true});
|
|
|
|
|
|
@@ -470,7 +471,7 @@ function edition_list_changed(channelId){
|
|
|
}
|
|
|
function find_channal(id) {
|
|
|
for (const iterator of _channalData) {
|
|
|
- if (id == iterator.id) {
|
|
|
+ if (id == iterator.id || id == iterator.uid) {
|
|
|
return iterator;
|
|
|
}
|
|
|
}
|
|
|
@@ -713,17 +714,18 @@ function note_json_html(in_json) {
|
|
|
//译文开始
|
|
|
output += "<div class='sent_tran_div'>";
|
|
|
for (const iterator of in_json.translation) {
|
|
|
- output += render_one_sent_tran_a(iterator);
|
|
|
+ if(iterator.channalinfo.type != "commentary"){
|
|
|
+ output += render_one_sent_tran_a(iterator);
|
|
|
+ }
|
|
|
}
|
|
|
output += "</div>";
|
|
|
//译文结束
|
|
|
output += "</div>"; /**note_body end */
|
|
|
|
|
|
//工具栏开始
|
|
|
- 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 += in_json.book + "-" + in_json.para + "-" + in_json.begin + "-" + in_json.end + "' >";
|
|
|
+ let sent_id = in_json.book + "-" + in_json.para + "-" + in_json.begin + "-" + in_json.end;
|
|
|
+ output += "<div class='other_tran_div' sent='" + sent_id + "' >";
|
|
|
+ output += "<div class='tool_bar' sent='" + sent_id + "' >";
|
|
|
output += "<span class='tool_left'>";
|
|
|
//第一个按钮
|
|
|
//新增译文按钮开始
|
|
|
@@ -738,13 +740,17 @@ function note_json_html(in_json) {
|
|
|
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_bar' sent='"+sent_id+"' channel_type='translation'>";
|
|
|
output +=
|
|
|
- "<span class='other_tran_span' title='🧲" +
|
|
|
+ "<span class='other_tran_span' title='" +
|
|
|
gLocal.gui.other +
|
|
|
gLocal.gui.translation +
|
|
|
"'>";
|
|
|
@@ -755,37 +761,65 @@ function note_json_html(in_json) {
|
|
|
output += "</span>";
|
|
|
output += "<span class='other_tran_num'></span>";
|
|
|
output += "</span>";
|
|
|
+ //第二个按钮结束
|
|
|
+
|
|
|
+ //分割线
|
|
|
+ output += "<span class='separate_line'></span>";
|
|
|
+
|
|
|
+ //nissaya
|
|
|
+ output += "<span class='other_bar' sent='"+sent_id+"' channel_type='nissaya' >";
|
|
|
+ output +=
|
|
|
+ "<span class='other_nissaya_span' title='" +
|
|
|
+ gLocal.gui.other +
|
|
|
+ gLocal.gui.translation +
|
|
|
+ "'>";
|
|
|
+ output += "<svg class='icon' style='fill: var(--box-bg-color1)'>";
|
|
|
+ output += "<use xlink:href='../../node_modules/bootstrap-icons/bootstrap-icons.svg#sun'>";
|
|
|
+ output += "</svg>" ;
|
|
|
+ output += "Nissaya" ;
|
|
|
+ output += "</span>";
|
|
|
+ output += "<span class='other_tran_num'></span>";
|
|
|
+ output += "</span>";
|
|
|
+
|
|
|
+ //分割线
|
|
|
output += "<span class='separate_line'></span>";
|
|
|
|
|
|
//手工义注
|
|
|
- output += "<span class='other_bar disable'>";
|
|
|
+ output += "<span class='other_bar' sent='"+sent_id+"' channel_type='commentary' >";
|
|
|
output +=
|
|
|
"<span class='other_tran_span commentray' title='📔" +
|
|
|
gLocal.gui.vannana +
|
|
|
- "'>🪔" +
|
|
|
- gLocal.gui.commentary +
|
|
|
+ "'>";
|
|
|
+ output += "<svg class='icon' style='fill: var(--box-bg-color1)'>";
|
|
|
+ output += "<use xlink:href='../public/images/svg/oil-lamp.svg#oil-lamp'>";
|
|
|
+ output += "</svg>" ;
|
|
|
+ output += gLocal.gui.commentary +
|
|
|
"</span>";
|
|
|
- output += "<span class='other_comm_num'></span>";
|
|
|
+ output += "<span class='other_tran_num'></span>";
|
|
|
output += "</span>";
|
|
|
+
|
|
|
+ //分割线
|
|
|
output += "<span class='separate_line'></span>";
|
|
|
|
|
|
//第三个按钮 相似句
|
|
|
if (parseInt(in_json.sim) > 0) {
|
|
|
- output += "<span class='other_bar' >";
|
|
|
+ output += "<span class='sim_bar' >";
|
|
|
output +=
|
|
|
"<span class='similar_sent_span' onclick=\"note_show_pali_sim('" +
|
|
|
in_json.pali_sent_id +
|
|
|
"')\" title='" +
|
|
|
gLocal.gui.similar_sentences +
|
|
|
- "'>🧬" +
|
|
|
- gLocal.gui.similar +
|
|
|
- "</span>";
|
|
|
+ "'>";
|
|
|
+ output += "<svg class='icon' style='fill: var(--box-bg-color1)'>";
|
|
|
+ output += "<use xlink:href='../../node_modules/bootstrap-icons/bootstrap-icons.svg#hdd-stack'>";
|
|
|
+ output += "</svg>" ;
|
|
|
+ output += gLocal.gui.similar + "</span>";
|
|
|
output += "<span class='similar_sent_num'>" + in_json.sim + "</span>";
|
|
|
output += "</span>";
|
|
|
output += "<span class='separate_line'></span>";
|
|
|
}
|
|
|
-
|
|
|
//第三个按钮 相似句结束
|
|
|
+
|
|
|
output += "</span>";
|
|
|
|
|
|
output += "<span class='tool_right'>";
|
|
|
@@ -961,11 +995,21 @@ function render_one_sent_tran_a(iterator, diff = false) {
|
|
|
tranText = str_diff(orgText, iterator.text);
|
|
|
} else {
|
|
|
//note_init处理句子链接
|
|
|
- tranText = note_init(term_std_str_to_tran(showText, iterator.channal, iterator.editor, iterator.lang));
|
|
|
+ if(iterator.type=='nissaya' || iterator.channalinfo.type=='nissaya'){
|
|
|
+ tranText = renderNissayaPreview(iterator.text);
|
|
|
+ }else{
|
|
|
+ tranText = iterator.text;
|
|
|
+ }
|
|
|
+ tranText = note_init(term_std_str_to_tran(tranText, iterator.channal, iterator.editor, iterator.lang));
|
|
|
+ if(iterator.type=='nissaya' || iterator.channalinfo.type=='nissaya'){
|
|
|
+ tranText = "<div class='nissaya'>"+tranText+"</div>";
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
let html = "";
|
|
|
html += "<div class='sent_tran ";
|
|
|
+ html += iterator.channalinfo.type;
|
|
|
if (typeof iterator.is_pr != "undefined" && iterator.is_pr == true) {
|
|
|
html += " pr ";
|
|
|
}
|
|
|
@@ -1211,7 +1255,33 @@ function render_one_sent_tran_a(iterator, diff = false) {
|
|
|
html += "</div>";
|
|
|
return html;
|
|
|
}
|
|
|
-
|
|
|
+function renderNissayaPreview(str){
|
|
|
+ let html ='';
|
|
|
+ //html +="<div class='nissaya'>";
|
|
|
+ const sent = str.split("\n");
|
|
|
+ for (const iterator of sent) {
|
|
|
+ const word = iterator.split("=");
|
|
|
+ if(iterator.indexOf('=')>=0){
|
|
|
+ html += "<span class='nsy_word'>"
|
|
|
+ html += "<span class='org'>";
|
|
|
+ switch (getCookie('language')) {
|
|
|
+ case 'my':
|
|
|
+ html += $.trim(word[0]) + "၊";
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ html += my_to_roman(word[0]);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ html += "</span>";
|
|
|
+ html += "<span class='meaning'>"+ word[1]+"</span>";
|
|
|
+ html += "</span>";
|
|
|
+ }else{
|
|
|
+ html += iterator;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //html += "</div>";
|
|
|
+ return html;
|
|
|
+}
|
|
|
function tran_sent_textarea_event_init() {
|
|
|
let textarea = document.querySelectorAll(".tran_sent_textarea");
|
|
|
for (let iterator of textarea) {
|
|
|
@@ -1550,43 +1620,60 @@ function new_sentence(book, para, begin, end, channel, obj) {
|
|
|
|
|
|
//显示更多译文按钮动作
|
|
|
function set_more_button_display() {
|
|
|
- $(".other_tran_div").each(function () {
|
|
|
+ $(".other_bar").each(function () {
|
|
|
const sentid = $(this).attr("sent").split("-");
|
|
|
+ const channelType = $(this).attr("channel_type");
|
|
|
|
|
|
const book = sentid[0];
|
|
|
const para = sentid[1];
|
|
|
const begin = sentid[2];
|
|
|
const end = sentid[3];
|
|
|
let count = 0;
|
|
|
+ let commentaryChannel=0;
|
|
|
+ if(channelType=='commentary'){
|
|
|
+ for (const iterator of _channal.split(',')) {
|
|
|
+ let thisChannel = find_channal(iterator);
|
|
|
+ if(thisChannel && thisChannel.type=='commentary'){
|
|
|
+ commentaryChannel++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
for (const iterator of _channalData) {
|
|
|
- if (iterator.final) {
|
|
|
+ if (iterator.final && iterator.type==channelType) {
|
|
|
for (const onesent of iterator.final) {
|
|
|
let id = onesent.id.split("-");
|
|
|
if (book == id[0] && para == id[1] && begin == id[2] && end == id[3] && onesent.final) {
|
|
|
- if (_channal.indexOf(iterator.id) == -1) {
|
|
|
- count++;
|
|
|
- }
|
|
|
+ if(channelType=='commentary'){
|
|
|
+ count++;
|
|
|
+ }else{
|
|
|
+ if (_channal.indexOf(iterator.id) == -1) {
|
|
|
+ count++;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- if (count > 0) {
|
|
|
+ if (count > 0 || commentaryChannel>0)
|
|
|
+ {
|
|
|
$(this).find(".other_tran_num").html(count);
|
|
|
$(this).find(".other_tran_num").attr("style", "display:inline-flex;");
|
|
|
- $(this)
|
|
|
- .find(".other_bar")
|
|
|
- .click(function () {
|
|
|
- const sentid = $(this).parent().parent().attr("sent").split("-");
|
|
|
+ $(this).off('click')
|
|
|
+ .on('click',function () {
|
|
|
+ const sentid = $(this).attr("sent").split("-");
|
|
|
+ const channelType = $(this).attr("channel_type");
|
|
|
const book = sentid[0];
|
|
|
const para = sentid[1];
|
|
|
const begin = sentid[2];
|
|
|
const end = sentid[3];
|
|
|
- let sentId = $(this).parent().parent().attr("sent");
|
|
|
- if ($(this).parent().parent().siblings(".other_tran").first().css("display") == "none") {
|
|
|
- $(".other_tran_div[sent='" + sentId + "']")
|
|
|
- .children(".other_tran")
|
|
|
- .slideDown();
|
|
|
- $(this).siblings(".more_tran ").css("transform", "unset");
|
|
|
+ let sentId = $(this).attr("sent");
|
|
|
+ let otherSentDiv = $(this).parent().parent().siblings(".other_tran").first();
|
|
|
+ if (otherSentDiv.css("display") == "none") {
|
|
|
+ otherSentDiv.slideDown();
|
|
|
+ //加号复位
|
|
|
+ //$(this).siblings(".more_tran ").css("transform", "unset");
|
|
|
$.get(
|
|
|
"../usent/get.php",
|
|
|
{
|
|
|
@@ -1594,42 +1681,57 @@ function set_more_button_display() {
|
|
|
para: para,
|
|
|
begin: begin,
|
|
|
end: end,
|
|
|
+ type:channelType,
|
|
|
},
|
|
|
function (data, status) {
|
|
|
let arrSent = JSON.parse(data);
|
|
|
- let html = "<div class='compact'>";
|
|
|
+ let html = "<div class='compact "+channelType+"'>";
|
|
|
+ if(channelType==='commentary'){
|
|
|
+ //先渲染被选择的channel
|
|
|
+ if (_channal != "") {
|
|
|
+ //for(const channel of _channal.split(","))
|
|
|
+ {
|
|
|
+ for (const sent of _arrData) {
|
|
|
+ if (sent.book == book && sent.para==para && sent.begin==begin && sent.end==end) {
|
|
|
+ for (const tran of sent.translation) {
|
|
|
+ if(tran.channalinfo.type=='commentary'){
|
|
|
+ html += render_one_sent_tran_a(tran);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //然后渲染没有被选择的
|
|
|
for (const iterator of arrSent) {
|
|
|
if (_channal.indexOf(iterator.channal) == -1) {
|
|
|
html += render_one_sent_tran_a(iterator);
|
|
|
}
|
|
|
}
|
|
|
html += "</div>";
|
|
|
- let sentId =
|
|
|
- arrSent[0].book +
|
|
|
- "-" +
|
|
|
- arrSent[0].paragraph +
|
|
|
- "-" +
|
|
|
- arrSent[0].begin +
|
|
|
- "-" +
|
|
|
- arrSent[0].end;
|
|
|
- $(".other_tran_div[sent='" + sentId + "']")
|
|
|
- .children(".other_tran")
|
|
|
- .html(html);
|
|
|
+ otherSentDiv.html(html);
|
|
|
+ if(channelType==='commentary'){
|
|
|
+ note_refresh_new();
|
|
|
+ }
|
|
|
+
|
|
|
//初始化文本编辑框消息处理
|
|
|
tran_sent_textarea_event_init();
|
|
|
}
|
|
|
);
|
|
|
} else {
|
|
|
- $(".other_tran_div[sent='" + sentId + "']")
|
|
|
- .children(".other_tran")
|
|
|
- .slideUp();
|
|
|
+ otherSentDiv.slideUp();
|
|
|
$(this).siblings(".more_tran ").css("transform", "rotate(-90deg)");
|
|
|
}
|
|
|
+
|
|
|
+ return false; // 阻止事件冒泡
|
|
|
});
|
|
|
- } else {
|
|
|
+ }else
|
|
|
+ {
|
|
|
//隐藏自己
|
|
|
//$(this).hide();
|
|
|
- $(this).find(".other_tran_span").addClass("disable"); //gLocal.gui.no + gLocal.gui.other + gLocal.gui.translation
|
|
|
+ $(this).addClass("disable");
|
|
|
//$(this).find(".more_tran").hide();
|
|
|
}
|
|
|
});
|
|
|
@@ -1681,7 +1783,8 @@ function tran_sent_edit_cancel(obj) {
|
|
|
function tran_sent_save(obj) {
|
|
|
let sentDiv = find_sent_tran_div(obj);
|
|
|
if (sentDiv) {
|
|
|
- let textarea = $(sentDiv).children().find(".tran_sent_textarea").first();
|
|
|
+ let textarea = $(sentDiv).children('.sent_tran_inner').first().children('.body').first().children('.edit').find(".tran_sent_textarea").first();
|
|
|
+ //let textarea = $(sentDiv).children().find(".tran_sent_textarea").first();
|
|
|
let isPr = $(textarea).attr("is_pr");
|
|
|
if (isPr == "true") {
|
|
|
note_pr_save(textarea);
|
|
|
@@ -1806,19 +1909,15 @@ function sent_save_callback(data) {
|
|
|
ntf_show("成功修改");
|
|
|
if (sent_tran_div) {
|
|
|
let divPreview = sent_tran_div.find(".preview").first();
|
|
|
+ let thisChannel = find_channal(result.channal);
|
|
|
if (result.text == "") {
|
|
|
+ //内容为空
|
|
|
let channel_info = "Empty";
|
|
|
- let thisChannel = find_channal(result.channal);
|
|
|
if (thisChannel) {
|
|
|
channel_info = thisChannel.name + "-" + thisChannel.nickname;
|
|
|
}
|
|
|
divPreview.html("<span style='color:var(--border-line-color);'>" + channel_info + "</span>");
|
|
|
} else {
|
|
|
- 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 &&
|
|
|
@@ -1834,6 +1933,24 @@ function sent_save_callback(data) {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ switch (thisChannel.type) {
|
|
|
+ case 'nissaya':
|
|
|
+ divPreview.html(renderNissayaPreview(result.text));
|
|
|
+ break;
|
|
|
+ case 'commentary':
|
|
|
+ divPreview.html(
|
|
|
+ note_init(result.text, result.channal, result.editor, result.lang)
|
|
|
+ );
|
|
|
+ note_refresh_new();
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ divPreview.html(
|
|
|
+ marked(term_std_str_to_tran(result.text, result.channal, result.editor, result.lang))
|
|
|
+ );
|
|
|
+ term_updata_translation();
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ popup_init();
|
|
|
}
|
|
|
}
|
|
|
} else if (result.commit_type == 3) {
|
|
|
@@ -2439,3 +2556,12 @@ function term_parent(paliword) {
|
|
|
}
|
|
|
return output;
|
|
|
}
|
|
|
+
|
|
|
+function setSentToolBarEvent(){
|
|
|
+ $('.sent_tran_inner').not('.commentary').off('mouseenter').on('mouseenter',function(){
|
|
|
+ $(this).children('.tool_bar').first().children('.right').show();
|
|
|
+ });
|
|
|
+ $('.sent_tran_inner').not('.commentary').off('mouseleave').on('mouseleave',function(){
|
|
|
+ $(this).children('.tool_bar').first().children('.right').hide();
|
|
|
+ })
|
|
|
+}
|