1(function( $, _ ) { 2 3 /** 4 * Triggered when the configuartor is fully rendered. 5 */ 6 wp.hooks.addAction( 'PC.fe.start', 'MKL/PC/Themes/wsb', function( view ) { 7 // Move the form to the toolbar 8 view.footer.form.$el.insertAfter( view.toolbar.$selection ); 9 10 // Add classes 11 view.$el.addClass( 'wsb' ); 12 if ( PC_config.config.disable_sticky_footer ) view.$el.addClass( 'no-sticky-footer' ); 13 if ( PC_config.config.no_toggle ) view.$el.addClass( 'no-toggle' ); 14 } ); 15 16 /** 17 * Location of the choices (in or out their parent) 18 */ 19 wp.hooks.addFilter( 'PC.fe.choices.where', 'MKL/PC/Themes/wsb', function( where ) { 20 return 'in'; 21 } ); 22 23 wp.hooks.addFilter( 'PC.fe.validation.summary_placement', 'MKL/PC/Themes/wsb', function( placement, ctx ) { 24 var $choices = ( ctx.$selection && ctx.$selection.length ) ? ctx.$selection : ctx.$toolbar.find( 'section.choices' ).first(); 25 if ( $choices.length ) { 26 return { method: 'prepend', $target: $choices }; 27 } 28 return placement; 29 } ); 30 31 /** 32 * On Layer activate 33 */ 34 wp.hooks.addAction( 'PC.fe.layer.activate', 'MKL/PC/Themes/wsb', function( view ) { 35 if ( ! wp.hooks.applyFilters( 'pc.themes.wsb.toggle_choices', true, view ) ) return; 36 if ( PC_config.config.no_toggle && 'dropdown' != view.model.get( 'display_mode' ) ) return; 37 if ( view.model.get( 'class_name' ) && view.model.get( 'class_name' ).includes( 'no-toggle' ) ) return; 38 39 view.$el.find( '.layer_choices' ).first().delay(40).slideDown( { step: function() { 40 if ( PC_config.config.auto_scroll && view.el.offsetParent ) view.el.offsetParent.scrollTo( 0, view.el.offsetTop ); 41 } } ); 42 } ); 43 44 /** 45 * On Layer deactivate 46 */ 47 wp.hooks.addAction( 'PC.fe.layer.deactivate', 'MKL/PC/Themes/wsb', function( view ) { 48 if ( ! wp.hooks.applyFilters( 'pc.themes.wsb.toggle_choices', true, view ) ) return; 49 if ( PC_config.config.no_toggle && 'dropdown' != view.model.get( 'display_mode' ) ) return; 50 if ( view.model.get( 'class_name' ) && view.model.get( 'class_name' ).includes( 'no-toggle' ) ) return; 51 view.$el.find( '.layer_choices' ).first().slideUp(200); 52 } ); 53 54 /** 55 * Do not render buttons if no_toggle is true 56 */ 57 wp.hooks.addFilter( 'mkl-pc-configurator-layer-item.with.button', 'MKL/PC/Themes/lapomme', function( use_button, data ) { 58 if ( 'dropdown' == data.display_mode ) return true; 59 if ( PC_config.config.no_toggle ) return false; 60 return use_button; 61 }, 20 ); 62 63 // Conditional logic: do not show / hide choices list visibility 64 wp.hooks.addFilter( 'mkl_pc_conditionals.toggle_choices', 'MKL/PC/Themes/wsb', function( where ) { 65 return false; 66 } ); 67 68 // Scroll to newly opened layer, when onening it using conditional logic 69 wp.hooks.addAction( 'conditional.selected_layer', 'MKL/PC/Themes/float', function( model ) { 70 var scrollToView = null; 71 _.each( PC.fe.modal.toolbar.layers.items, function( view ) { 72 if ( view.model.id == model.id ) { 73 scrollToView = view; 74 } 75 } ); 76 77 if ( scrollToView ) { 78 setTimeout( function() { 79 scrollToView.el.offsetParent.scrollTo( 0, scrollToView.el.offsetTop ); 80 }, 150 ); 81 } 82 } ); 83 84 /** 85 * Steps: move nave to the appropriate location: before .pc_configurator_form 86 */ 87 wp.hooks.addFilter( 'PC.fe.steps_position', 'MKL/PC/Themes/wsb', function( position, $nav ) { 88 PC.fe.modal.toolbar.$( '.pc_configurator_form' ).before( $nav ); 89 return PC.fe.modal.toolbar.$el; 90 } ); 91 92 /** 93 * Display step: scroll back to the top 94 */ 95 wp.hooks.addAction( 'PC.fe.steps.display_step', 'MKL/PC/Themes/wsb', function( steps ) { 96 var scrollable = PC.fe.modal.$( 'section.choices' ); 97 if ( scrollable.length ) scrollable[0].scrollTo( 0, 0 ); 98 } ); 99 100})( jQuery, PC._us || window._ );
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.