1 2(function($){ 3 // serialize array function 4 $.fn.serializeObject=function(){var o={};var a=this.serializeArray();$.each(a,function(){if(o[this.name]){if(!o[this.name].push){o[this.name]=[o[this.name]];} o[this.name].push(this.value||'');}else{o[this.name]=this.value||'';}});return o;}; 5 // check for mobiles and tablets 6 window.responsive_queries = window.responsive_queries || function () { 7 var window_width = jQuery(window).width(); 8 var window_height= jQuery(window).height(); 9 // 10 window.is_mobile = (window_width < 768); 11 window.is_tablet_portrait = (window_width >= 768 && window_width < 992); 12 window.is_tablet_landscape = (window_width >= 992 && window_width < 1200 && window_height <= 768); 13 window.is_tablet = window.is_tablet_portrait || window.is_tablet_landscape; 14 }; 15 16 // fix for calendars if they are 31 days and they start on sunday ( more rows ) 17 window.bookingform_adapt = window.bookingform_adapt || function () { 18 var container = $('#bookingform_container'); 19 var box = $('#booking_form_box'); 20 if(container.length === 0 || box.length === 0) return; 21 // heights 22 var container_h = container.outerHeight(); 23 var box_h = box.outerHeight(); 24 // if are not equal 25 if(container_h!==box_h) { 26 // let's adapt 27 container.stop().animate({ 28 height: box_h 29 },200,function(){ 30 }); 31 } 32 }; 33 34 // update the hidden selects 35 window.update_selects = window.update_selects || function (arrival_date, departure_date) { 36 // days vars 37 var fromday = ((new Date(arrival_date)).getDate() < 10 ? '0' : '') + (new Date(arrival_date)).getDate(); 38 var frommonth = ((new Date(arrival_date)).getMonth() < 9 ? '0' : '') + ((new Date(arrival_date)).getMonth() + 1); 39 var fromyear = (new Date(arrival_date)).getFullYear(); 40 // 41 var today = ((new Date(departure_date)).getDate() < 10 ? '0' : '') + (new Date(departure_date)).getDate(); 42 var tomonth = ((new Date(departure_date)).getMonth() < 9 ? '0' : '') + ((new Date(departure_date)).getMonth() + 1); 43 var toyear = (new Date(departure_date)).getFullYear(); 44 // i update the hidden fields for the QS form 45 $('input[name=fromday]').val(fromday); 46 $('input[name=frommonth]').val(frommonth); 47 $('input[name=fromyear]').val(fromyear); 48 // i update the hidden fields for departure date 49 $('input[name=today]').val(today); 50 $('input[name=tomonth]').val(tomonth); 51 $('input[name=toyear]').val(toyear); 52 }; 53 54 // initialzie datepickers 55 window.init_datepickers = window.init_datepickers || function () { 56 // vars 57 var today = new Date(); 58 var cur = -1; 59 var prv = -1; 60 var dp = $('#inline-datepicker'); 61 var nmonths = 2; 62 // mobile 63 var window_width = jQuery(window).width(); 64 // mobile 65 if(window_width<768){ 66 nmonths = 1; 67 } 68 // inin the datepicker 69 dp.datepicker({ 70 numberOfMonths: nmonths, 71 'minDate': today, 72 firstDay: 0, 73 beforeShowDay: function ( date ) { 74 var _class = ''; 75 if(date.getTime() === Math.min(prv, cur)) { 76 _class = 'date-range-selected checkin-date'; 77 } else if(date.getTime() === Math.max(prv, cur)) { 78 _class = 'date-range-selected checkout-date'; 79 } else if(date.getTime() > Math.min(prv, cur) && date.getTime() < Math.max(prv, cur)) { 80 _class = 'date-range-selected'; 81 } 82 return [true, _class]; 83 }, 84 onChangeMonthYear : function ( year, month, inst ) { 85 setTimeout(function(){ 86 bookingform_adapt(); 87 },500); 88 89 }, 90 onSelect: function ( dateText, inst ) { 91 var arrival_date; 92 var departure_date; 93 prv = cur; 94 cur = (new Date(inst.selectedYear, inst.selectedMonth, inst.selectedDay)).getTime(); 95 if ( prv === -1 || prv === cur ) { 96 prv = cur; 97 arrival_date = $.datepicker.formatDate( window.date_format, new Date(inst.selectedYear, inst.selectedMonth, inst.selectedDay), {} ); 98 // $('#check-in').val( arrival_date ); // put date in the input 99 $('.date_arrival .arrival' ).text( arrival_date ); 100 } else { 101 arrival_date = $.datepicker.formatDate( window.date_format, new Date(Math.min(prv,cur)), {} ); 102 departure_date = $.datepicker.formatDate( window.date_format, new Date(Math.max(prv,cur)), {} ); 103 //$('#check-in').val( arrival_date ); // put date in the input 104 //$('#check-out').val( departure_date ); // put date in the input 105 num_of_nights = Math.abs(Math.round(( cur - prv ) / (24 * 60 * 60 * 1000))); 106 if( num_of_nights > 1 ) { 107 $('.box_nights .singular').hide(); 108 $('.box_nights .plural').show(); 109 } else { 110 $('.box_nights .singular').show(); 111 $('.box_nights .plural').hide(); 112 } 113 // i show the nights 114 $('.box_nights .n_nights').text(num_of_nights); 115 // i update the fields 116 $('.date_arrival .arrival' ).text( arrival_date ); 117 $('.date_departure .departure' ).text( departure_date ); 118 update_selects( Math.min(prv,cur) , Math.max(prv,cur) ); 119 } 120 } 121 }); 122 // WINDOW RESIZE 123 jQuery(window).resize(function () { 124 // vars 125 var window_width = jQuery(window).width(); 126 // mobile 127 if(window_width<768){ 128 nmonths = 1; 129 } else { 130 nmonths = 2; 131 } 132 // 133 dp.datepicker( "option", "numberOfMonths", nmonths ); 134 }); 135 }; 136 137 // read children age valuse 138 // window.childrenages = window.childrenages || function () { 139 // var child_sels = $('.children_age_sel'); 140 // var num_children = $('.bf_select-children').val(); 141 // var values = new Array; 142 // child_sels.each(function(k){ 143 // var val = $(this).val(); 144 // if(val!=='' && k<=num_children-1){ 145 // values.push(val); 146 // } 147 // }); 148 // $('input[name=childrenAges1]').val(values.toString()); 149 // }; 150 151 // openclose the box 152 window.open_close_bf = window.open_close_bf || function(close){ 153 // debug(opts); 154 // close? 155 if(typeof close === 'undefined') close = false;
156 // vars 157 var booking_form_wrap = $('#booking_form_wrap'); 158 // var booking_form_placeholder = $('#booking_form_placeholder'); 159 var mClass = ('opened'); 160 var noScrollClass = ('noscroll'); 161 // action 162 if (!booking_form_wrap.hasClass(mClass) && !close ) { 163 // display block 164 booking_form_wrap.removeClass('none'); 165 // wait a sec and then 166 setTimeout(function(){ 167 // i put it above all - fade in 168 booking_form_wrap.css('z-index',900); 169 booking_form_wrap.addClass(mClass); 170 // html no scroll 171 $('html').addClass(noScrollClass); 172 // launch datepickers 173 init_datepickers(); 174 },200); 175 } else { 176 if (booking_form_wrap.hasClass(mClass)) { 177 // close 178 // first step - fade out 179 booking_form_wrap.removeClass(mClass); 180 setTimeout(function () { 181 // second step - i put all below 182 booking_form_wrap.css('z-index',1); 183 $('html').removeClass(noScrollClass); 184 booking_form_wrap.addClass('none'); 185 // booking_form_wrap.css('display','none'); 186 }, 500); 187 } 188 } 189 190 }; 191 192 // start the bf 193 window.start_bookingform = window.start_bookingform || function(){ 194 // open / close bf box 195 // btns 196 // OPEN // , .offer_contacts .book , .btns .book_button , .buttons_bar .book_button 197 var btns_open = $('#main_book a , a#main_book_mobile '); 198 // CLOSE 199 var btn_close = $('.close_booking'); 200 // triggers buttons 201 btns_open.on('click',function () { 202 open_close_bf(); 203 }); 204 btn_close.on('click',function () { 205 open_close_bf(); 206 }); 207 // bf manage 208 if (typeof hotel_data !== 'undefined' && typeof hotel_data.fb_cluster_name !== 'undefined') { 209 // 210 setTimeout(function(){ 211 var today = new Date(); 212 var tomorrow = new Date(today.getTime()+86400000); 213 update_selects(today,tomorrow); 214 var arrival_date = $.datepicker.formatDate( window.date_format, today, {} ); 215 $('.date_arrival .arrival' ).text( arrival_date ); 216 },1000); 217 // 218 var submit_button = $('#booking_form #bf_submit'); 219 // book now button 220 submit_button.on('click',function() { 221 // $('.selectable').removeClass('noselect'); 222 hhotelDispoprice(document.idForm); 223 }); 224 // $(document).on('click',function (event) { 225 // if ( !$(event.target).closest('#booking_form_box').length 226 // && !$(event.target).closest('.ui-datepicker-group').length 227 // && !$(event.target).closest('.ui-datepicker-header').length 228 // // && !$(event.target).closest('.offer_contacts').length 229 // // && !$(event.target).closest('#header').length 230 // // && !$(event.target).closest('.map_marker_popup').length 231 // // && !$(event.target).closest('.book_btn.open_single').length 232 // // && !$(event.target).closest('.go_iata a').length 233 // // && !$(event.target).closest('.btns').length 234 // // && !$(event.target).closest('.buttons_bar').length 235 // // && !$(event.target).closest('a#mobile_open_booking').length 236 // ) { 237 // open_close_bf(true); 238 // } 239 // }); 240 } 241 }; 242 243 // cancel function 244 window.cancel_booking = window.cancel_booking || function(){ 245 $('.cancel_booking').on('click',function(){ 246 var hname = $('[name=Hotelnames]').val(); 247 if(hname==='All') { 248 alert('Please select a Hotel!'); 249 } else { 250 hhotelcancel(hname,''); 251 } 252 }); 253 }; 254 255 // websdkssss 256 window.web_sdk_offers = window.web_sdk_offers || function(){ 257 $fbsdk.Config.baseHost = 'websdk.fastbooking-services.com'; 258 $('div[data-websdk]').each(function() { 259 // vars 260 var html; 261 var config; 262 var model; 263 // 264 var container = $(this); 265 var model_name = container.data('websdk'); 266 var id = container.attr('id'); 267 var custom_template = container.data('websdk-template'); 268 var template_id = custom_template ? custom_template : '#'+id+'_template'; 269 var template = $(template_id).text(); 270 // if i have conf 271 if (typeof websdk_config !== 'undefined' && typeof websdk_config[id] !== 'undefined' /*&& typeof $fbsdk !== "undefined"*/) { 272 config = websdk_config[id]; 273 $fbsdk.baseHost = config.baseHost; 274 model = new $fbsdk[model_name](config.params); 275 model.setAuthToken(config._authCode); 276 model.load(function(error) { 277 var data; 278 var i; 279 if (!error) { 280 //YEAH, this happens when we have data and we're ready to use it! 281 data=this.getRawData(); 282 if(model_name === 'Offers' && data.rates.length === 0){ 283 container.addClass('no_offers'); 284 //.special_offers_row', 285 //'find' => '.hotel .price .price ' 286 container.closest('.special_offers_row').find('.hotel .price').remove(); 287 } 288 289 290 if (typeof data.rates !== 'undefined') { 291 292 if (typeof config.excluded_offers !== 'undefined' && config.excluded_offers !== '') { 293 var temp_rates = []; 294 for (var i = 0; i < data.rates.length; i++) { 295 if (typeof data.rates[i] !== 'undefined') { 296 if ($.inArray(data.rates[i].rate.name, config.excluded_offers) == -1) { 297 // if is allowed 298 temp_rates.push(data.rates[i]); 299 } 300 } 301 } 302 // OVERRRIDE THE OBJ 303 data.rates = temp_rates; 304 } 305 306 if(typeof config['putBestPriceIn'] !== 'undefined'){ 307 var bestprice = false;
308 for(var i =0; i < data.rates.length; i++){ 309 if(bestprice === false || data.rates[i].quotation.totalPrice < bestprice){ 310 bestprice = data.rates[i].quotation.totalPrice; 311 } 312 } 313 if(bestprice){ 314 container.closest(config['putBestPriceIn'].closest).find(config['putBestPriceIn'].find).html(bestprice); 315 } 316 } 317 if (typeof config.number !== 'undefined' && config.number <= data.rates.length) { 318 data.rates.length = parseInt(config.number,10); 319 } 320 for (var t = 0; t < data.rates.length; t++){ 321 if(t%2 === 0){ 322 data.rates[t].rate.classname = 'even'; 323 } else{ 324 data.rates[t].rate.classname = 'odd'; 325 } 326 data.rates[t].rate.shortdescription = data.rates[t].rate.plain_description.substr(0,200)+'...'; 327 } 328 } 329 330 331 html = Mustache.render(template, data); 332 container.html(html); 333 334 // da qui in poi ho HTML delle offerte nella pagina 335 // var maxHeight = 0; 336 var offers = container.find('.promotion, .offer_wrap'); 337 offers.each(function(el, i) { 338 var offer = $(this); 339 // var height = offer.height(); 340 // if (height > maxHeight) { 341 // maxHeight = height; 342 // } 343 var description = offer.find('.details'); 344 // var content = $(this).find('.preview_content'); 345 346 offer.find('div.info, div.title, div.price ').on('click', function(){ 347 $.fancybox({ 348 content: description 349 }); 350 }); 351 // offer.find('.preview_content').css({'padding-top': ($('.promotion').height() - $('.preview_content').height()) / 2}); 352 }); 353 // offers.each(function() { 354 // $(this).css('height', maxHeight); 355 // }); 356 // offersHeight(); 357 } else { 358 // in caso di errore 359 container.fadeOut(); 360 } 361 }); 362 } 363 }); 364 }; 365 // manage 366 window.web_sdk_offers_manage = window.web_sdk_offers_manage || function(){ 367 // check 368 if($('div[data-websdk]').length===0) return; 369 // vars 370 var offers_loaded = false; 371 var box_offset; 372 // WINDOW SCROLL for home 373 if(jQuery('body').hasClass('homepage')) { 374 box_offset = $('#offers_list').offset().top; 375 var window_h = $(window).height(); 376 var window_scrolled = $(window).scrollTop(); 377 if(box_offset<(window_h+window_scrolled) && !offers_loaded) { 378 web_sdk_offers(); 379 offers_loaded = true; 380 } 381 jQuery(window).scroll(function () { 382 // check 383 if(offers_loaded) return ; 384 // on scrolling 385 box_offset = $('#offers_list').offset().top; 386 var window_h = $(window).height(); 387 var window_scrolled = $(window).scrollTop(); 388 if(box_offset<(window_h+window_scrolled)) { 389 web_sdk_offers(); 390 offers_loaded = true; 391 } 392 }); 393 } else { 394 // go offers 395 web_sdk_offers(); 396 } 397 // // if is home 398 // window.is_index = jQuery('html').hasClass('homepage'); 399 // // condition 400 // if(is_index){ 401 // var position_offers = $('#offers_list').offset().top - $('#offers_list').height(); 402 // var __home_offers_loaded = false;
403 // $(window).on("scroll", function() { 404 // var scrollPosition = window.pageYOffset; 405 // if(!__home_offers_loaded && scrollPosition >= position_offers){ 406 // __home_offers_loaded = true; 407 // web_sdk_offers(); 408 // } 409 // }); 410 // } else { 411 // web_sdk_offers(); 412 // } 413 }; 414 415 416 417 // rooms wsdk 418 window.web_sdk_rooms = window.web_sdk_rooms || function(){ 419 $('div.websdk-room').each(function() { 420 var container = $(this), 421 price = container.find('.startingfrom .price'), 422 firstdate = container.find('.premiere_date .first-available-date'), 423 booknow = container.find('a.book'), 424 loading = container.find('.spinner'), 425 model_name = 'Offers', 426 id = container.attr('id'), config, model, rate; 427 428 if (typeof websdk_config !== 'undefined' && typeof websdk_config[id] !== 'undefined') { 429 config = websdk_config[id]; 430 $fbsdk.baseHost = config.baseHost; 431 432 if(config.params.roomRestriction !== ''){ 433 model = new $fbsdk[model_name](config.params); 434 model.setAuthToken(config._authCode); 435 model.load(function(error) { 436 var data,i; 437 if (!error) { 438 //YEAH, this happens when we have data and we're ready to use it! 439 data=this.getRawData(); 440 if (typeof config.number !== 'undefined') { 441 data.rates.length = parseInt(config.number,10); 442 } 443 if(typeof data.rates[0]){ 444 rate = data.rates[0]; 445 price.html(rate.quotation.totalPrice+'<span class="currency">'+' '+currency+'</span>'); 446 firstdate.html(rate.firstAvailDate.bookingParams.from); 447 //booknow.attr('onclick',rate.firstAvailDate.jsBookLink); 448 //booknow.attr('href','javascript:;'); 449 loading.hide(); 450 price.parent().fadeIn(); 451 //booknow.fadeIn(); 452 } 453 } 454 }); 455 } else{ 456 // to do: gestire il caso quando non viene passato il roomcode 457 booknow.fadeIn(); 458 loading.hide(); 459 } 460 } 461 }); 462 }; 463 464 // DOM ready 465 $(document).ready(function() { 466 // general 467 responsive_queries(); 468 469 //START ME UP 470 start_bookingform(); 471 472 // cancel booking 473 cancel_booking(); 474 475 // Offers websdk 476 web_sdk_offers_manage(); 477 478 // Web SDK rooms 479 web_sdk_rooms(); 480 481 // 482 // // children policy 483 // $('.bf_select-children').on('change',function(){ 484 // var box = $('.children_ages'); 485 // if(box.length == 0) return; 486 // var box_content = $('.children_ages_content'); 487 // var val = $(this).val(); 488 // if(val>0) { 489 // // let's open 490 // box.find('.children_box').addClass('hidden'); 491 // for(i=1;i<=val;i++) { 492 // box.find('.children_age_'+i).removeClass('hidden'); 493 // } 494 // box.css('top',$('#booking_form_container').outerHeight()); 495 // box.stop().animate({ 496 // height: box_content.outerHeight() 497 // },200,function(){ 498 // $(this).addClass('opened'); 499 // var bookingform_content_h = $('#booking_form').outerHeight(); 500 // var visibile_h = parseInt($(window).outerHeight()-$('#header_wrapper').outerHeight(),10); 501 // var bookingform_h = Math.min(bookingform_content_h,visibile_h); 502 // bookingform.stop().animate({ 503 // height: bookingform_h 504 // },400,'swing',function(){ 505 // if(bookingform_content_h>visibile_h){ 506 // bookingform.addClass('overflow_scroll'); 507 // } else { 508 // bookingform.removeClass('overflow_scroll'); 509 // } 510 // }); 511 // }); 512 // childrenages(); 513 // } else { 514 // // let's close 515 // box.stop().animate({ 516 // height: 0 517 // },200,function(){ 518 // $(this).removeClass('opened'); 519 // var bookingform_content_h = $('#booking_form').outerHeight(); 520 // var visibile_h = parseInt($(window).outerHeight()-$('#header_wrapper').outerHeight(),10); 521 // var bookingform_h = Math.min(bookingform_content_h,visibile_h); 522 // bookingform.stop().animate({ 523 // height: bookingform_h 524 // },400,'swing',function(){ 525 // }); 526 // }); 527 // var child_sels = $('.children_age_sel'); 528 // child_sels.each(function(){ 529 // $(this).val(''); 530 // }); 531 // } 532 // }); 533 // 534 // $('.children_age_sel').on('change',function(){ 535 // childrenages(); 536 // }); 537 // 538 // // room_book 539 // $('.room_book').on('click tap',function(){ 540 // // ?? 541 // }); 542 543 }); 544 545})(jQuery); 546
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.