$(function () { $("#title").after( '' + '' + '' + ' 重复的标题' + ' 无重复'); $(".repeat-button-check, input[name=title]").on("click blur", function () { repeattitleinfo(); }); $(".title-repeat a").popover({ placement: "bottom", trigger: "click", html: true }); var displaybutton = ""; $(".repeat-button").mouseenter(function () { if ($(this).css("display") !== "none") { $('.repeat-button-check').show(); displaybutton = $(this).find("img"); $(this).find("img").hide(); } }); $(".repeat-button-check").mouseleave(function () { if (displaybutton != "") { $(".repeat-button-check").hide(); displaybutton.show(); displaybutton = ""; } }); $(".norepeat-button").mouseenter(function () { if ($(this).css("display") !== "none") { $('.repeat-button-check').show(); displaybutton = $(this).find("img"); $(this).find("img").hide(); } }); $("#btnsubmission").click(function () { $("input[name=status]").val("0"); $("#formbox form").submit(); }); $("#btndraft").click(function () { $("input[name=status]").val("-1"); $("#formbox form").submit(); }); $("#btnaddfeaturedimage").on("click", function () { addphoto("featuredimage", $(this)); }); function addphoto(fieldname, photo) { var imgwrap = photo.parent().prev(); var imgsrc = imgwrap.find("img").attr('src'); if (imgsrc.indexof("data:image") > -1) { var datas = $(".upload-multi").data(); var severfilepath = imgwrap.prev().attr("filepath"); if (isimage(severfilepath)) { imgsrc = severfilepath.replace('$/', datas.uploadpath); } else { // 多视频上传 添加封面图片/添加视频待播放时画面 $.ajax(datas.cropperuploadurl, { data: { uploadproviderkey: 'videofeaturedimage', filename: pe.tools.uuid(16, 4) + '.jpg', contenttype: 'image/jpeg', file: imgsrc, __requestverificationtoken: pe.security.csrf.getrequestverificationtokenvalue() }, type: 'post', success: function (result) { if (result.iserror || !result.relativepath) { return; } addphotocore(fieldname, result.relativepath.replace(datas.uploadpathreplacesymbol, datas.uploadpath)); }, error: function (xhr) { } }); return; } } addphotocore(fieldname, imgsrc); } function addphotocore(fieldname, imgsrc) { $("input[name=" + fieldname + "]").val(imgsrc); $("#thumbnail" + fieldname + "").parent(".imgwrap").addclass("imgwrap-upload-success"); $("#thumbnail" + fieldname + "").attr('src', imgsrc); var $uploadplaceholder = $("#file-picker-" + fieldname + "").parents('#upload-placeholder'); $uploadplaceholder.css("position", "absolute"); $uploadplaceholder.css("top", "-15000px"); $("#files-" + fieldname + "").removeclass("hidden"); } function isimage(url) { if (!url) { return false; } var dotindex = url.lastindexof("."); var filepathlength = url.length; var filepathsuffix = url.substring(dotindex, filepathlength); var imagearr = ['.bmp', '.gif', '.jpg', '.pic', '.png', '.tif', '.jpeg']; return imagearr.indexof(filepathsuffix.touppercase()) > -1 } }); function repeattitleinfo() { var url = $("#repeaturl").val(); var title = $("input[name=title]").val(); var repeat = $(".title-repeat"); var norepeat = $(".title-norepeat"); var repeatbuttoncheck = $(".repeat-button-check"); var repeatbutton = $(".repeat-button"); var norepeatbutton = $(".norepeat-button"); title = title.replace(/(^\s*)|(\s*$)/g, ""); if (title !== "") { var contentid = $("input[name=contentid]").val(); $.postpreventcsrf(url, { contentid: contentid, title: title }, function (value) { if (!value && typeof (value) != undefined && typeof (value) != 'undefined' && value != "undefined" && value != "" ) { var html = ""; var list = json.parse(value); $.each(list, function (i, v) { var nodename = v.nodename.length > 6 ? v.nodename.substr(0, 6) + "..." : v.nodename; var status = ""; switch (v.status) { case -1: status = "草稿"; break; case -2: status = "退稿"; break; case -3: status = "已删除"; break; case 0: status = "待审核"; break; case 1: status = "审核中"; break; case 99: status = "终审通过"; break; default: status = "归档内容"; break; } html += ""; }); html += "
内容id状态所属节点
" + v.contentid + "" + status + " " + nodename + "
"; repeat.children("a").attr("data-content", html); repeat.show(); norepeat.hide(); repeatbutton.show(); repeatbuttoncheck.hide(); norepeatbutton.hide(); } else { norepeatbutton.show(); repeatbuttoncheck.hide(); repeatbutton.hide(); norepeat.show(); repeat.hide(); } }); } else { repeatbuttoncheck.show(); repeatbutton.hide(); norepeatbutton.hide(); norepeat.hide(); repeat.hide(); } }