From f19ad10571593732a9c6d6dda0cfc6db808935f2 Mon Sep 17 00:00:00 2001 From: Andrew Ozz Date: Wed, 15 Oct 2014 06:05:18 +0000 Subject: [PATCH] Admin menu: - Fix pinning after resizing the window. - Merge the two DOM ready callbacks in common.js - Fix the submenus position adjustment on focus. See #29806 Built from https://develop.svn.wordpress.org/trunk@29898 git-svn-id: http://core.svn.wordpress.org/trunk@29653 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/js/common.js | 271 +++++++++++++++++++------------------- wp-admin/js/common.min.js | 2 +- 2 files changed, 138 insertions(+), 135 deletions(-) diff --git a/wp-admin/js/common.js b/wp-admin/js/common.js index 422adcc28f..fe46474d0e 100644 --- a/wp-admin/js/common.js +++ b/wp-admin/js/common.js @@ -173,14 +173,35 @@ $('.contextual-help-tabs').delegate('a', 'click', function(e) { $(document).ready( function() { var checks, first, last, checked, sliced, mobileEvent, transitionTimeout, focusedRowActions, lastClicked = false, - menu = $('#adminmenu'), pageInput = $('input.current-page'), currentPage = pageInput.val(), isIOS = /iPhone|iPad|iPod/.test( navigator.userAgent ), - isAndroid = navigator.userAgent.indexOf( 'Android' ) !== -1; + isAndroid = navigator.userAgent.indexOf( 'Android' ) !== -1, + $document = $( document ), + $window = $( window ), + $body = $( document.body ), + $adminMenuWrap = $( '#adminmenuwrap' ), + $wpwrap = $( '#wpwrap' ), + $adminmenu = $( '#adminmenu' ), + $overlay = $( '#wp-responsive-overlay' ), + $toolbar = $( '#wp-toolbar' ), + $toolbarPopups = $toolbar.find( 'a[aria-haspopup="true"]' ), + $sortables = $('.meta-box-sortables'), + wpResponsiveActive = false, + $adminbar = $( '#wpadminbar' ), + lastScrollPosition = 0, + pinnedMenuTop = false, + pinnedMenuBottom = false, + menuTop = 0, + height = { + window: $window.height(), + adminbar: $adminbar.height(), + menu: $adminMenuWrap.height() + }; + // when the menu is folded, make the fly-out submenu header clickable - menu.on('click.wp-submenu-head', '.wp-submenu-head', function(e){ + $adminmenu.on('click.wp-submenu-head', '.wp-submenu-head', function(e){ $(e.target).parent().siblings('a').get(0).click(); }); @@ -224,133 +245,116 @@ $(document).ready( function() { $( document ).trigger( 'wp-collapse-menu', { state: state } ); }); + function adjustSubmenu( $menuItem ) { + var bottomOffset, pageHeight, adjustment, theFold, menutop, wintop, maxtop, + $submenu = $menuItem.find( '.wp-submenu' ); + + menutop = $menuItem.offset().top; + wintop = $window.scrollTop(); + maxtop = menutop - wintop - 30; // max = make the top of the sub almost touch admin bar + + bottomOffset = menutop + $submenu.height() + 1; // Bottom offset of the menu + pageHeight = $wpwrap.height(); // Height of the entire page + adjustment = 60 + bottomOffset - pageHeight; + theFold = $window.height() + wintop - 50; // The fold + + if ( theFold < ( bottomOffset - adjustment ) ) { + adjustment = bottomOffset - theFold; + } + + if ( adjustment > maxtop ) { + adjustment = maxtop; + } + + if ( adjustment > 1 ) { + $submenu.css( 'margin-top', '-' + adjustment + 'px' ); + } else { + $submenu.css( 'margin-top', '' ); + } + } + if ( 'ontouchstart' in window || /IEMobile\/[1-9]/.test(navigator.userAgent) ) { // touch screen device // iOS Safari works with touchstart, the rest work with click mobileEvent = isIOS ? 'touchstart' : 'click'; // close any open submenus when touch/click is not on the menu $(document.body).on( mobileEvent+'.wp-mobile-hover', function(e) { - if ( menu.data('wp-responsive') ) { + if ( $adminmenu.data('wp-responsive') ) { return; } - if ( ! $(e.target).closest('#adminmenu').length ) { - menu.find('li.wp-has-submenu.opensub').removeClass('opensub'); + if ( ! $( e.target ).closest( '#adminmenu' ).length ) { + $adminmenu.find( 'li.opensub' ).removeClass( 'opensub' ); } }); - menu.find('a.wp-has-submenu').on( mobileEvent+'.wp-mobile-hover', function(e) { - var b, h, o, f, menutop, wintop, maxtop, - el = $(this), - parent = el.parent(), - m = parent.find('.wp-submenu'); + $adminmenu.find( 'a.wp-has-submenu' ).on( mobileEvent + '.wp-mobile-hover', function( event ) { + var $menuItem = $(this).parent(); - if ( menu.data('wp-responsive') ) { + if ( $adminmenu.data( 'wp-responsive' ) ) { return; } // Show the sub instead of following the link if: // - the submenu is not open // - the submenu is not shown inline or the menu is not folded - if ( !parent.hasClass('opensub') && ( !parent.hasClass('wp-menu-open') || parent.width() < 40 ) ) { - e.preventDefault(); - - menutop = parent.offset().top; - wintop = $(window).scrollTop(); - maxtop = menutop - wintop - 30; // max = make the top of the sub almost touch admin bar - - b = menutop + m.height() + 1; // Bottom offset of the menu - h = $('#wpwrap').height(); // Height of the entire page - o = 60 + b - h; - f = $(window).height() + wintop - 50; // The fold - - if ( f < (b - o) ) { - o = b - f; - } - - if ( o > maxtop ) { - o = maxtop; - } - - if ( o > 1 ) { - m.css('margin-top', '-'+o+'px'); - } else { - m.css('margin-top', ''); - } - - menu.find('li.opensub').removeClass('opensub'); - parent.addClass('opensub'); + if ( ! $menuItem.hasClass( 'opensub' ) && ( ! $menuItem.hasClass( 'wp-menu-open' ) || $menuItem.width() < 40 ) ) { + event.preventDefault(); + adjustSubmenu( $menuItem ); + $adminmenu.find( 'li.opensub' ).removeClass( 'opensub' ); + $menuItem.addClass('opensub'); } }); } if ( ! isIOS && ! isAndroid ) { - menu.find('li.wp-has-submenu').hoverIntent({ + $adminmenu.find( 'li.wp-has-submenu' ).hoverIntent({ over: function() { - var b, h, o, f, m = $(this).find('.wp-submenu'), menutop, wintop, maxtop, top = parseInt( m.css('top'), 10 ); + var $menuItem = $( this ), + $submenu = $menuItem.find( '.wp-submenu' ), + top = parseInt( $submenu.css( 'top' ), 10 ); - if ( isNaN(top) || top > -5 ) { // meaning the submenu is visible + if ( isNaN( top ) || top > -5 ) { // the submenu is visible return; } - if ( menu.data('wp-responsive') ) { + if ( $adminmenu.data( 'wp-responsive' ) ) { // The menu is in responsive mode, bail return; } - menutop = $(this).offset().top; - wintop = $(window).scrollTop(); - maxtop = menutop - wintop - 30; // max = make the top of the sub almost touch admin bar - - b = menutop + m.height() + 1; // Bottom offset of the menu - h = $('#wpwrap').height(); // Height of the entire page - o = 60 + b - h; - f = $(window).height() + wintop - 15; // The fold - - if ( f < (b - o) ) { - o = b - f; - } - - if ( o > maxtop ) { - o = maxtop; - } - - if ( o > 1 ) { - m.css('margin-top', '-'+o+'px'); - } else { - m.css('margin-top', ''); - } - - menu.find('li.menu-top').removeClass('opensub'); - $(this).addClass('opensub'); + adjustSubmenu( $menuItem ); + $adminmenu.find( 'li.opensub' ).removeClass( 'opensub' ); + $menuItem.addClass( 'opensub' ); }, out: function(){ - if ( menu.data('wp-responsive') ) { + if ( $adminmenu.data( 'wp-responsive' ) ) { // The menu is in responsive mode, bail return; } - $(this).removeClass('opensub').find('.wp-submenu').css('margin-top', ''); + $( this ).removeClass( 'opensub' ).find( '.wp-submenu' ).css( 'margin-top', '' ); }, timeout: 200, sensitivity: 7, interval: 90 }); - menu.on('focus.adminmenu', '.wp-submenu a', function(e){ - if ( menu.data('wp-responsive') ) { + $adminmenu.on( 'focus.adminmenu', '.wp-submenu a', function( event ) { + if ( $adminmenu.data( 'wp-responsive' ) ) { // The menu is in responsive mode, bail return; } - $(e.target).closest('li.menu-top').addClass('opensub'); - }).on('blur.adminmenu', '.wp-submenu a', function(e){ - if ( menu.data('wp-responsive') ) { - // The menu is in responsive mode, bail + $( event.target ).closest( 'li.menu-top' ).addClass( 'opensub' ); + }).on( 'blur.adminmenu', '.wp-submenu a', function( event ) { + if ( $adminmenu.data( 'wp-responsive' ) ) { return; } - $(e.target).closest('li.menu-top').removeClass('opensub'); + $( event.target ).closest( 'li.menu-top' ).removeClass( 'opensub' ); + }).find( 'li.wp-has-submenu' ).on( 'focusin.adminmenu', function() { + adjustSubmenu( $( this ) ); }); } @@ -527,60 +531,20 @@ $(document).ready( function() { toggleUploadButton(); input.on('change', toggleUploadButton); })(); -}); - -// Fire a custom jQuery event at the end of window resize -( function() { - var timeout; - - function triggerEvent() { - $(document).trigger( 'wp-window-resized' ); - } - - function fireOnce() { - window.clearTimeout( timeout ); - timeout = window.setTimeout( triggerEvent, 200 ); - } - - $(window).on( 'resize.wp-fire-once', fireOnce ); -}()); - -$(document).ready( function() { - var $document = $( document ), - $window = $( window ), - $body = $( document.body ), - $adminMenuWrap = $( '#adminmenuwrap' ), - $wpwrap = $( '#wpwrap' ), - $adminmenu = $( '#adminmenu' ), - $overlay = $( '#wp-responsive-overlay' ), - $toolbar = $( '#wp-toolbar' ), - $toolbarPopups = $toolbar.find( 'a[aria-haspopup="true"]' ), - $sortables = $('.meta-box-sortables'), - wpResponsiveActive = false, - $adminbar = $( '#wpadminbar' ), - lastScrollPosition = 0, - fixedMenuTop = false, - fixedMenuBottom = false, - menuTop = 0, - height = { - window: $window.height(), - adminbar: $adminbar.height(), - menu: $adminMenuWrap.height() - }; function pinMenu() { var windowPos = $window.scrollTop(); - if ( $adminmenu.data('wp-responsive') ) { + if ( isIOS || $adminmenu.data('wp-responsive') ) { return; } if ( height.menu + height.adminbar > height.window ) { if ( windowPos > lastScrollPosition ) { // Scrolling down - if ( fixedMenuTop ) { + if ( pinnedMenuTop ) { // let it scroll - fixedMenuTop = false; + pinnedMenuTop = false; menuTop = $adminMenuWrap.offset().top - height.adminbar; $adminMenuWrap.css({ @@ -588,9 +552,9 @@ $(document).ready( function() { top: menuTop, bottom: '' }); - } else if ( ! fixedMenuBottom && $adminMenuWrap.offset().top + height.menu < windowPos + height.window ) { + } else if ( ! pinnedMenuBottom && $adminMenuWrap.offset().top + height.menu < windowPos + height.window ) { // pin the bottom - fixedMenuBottom = true; + pinnedMenuBottom = true; $adminMenuWrap.css({ position: 'fixed', @@ -600,9 +564,9 @@ $(document).ready( function() { } } else if ( windowPos < lastScrollPosition ) { // Scrolling up - if ( fixedMenuBottom ) { + if ( pinnedMenuBottom ) { // let it scroll - fixedMenuBottom = false; + pinnedMenuBottom = false; menuTop = $adminMenuWrap.offset().top - height.adminbar; $adminMenuWrap.css({ @@ -610,9 +574,9 @@ $(document).ready( function() { top: menuTop, bottom: '' }); - } else if ( ! fixedMenuTop && $adminMenuWrap.offset().top >= windowPos + height.adminbar ) { + } else if ( ! pinnedMenuTop && $adminMenuWrap.offset().top >= windowPos + height.adminbar ) { // pin the top - fixedMenuTop = true; + pinnedMenuTop = true; $adminMenuWrap.css({ position: 'fixed', @@ -620,30 +584,53 @@ $(document).ready( function() { bottom: '' }); } + } else { + // Resizing + pinnedMenuTop = pinnedMenuBottom = false; + menuTop = $adminMenuWrap.offset().top - height.adminbar; + + $adminMenuWrap.css({ + position: 'absolute', + top: menuTop, + bottom: '' + }); } } lastScrollPosition = windowPos; } + function unpinMenu() { + if ( isIOS ) { + return; + } + + pinnedMenuTop = pinnedMenuBottom = false; + $adminMenuWrap.css({ + position: '', + top: '', + bottom: '' + }); + } + function setPinMenu() { if ( $adminmenu.data('wp-responsive') ) { $body.removeClass( 'sticky-menu' ); - $adminMenuWrap.css({ - position: '', - top: '', - bottom: '' - }); + unpinMenu(); } else if ( height.menu + height.adminbar > height.window ) { - $body.removeClass( 'sticky-menu' ); pinMenu(); + $body.removeClass( 'sticky-menu' ); } else { $body.addClass( 'sticky-menu' ); + unpinMenu(); } } setPinMenu(); - $window.on( 'scroll.pin-menu', pinMenu ); + + if ( ! isIOS ) { + $window.on( 'scroll.pin-menu', pinMenu ); + } $document.on( 'wp-window-resized.pin-menu', function() { height.window = $window.height(); @@ -790,6 +777,22 @@ $(document).ready( function() { window.wpResponsive.init(); }); +// Fire a custom jQuery event at the end of window resize +( function() { + var timeout; + + function triggerEvent() { + $(document).trigger( 'wp-window-resized' ); + } + + function fireOnce() { + window.clearTimeout( timeout ); + timeout = window.setTimeout( triggerEvent, 200 ); + } + + $(window).on( 'resize.wp-fire-once', fireOnce ); +}()); + // Make Windows 8 devices play along nicely. (function(){ if ( '-ms-user-select' in document.documentElement.style && navigator.userAgent.match(/IEMobile\/10\.0/) ) { diff --git a/wp-admin/js/common.min.js b/wp-admin/js/common.min.js index 9c2e66888f..7acfe35451 100644 --- a/wp-admin/js/common.min.js +++ b/wp-admin/js/common.min.js @@ -1 +1 @@ -var showNotice,adminMenu,columns,validateForm,screenMeta;!function(a,b){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).show(),this.colSpanChange(1)},unchecked:function(b){a(".column-"+b).hide(),this.colSpanChange(-1)},hidden:function(){return a(".manage-column").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-toggle a"),this.page=a("#wpcontent"),this.toggles.click(this.toggleEvent)},toggleEvent:function(b){var c=a(this.href.replace(/.+#/,"#"));b.preventDefault(),c.length&&(c.is(":visible")?screenMeta.close(c,a(this)):screenMeta.open(c,a(this)))},open:function(b,c){a(".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(){var c,d,e,f,g,h,i,j,k=!1,l=a("#adminmenu"),m=a("input.current-page"),n=m.val(),o=/iPhone|iPad|iPod/.test(navigator.userAgent),p=-1!==navigator.userAgent.indexOf("Android");l.on("click.wp-submenu-head",".wp-submenu-head",function(b){a(b.target).parent().siblings("a").get(0).click()}),a("#collapse-menu").on("click.collapse-menu",function(){var c,d,e=a(document.body);a("#adminmenu div.wp-submenu").css("margin-top",""),c=b.innerWidth?Math.max(b.innerWidth,document.documentElement.clientWidth):961,c&&960>c?e.hasClass("auto-fold")?(e.removeClass("auto-fold").removeClass("folded"),setUserSetting("unfold",1),setUserSetting("mfold","o"),d="open"):(e.addClass("auto-fold"),setUserSetting("unfold",0),d="folded"):e.hasClass("folded")?(e.removeClass("folded"),setUserSetting("mfold","o"),d="open"):(e.addClass("folded"),setUserSetting("mfold","f"),d="folded"),a(document).trigger("wp-collapse-menu",{state:d})}),("ontouchstart"in b||/IEMobile\/[1-9]/.test(navigator.userAgent))&&(h=o?"touchstart":"click",a(document.body).on(h+".wp-mobile-hover",function(b){l.data("wp-responsive")||a(b.target).closest("#adminmenu").length||l.find("li.wp-has-submenu.opensub").removeClass("opensub")}),l.find("a.wp-has-submenu").on(h+".wp-mobile-hover",function(c){var d,e,f,g,h,i,j,k=a(this),m=k.parent(),n=m.find(".wp-submenu");l.data("wp-responsive")||m.hasClass("opensub")||m.hasClass("wp-menu-open")&&!(m.width()<40)||(c.preventDefault(),h=m.offset().top,i=a(b).scrollTop(),j=h-i-30,d=h+n.height()+1,e=a("#wpwrap").height(),f=60+d-e,g=a(b).height()+i-50,d-f>g&&(f=d-g),f>j&&(f=j),f>1?n.css("margin-top","-"+f+"px"):n.css("margin-top",""),l.find("li.opensub").removeClass("opensub"),m.addClass("opensub"))})),o||p||(l.find("li.wp-has-submenu").hoverIntent({over:function(){var c,d,e,f,g,h,i,j=a(this).find(".wp-submenu"),k=parseInt(j.css("top"),10);isNaN(k)||k>-5||l.data("wp-responsive")||(g=a(this).offset().top,h=a(b).scrollTop(),i=g-h-30,c=g+j.height()+1,d=a("#wpwrap").height(),e=60+c-d,f=a(b).height()+h-15,c-e>f&&(e=c-f),e>i&&(e=i),e>1?j.css("margin-top","-"+e+"px"):j.css("margin-top",""),l.find("li.menu-top").removeClass("opensub"),a(this).addClass("opensub"))},out:function(){l.data("wp-responsive")||a(this).removeClass("opensub").find(".wp-submenu").css("margin-top","")},timeout:200,sensitivity:7,interval:90}),l.on("focus.adminmenu",".wp-submenu a",function(b){l.data("wp-responsive")||a(b.target).closest("li.menu-top").addClass("opensub")}).on("blur.adminmenu",".wp-submenu a",function(b){l.data("wp-responsive")||a(b.target).closest("li.menu-top").removeClass("opensub")})),a("div.wrap h2:first").nextAll("div.updated, div.error").addClass("below-h2"),a("div.updated, div.error").not(".below-h2, .inline").insertAfter(a("div.wrap h2:first")),screenMeta.init(),a("tbody").children().children(".check-column").find(":checkbox").click(function(b){if("undefined"==b.shiftKey)return!0;if(b.shiftKey){if(!k)return!0;c=a(k).closest("form").find(":checkbox"),d=c.index(k),e=c.index(this),f=a(this).prop("checked"),d>0&&e>0&&d!=e&&(g=e>d?c.slice(d,e):c.slice(e,d),g.prop("checked",function(){return a(this).closest("tr").is(":visible")?f:!1}))}k=this;var h=a(this).closest("tbody").find(":checkbox").filter(":visible").not(":checked");return a(this).closest("table").children("thead, tfoot").find(":checkbox").prop("checked",function(){return 0===h.length}),!0}),a("thead, tfoot").find(".check-column :checkbox").on("click.wp-toggle-checkboxes",function(b){var c=a(this),d=c.closest("table"),e=c.prop("checked"),f=b.shiftKey||c.data("wp-toggle");d.children("tbody").filter(":visible").children().children(".check-column").find(":checkbox").prop("checked",function(){return a(this).is(":hidden")?!1:f?!a(this).prop("checked"):e?!0:!1}),d.children("thead, tfoot").filter(":visible").children().children(".check-column").find(":checkbox").prop("checked",function(){return f?!1:e?!0:!1})}),a("td.post-title, td.title, td.comment, .bookmarks td.column-name, td.blogname, td.username, .dashboard-comment-wrap").focusin(function(){clearTimeout(i),j=a(this).find(".row-actions"),j.addClass("visible")}).focusout(function(){i=setTimeout(function(){j.removeClass("visible")},30)}),a("#default-password-nag-no").click(function(){return setUserSetting("default_password_nag","hide"),a("div.default-password-nag").hide(),!1}),a("#newcontent").bind("keydown.wpevent_InsertTab",function(b){var c,d,e,f,g,h=b.target;if(27==b.keyCode)return void a(h).data("tab-out",!0);if(!(9!=b.keyCode||b.ctrlKey||b.altKey||b.shiftKey)){if(a(h).data("tab-out"))return void a(h).data("tab-out",!1);c=h.selectionStart,d=h.selectionEnd,e=h.value;try{this.lastKey=9}catch(i){}document.selection?(h.focus(),g=document.selection.createRange(),g.text=" "):c>=0&&(f=this.scrollTop,h.value=e.substring(0,c).concat(" ",e.substring(d)),h.selectionStart=h.selectionEnd=c+1,this.scrollTop=f),b.stopPropagation&&b.stopPropagation(),b.preventDefault&&b.preventDefault()}}),a("#newcontent").bind("blur.wpevent_InsertTab",function(){this.lastKey&&9==this.lastKey&&this.focus()}),m.length&&m.closest("form").submit(function(){-1==a('select[name="action"]').val()&&-1==a('select[name="action2"]').val()&&m.val()==n&&m.val("1")}),a('.search-box input[type="search"], .search-box input[type="submit"]').mousedown(function(){a('select[name^="action"]').val("-1")}),a("#contextual-help-link, #show-settings-link").on("focus.scroll-into-view",function(a){a.target.scrollIntoView&&a.target.scrollIntoView(!1)}),function(){function b(){c.prop("disabled",""===d.map(function(){return a(this).val()}).get().join(""))}var c,d,e=a("form.wp-upload-form");e.length&&(c=e.find('input[type="submit"]'),d=e.find('input[type="file"]'),b(),d.on("change",b))}()}),function(){function c(){a(document).trigger("wp-window-resized")}function d(){b.clearTimeout(e),e=b.setTimeout(c,200)}var e;a(b).on("resize.wp-fire-once",d)}(),a(document).ready(function(){function c(){var a=f.scrollTop();j.data("wp-responsive")||(u.menu+u.adminbar>u.window&&(a>q?r?(r=!1,t=h.offset().top-u.adminbar,h.css({position:"absolute",top:t,bottom:""})):!s&&h.offset().top+u.menua&&(s?(s=!1,t=h.offset().top-u.adminbar,h.css({position:"absolute",top:t,bottom:""})):!r&&h.offset().top>=a+u.adminbar&&(r=!0,h.css({position:"fixed",top:"",bottom:""})))),q=a)}function d(){j.data("wp-responsive")?(g.removeClass("sticky-menu"),h.css({position:"",top:"",bottom:""})):u.menu+u.adminbar>u.window?(g.removeClass("sticky-menu"),c()):g.addClass("sticky-menu")}var e=a(document),f=a(b),g=a(document.body),h=a("#adminmenuwrap"),i=a("#wpwrap"),j=a("#adminmenu"),k=a("#wp-responsive-overlay"),l=a("#wp-toolbar"),m=l.find('a[aria-haspopup="true"]'),n=a(".meta-box-sortables"),o=!1,p=a("#wpadminbar"),q=0,r=!1,s=!1,t=0,u={window:f.height(),adminbar:p.height(),menu:h.height()};d(),f.on("scroll.pin-menu",c),e.on("wp-window-resized.pin-menu",function(){u.window=f.height(),u.adminbar=p.height(),d()}).on("wp-collapse-menu.pin-menu",function(){u.menu=h.height(),d()}),b.wpResponsive={init:function(){var c=this;e.on("wp-responsive-activate.wp-responsive",function(){c.activate()}).on("wp-responsive-deactivate.wp-responsive",function(){c.deactivate()}),a("#wp-admin-bar-menu-toggle a").attr("aria-expanded","false"),a("#wp-admin-bar-menu-toggle").on("click.wp-responsive",function(b){b.preventDefault(),i.toggleClass("wp-responsive-open"),i.hasClass("wp-responsive-open")?(a(this).find("a").attr("aria-expanded","true"),a("#adminmenu a:first").focus()):a(this).find("a").attr("aria-expanded","false")}),j.on("click.wp-responsive","li.wp-has-submenu > a",function(b){j.data("wp-responsive")&&(a(this).parent("li").toggleClass("selected"),b.preventDefault())}),c.trigger(),e.on("wp-window-resized.wp-responsive",a.proxy(this.trigger,this)),f.on("load.wp-responsive",function(){var a=navigator.userAgent.indexOf("AppleWebKit/")>-1?f.width():b.innerWidth;782>=a&&c.disableSortables()})},activate:function(){d(),g.hasClass("auto-fold")||g.addClass("auto-fold"),j.data("wp-responsive",1),this.disableSortables()},deactivate:function(){d(),j.removeData("wp-responsive"),this.enableSortables()},trigger:function(){var a;b.innerWidth&&(a=Math.max(b.innerWidth,document.documentElement.clientWidth),782>=a?o||(e.trigger("wp-responsive-activate"),o=!0):o&&(e.trigger("wp-responsive-deactivate"),o=!1),480>=a?this.enableOverlay():this.disableOverlay())},enableOverlay:function(){0===k.length&&(k=a('
').insertAfter("#wpcontent").hide().on("click.wp-responsive",function(){l.find(".menupop.hover").removeClass("hover"),a(this).hide()})),m.on("click.wp-responsive",function(){k.show()})},disableOverlay:function(){m.off("click.wp-responsive"),k.hide()},disableSortables:function(){if(n.length)try{n.sortable("disable")}catch(a){}},enableSortables:function(){if(n.length)try{n.sortable("enable")}catch(a){}}},b.wpResponsive.init()}),function(){if("-ms-user-select"in document.documentElement.style&&navigator.userAgent.match(/IEMobile\/10\.0/)){var a=document.createElement("style");a.appendChild(document.createTextNode("@-ms-viewport{width:auto!important}")),document.getElementsByTagName("head")[0].appendChild(a)}}()}(jQuery,window); \ No newline at end of file +var showNotice,adminMenu,columns,validateForm,screenMeta;!function(a,b){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).show(),this.colSpanChange(1)},unchecked:function(b){a(".column-"+b).hide(),this.colSpanChange(-1)},hidden:function(){return a(".manage-column").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-toggle a"),this.page=a("#wpcontent"),this.toggles.click(this.toggleEvent)},toggleEvent:function(b){var c=a(this.href.replace(/.+#/,"#"));b.preventDefault(),c.length&&(c.is(":visible")?screenMeta.close(c,a(this)):screenMeta.open(c,a(this)))},open:function(b,c){a(".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=u.scrollTop(),h=f-g-30,b=f+i.height()+1,c=x.height(),d=60+b-c,e=u.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(){var a=u.scrollTop();r||y.data("wp-responsive")||(J.menu+J.adminbar>J.window&&(a>F?G?(G=!1,I=w.offset().top-J.adminbar,w.css({position:"absolute",top:I,bottom:""})):!H&&w.offset().top+J.menua?H?(H=!1,I=w.offset().top-J.adminbar,w.css({position:"absolute",top:I,bottom:""})):!G&&w.offset().top>=a+J.adminbar&&(G=!0,w.css({position:"fixed",top:"",bottom:""})):(G=H=!1,I=w.offset().top-J.adminbar,w.css({position:"absolute",top:I,bottom:""}))),F=a)}function e(){r||(G=H=!1,w.css({position:"",top:"",bottom:""}))}function f(){y.data("wp-responsive")?(v.removeClass("sticky-menu"),e()):J.menu+J.adminbar>J.window?(d(),v.removeClass("sticky-menu")):(v.addClass("sticky-menu"),e())}var g,h,i,j,k,l,m,n,o=!1,p=a("input.current-page"),q=p.val(),r=/iPhone|iPad|iPod/.test(navigator.userAgent),s=-1!==navigator.userAgent.indexOf("Android"),t=a(document),u=a(b),v=a(document.body),w=a("#adminmenuwrap"),x=a("#wpwrap"),y=a("#adminmenu"),z=a("#wp-responsive-overlay"),A=a("#wp-toolbar"),B=A.find('a[aria-haspopup="true"]'),C=a(".meta-box-sortables"),D=!1,E=a("#wpadminbar"),F=0,G=!1,H=!1,I=0,J={window:u.height(),adminbar:E.height(),menu:w.height()};y.on("click.wp-submenu-head",".wp-submenu-head",function(b){a(b.target).parent().siblings("a").get(0).click()}),a("#collapse-menu").on("click.collapse-menu",function(){var c,d,e=a(document.body);a("#adminmenu div.wp-submenu").css("margin-top",""),c=b.innerWidth?Math.max(b.innerWidth,document.documentElement.clientWidth):961,c&&960>c?e.hasClass("auto-fold")?(e.removeClass("auto-fold").removeClass("folded"),setUserSetting("unfold",1),setUserSetting("mfold","o"),d="open"):(e.addClass("auto-fold"),setUserSetting("unfold",0),d="folded"):e.hasClass("folded")?(e.removeClass("folded"),setUserSetting("mfold","o"),d="open"):(e.addClass("folded"),setUserSetting("mfold","f"),d="folded"),a(document).trigger("wp-collapse-menu",{state:d})}),("ontouchstart"in b||/IEMobile\/[1-9]/.test(navigator.userAgent))&&(l=r?"touchstart":"click",a(document.body).on(l+".wp-mobile-hover",function(b){y.data("wp-responsive")||a(b.target).closest("#adminmenu").length||y.find("li.opensub").removeClass("opensub")}),y.find("a.wp-has-submenu").on(l+".wp-mobile-hover",function(b){var d=a(this).parent();y.data("wp-responsive")||d.hasClass("opensub")||d.hasClass("wp-menu-open")&&!(d.width()<40)||(b.preventDefault(),c(d),y.find("li.opensub").removeClass("opensub"),d.addClass("opensub"))})),r||s||(y.find("li.wp-has-submenu").hoverIntent({over:function(){var b=a(this),d=b.find(".wp-submenu"),e=parseInt(d.css("top"),10);isNaN(e)||e>-5||y.data("wp-responsive")||(c(b),y.find("li.opensub").removeClass("opensub"),b.addClass("opensub"))},out:function(){y.data("wp-responsive")||a(this).removeClass("opensub").find(".wp-submenu").css("margin-top","")},timeout:200,sensitivity:7,interval:90}),y.on("focus.adminmenu",".wp-submenu a",function(b){y.data("wp-responsive")||a(b.target).closest("li.menu-top").addClass("opensub")}).on("blur.adminmenu",".wp-submenu a",function(b){y.data("wp-responsive")||a(b.target).closest("li.menu-top").removeClass("opensub")}).find("li.wp-has-submenu").on("focusin.adminmenu",function(){c(a(this))})),a("div.wrap h2:first").nextAll("div.updated, div.error").addClass("below-h2"),a("div.updated, div.error").not(".below-h2, .inline").insertAfter(a("div.wrap h2:first")),screenMeta.init(),a("tbody").children().children(".check-column").find(":checkbox").click(function(b){if("undefined"==b.shiftKey)return!0;if(b.shiftKey){if(!o)return!0;g=a(o).closest("form").find(":checkbox"),h=g.index(o),i=g.index(this),j=a(this).prop("checked"),h>0&&i>0&&h!=i&&(k=i>h?g.slice(h,i):g.slice(i,h),k.prop("checked",function(){return a(this).closest("tr").is(":visible")?j:!1}))}o=this;var c=a(this).closest("tbody").find(":checkbox").filter(":visible").not(":checked");return a(this).closest("table").children("thead, tfoot").find(":checkbox").prop("checked",function(){return 0===c.length}),!0}),a("thead, tfoot").find(".check-column :checkbox").on("click.wp-toggle-checkboxes",function(b){var c=a(this),d=c.closest("table"),e=c.prop("checked"),f=b.shiftKey||c.data("wp-toggle");d.children("tbody").filter(":visible").children().children(".check-column").find(":checkbox").prop("checked",function(){return a(this).is(":hidden")?!1:f?!a(this).prop("checked"):e?!0:!1}),d.children("thead, tfoot").filter(":visible").children().children(".check-column").find(":checkbox").prop("checked",function(){return f?!1:e?!0:!1})}),a("td.post-title, td.title, td.comment, .bookmarks td.column-name, td.blogname, td.username, .dashboard-comment-wrap").focusin(function(){clearTimeout(m),n=a(this).find(".row-actions"),n.addClass("visible")}).focusout(function(){m=setTimeout(function(){n.removeClass("visible")},30)}),a("#default-password-nag-no").click(function(){return setUserSetting("default_password_nag","hide"),a("div.default-password-nag").hide(),!1}),a("#newcontent").bind("keydown.wpevent_InsertTab",function(b){var c,d,e,f,g,h=b.target;if(27==b.keyCode)return void a(h).data("tab-out",!0);if(!(9!=b.keyCode||b.ctrlKey||b.altKey||b.shiftKey)){if(a(h).data("tab-out"))return void a(h).data("tab-out",!1);c=h.selectionStart,d=h.selectionEnd,e=h.value;try{this.lastKey=9}catch(i){}document.selection?(h.focus(),g=document.selection.createRange(),g.text=" "):c>=0&&(f=this.scrollTop,h.value=e.substring(0,c).concat(" ",e.substring(d)),h.selectionStart=h.selectionEnd=c+1,this.scrollTop=f),b.stopPropagation&&b.stopPropagation(),b.preventDefault&&b.preventDefault()}}),a("#newcontent").bind("blur.wpevent_InsertTab",function(){this.lastKey&&9==this.lastKey&&this.focus()}),p.length&&p.closest("form").submit(function(){-1==a('select[name="action"]').val()&&-1==a('select[name="action2"]').val()&&p.val()==q&&p.val("1")}),a('.search-box input[type="search"], .search-box input[type="submit"]').mousedown(function(){a('select[name^="action"]').val("-1")}),a("#contextual-help-link, #show-settings-link").on("focus.scroll-into-view",function(a){a.target.scrollIntoView&&a.target.scrollIntoView(!1)}),function(){function b(){c.prop("disabled",""===d.map(function(){return a(this).val()}).get().join(""))}var c,d,e=a("form.wp-upload-form");e.length&&(c=e.find('input[type="submit"]'),d=e.find('input[type="file"]'),b(),d.on("change",b))}(),f(),r||u.on("scroll.pin-menu",d),t.on("wp-window-resized.pin-menu",function(){J.window=u.height(),J.adminbar=E.height(),f()}).on("wp-collapse-menu.pin-menu",function(){J.menu=w.height(),f()}),b.wpResponsive={init:function(){var c=this;t.on("wp-responsive-activate.wp-responsive",function(){c.activate()}).on("wp-responsive-deactivate.wp-responsive",function(){c.deactivate()}),a("#wp-admin-bar-menu-toggle a").attr("aria-expanded","false"),a("#wp-admin-bar-menu-toggle").on("click.wp-responsive",function(b){b.preventDefault(),x.toggleClass("wp-responsive-open"),x.hasClass("wp-responsive-open")?(a(this).find("a").attr("aria-expanded","true"),a("#adminmenu a:first").focus()):a(this).find("a").attr("aria-expanded","false")}),y.on("click.wp-responsive","li.wp-has-submenu > a",function(b){y.data("wp-responsive")&&(a(this).parent("li").toggleClass("selected"),b.preventDefault())}),c.trigger(),t.on("wp-window-resized.wp-responsive",a.proxy(this.trigger,this)),u.on("load.wp-responsive",function(){var a=navigator.userAgent.indexOf("AppleWebKit/")>-1?u.width():b.innerWidth;782>=a&&c.disableSortables()})},activate:function(){f(),v.hasClass("auto-fold")||v.addClass("auto-fold"),y.data("wp-responsive",1),this.disableSortables()},deactivate:function(){f(),y.removeData("wp-responsive"),this.enableSortables()},trigger:function(){var a;b.innerWidth&&(a=Math.max(b.innerWidth,document.documentElement.clientWidth),782>=a?D||(t.trigger("wp-responsive-activate"),D=!0):D&&(t.trigger("wp-responsive-deactivate"),D=!1),480>=a?this.enableOverlay():this.disableOverlay())},enableOverlay:function(){0===z.length&&(z=a('
').insertAfter("#wpcontent").hide().on("click.wp-responsive",function(){A.find(".menupop.hover").removeClass("hover"),a(this).hide()})),B.on("click.wp-responsive",function(){z.show()})},disableOverlay:function(){B.off("click.wp-responsive"),z.hide()},disableSortables:function(){if(C.length)try{C.sortable("disable")}catch(a){}},enableSortables:function(){if(C.length)try{C.sortable("enable")}catch(a){}}},b.wpResponsive.init()}),function(){function c(){a(document).trigger("wp-window-resized")}function d(){b.clearTimeout(e),e=b.setTimeout(c,200)}var e;a(b).on("resize.wp-fire-once",d)}(),function(){if("-ms-user-select"in document.documentElement.style&&navigator.userAgent.match(/IEMobile\/10\.0/)){var a=document.createElement("style");a.appendChild(document.createTextNode("@-ms-viewport{width:auto!important}")),document.getElementsByTagName("head")[0].appendChild(a)}}()}(jQuery,window); \ No newline at end of file