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

1 line
13 KiB
JavaScript
Raw Permalink Normal View History

var showNotice,adminMenu,columns,validateForm,screenMeta;!function(F,R){var e,n,_=F(document),L=F(R),V=F(document.body);function t(){_.trigger("wp-window-resized")}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).removeClass("hidden"),this.colSpanChange(1)},unchecked:function(e){F(".column-"+e).addClass("hidden"),this.colSpanChange(-1)},hidden:function(){return F(".manage-column[id]").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()))}},_.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")}).length},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-links").find(".show-settings"),this.page=F("#wpcontent"),this.toggles.click(this.toggleEvent)},toggleEvent:function(){var e=F("#"+F(this).attr("aria-controls"));e.length&&(e.is(":visible")?screenMeta.close(e,F(this)):screenMeta.open(e,F(this)))},open:function(e,n){F("#screen-meta-links").find(".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)}),_.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()}),_.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()}),_.ready(function(){var t,i,o,s,e,n,a,r,c,l=!1,d=F("input.current-page"),u=d.val(),p=/iPhone|iPad|iPod/.test(navigator.userAgent),f=-1!==navigator.userAgent.indexOf("Android"),h=F(document.documentElement).hasClass("ie8"),m=F("#adminmenuwrap"),v=F("#wpwrap"),w=F("#adminmenu"),g=F("#wp-responsive-overlay"),b=F("#wp-toolbar"),C=b.find('a[aria-haspopup="true"]'),k=F(".meta-box-sortables"),x=!1,y=F("#wpadminbar"),S=0,M=!1,E=!1,T=0,D=!1,W={window:L.height(),wpwrap:v.height(),adminbar:y.height(),menu:m.height()};function A(){var e=F("a.wp-has-current-submenu"),n=R.innerWidth?Math.max(R.innerWidth,document.documentElement.clientWidth):961;V.hasClass("folded")||V.hasClass("auto-fold")&&n&&n<=960&&782<n?e.attr("aria-haspopup","true"):e.attr("aria-haspopup","false")}function I(e){var n=e.find(".wp-submenu"),t=e.offset().top,i=L.scrollTop(),o=t-i-30,e=t+n.height()+1,t=60+e-v.height(),i=L.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 U(){F(".notice.is-dismissible").each(function(){var n=F(this),e=F('<button type="button" class="notice-dismiss"><span class="screen-reader-text"></span></button>'),t=commonL10n.dismiss||"";e.find(".screen-reader-text").text(t),e.on("click.wp-dismiss-notice",function(e){e.p