jQuery((function(n){if(void 0!==window.pltVars){var t=n(".plt-copy-short-url"),e=new ClipboardJS(".plt-copy-short-url"),i=window.pltVars,o=i.copied,l=i.browserNoSupportCopying;ClipboardJS.isSupported()?t.click((function(n){return n.preventDefault()})):t.hide(),n(".plt-links-to button").click((function(){return n("#cws-links-to").focus()})),e.on("success",(function(t){var e=n(t.trigger);e.text(o),setTimeout((function(){return e.text(e.data("original-text"))}),4e3)})),e.on("error",(function(e){n(e.trigger).text(l),setTimeout((function(){return t.hide()}),4e3)}))}})),jQuery((function(n){if(void 0!==window.pltVars){var t=n("#plt-quick-add"),e=t.find("form:first"),i=n("#plt-quick-add-save"),o=n("#plt-quick-add-publish"),l=n('a[href$="post_type=page&page=plt-add-page-link"], a[href$="#new-page-link"]'),r=t.find(".messages"),a=t.find(".short-url-message"),u=t.find('[name="title"]'),p=t.find('[name="url"]'),c=t.find('[name="slug"]'),d=t.find('[name="plt_nonce"]').val(),s=c.prop("placeholder"),f=window.pltVars.fancyUrls,g=function(n){return function(){return t.dialog(n)}},v=g("isOpen"),h=g("open"),w=g("close"),k=function(){return b(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"").replace(/-$/,"")},b=function(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"").toLowerCase().replace(/\s+/g,"-").replace(/-{2,}/g,"-").replace(/[^a-z0-9-]/,"").replace(/^-/,"")},y=function(){var n=k(u.val()),t=b(c.val());c.prop("placeholder",n.length?n:s),c.val(t)},m=function(n){return function(t){t.preventDefault(),n()}},_=m((function(){return c.val(k(c.val()))})),x=m((function(){return n=c.prop("placeholder").length>16&&!c.val().length,a.toggle(n);var n})),C=function(){u.val(""),p.val(""),c.val(""),c.prop("placeholder",s),q()},q=function(){return function(){var n=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];o.prop("disabled",!n),i.prop("disabled",!n)}(u.val().length&&p.val().length)},O=function(){var t=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).publish,e=void 0===t||t,i=u.val(),o=p.val(),l=c.val()?c.val():k(i);n.post(ajaxurl,{action:"plt_quick_add",plt_title:i,plt_url:o,plt_slug:l,plt_publish:e?1:0,plt_nonce:d},(function(t){var e=t.data.message;C(),u.focus(),function(t,e){var i=function(t){var e=n("<p>".concat(t,"</p>"));return r.append(e),e}(t);setTimeout((function(){return i.fadeOut()}),e)}(e,5e3)}))},S=m((function(){return v()?w():h()})),V=m((function(){return O({publish:!1})})),j=m((function(){return O({publish:!0})}));t.dialog({title:"Add Page Link",dialogClass:"wp-dialog plt-ui-dialog",autoOpen:!1,draggable:!1,width:"auto",modal:!0,resizable:!1,closeOnEscape:!0,position:{my:"center",at:"center",of:window},open:function(){return n(".ui-widget-overlay").bind("click",w)},create:function(){n(".plt-ui-dialog .ui-dialog-titlebar-close").addClass("ui-button"),n(".plt-ui-dialog").css({position:"fixed"})}});var z=function(){v()&&t.dialog("option","position",{my:"center",at:"center",of:window})};n(window).scroll(z).resize(z),f&&(u.keyup(y),u.keyup(x),c.keyup(y),c.keyup(x),e.change(_)),l.click(S),i.click(V),o.click(j),e.submit(j),u.keyup(q),p.keyup(q),e.change(q),C()}}));