1 line
3.1 KiB
JavaScript
1 line
3.1 KiB
JavaScript
var ajaxWidgets,ajaxPopulateWidgets,quickPressLoad;jQuery(document).ready(function(o){var t,s=o("#welcome-panel"),e=o("#wp_welcome_panel-hide");t=function(e){o.post(ajaxurl,{action:"update-welcome-panel",visible:e,welcomepanelnonce:o("#welcomepanelnonce").val()})},s.hasClass("hidden")&&e.prop("checked")&&s.removeClass("hidden"),o(".welcome-panel-close, .welcome-panel-dismiss a",s).click(function(e){e.preventDefault(),s.addClass("hidden"),t(0),o("#wp_welcome_panel-hide").prop("checked",!1)}),e.click(function(){s.toggleClass("hidden",!this.checked),t(this.checked?1:0)}),ajaxWidgets=["dashboard_primary"],(ajaxPopulateWidgets=function(e){function t(e,t){var s,i=o("#"+t+" div.inside:visible").find(".widget-loading");i.length&&(s=i.parent(),setTimeout(function(){s.load(ajaxurl+"?action=dashboard-widgets&widget="+t+"&pagenow="+pagenow,"",function(){s.hide().slideDown("normal",function(){o(this).css("display","")})})},500*e))}e?(e=e.toString(),-1!==o.inArray(e,ajaxWidgets)&&t(0,e)):o.each(ajaxWidgets,t)})(),postboxes.add_postbox_toggles(pagenow,{pbshow:ajaxPopulateWidgets}),(quickPressLoad=function(){var e,s,i,n,a,t=o("#quickpost-action");o('#quick-press .submit input[type="submit"], #quick-press .submit input[type="reset"]').prop("disabled",!1),e=o("#quick-press").submit(function(){return o("#dashboard_quick_press #publishing-action .spinner").show(),o('#quick-press .submit input[type="submit"], #quick-press .submit input[type="reset"]').prop("disabled",!0),o.post(e.attr("action"),e.serializeArray(),function(e){var t;o("#dashboard_quick_press .inside").html(e),o("#quick-press").removeClass("initial-form"),quickPressLoad(),(t=o(".drafts ul li").first()).css("background","#fffbe5"),setTimeout(function(){t.css("background","none")},1e3),o("#title").focus()}),!1}),o("#publish").click(function(){t.val("post-quickpress-publish")}),o("#title, #tags-input, #content").each(function(){var e=o(this),t=o("#"+this.id+"-prompt-text");""===this.value&&t.removeClass("screen-reader-text"),t.click(function(){o(this).addClass("screen-reader-text"),e.focus()}),e.blur(function(){""===this.value&&t.removeClass("screen-reader-text")}),e.focus(function(){t.addClass("screen-reader-text")})}),o("#quick-press").on("click focusin",function(){wpActiveEditor="content"}),document.documentMode&&document.documentMode<9||(o("body").append('<div class="quick-draft-textarea-clone" style="display: none;"></div>'),s=o(".quick-draft-textarea-clone"),i=o("#content"),n=i.height(),a=o(window).height()-100,s.css({"font-family":i.css("font-family"),"font-size":i.css("font-size"),"line-height":i.css("line-height"),"padding-bottom":i.css("paddingBottom"),"padding-left":i.css("paddingLeft"),"padding-right":i.css("paddingRight"),"padding-top":i.css("paddingTop"),"white-space":"pre-wrap","word-wrap":"break-word",display:"none"}),i.on("focus input propertychange",function(){var e=o(this),t=e.val()+" ",t=s.css("width",e.css("width")).text(t).outerHeight()+2;i.css("overflow-y","auto"),t===n||a<=t&&a<=n||(n=a<t?a:t,i.css("overflow","hidden"),e.css("height",n+"px"))}))})(),o(".meta-box-sortables").sortable("option","containment","#wpwrap")}); |