[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

/wp-admin/js/ -> postbox.min.js (source)

   1  /*! This file is auto-generated */
   2  !function(l){var a=l(document),n=wp.i18n.__;window.postboxes={handle_click:function(){var e,s=l(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(postboxes.page),t&&(!o.hasClass("closed")&&l.isFunction(postboxes.pbshow)?postboxes.pbshow(t):o.hasClass("closed")&&l.isFunction(postboxes.pbhide)&&postboxes.pbhide(t)),a.trigger("postbox-toggled",o))},handleOrder:function(){var e,s=l(this),o=s.closest(".postbox"),t=o.attr("id"),a=o.closest(".meta-box-sortables").find(".postbox:visible"),r=a.length,i=a.index(o);if("dashboard_browser_nag"!==t){if("true"===s.attr("aria-disabled"))return e=s.hasClass("handle-order-higher")?n("The box is on the first position"):n("The box is on the last position"),void wp.a11y.speak(e);if(s.hasClass("handle-order-higher")){if(0===i)return void postboxes.handleOrderBetweenSortables("previous",s,o);o.prevAll(".postbox:visible").eq(0).before(o),s.focus(),postboxes.updateOrderButtonsProperties(),postboxes.save_order(postboxes.page)}if(s.hasClass("handle-order-lower")){if(i+1===r)return void postboxes.handleOrderBetweenSortables("next",s,o);o.nextAll(".postbox:visible").eq(0).after(o),s.focus(),postboxes.updateOrderButtonsProperties(),postboxes.save_order(postboxes.page)}}},handleOrderBetweenSortables:function(e,s,o){var t,a,r=s.closest(".meta-box-sortables").attr("id"),i=[];l(".meta-box-sortables:visible").each(function(){i.push(l(this).attr("id"))}),1!==i.length&&(t=l.inArray(r,i),a=o.detach(),"previous"===e&&l(a).appendTo("#"+i[t-1]),"next"===e&&l(a).prependTo("#"+i[t+1]),postboxes._mark_area(),s.focus(),postboxes.updateOrderButtonsProperties(),postboxes.save_order(postboxes.page))},updateOrderButtonsProperties:function(){var e=l(".meta-box-sortables:visible:first").attr("id"),s=l(".meta-box-sortables:visible:last").attr("id"),o=l(".postbox:visible:first"),t=l(".postbox:visible:last"),a=o.attr("id"),r=t.attr("id"),i=o.closest(".meta-box-sortables").attr("id"),n=t.closest(".meta-box-sortables").attr("id"),d=l(".handle-order-higher"),b=l(".handle-order-lower");d.attr("aria-disabled","false").removeClass("hidden"),b.attr("aria-disabled","false").removeClass("hidden"),e===s&&a===r&&(d.addClass("hidden"),b.addClass("hidden")),e===i&&l(o).find(".handle-order-higher").attr("aria-disabled","true"),s===n&&l(".postbox:visible .handle-order-lower").last().attr("aria-disabled","true")},add_postbox_toggles:function(t,e){var s=l(".postbox .hndle, .postbox .handlediv"),o=l(".postbox .handle-order-higher, .postbox .handle-order-lower");this.page=t,this.init(t,e),s.on("click.postboxes",this.handle_click),o.on("click.postboxes",this.handleOrder),l(".postbox .hndle a").click(function(e){e.stopPropagation()}),l(".postbox a.dismiss").on("click.postboxes",function(e){var s=l(this).parents(".postbox").attr("id")+"-hide";e.preventDefault(),l("#"+s).prop("checked",!1).triggerHandler("click")}),l(".hide-postbox-tog").bind("click.postboxes",function(){var e=l(this),s=e.val(),o=l("#"+s);e.prop("checked")?(o.show(),l.isFunction(postboxes.pbshow)&&postboxes.pbshow(s)):(o.hide(),l.isFunction(postboxes.pbhide)&&postboxes.pbhide(s)),postboxes.save_state(t),postboxes._mark_area(),a.trigger("postbox-toggled",o)}),l('.columns-prefs input[type="radio"]').bind("click.postboxes",function(){var e=parseInt(l(this).val(),10);e&&(postboxes._pb_edit(e),postboxes.save_order(t))})},init:function(s,e){var o=l(document.body).hasClass("mobile"),t=l(".postbox .handlediv");l.extend(this,e||{}),l(".meta-box-sortables").sortable({placeholder:"sortable-placeholder",connectWith:".meta-box-sortables",items:".postbox",handle:".hndle",cursor:"move",delay:o?200:0,distance:2,tolerance:"pointer",forcePlaceholderSize:!0,helper:function(e,s){return s.clone().find(":input").attr("name",function(e,s){return"sort_"+parseInt(1e5*Math.random(),10).toString()+"_"+s}).end()},opacity:.65,start:function(){l("body").addClass("is-dragging-metaboxes")},stop:function(){var e=l(this);l("body").removeClass("is-dragging-metaboxes"),e.find("#dashboard_browser_nag").is(":visible")&&"dashboard_browser_nag"!=this.firstChild.id?e.sortable("cancel"):(postboxes.updateOrderButtonsProperties(),postboxes.save_order(s))},receive:function(e,s){"dashboard_browser_nag"==s.item[0].id&&l(s.sender).sortable("cancel"),postboxes._mark_area(),a.trigger("postbox-moved",s.item)}}),o&&(l(document.body).bind("orientationchange.postboxes",function(){postboxes._pb_change()}),this._pb_change()),this._mark_area(),this.updateOrderButtonsProperties(),a.on("postbox-toggled",this.updateOrderButtonsProperties),t.each(function(){var e=l(this);e.attr("aria-expanded",!e.closest(".postbox").hasClass("closed"))})},save_state:function(e){var s,o;"nav-menus"!==e&&(s=l(".postbox").filter(".closed").map(function(){return this.id}).get().join(","),o=l(".postbox").filter(":hidden").map(function(){return this.id}).get().join(","),l.post(ajaxurl,{action:"closed-postboxes",closed:s,hidden:o,closedpostboxesnonce:jQuery("#closedpostboxesnonce").val(),page:e}))},save_order:function(e){var s,o=l(".columns-prefs input:checked").val()||0;s={action:"meta-box-order",_ajax_nonce:l("#meta-box-order-nonce").val(),page_columns:o,page:e},l(".meta-box-sortables").each(function(){s["order["+this.id.split("-")[0]+"]"]=l(this).sortable("toArray").join(",")}),l.post(ajaxurl,s,function(e){e.success&&wp.a11y.speak(n("The boxes order has been saved."))})},_mark_area:function(){var e=l("#dashboard-widgets .meta-box-sortables:visible, #post-body .meta-box-sortables:visible"),s=!0;e.each(function(){var e=l(this);e.children(".postbox:visible").length?(e.removeClass("empty-container"),s=!1):e.addClass("empty-container")}),postboxes.updateEmptySortablesText(e,s)},updateEmptySortablesText:function(e,s){var o=l("#dashboard-widgets").length,t=n(s?"Add boxes from the Screen Options menu":"Drag boxes here");o&&e.each(function(){l(this).hasClass("empty-container")&&l(this).attr("data-emptyString",t)})},_pb_edit:function(e){var s=l(".metabox-holder").get(0);s&&(s.className=s.className.replace(/columns-\d+/,"columns-"+e)),l(document).trigger("postboxes-columnchange")},_pb_change:function(){var e=l('label.columns-prefs-1 input[type="radio"]');switch(window.orientation){case 90:case-90:e.length&&e.is(":checked")||this._pb_edit(2);break;case 0:case 180:l("#poststuff").length?this._pb_edit(1):e.length&&e.is(":checked")||this._pb_edit(2)}},pbshow:!1,pbhide:!1}}(jQuery);


Generated: Mon Aug 3 01:00:04 2020 Cross-referenced by PHPXref 0.7.1