Current File : //var/softaculous/sitepad/editor/site-admin/js/post.min.js
window.makeSlugeditClickable=window.editPermalink=function(){},window.wp=window.wp||{},function(t){var e=!1;window.commentsBox={st:0,get:function(e,a){var i,s=this.st;return a||(a=20),this.st+=a,this.total=e,t("#commentsdiv .spinner").addClass("is-active"),i={action:"get-comments",mode:"single",_ajax_nonce:t("#add_comment_nonce").val(),p:t("#post_ID").val(),start:s,number:a},t.post(ajaxurl,i,function(e){if(e=wpAjax.parseAjaxResponse(e),t("#commentsdiv .widefat").show(),t("#commentsdiv .spinner").removeClass("is-active"),"object"==typeof e&&e.responses[0]){t("#the-comment-list").append(e.responses[0].data),theList=theExtraList=null,t("a[className*=':']").unbind(),commentsBox.st>commentsBox.total?t("#show-comments").hide():t("#show-comments").show().children("a").html(postL10n.showcomm);return}if(1==e){t("#show-comments").html(postL10n.endcomm);return}t("#the-comment-list").append('<tr><td colspan="2">'+wpAjax.broken+"</td></tr>")}),!1},load:function(t){this.st=jQuery("#the-comment-list tr.comment:visible").length,this.get(t)}},window.WPSetThumbnailHTML=function(e){t(".inside","#postimagediv").html(e)},window.WPSetThumbnailID=function(e){var a=t('input[value="_thumbnail_id"]',"#list-table");a.length>0&&t("#meta\\["+a.attr("id").match(/[0-9]+/)+"\\]\\[value\\]").text(e)},window.WPRemoveThumbnail=function(e){t.post(ajaxurl,{action:"set-post-thumbnail",post_id:t("#post_ID").val(),thumbnail_id:-1,_ajax_nonce:e,cookie:encodeURIComponent(document.cookie)},function(t){"0"==t?alert(setPostThumbnailL10n.error):WPSetThumbnailHTML(t)})},t(document).on("heartbeat-send.refresh-lock",function(e,a){var i=t("#active_post_lock").val(),s=t("#post_ID").val(),n={};s&&t("#post-lock-dialog").length&&(n.post_id=s,i&&(n.lock=i),a["wp-refresh-post-lock"]=n)}).on("heartbeat-tick.refresh-lock",function(e,a){var i,s,n;a["wp-refresh-post-lock"]&&((i=a["wp-refresh-post-lock"]).lock_error?(s=t("#post-lock-dialog")).length&&!s.is(":visible")&&(wp.autosave&&(t(document).one("heartbeat-tick",function(){wp.autosave.server.suspend(),s.removeClass("saving").addClass("saved"),t(window).off("beforeunload.edit-post")}),s.addClass("saving"),wp.autosave.server.triggerSave()),i.lock_error.avatar_src&&(n=t('<img class="avatar avatar-64 photo" width="64" height="64" alt="" />').attr("src",i.lock_error.avatar_src.replace(/&amp;/g,"&")),s.find("div.post-locked-avatar").empty().append(n)),s.show().find(".currently-editing").text(i.lock_error.text),s.find(".wp-tab-first").focus()):i.new_lock&&t("#active_post_lock").val(i.new_lock))}).on("before-autosave.update-post-slug",function(){e=document.activeElement&&"title"===document.activeElement.id}).on("after-autosave.update-post-slug",function(){t("#edit-slug-box > *").length||e||t.post(ajaxurl,{action:"sample-permalink",post_id:t("#post_ID").val(),new_title:t("#title").val(),samplepermalinknonce:t("#samplepermalinknonce").val()},function(e){"-1"!=e&&t("#edit-slug-box").html(e)})})}(jQuery),function(t){var e,a;function i(){e=!1,window.clearTimeout(a),a=window.setTimeout(function(){e=!0},3e5)}t(document).on("heartbeat-send.wp-refresh-nonces",function(a,i){var s,n=t("#wp-auth-check-wrap");(e||n.length&&!n.hasClass("hidden"))&&(s=t("#post_ID").val())&&t("#_wpnonce").val()&&(i["wp-refresh-post-nonces"]={post_id:s})}).on("heartbeat-tick.wp-refresh-nonces",function(e,a){var s=a["wp-refresh-post-nonces"];s&&(i(),s.replace&&t.each(s.replace,function(e,a){t("#"+e).val(a)}),s.heartbeatNonce&&(window.heartbeatSettings.nonce=s.heartbeatNonce))}).ready(function(){i()})}(jQuery),jQuery(document).ready(function(t){var e,a,i,s,n,o,l="",r=t("#content"),c=t(document),p=t("#post_ID").val()||0,d=t("#submitpost").add("#sitepad-submit-actions"),u=!0,h=t("#post-visibility-select"),f=t("#timestampdiv"),v=t("#post-status-select"),m=!!window.navigator.platform&&-1!==window.navigator.platform.indexOf("Mac");postboxes.add_postbox_toggles(pagenow),window.name="",t("#post-lock-dialog .notification-dialog").on("keydown",function(e){if(9==e.which){var a=t(e.target);a.hasClass("wp-tab-first")&&e.shiftKey?(t(this).find(".wp-tab-last").focus(),e.preventDefault()):a.hasClass("wp-tab-last")&&!e.shiftKey&&(t(this).find(".wp-tab-first").focus(),e.preventDefault())}}).filter(":visible").find(".wp-tab-first").focus(),wp.heartbeat&&t("#post-lock-dialog").length&&wp.heartbeat.interval(15),s=d.find(":submit, a.submitdelete, #post-preview").on("click.edit-post",function(e){var a=t(this);if(a.hasClass("disabled")){e.preventDefault();return}!(a.hasClass("submitdelete")||a.is("#post-preview"))&&t("form#post").off("submit.edit-post").on("submit.edit-post",function(e){if(!e.isDefaultPrevented()){if(wp.autosave&&wp.autosave.server.suspend(),"undefined"!=typeof commentReply){if(!commentReply.discardCommentChanges())return!1;commentReply.close()}u=!1,t(window).off("beforeunload.edit-post"),s.addClass("disabled"),"publish"===a.attr("id")?d.find("#major-publishing-actions .spinner").addClass("is-active"):d.find("#minor-publishing .spinner").addClass("is-active")}})}),t("#post-preview").on("click.post-preview",function(e){var a=t(this),i=t("form#post"),s=t("input#wp-preview"),n=a.attr("target")||"wp-preview",o=navigator.userAgent.toLowerCase();e.preventDefault(),!a.hasClass("disabled")&&(wp.autosave&&wp.autosave.server.tempBlockSave(),s.val("dopreview"),i.attr("target",n).submit().attr("target",""),-1!==o.indexOf("safari")&&-1===o.indexOf("chrome")&&i.attr("action",function(t,e){return e+"?t="+new Date().getTime()}),s.val(""))}),t("#title").on("keydown.editor-focus",function(t){var e;if(9===t.keyCode&&!t.ctrlKey&&!t.altKey&&!t.shiftKey){if((e="undefined"!=typeof tinymce&&tinymce.get("content"))&&!e.isHidden())e.focus();else{if(!r.length)return;r.focus()}t.preventDefault()}}),t("#auto_draft").val()&&t("#title").blur(function(){var e;this.value&&!t("#edit-slug-box > *").length&&(t("form#post").one("submit",function(){e=!0}),window.setTimeout(function(){!e&&wp.autosave&&wp.autosave.server.triggerSave()},200))}),c.on("autosave-disable-buttons.edit-post",function(){s.addClass("disabled")}).on("autosave-enable-buttons.edit-post",function(){wp.heartbeat&&wp.heartbeat.hasConnectionError()||s.removeClass("disabled")}).on("before-autosave.edit-post",function(){t(".autosave-message").text(postL10n.savingText)}).on("after-autosave.edit-post",function(e,a){t(".autosave-message").text(a.message),t(document.body).hasClass("post-new-php")&&t(".submitbox .submitdelete").show()}),t(window).on("beforeunload.edit-post",function(){var t="undefined"!=typeof tinymce&&tinymce.get("content");if(t&&!t.isHidden()&&t.isDirty()||wp.autosave&&wp.autosave.server.postChanged())return postL10n.saveAlert}).on("unload.edit-post",function(e){if(u&&(!e.target||"#document"==e.target.nodeName)){var a=t("#post_ID").val(),i=t("#active_post_lock").val();if(a&&i){var s={action:"wp-remove-post-lock",_wpnonce:t("#_wpnonce").val(),post_ID:a,active_post_lock:i};if(window.FormData&&window.navigator.sendBeacon){var n=new window.FormData;if(t.each(s,function(t,e){n.append(t,e)}),window.navigator.sendBeacon(ajaxurl,n))return}t.post({async:!1,data:s,url:ajaxurl})}}}),t("#tagsdiv-post_tag").length?window.tagBox&&window.tagBox.init():t(".meta-box-sortables").children("div.postbox").each(function(){if(0===this.id.indexOf("tagsdiv-"))return window.tagBox&&window.tagBox.init(),!1}),t(".categorydiv").each(function(){var e,a,i,s,n;(i=t(this).attr("id").split("-")).shift(),n=(s=i.join("-"))+"_tab","category"==s&&(n="cats"),t("a","#"+s+"-tabs").click(function(e){e.preventDefault();var a=t(this).attr("href");t(this).parent().addClass("tabs").siblings("li").removeClass("tabs"),t("#"+s+"-tabs").siblings(".tabs-panel").hide(),t(a).show(),"#"+s+"-all"==a?deleteUserSetting(n):setUserSetting(n,"pop")}),getUserSetting(n)&&t('a[href="#'+s+'-pop"]',"#"+s+"-tabs").click(),t("#new"+s).one("focus",function(){t(this).val("").removeClass("form-input-tip")}),t("#new"+s).keypress(function(e){13===e.keyCode&&(e.preventDefault(),t("#"+s+"-add-submit").click())}),t("#"+s+"-add-submit").click(function(){t("#new"+s).focus()}),e=function(e){return!!t("#new"+s).val()&&(e.data+="&"+t(":checked","#"+s+"checklist").serialize(),t("#"+s+"-add-submit").prop("disabled",!0),e)},a=function(e,a){var i,n=t("#new"+s+"_parent");t("#"+s+"-add-submit").prop("disabled",!1),"undefined"!=a.parsed.responses[0]&&(i=a.parsed.responses[0].supplemental.newcat_parent)&&(n.before(i),n.remove())},t("#"+s+"checklist").wpList({alt:"",response:s+"-ajax-response",addBefore:e,addAfter:a}),t("#"+s+"-add-toggle").click(function(e){e.preventDefault(),t("#"+s+"-adder").toggleClass("wp-hidden-children"),t('a[href="#'+s+'-all"]',"#"+s+"-tabs").click(),t("#new"+s).focus()}),t("#"+s+"checklist, #"+s+"checklist-pop").on("click",'li.popular-category > label input[type="checkbox"]',function(){var e=t(this),a=e.is(":checked"),i=e.val();i&&e.parents("#taxonomy-"+s).length&&t("#in-"+s+"-"+i+", #in-popular-"+s+"-"+i).prop("checked",a)})}),t("#postcustom").length&&t("#the-list").wpList({addBefore:function(e){return e.data+="&post_id="+t("#post_ID").val(),e},addAfter:function(){t("table#list-table").show()}}),t("#submitdiv").length&&(a=t("#timestamp").html(),i=t("#post-visibility-display").html(),n=function(){"public"!=h.find("input:radio:checked").val()?(t("#sticky").prop("checked",!1),t("#sticky-span").hide()):t("#sticky-span").show(),"password"!=h.find("input:radio:checked").val()?t("#password-span").hide():t("#password-span").show()},o=function(){if(!f.length)return!0;var e,i,s,n,o=t("#post_status"),l=t('option[value="publish"]',o),r=t("#aa").val(),c=t("#mm").val(),p=t("#jj").val(),d=t("#hh").val(),u=t("#mn").val();return(e=new Date(r,c-1,p,d,u),i=new Date(t("#hidden_aa").val(),t("#hidden_mm").val()-1,t("#hidden_jj").val(),t("#hidden_hh").val(),t("#hidden_mn").val()),s=new Date(t("#cur_aa").val(),t("#cur_mm").val()-1,t("#cur_jj").val(),t("#cur_hh").val(),t("#cur_mn").val()),e.getFullYear()!=r||1+e.getMonth()!=c||e.getDate()!=p||e.getMinutes()!=u)?(f.find(".timestamp-wrap").addClass("form-invalid"),!1):(f.find(".timestamp-wrap").removeClass("form-invalid"),e>s&&"future"!=t("#original_post_status").val()?(n=postL10n.publishOnFuture,t("#publish").val(postL10n.schedule)):e<=s&&"publish"!=t("#original_post_status").val()?(n=postL10n.publishOn,t("#publish").val(postL10n.publish)):(n=postL10n.publishOnPast,t("#publish").val(postL10n.update)),i.toUTCString()==e.toUTCString()?t("#timestamp").html(a):t("#timestamp").html("\n"+n+" <b>"+postL10n.dateFormat.replace("%1$s",t('option[value="'+c+'"]',"#mm").attr("data-text")).replace("%2$s",parseInt(p,10)).replace("%3$s",r).replace("%4$s",("00"+d).slice(-2)).replace("%5$s",("00"+u).slice(-2))+"</b> "),"private"==h.find("input:radio:checked").val()?(t("#publish").val(postL10n.update),0===l.length?o.append('<option value="publish">'+postL10n.privatelyPublished+"</option>"):l.html(postL10n.privatelyPublished),t('option[value="publish"]',o).prop("selected",!0),t("#misc-publishing-actions .edit-post-status").hide()):("future"==t("#original_post_status").val()||"draft"==t("#original_post_status").val()?l.length&&(l.remove(),o.val(t("#hidden_post_status").val())):l.html(postL10n.published),o.is(":hidden")&&t("#misc-publishing-actions .edit-post-status").show()),t("#post-status-display").html(t("option:selected",o).text()),"private"==t("option:selected",o).val()||"publish"==t("option:selected",o).val()?t("#save-post").hide():(t("#save-post").show(),"pending"==t("option:selected",o).val()?t("#save-post").show().val(postL10n.savePending):t("#save-post").show().val(postL10n.saveDraft)),!0)},t("#visibility .edit-visibility").click(function(e){e.preventDefault(),h.is(":hidden")&&(n(),h.slideDown("fast",function(){h.find('input[type="radio"]').first().focus()}),t(this).hide())}),h.find(".cancel-post-visibility").click(function(e){h.slideUp("fast"),t("#visibility-radio-"+t("#hidden-post-visibility").val()).prop("checked",!0),t("#post_password").val(t("#hidden-post-password").val()),t("#sticky").prop("checked",t("#hidden-post-sticky").prop("checked")),t("#post-visibility-display").html(i),t("#visibility .edit-visibility").show().focus(),o(),e.preventDefault()}),h.find(".save-post-visibility").click(function(e){h.slideUp("fast"),t("#visibility .edit-visibility").show().focus(),o(),"public"!=h.find("input:radio:checked").val()&&t("#sticky").prop("checked",!1),l=t("#sticky").prop("checked")?"Sticky":"",t("#post-visibility-display").html(postL10n[h.find("input:radio:checked").val()+l]),e.preventDefault()}),h.find("input:radio").change(function(){n()}),f.siblings("a.edit-timestamp").click(function(e){f.is(":hidden")&&(f.slideDown("fast",function(){t("input, select",f.find(".timestamp-wrap")).first().focus()}),t(this).hide()),e.preventDefault()}),f.find(".cancel-timestamp").click(function(e){f.slideUp("fast").siblings("a.edit-timestamp").show().focus(),t("#mm").val(t("#hidden_mm").val()),t("#jj").val(t("#hidden_jj").val()),t("#aa").val(t("#hidden_aa").val()),t("#hh").val(t("#hidden_hh").val()),t("#mn").val(t("#hidden_mn").val()),o(),e.preventDefault()}),f.find(".save-timestamp").click(function(t){o()&&(f.slideUp("fast"),f.siblings("a.edit-timestamp").show().focus()),t.preventDefault()}),t("#post").on("submit",function(e){o()||(e.preventDefault(),f.show(),wp.autosave&&wp.autosave.enableButtons(),t("#publishing-action .spinner").removeClass("is-active"))}),v.siblings("a.edit-post-status").click(function(e){v.is(":hidden")&&(v.slideDown("fast",function(){v.find("select").focus()}),t(this).hide()),e.preventDefault()}),v.find(".save-post-status").click(function(t){v.slideUp("fast").siblings("a.edit-post-status").show().focus(),o(),t.preventDefault()}),v.find(".cancel-post-status").click(function(e){v.slideUp("fast").siblings("a.edit-post-status").show().focus(),t("#post_status").val(t("#hidden_post_status").val()),o(),e.preventDefault()})),t("#titlediv").on("click",".edit-slug",function(){!function e(){var a,i,s,n,o=0,l=t("#post_name"),r=l.val(),c=t("#sample-permalink"),d=c.html(),u=t("#sample-permalink a").html(),h=t("#edit-slug-buttons"),f=h.html(),v=t("#editable-post-name-full");for(v.find("img").replaceWith(function(){return this.alt}),v=v.html(),c.html(u),n=(s=t("#editable-post-name")).html(),h.html('<button type="button" class="save button button-small">'+postL10n.ok+'</button> <button type="button" class="cancel button-link">'+postL10n.cancel+"</button>"),h.children(".save").click(function(){var e=s.children("input").val();if(e==t("#editable-post-name-full").text()){h.children(".cancel").click();return}t.post(ajaxurl,{action:"sample-permalink",post_id:p,new_slug:e,new_title:t("#title").val(),samplepermalinknonce:t("#samplepermalinknonce").val()},function(a){var i=t("#edit-slug-box");i.html(a),i.hasClass("hidden")&&i.fadeIn("fast",function(){i.removeClass("hidden")}),h.html(f),c.html(d),l.val(e),t(".edit-slug").focus(),wp.a11y.speak(postL10n.permalinkSaved)})}),h.children(".cancel").click(function(){t("#view-post-btn").show(),s.html(n),h.html(f),c.html(d),l.val(r),t(".edit-slug").focus()}),a=0;a<v.length;++a)"%"==v.charAt(a)&&o++;i=o>v.length/4?"":v,s.html('<input type="text" id="new-post-slug" value="'+i+'" autocomplete="off" />').children("input").keydown(function(t){var e=t.which;13===e&&(t.preventDefault(),h.children(".save").click()),27===e&&h.children(".cancel").click()}).keyup(function(){l.val(this.value)}).focus()}()}),window.wptitlehint=function(e){var a=t("#"+(e=e||"title")),i=t("#"+e+"-prompt-text");""===a.val()&&i.removeClass("screen-reader-text"),i.click(function(){t(this).addClass("screen-reader-text"),a.focus()}),a.blur(function(){""===this.value&&i.removeClass("screen-reader-text")}).focus(function(){i.addClass("screen-reader-text")}).keydown(function(e){i.addClass("screen-reader-text"),t(this).unbind(e)})},wptitlehint(),function(){var e,a,i,s=t("#post-status-info"),n=t("#postdivrich");if(!r.length||"ontouchstart"in window){t("#content-resize-handle").hide();return}function o(t){!n.hasClass("wp-editor-expand")&&(i?e.theme.resizeTo(null,a+t.pageY):r.height(Math.max(50,a+t.pageY)),t.preventDefault())}function l(){var a,s;!n.hasClass("wp-editor-expand")&&(i?(e.focus(),((s=parseInt(t("#wp-content-editor-container .mce-toolbar-grp").height(),10))<10||s>200)&&(s=30),a=parseInt(t("#content_ifr").css("height"),10)+s-28):(r.focus(),a=parseInt(r.css("height"),10)),c.off(".wp-editor-resize"),a&&a>50&&a<5e3&&setUserSetting("ed_size",a))}s.on("mousedown.wp-editor-resize",function(s){"undefined"!=typeof tinymce&&(e=tinymce.get("content")),e&&!e.isHidden()?(i=!0,a=t("#content_ifr").height()-s.pageY):(i=!1,a=r.height()-s.pageY,r.blur()),c.on("mousemove.wp-editor-resize",o).on("mouseup.wp-editor-resize mouseleave.wp-editor-resize",l),s.preventDefault()}).on("mouseup.wp-editor-resize",l)}(),"undefined"!=typeof tinymce&&(t("#post-formats-select input.post-format").on("change.set-editor-class",function(){var e,a,i=this.id;i&&t(this).prop("checked")&&(e=tinymce.get("content"))&&((a=e.getBody()).className=a.className.replace(/\bpost-format-[^ ]+/,""),e.dom.addClass(a,"post-format-0"==i?"post-format-standard":i),t(document).trigger("editor-classchange"))}),t("#page_template").on("change.set-editor-class",function(){var e,a,i=t(this).val()||"";(i=i.substr(i.lastIndexOf("/")+1,i.length).replace(/\.php$/,"").replace(/\./g,"-"))&&(e=tinymce.get("content"))&&((a=e.getBody()).className=a.className.replace(/\bpage-template-[^ ]+/,""),e.dom.addClass(a,"page-template-"+i),t(document).trigger("editor-classchange"))})),r.on("keydown.wp-autosave",function(t){83===t.which&&!t.shiftKey&&!t.altKey&&(!m||t.metaKey&&!t.ctrlKey)&&(m||t.ctrlKey)&&(wp.autosave&&wp.autosave.server.triggerSave(),t.preventDefault())}),"auto-draft"===t("#original_post_status").val()&&window.history.replaceState&&t("#publish").on("click",function(){e=window.location.href,e+=-1!==e.indexOf("?")?"&":"?",e+="wp-post-new-reload=true",window.history.replaceState(null,null,e)})}),function(t,e){t(function(){var a,i=t("#content"),s=t("#wp-word-count").find(".word-count"),n=0;function o(){var t,o;t=!a||a.isHidden()?i.val():a.getContent({format:"raw"}),(o=e.count(t))!==n&&s.text(o),n=o}t(document).on("tinymce-editor-init",function(t,e){"content"===e.id&&(a=e,e.on("nodechange keyup",_.debounce(o,1e3)))}),i.on("input keyup",_.debounce(o,1e3)),o()})}(jQuery,new wp.utils.WordCounter);