2017-07-15 17:48:46 +02:00
|
|
|
!function(a,b){var c=function(){function c(a){return a&&b.pressThisL10n?b.pressThisL10n[a]||a:a||""}function d(b){return b=a.trim(b||""),/^(?:https?:)?\/\//.test(b)?(b=wp.sanitize.stripTags(b),b.replace(/["\\]+/g,"")):""}function e(){a(".spinner").addClass("is-active"),a(".post-actions button").attr("disabled","disabled")}function f(){a(".spinner").removeClass("is-active"),a(".post-actions button").removeAttr("disabled")}function g(a){var c,d;G&&!G.isHidden()||(a="reset"===a||Z&&Z>X.value.length,d=X.style.height,a?(c=b.pageYOffset,X.style.height="auto",X.style.height=Math.max(X.scrollHeight,Y)+"px",b.scrollTo(b.pageXOffset,c)):parseInt(X.style.height,10)<X.scrollHeight&&(X.style.height=X.scrollHeight+"px"),Z=X.value.length)}function h(){if(!G)return!1;var a,b,c,d=G.selection.getNode();if(G.wp&&G.wp.getView&&(b=G.wp.getView(d)))c=b.getBoundingClientRect();else{a=G.selection.getRng();try{c=a.getClientRects()[0]}catch(e){}c||(c=d.getBoundingClientRect())}return!!c.height&&c}function i(a){var c=b.tinymce.util.VK,d=a.keyCode;d<=47&&d!==c.SPACEBAR&&d!==c.ENTER&&d!==c.DELETE&&d!==c.BACKSPACE&&d!==c.UP&&d!==c.LEFT&&d!==c.DOWN&&d!==c.UP||d>=91&&d<=93||d>=112&&d<=123||144===d||145===d||j(d)}function j(a){var c,d,e,f=h(),g=50,i=65,j=b.tinymce.util.VK;f&&(c=f.top+G.iframeElement.getBoundingClientRect().top,d=c+f.height,c-=g,d+=i,e=J.height(),e<f.height||(c<0&&(a===j.UP||a===j.LEFT||a===j.BACKSPACE)?b.scrollTo(b.pageXOffset,c+b.pageYOffset):d>e&&b.scrollTo(b.pageXOffset,d+b.pageYOffset-e)))}function k(){var b=a("#title-container");return b.find("img.emoji").each(function(){var b=a(this);b.replaceWith(a("<span>").text(b.attr("alt")))}),wp.sanitize.sanitizeText(b.text())}function l(){var c=a("#pressthis-form"),d=a('<input type="hidden" name="post_category[]" value="">');G&&G.save(),a("#post_title").val(k()),b.tagBox&&a("div.tagsdiv").each(function(){b.tagBox.flushTags(this,!1,1)}),a(".categories-select .category").each(function(b,e){var f=a(e);f.hasClass("selected")&&c.append(d.clone().val(f.attr("data-term-id")||""))})}function m(d){var g;L=!1,e(),"publish"===d&&a("#post_status").val("publish"),l(),g=a("#pressthis-form").serialize(),a.ajax({type:"post",url:b.ajaxurl,data:g}).always(function(){f(),s(),a(".publish-button").removeClass("is-saving")}).done(function(a){if(a.success){if(a.data.redirect)if(b.opener&&(N.redirInParent||a.data.force))try{b.opener.location.href=a.data.redirect,b.setTimeout(function(){b.self.close()},200)}catch(c){b.location.href=a.data.redirect}else b.location.href=a.data.redirect}else r(a.data.errorMessage)}).fail(function(){r(c("serverError"))})}function n(a){var c,e,f="";c=d(a.attr("data-wp-src")||""),e=d(O.u),a.hasClass("is-image")?(e||(e=c),f='<a href="'+e+'"><img class="alignnone size-full" src="'+c+'" alt="" /></a>'):f="[embed]"+c+"[/embed]",G&&!G.isHidden()?Q?G.execCommand("mceInsertContent",!1,f):G.setContent("<p>"+f+"</p>"+G.getContent()):b.QTags&&b.QTags.insertContent(f)}function o(){var c,d=a("#new-category").val();d&&(c={action:"press-this-add-category",post_id:a("#post_ID").val()||0,name:d,new_cat_nonce:a("#_ajax_nonce-add-category").val()||"",parent:a("#new-category-parent").val()||0},a.post(b.ajaxurl,c,function(b){if(b.success){var c,d,e=a("ul.categories-select");a.each(b.data,function(b,f){var g=a("<li>").append(a('<div class="category selected" tabindex="0" role="checkbox" aria-checked="true">').attr("data-term-id",f.term_id).text(f.name));f.parent?(d&&d.length||(c=e.find('div[data-term-id="'+f.parent+'"]').parent(),d=c.find("ul.children:first"),d.length||(d=a('<ul class="children">').appendTo(c))),d.prepend(g)):e.prepend(g),g.focus()}),F()}else r(b.data.errorMessage)}))}function p(){O.hasData&&a("#scanbar").hide()}function q(b,c){var d=a(".editor-wrapper div.alerts"),e=c?"is-error":"is-notice";d.append(a('<p class="alert '+e+'">').text(b))}function r(a){q(a,!0)}function s(){a("div.alerts").empty()}function t(){O.errors&&a.each(O.errors,function(a,b){r(b)})}function u(a,b,d){var e=I.clone().addClass("is-image");e.attr("data-wp-src",a).css("background-image","url("+b+")").find("span").text(c("s
|