1'use strict'; 2 3function hb_date_str_2_obj( str_date ) { 4 if ( str_date ) { 5 var array_date = str_date.split( '-' ); 6 return new Date( array_date[0], array_date[1] - 1, array_date[2] ); 7 } else { 8 return false; 9 } 10} 11 12function hb_date_obj_2_str( obj_date ) { 13 if ( obj_date ) { 14 var y = obj_date.getFullYear(), 15 m = obj_date.getMonth() + 1, 16 d = obj_date.getDate(); 17 m = m + ''; 18 d = d + ''; 19 if ( m.length == 1 ) { 20 m = '0' + m; 21 } 22 if ( d.length == 1 ) { 23 d = '0' + d; 24 } 25 return y + '-' + m + '-' + d; 26 } else { 27 return false; 28 } 29} 30 31function hb_format_date() { 32 jQuery( '.hb-format-date' ).each( function() { 33 var str_date = jQuery( this ).html(); 34 if ( str_date.indexOf( '-' ) > -1 ) { 35 var date = hb_date_str_2_obj( str_date ); 36 jQuery( this ).html( jQuery.datepick.formatDate( hb_date_format, date ) ).removeClass( 'hb-format-date' ); 37 } 38 }); 39} 40 41function hb_get_season_id( date ) { 42 var seasons = hb_booking_form_data.seasons, 43 nb_day, 44 copied_date = new Date( date.valueOf() ); 45 46 copied_date.setHours( 0, 0, 0, 0 ); 47 48 nb_day = date.getDay(); 49 if ( nb_day == 0 ) { 50 nb_day = 6; 51 } else { 52 nb_day = nb_day - 1; 53 } 54 nb_day += ''; 55 56 var priorities = ['high', '', 'low']; 57 for ( var i = 0; i < 3; i++ ) { 58 for ( var j = 0; j < seasons.length; j++ ) { 59 var start = hb_date_str_2_obj( seasons[ j ]['start_date'] ); 60 var end = hb_date_str_2_obj( seasons[ j ]['end_date'] ); 61 start.setHours( 0, 0, 0, 0 ); 62 end.setHours( 0, 0, 0, 0 ); 63 if ( 64 ( seasons[ j ]['priority'] == priorities[ i ] ) && 65 ( copied_date >= start ) && 66 ( copied_date <= end ) && 67 ( seasons[ j ]['days'].indexOf( nb_day ) != -1 ) 68 ) { 69 return seasons[ j ]['season_id']; 70 } 71 } 72 } 73 return false; 74} 75 76function hb_resize_forms() { 77 jQuery( '.hb-booking-search-form' ).each( function() { 78 var body_class = ''; 79 if ( jQuery( this ).attr( 'id' ) != '' ) { 80 body_class = 'hb-' + jQuery( this ).attr('id') + '-is-vertical'; 81 } 82 if ( jQuery( this ).width() < hb_booking_form_data.horizontal_form_min_width ) { 83 jQuery( this ).addClass( 'hb-vertical-search-form' ); 84 jQuery( this ).removeClass( 'hb-horizontal-search-form' ); 85 jQuery( 'body' ).addClass( body_class ); 86 } else { 87 jQuery( this ).removeClass( 'hb-vertical-search-form' ); 88 jQuery( this ).addClass( 'hb-horizontal-search-form' ); 89 jQuery( 'body' ).removeClass( body_class ); 90 } 91 if ( jQuery( this ).width() < 400 ) { 92 jQuery( this ).addClass( 'hb-narrow-search-form' ); 93 } else { 94 jQuery( this ).removeClass( 'hb-narrow-search-form' ); 95 } 96 }); 97 jQuery( '.hb-booking-details-form' ).each( function() { 98 if ( jQuery( this ).width() < hb_booking_form_data.details_form_stack_width ) { 99 jQuery( this ).addClass( 'hb-details-form-stacked' ); 100 } else { 101 jQuery( this ).removeClass( 'hb-details-form-stacked' ); 102 } 103 }); 104}
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.