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

1 line
1.5 KiB
JavaScript

!function(a){function b(){e.removeClass("top bottom"),e.filter(":visible").first().addClass("top"),e.filter(":visible").last().addClass("bottom").find(f).addClass("bottom")}function c(a){var c=a.closest(".accordion-section"),e=c.closest(".accordion-container").find(".open"),g=c.find(f);if(!c.hasClass("cannot-expand")){if(c.hasClass("control-panel"))return void d(c);c.hasClass("open")?(c.toggleClass("open"),g.toggle(!0).slideToggle(150)):(e.removeClass("open"),e.find(f).show().slideUp(150),g.toggle(!1).slideToggle(150),c.toggleClass("open")),b()}}function d(a){var b,c=a.closest(".accordion-section"),d=c.closest(".wp-full-overlay"),e=d.find(".accordion-section.open"),f=c.find(".control-panel-content");c.hasClass("current-panel")?(c.toggleClass("current-panel"),d.toggleClass("in-sub-panel"),f.delay(180).hide(0,function(){f.css("margin-top","inherit")})):(e.removeClass("open"),f.show(0,function(){b=f.offset().top,f.css("margin-top",45-b),c.toggleClass("current-panel"),d.toggleClass("in-sub-panel")}))}a(document).ready(function(){a(".accordion-container").on("click keydown",".accordion-section-title",function(b){("keydown"!==b.type||13===b.which)&&(b.preventDefault(),c(a(this)))}),a(".accordion-container").on("click keydown",".control-panel-back",function(b){("keydown"!==b.type||13===b.which)&&(b.preventDefault(),d(a(this)))}),a(".hide-postbox-tog").click(function(){b()})});var e=a(".accordion-container li.accordion-section"),f=a(".accordion-section-content");b()}(jQuery);