1/* global cbk_enhanced_params */ 2 3jQuery( function ( $ ) { 4 'use strict' ; 5 6 try { 7 $( document.body ).on( 'cbk-enhanced-init' , function () { 8 if ( $( 'select.cbk_select2' ).length ) { 9 //Select2 with customization 10 $( 'select.cbk_select2' ).each( function () { 11 var select2_args = { 12 allowClear : $( this ).data( 'allow_clear' ) ? true : false , 13 placeholder : $( this ).data( 'placeholder' ) , 14 minimumResultsForSearch : 10 , 15 } ; 16 17 $( this ).selectWoo( select2_args ) ; 18 } ) ; 19 } 20 if ( $( 'select.cbk_select2_search' ).length ) { 21 //Multiple select with ajax search 22 $( 'select.cbk_select2_search' ).each( function () { 23 var select2_args = { 24 allowClear : $( this ).data( 'allow_clear' ) ? true : false , 25 placeholder : $( this ).data( 'placeholder' ) , 26 minimumInputLength : $( this ).data( 'minimum_input_length' ) ? $( this ).data( 'minimum_input_length' ) : 3 , 27 escapeMarkup : function ( m ) { 28 return m ; 29 } , 30 ajax : { 31 url : cbk_enhanced_params.ajaxurl , 32 dataType : 'json' , 33 delay : 250 , 34 data : function ( params ) { 35 return { 36 term : params.term , 37 action : $( this ).data( 'action' ) ? $( this ).data( 'action' ) : 'cbk_json_search_customers' , 38 exclude_global_variable : $( this ).data( 'exclude-global-variable' ) ? $( this ).data( 'exclude-global-variable' ) : 'no' , 39 restrict_sale_price_products : $( this ).data( 'restrict-sale-price-products' ) ? $( this ).data( 'restrict-sale-price-products' ) : 'no' , 40 cbk_security : $( this ).data( 'nonce' ) ? $( this ).data( 'nonce' ) : cbk_enhanced_params.search_nonce , 41 } ; 42 } , 43 processResults : function ( data ) { 44 var terms = [ ] ; 45 if ( data ) { 46 $.each( data , function ( id , term ) { 47 terms.push( { 48 id : id , 49 text : term 50 } ) ; 51 } ) ; 52 } 53 return { 54 results : terms 55 } ; 56 } , 57 cache : true 58 } 59 } ; 60 61 $( this ).selectWoo( select2_args ) ; 62 } ) ; 63 } 64 65 if ( $( '.cbk_datepicker' ).length ) { 66 $( '.cbk_datepicker' ).on( 'change' , function ( ) { 67 if ( $( this ).val( ) === '' ) { 68 $( this ).next( ".cbk_alter_datepicker_value" ).val( '' ) ; 69 } 70 } ) ; 71 $( '.cbk_datepicker' ).each( function ( ) { 72 $( this ).datepicker( { 73 altField : $( this ).next( ".cbk_alter_datepicker_value" ) , 74 altFormat : 'yy-mm-dd' , 75 changeMonth : true , 76 changeYear : true , 77 showButtonPanel : true , 78 showOn : "button" , 79 buttonImage : cbk_enhanced_params.calendar_image , 80 buttonImageOnly : true 81 } ) ; 82 } ) ; 83 } 84 85 } ) ; 86 87 $( document.body ).trigger( 'cbk-enhanced-init' ) ; 88 } catch ( err ) { 89 window.console.log( err ) ; 90 } 91 92} ) ;
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.