function add_to_collect_dlg_init() { $("[vui='collect-dlg']").each(function () { $(this).css("position", "relative"); let html = ""; html += ''; html += '' + gLocal.gui.add_to + gLocal.gui.anthology + ""; html += ""; html += ""; html += ""; $(this).html(html); }); $(".button_add_to_collect").click(function () { let html = ""; let article_id = $(this).parent().parent().attr("a_id"); html += "
"; html += "
"; html += ""; html += "
"; html += "
"; html += "
"; html += "
"; html += "
"; html += "
"; html += "
"; html += "添加新的文集"; html += "
"; html += "
"; html += "
"; html += ""; html += ""; html += "
"; html += "
"; $(this).siblings(".float_dlg").first().html(html); $(this).siblings(".float_dlg").first().show(); $.get( "../article/list_article_in_collect.php", { id: article_id, }, function (data, status) { let collect_list = JSON.parse(data); let id = collect_list.article_id; let html_exist = ""; for (const iterator of collect_list.exist) { html_exist += "
"; html_exist += iterator.title; html_exist += "
"; } $("#add_to_collect_dlg_" + id) .find(".exist") .first() .html(html_exist); if (collect_list.others) { let html_others = ""; for (const iterator of collect_list.others) { html_others += "
"; html_others += iterator.title; html_others += "
"; } $("#add_to_collect_dlg_" + id) .find(".others") .first() .html(html_others); } } ); }); } function article_add_to_collect_ok(article_id) { let obj = document.querySelectorAll(".collect"); let collect_id = new Array(); for (const iterator of obj) { if (iterator.checked == true) { collect_id.push(iterator.getAttributeNode("collect_id").value); } } $.post( "../article/add_article_to_collect.php", { id: article_id, title: $("#input_article_title").val(), data: JSON.stringify(collect_id), }, function (data) { let result = JSON.parse(data); if (result.status > 0) { alert(result.message); } else { add_to_collect_dlg_close(result.id); } } ); } function article_add_to_collect_cancel(article_id) { add_to_collect_dlg_close(article_id); } function add_to_collect_dlg_close(article_id) { $("#add_to_collect_dlg_" + article_id) .parent() .hide(); }