WordPress/wp-admin/js/postbox.min.js

2 lines
7.0 KiB
JavaScript
Raw Normal View History

/*! This file is auto-generated */
!function(i){var a=i(document),r=i("body"),d=wp.i18n.__;window.postboxes={handle_click:function(){var e,s=i(this),o=s.closest(".postbox"),t=o.attr("id");"dashboard_browser_nag"!==t&&(o.toggleClass("closed"),e=!o.hasClass("closed"),s.hasClass("handlediv")?s.attr("aria-expanded",e):s.closest(".postbox").find("button.handlediv").attr("aria-expanded",e),"press-this"!==postboxes.page&&postboxes.save_state(),t&&(!o.hasClass("closed")&&i.isFunction(postboxes.pbshow)?postboxes.pbshow(t):o.hasClass("closed")&&i.isFunction(postboxes.pbhide)&&postboxes.pbhide(t)),a.trigger("postbox-toggled",o))},handleOrder:function(){var e,s=i(this),o=s.closest(".postbox"),t=o.attr("id"),a=o.closest(".meta-box-sortables").find(".postbox:visible"),r=a.length,n=a.index(o);if("dashboard_browser_nag"!==t){if("true"===s.attr("aria-disabled"))return e=s.hasClass("handle-order-higher")?d("The box is on the first position"):d("The box is on the last position"),void wp.a11y.speak(e);if(s.hasClass("handle-order-higher")){if(0===n)return void postboxes.handleOrderBetweenSortables("previous",s,o);o.prevAll(".postbox:visible").eq(0).before(o),s.focus(),postboxes.updateOrderButtonsProperties(),postboxes.save_order()}else if(s.hasClass("handle-order-lower")){if(n+1===r)return void postboxes.handleOrderBetweenSortables("next",s,o);o.nextAll(".postbox:visible").eq(0).after(o),s.focus(),postboxes.updateOrderButtonsProperties(),postboxes.save_order()}}},handleOrderBetweenSortables:function(e,s,o){var t,a,r=s.closest(".meta-box-sortables").attr("id"),n=[];i(".meta-box-sortables:visible").each(function(){n.push(i(this).attr("id"))}),1!==n.length&&(t=i.inArray(r,n),a=o.detach(),"previous"===e&&i(a).appendTo("#"+n[t-1]),"next"===e&&i(a).prependTo("#"+n[t+1]),postboxes._mark_area(),s.focus(),postboxes.save_order())},showArrangeArrows:function(){i(".postbox-arrange-arrow").attr("aria-disabled","false").removeClass("hidden"),postboxes._mark_area()},hideArrangeArrows:function(){i(".postbox-arrange-arrow").attr("aria-disabled","true").addClass("hidden"),postboxes._mark_area()},updateOrderButtonsProperties:function(){var e=i(".postbox:visible"),s=i(".meta-box-sortables:visible").not(".unused-container").filter(function(e,s){return!(0<e&&0===s.clientHeight)});1!==s.length||1!==e.length?(r.hasClass("screen-options-open")&&i(".postbox-arrange-arrow").removeClass("hidden").attr("aria-disabled","false"),e.first().parent()[0]===s.first()[0]&&e.first().find(".handle-order-higher").attr("aria-disabled","true"),e.last().parent()[0]===s.last()[0]&&e.last().find(".handle-order-lower").attr("aria-disabled","true")):i(".postbox-arrange-arrow").addClass("hidden").attr("aria-disabled","true")},add_postbox_toggles:function(e,s){var o=i(".postbox .hndle, .postbox .handlediv"),t=i(".postbox .postbox-arrange-arrow");this.page=e,this.init(e,s),o.on("click.postboxes",this.handle_click),t.on("click.postboxes",this.handleOrder),i(".postbox .hndle a").on("click",function(e){e.stopPropagation()}),i(".postbox a.dismiss").on("click.postboxes",function(e){var s=i(this).parents(".postbox").attr("id")+"-hide";e.preventDefault(),i("#"+s).prop("checked",!1).triggerHandler("click")}),i(".hide-postbox-tog").on("click.postboxes",function(){var e=i(this),s=e.val(),o=i("#"+s);e.prop("checked")?(o.show(),i.isFunction(postboxes.pbshow)&&postboxes.pbshow(s)):(o.hide(),i.isFunction(postboxes.pbhide)&&postboxes.pbhide(s)),postboxes.save_state(),postboxes._mark_area(),a.trigger("postbox-toggled",o)}),i('.columns-prefs input[type="radio"]').on("click.postboxes",function(){var e=parseInt(i(this).val(),10);e&&(postboxes._pb_edit(e),postboxes.save_order())}),a.on("screen:options:open",function(){r.addClass("screen-options-open"),postboxes.initializeSortable(),postboxes.showArrangeArrows()}).on("screen:options:close",function(){r.removeClass("screen-options-open"),i(".meta-box-sortables").sortable("destroy"),postboxes.hideArrangeArrows()})},initializeSortable:function(){var s=0<a.find("#screen-options-wrap").length;i(".meta-box-sortables").sortable({placeholder:"sortable-placeholder",connectWith:".meta-box-sortables",item