customizer-header.js (1173B)
1 (function($) { 2 window.CP_Customizer.addModule(function(CP_Customizer) { 3 var control = wp.customize.panel('header_panel'); 4 var $headerLi = control.container.eq(0); 5 // remove default events 6 $headerLi.children('h3').addBack().off(); 7 8 $headerLi.find('[data-name="change"]').addBack().click(function(event) { 9 event.preventDefault(); 10 event.stopPropagation(); 11 12 var sectionID = 'header_layout'; 13 if (CP_Customizer.isRightSidebarVisible(sectionID)) { 14 CP_Customizer.hideRightSidebar(); 15 } else { 16 CP_Customizer.openRightSidebar(sectionID); 17 } 18 }); 19 20 21 $headerLi.find('[data-name="edit"]').unbind('click').click(function(event) { 22 event.preventDefault(); 23 event.stopPropagation(); 24 25 if (CP_Customizer.isRightSidebarVisible('header_background_chooser')) { 26 CP_Customizer.hideRightSidebar(); 27 } else { 28 CP_Customizer.openRightSidebar('header_background_chooser'); 29 } 30 31 $(this).toggleClass('active'); 32 }); 33 34 }); 35 })(jQuery);