1 line
12 KiB
JavaScript
1 line
12 KiB
JavaScript
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+W.window-W.menu-W.adminbar),g.css({position:"absolute",top:I,bottom:""})):!A&&g.offset().top+W.menu<n+W.window&&(A=!0,g.css({position:"fixed",top:"",bottom:0})):n<E?A?(A=!1,(I=g.offset().top-W.adminbar+(E-n))+W.menu>n+W.window&&(I=n),g.css({position:"absolute",top:I,bottom:""})):!T&&g.offset().top>=n+W.adminbar&&(T=!0,g.css({position:"fixed",top:"",bottom:""})):e&&(T=A=!1,0<(I=n+W.window-W.menu-W.adminbar-1)?g.css({position:"absolute",top:I,bottom:""}):j())}E=n}}function O(){W={window:v.height(),wpwrap:w.height(),adminbar:D.height(),menu:g.height()}}function j(){!p&&U&&(T=A=U=!1,g.css({position:"",top:"",bottom:""}))}function P(){O(),k.data("wp-responsive")?(b.removeClass("sticky-menu"),j()):W.menu+W.adminbar>W.window?(N(),b.removeClass("sticky-menu")):(b.addClass("sticky-menu"),j())}k.on("click.wp-submenu-head",".wp-submenu-head",function(e){F(e.target).parent().siblings("a").get(0).click()}),F("#collapse-menu").on("click.collapse-menu",function(){var e,n=F(document.body);F("#adminmenu div.wp-submenu").css("margin-top",""),n=(e=R.innerWidth?Math.max(R.innerWidth,document.documentElement.clientWidth):961)&&e<960?n.hasClass("auto-fold")?(n.removeClass("auto-fold").removeClass("folded"),setUserSetting("unfold",1),setUserSetting("mfold","o"),"open"):(n.addClass("auto-fold"),setUserSetting("unfold",0),"folded"):n.hasClass("folded")?(n.removeClass("folded"),setUserSetting("mfold","o"),"open"):(n.addClass("folded"),setUserSetting("mfold","f"),"folded"),F(document).trigger("wp-collapse-menu",{state:n})}),("ontouchstart"in R||/IEMobile\/[1-9]/.test(navigator.userAgent))&&(e=p?"touchstart":"click",F(document.body).on(e+".wp-mobile-hover",function(e){k.data("wp-responsive")||F(e.target).closest("#adminmenu").length||k.find("li.opensub").removeClass("opensub")}),k.find("a.wp-has-submenu").on(e+".wp-mobile-hover",function(e){var n=F(this).parent();k.data("wp-responsive")||n.hasClass("opensub")||n.hasClass("wp-menu-open")&&!(n.width()<40)||(e.preventDefault(),K(n),k.find("li.opensub").removeClass("opensub"),n.addClass("opensub"))})),p||m||(k.find("li.wp-has-submenu").hoverIntent({over:function(){var e=F(this),n=e.find(".wp-submenu"),n=parseInt(n.css("top"),10);isNaN(n)||-5<n||k.data("wp-responsive")||(K(e),k.find("li.opensub").removeClass("opensub"),e.addClass("opensub"))},out:function(){k.data("wp-responsive")||F(this).removeClass("opensub").find(".wp-submenu").css("margin-top","")},timeout:200,sensitivity:7,interval:90}),k.on("focus.adminmenu",".wp-submenu a",function(e){k.data("wp-responsive")||F(e.target).closest("li.menu-top").addClass("opensub")}).on("blur.adminmenu",".wp-submenu a",function(e){k.data("wp-responsive")||F(e.target).closest("li.menu-top").removeClass("opensub")}).find("li.wp-has-submenu.wp-not-current-submenu").on("focusin.adminmenu",function(){K(F(this))})),(m=F("div.wrap h2:first")).nextAll("div.updated, div.error, div.notice").addClass("below-h2"),F("div.updated, div.error, div.notice").not(".below-h2, .inline").insertAfter(m),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),n.append(e),e.on("click.wp-dismiss-notice",function(e){e.preventDefault(),n.fadeTo(100,0,function(){F(this).slideUp(100,function(){F(this).remove()})})})}),screenMeta.init(),F("tbody").children().children(".check-column").find(":checkbox").click(function(e){if("undefined"==e.shiftKey)return!0;if(e.shiftKey){if(!l)return!0;t=F(l).closest("form").find(":checkbox"),i=t.index(l),o=t.index(this),s=F(this).prop("checked"),0<i&&0<o&&i!=o&&(i<o?t.slice(i,o):t.slice(o,i)).prop("checked",function(){return!!F(this).closest("tr").is(":visible")&&s})}var n=F(l=this).closest("tbody").find(":checkbox").filter(":visible").not(":checked");return F(this).closest("table").children("thead, tfoot").find(":checkbox").prop("checked",function(){return 0===n.length}),!0}),F("thead, tfoot").find(".check-column :checkbox").on("click.wp-toggle-checkboxes",function(e){var n=F(this),t=n.closest("table"),i=n.prop("checked"),o=e.shiftKey||n.data("wp-toggle");t.children("tbody").filter(":visible").children().children(".check-column").find(":checkbox").prop("checked",function(){return!F(this).is(":hidden")&&(o?!F(this).prop("checked"):!!i)}),t.children("thead, tfoot").filter(":visible").children().children(".check-column").find(":checkbox").prop("checked",function(){return!o&&!!i})}),F("#wpbody-content").on({focusin:function(){clearTimeout(n),a=F(this).find(".row-actions"),F(".row-actions").not(this).removeClass("visible"),a.addClass("visible")},focusout:function(){n=setTimeout(function(){a.removeClass("visible")},30)}},"td.post-title, td.title, td.comment, .tags td.column-name, .bookmarks td.column-name, td.blogname, .users-network td.column-blogs, td.username, .dashboard-comment-wrap"),F("#default-password-nag-no").click(function(){return setUserSetting("default_password_nag","hide"),F("div.default-password-nag").hide(),!1}),F("#newcontent").bind("keydown.wpevent_InsertTab",function(e){var n,t,i,o,s=e.target;if(27==e.keyCode)return e.preventDefault(),void F(s).data("tab-out",!0);9!=e.keyCode||e.ctrlKey||e.altKey||e.shiftKey||(F(s).data("tab-out")?F(s).data("tab-out",!1):(n=s.selectionStart,t=s.selectionEnd,i=s.value,document.selection?(s.focus(),document.selection.createRange().text="\t"):0<=n&&(o=this.scrollTop,s.value=i.substring(0,n).concat("\t",i.substring(t)),s.selectionStart=s.selectionEnd=n+1,this.scrollTop=o),e.stopPropagation&&e.stopPropagation(),e.preventDefault&&e.preventDefault()))}),d.length&&d.closest("form").submit(function(){-1==F('select[name="action"]').val()&&-1==F('select[name="action2"]').val()&&d.val()==u&&d.val("1")}),F('.search-box input[type="search"], .search-box input[type="submit"]').mousedown(function(){F('select[name^="action"]').val("-1")}),F("#contextual-help-link, #show-settings-link").on("focus.scroll-into-view",function(e){e.target.scrollIntoView&&e.target.scrollIntoView(!1)}),(m=F("form.wp-upload-form")).length&&(c=m.find('input[type="submit"]'),r=m.find('input[type="file"]'),z(),r.on("change",z)),p||(v.on("scroll.pin-menu",N),h.on("tinymce-editor-init.pin-menu",function(e,n){n.on("wp-autoresize",O)})),R.wpResponsive={init:function(){var e=this;h.on("wp-responsive-activate.wp-responsive",function(){e.activate()}).on("wp-responsive-deactivate.wp-responsive",function(){e.deactivate()}),F("#wp-admin-bar-menu-toggle a").attr("aria-expanded","false"),F("#wp-admin-bar-menu-toggle").on("click.wp-responsive",function(e){e.preventDefault(),w.toggleClass("wp-responsive-open"),w.hasClass("wp-responsive-open")?(F(this).find("a").attr("aria-expanded","true"),F("#adminmenu a:first").focus()):F(this).find("a").attr("aria-expanded","false")}),k.on("click.wp-responsive","li.wp-has-submenu > a",function(e){k.data("wp-responsive")&&(F(this).parent("li").toggleClass("selected"),e.preventDefault())}),e.trigger(),h.on("wp-window-resized.wp-responsive",F.proxy(this.trigger,this)),v.on("load.wp-responsive",function(){(-1<navigator.userAgent.indexOf("AppleWebKit/")?v.width():R.innerWidth)<=782&&e.disableSortables()})},activate:function(){P(),b.hasClass("auto-fold")||b.addClass("auto-fold"),k.data("wp-responsive",1),this.disableSortables()},deactivate:function(){P(),k.removeData("wp-responsive"),this.enableSortables()},trigger:function(){var e;R.innerWidth&&((e=Math.max(R.innerWidth,document.documentElement.clientWidth))<=782?M||(h.trigger("wp-responsive-activate"),M=!0):M&&(h.trigger("wp-responsive-deactivate"),M=!1),e<=480?this.enableOverlay():this.disableOverlay())},enableOverlay:function(){0===C.length&&(C=F('<div id="wp-responsive-overlay"></div>').insertAfter("#wpcontent").hide().on("click.wp-responsive",function(){y.find(".menupop.hover").removeClass("hover"),F(this).hide()})),x.on("click.wp-responsive",function(){C.show()})},disableOverlay:function(){x.off("click.wp-responsive"),C.hide()},disableSortables:function(){if(S.length)try{S.sortable("disable")}catch(e){}},enableSortables:function(){if(S.length)try{S.sortable("enable")}catch(e){}}},R.wpResponsive.init(),P(),h.on("wp-pin-menu wp-window-resized.pin-menu postboxes-columnchange.pin-menu postbox-toggled.pin-menu wp-collapse-menu.pin-menu wp-scroll-start.pin-menu",P)}),F(R).on("resize.wp-fire-once",function(){R.clearTimeout(n),n=R.setTimeout(e,200)}),"-ms-user-select"in document.documentElement.style&&navigator.userAgent.match(/IEMobile\/10\.0/)&&((t=document.createElement("style")).appendChild(document.createTextNode("@-ms-viewport{width:auto!important}")),document.getElementsByTagName("head")[0].appendChild(t))}(jQuery,window); |