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

1 line
12 KiB
JavaScript
Raw Normal View History

var showNotice,adminMenu,columns,validateForm,screenMeta;!function(F,R){function e(){F(document).trigger("wp-window-resized")}var n,t;adminMenu={init:function(){},fold:function(){},restoreMenuState:function(){},toggle:function(){},favorites:function(){}},columns={init:function(){var t=this;F(".hide-column-tog","#adv-settings").click(function(){var e=F(this),n=e.val();e.prop("checked")?t.checked(n):t.unchecked(n),columns.saveManageColumnsState()})},saveManageColumnsState:function(){var e=this.hidden();F.post(ajaxurl,{action:"hidden-columns",hidden:e,screenoptionnonce:F("#screenoptionnonce").val(),page:pagenow})},checked:function(e){F(".column-"+e).show(),this.colSpanChange(1)},unchecked:function(e){F(".column-"+e).hide(),this.colSpanChange(-1)},hidden:function(){return F(".manage-column").filter(":hidden").map(function(){return this.id}).get().join(",")},useCheckboxesForHidden:function(){this.hidden=function(){return F(".hide-column-tog").not(":checked").map(function(){var e=this.id;return e.substring(e,e.length-5)}).get().join(",")}},colSpanChange:function(e){var n=F("table").find(".colspanchange");n.length&&(e=parseInt(n.attr("colspan"),10)+e,n.attr("colspan",e.toString()))}},F(document).ready(function(){columns.init()}),validateForm=function(e){return!F(e).find(".form-required").filter(function(){return""===F("input:visible",this).val()}).addClass("form-invalid").find("input:visible").change(function(){F(this).closest(".form-invalid").removeClass("form-invalid")}).size()},showNotice={warn:function(){var e=commonL10n.warnDelete||"";return!!confirm(e)},note:function(e){alert(e)}},screenMeta={element:null,toggles:null,page:null,init:function(){this.element=F("#screen-meta"),this.toggles=F(".screen-meta-toggle a"),this.page=F("#wpcontent"),this.toggles.click(this.toggleEvent)},toggleEvent:function(e){var n=F(this.href.replace(/.+#/,"#"));e.preventDefault(),n.length&&(n.is(":visible")?screenMeta.close(n,F(this)):screenMeta.open(n,F(this)))},open:function(e,n){F(".screen-meta-toggle").not(n.parent()).css("visibility","hidden"),e.parent().show(),e.slideDown("fast",function(){e.focus(),n.addClass("screen-meta-active").attr("aria-expanded",!0)}),F(document).trigger("screen:options:open")},close:function(e,n){e.slideUp("fast",function(){n.removeClass("screen-meta-active").attr("aria-expanded",!1),F(".screen-meta-toggle").css("visibility",""),e.parent().hide()}),F(document).trigger("screen:options:close")}},F(".contextual-help-tabs").delegate("a","click",function(e){var n=F(this);if(e.preventDefault(),n.is(".active a"))return!1;F(".contextual-help-tabs .active").removeClass("active"),n.parent("li").addClass("active"),n=F(n.attr("href")),F(".help-tab-content").not(n).removeClass("active").hide(),n.addClass("active").show()}),F(document).ready(function(){var t,i,o,s,e,n,a,c,r,l=!1,d=F("input.current-page"),u=d.val(),p=/iPhone|iPad|iPod/.test(navigator.userAgent),m=-1!==navigator.userAgent.indexOf("Android"),f=F(document.documentElement).hasClass("ie8"),h=F(document),v=F(R),b=F(document.body),g=F("#adminmenuwrap"),w=F("#wpwrap"),k=F("#adminmenu"),C=F("#wp-responsive-overlay"),y=F("#wp-toolbar"),x=y.find('a[aria-haspopup="true"]'),S=F(".meta-box-sortables"),M=!1,D=F("#wpadminbar"),E=0,T=!1,A=!1,I=0,U=!1,W={window:v.height(),wpwrap:w.height(),adminbar:D.height(),menu:g.height()};function K(e){var n=e.find(".wp-submenu"),t=e.offset().top,i=v.scrollTop(),o=t-i-30,e=t+n.height()+1,t=60+e-w.height(),i=v.height()+i-50;1<(t=o<(t=i<e-t?e-i:t)?o:t)?n.css("margin-top","-"+t+"px"):n.css("margin-top","")}function z(){c.prop("disabled",""===r.map(function(){return F(this).val()}).get().join(""))}function N(e){var n=v.scrollTop(),e=!e||"scroll"!==e.type;if(!(p||f||k.data("wp-responsive")))if(W.menu+W.adminbar<W.window||W.menu+W.adminbar+20>W.wpwrap)j();else{if(U=!0,W.menu+W.adminbar>W.window){if(n<0)return void(T||(A=!(T=!0),g.css({position:"fixed",top:"",bottom:""})));if(n+W.window>h.height()-1)return void(A||(T=!(A=!0),g.css({position:"fixed",top:"",bottom:0})));E<n?T?(T=!1,(I=g.offset().top-W.adminbar-(n-E))+W.menu+W.adminbar<n+W.window&&(I=n+