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

1 line
13 KiB
JavaScript
Raw Normal View History

var showNotice,adminMenu,columns,validateForm,screenMeta;!function(a,b,c){adminMenu={init:function(){},fold:function(){},restoreMenuState:function(){},toggle:function(){},favorites:function(){}},columns={init:function(){var b=this;a(".hide-column-tog","#adv-settings").click(function(){var c=a(this),d=c.val();c.prop("checked")?b.checked(d):b.unchecked(d),columns.saveManageColumnsState()})},saveManageColumnsState:function(){var b=this.hidden();a.post(ajaxurl,{action:"hidden-columns",hidden:b,screenoptionnonce:a("#screenoptionnonce").val(),page:pagenow})},checked:function(b){a(".column-"+b).removeClass("hidden"),this.colSpanChange(1)},unchecked:function(b){a(".column-"+b).addClass("hidden"),this.colSpanChange(-1)},hidden:function(){return a(".manage-column[id]").filter(":hidden").map(function(){return this.id}).get().join(",")},useCheckboxesForHidden:function(){this.hidden=function(){return a(".hide-column-tog").not(":checked").map(function(){var a=this.id;return a.substring(a,a.length-5)}).get().join(",")}},colSpanChange:function(b){var c,d=a("table").find(".colspanchange");d.length&&(c=parseInt(d.attr("colspan"),10)+b,d.attr("colspan",c.toString()))}},a(document).ready(function(){columns.init()}),validateForm=function(b){return!a(b).find(".form-required").filter(function(){return""===a("input:visible",this).val()}).addClass("form-invalid").find("input:visible").change(function(){a(this).closest(".form-invalid").removeClass("form-invalid")}).size()},showNotice={warn:function(){var a=commonL10n.warnDelete||"";return confirm(a)?!0:!1},note:function(a){alert(a)}},screenMeta={element:null,toggles:null,page:null,init:function(){this.element=a("#screen-meta"),this.toggles=a("#screen-meta-links").find(".show-settings"),this.page=a("#wpcontent"),this.toggles.click(this.toggleEvent)},toggleEvent:function(){var b=a("#"+a(this).attr("aria-controls"));b.length&&(b.is(":visible")?screenMeta.close(b,a(this)):screenMeta.open(b,a(this)))},open:function(b,c){a("#screen-meta-links").find(".screen-meta-toggle").not(c.parent()).css("visibility","hidden"),b.parent().show(),b.slideDown("fast",function(){b.focus(),c.addClass("screen-meta-active").attr("aria-expanded",!0)}),a(document).trigger("screen:options:open")},close:function(b,c){b.slideUp("fast",function(){c.removeClass("screen-meta-active").attr("aria-expanded",!1),a(".screen-meta-toggle").css("visibility",""),b.parent().hide()}),a(document).trigger("screen:options:close")}},a(".contextual-help-tabs").delegate("a","click",function(b){var c,d=a(this);return b.preventDefault(),d.is(".active a")?!1:(a(".contextual-help-tabs .active").removeClass("active"),d.parent("li").addClass("active"),c=a(d.attr("href")),a(".help-tab-content").not(c).removeClass("active").hide(),void c.addClass("active").show())}),a(document).ready(function(){function c(a){var b,c,d,e,f,g,h,i=a.find(".wp-submenu");f=a.offset().top,g=w.scrollTop(),h=f-g-30,b=f+i.height()+1,c=z.height(),d=60+b-c,e=w.height()+g-50,b-d>e&&(d=b-e),d>h&&(d=h),d>1?i.css("margin-top","-"+d+"px"):i.css("margin-top","")}function d(a){var b=w.scrollTop(),c=!a||"scroll"!==a.type;if(!(s||u||A.data("wp-responsive"))){if(M.menu+M.adminbar<M.window||M.menu+M.adminbar+20>M.wpwrap)return void f();if(L=!0,M.menu+M.adminbar>M.window){if(0>b)return void(I||(I=!0,J=!1,y.css({position:"fixed",top:"",bottom:""})));if(b+M.window>v.height()-1)return void(J||(J=!0,I=!1,y.css({position:"fixed",top:"",bottom:0})));b>H?I?(I=!1,K=y.offset().top-M.adminbar-(b-H),K+M.menu+M.adminbar<b+M.window&&(K=b+M.window-M.menu-M.adminbar),y.css({position:"absolute",top:K,bottom:""})):!J&&y.offset().top+M.menu<b+M.window&&(J=!0,y.css({position:"fixed",top:"",bottom:0})):H>b?J?(J=!1,K=y.offset().top-M.adminbar+(H-b),K+M.menu>b+M.window&&(K=b),y.css({position:"absolute",top:K,bottom:""})):!I&&y.offset().top>=b+M.adminbar&&(I=!0,y.css({position:"fixed",top:"",bottom:""})):c&&(I=J=!1,K=b+M.window-M.menu-M.adminbar-1,K>0?y.css({position:"absolute",top:K,bottom:""}):f())}H=b}}function e(){M={window:w.height(),wpwrap:z.height(),adminbar:G.height(),menu:y.height()}}function f(){!s&&L&&(I=