1jQuery(document).ready(function($){ 2 var $timetable = $(), //allows to determine which timetable should be used 3 tt_atts; //value depends on the active timetable 4 5 $(".tt_tabs_navigation a").click(function(event){ 6 var $this = $(this); 7 $this.parent().parent().find("li").removeClass("ui-tabs-active"); 8 $this.parent().addClass("ui-tabs-active"); 9 }); 10 11 $(".tt_tabs").tabs({ 12 event: "change", 13 show: true, 14 create: function(event, ui){ 15 $timetable = ui.panel.closest(".tt_wrapper"); 16 if($timetable.find(".tt_tabs_navigation.all_filters").length 17 && window.location.href.indexOf("book-event-hour-")===-1) 18 { 19 if(ui.tab.length && $timetable.find(".tt_tabs_navigation.events_categories_filter a[href='" + ui.tab[0].children[0].hash + "']").length) 20 $timetable.find(".tt_tabs_navigation.events_categories_filter a[href='" + ui.tab[0].children[0].hash + "']").parent().addClass("ui-tabs-active"); 21 else 22 $timetable.find(".tt_tabs_navigation.events_categories_filter li:first-child a").parent().addClass("ui-tabs-active"); 23 24 if(ui.tab.length && $timetable.find(".tt_tabs_navigation.events_filter a[href='" + ui.tab[0].children[0].hash + "']").length) 25 $timetable.find(".tt_tabs_navigation.events_filter a[href='" + ui.tab[0].children[0].hash + "']").parent().addClass("ui-tabs-active"); 26 else 27 $timetable.find(".tt_tabs_navigation.events_filter li:first-child a").parent().addClass("ui-tabs-active"); 28 } 29 30// scroll to active timetable 31 var param_fragment = escape_str($.param.fragment()); 32 if($('#' + param_fragment).closest(".tt_wrapper").length) 33 $("html, body").animate({scrollTop: $('#' + param_fragment).closest(".tt_wrapper").offset().top-80}, 400); 34 } 35 }); 36 37 //browser history 38 $(".tt_tabs .ui-tabs-nav a").click(function(){ 39 if($(this).attr("href").substr(0,4)!="http") 40 $.bbq.pushState($(this).attr("href")); 41 else 42 window.location.href = $(this).attr("href"); 43 }); 44 45 //dropdown navigation 46 $(".tabs_box_navigation").mouseover(function(){ 47 $(this).find("ul").removeClass("tabs_box_navigation_hidden"); 48 }); 49 50 $(".tabs_box_navigation a").click(function(event){ 51 if($.param.fragment()==$(this).attr("href").replace("#", "") || ($.param.fragment()=="" && $(this).attr("href").replace("#", "").substr(0, 10)=="all-events")) 52 event.preventDefault(); 53 $(this).parent().parent().find(".selected").removeClass("selected"); 54 $(this).parent().addClass("selected"); 55 $(this).parent().parent().parent().children("label").text($(this).text()); 56 $(this).parent().parent().addClass("tabs_box_navigation_hidden"); 57 }); 58 59 $(".tt_tabs_navigation:not(.all_filter) a, .tabs_box_navigation:not(.all_filter) a").click(function(event){ 60 event.preventDefault(); 61 var $this = $(this), 62 hash, 63 newHref, 64 sharpIdx, 65 event_str, 66 events_category_str, 67 all_events_str; 68 69 $timetable = $this.closest(".tt_wrapper"); 70 all_events_str = "all-events" + (typeof($timetable.attr("id"))!="undefined" ? "-" + $timetable.attr("id") : ""); 71 72 hash = $this.attr("href"); 73 sharpIdx = (window.location.href.indexOf("#")!==-1 ? window.location.href.indexOf("#") : window.location.href.length); 74 event_str = ($timetable.find(".events_filter .selected a").length ? $timetable.find(".events_filter .selected a").attr("href").replace("#", "") : ($timetable.find(".events_filter .ui-tabs-active a").length ? $timetable.find(".events_filter .ui-tabs-active a").attr("href").replace("#", "") : "")); 75 events_category_str = ($timetable.find(".events_categories_filter .selected a").length ? $timetable.find(".events_categories_filter .selected a").attr("href").replace("#", "") : ($timetable.find(".events_categories_filter .ui-tabs-active a").length ? $timetable.find(".events_categories_filter .ui-tabs-active a").attr("href").replace("#", "") : "")); 76 $timetable.find(".tt_error_message").addClass("tt_hide"); 77 if(event_str!=="" && events_category_str!=="") 78 { 79 if((event_str!==all_events_str && events_category_str!==all_events_str && $timetable.find("[id='" + event_str + "'][class*='tt-event-category-" + events_category_str.toLowerCase() +"']").length) || (events_category_str===all_events_str)) 80 { 81 newHref = escape_str(window.location.href.substr(0, sharpIdx)) + decodeURIComponent("#" + event_str); 82 if(window.location.href!=newHref) 83 window.location.href = newHref; 84 } 85 else if(event_str===all_events_str && events_category_str!==all_events_str) 86 { 87 newHref = escape_str(window.location.href.substr(0, sharpIdx)) + decodeURIComponent("#" + events_category_str); 88 if(window.location.href!=newHref) 89 window.location.href = newHref; 90 } 91 else 92 {
93 var scrollTop = $(document).scrollTop(); 94 newHref = escape_str(window.location.href.substr(0, sharpIdx)) + "#"; 95 if(window.location.href!=newHref) 96 window.location.href = newHref; 97 $timetable.find(".tt_tabs").tabs("option", "collapsible", true); 98 $timetable.find(".tt_tabs").tabs("option", "active", false); 99 $timetable.find(".tt_error_message").removeClass("tt_hide"); 100 $("html, body").scrollTop(scrollTop); 101 } 102 } 103 else 104 { 105 newHref = escape_str(window.location.href.substr(0, sharpIdx)) + decodeURIComponent(hash); 106 if(window.location.href!=newHref) 107 window.location.href = newHref; 108 //window.location.hash is causing issues on Safari, because of that 109 //it's necessary to use window.location.href 110 } 111 }); 112 113 //hashchange 114 $(window).bind("hashchange", function(event){ 115 var param_fragment = escape_str($.param.fragment()); 116 //some browsers will have the URL fragment already encoded, 117 //while others will not, thus it's necessary to handle both cases. 118 119 //URL fragment is already encoded: 120 $(".tabs_box_navigation a[href='#" + param_fragment + "']").trigger("click"); 121 $(".tt_tabs .ui-tabs-nav [href='#" + param_fragment + "']").trigger("change"); 122 //URL fragment must be encoded: 123 $(".tabs_box_navigation a[href='#" + encodeURIComponent(param_fragment) + "']").trigger("click"); 124 $(".tt_tabs .ui-tabs-nav [href='#" + encodeURIComponent(param_fragment) + "']").trigger("change"); 125 }).trigger("hashchange"); 126 127 //tooltip 128 $(".tt_tooltip").bind("mouseover click", function(){ 129 var $this = $(this), 130 $attach_to = $this, 131 $tooltip_text, 132 position, 133 top, 134 left; 135 136 if($this.is(".event_container")) 137 $attach_to = $this.parent(); 138 $tooltip_text = $this.children(".tt_tooltip_text"); 139 140 $tooltip_text.css("width", $this.outerWidth() + "px"); 141 $tooltip_text.css("height", $tooltip_text.height() + "px"); 142 143 if($('body').hasClass('rtl')) 144 { 145 //RTL MODE, TD is static 146 position = $attach_to.position(); 147 top = position.top-$tooltip_text.innerHeight() + "px"; 148 left = position.left + "px"; 149 } 150 else 151 { 152 //LTR MODE, TD is relative 153 top = -($tooltip_text.parent().offset().top-$attach_to.offset().top+$tooltip_text.innerHeight()) + "px"; 154 left = "0px"; 155 } 156 157 $tooltip_text.css({ 158 "top": top, 159 "left": left 160 }); 161 }); 162 163 //Handle hover booking buttons in RTL mode 164 $("body.rtl .booking_hover_buttons td.event").bind("mouseover click", function(){ 165 var $td = $(this), 166 button_height = 50, /* fixed value */ 167 height, 168 width; 169 170 if($td.hasClass("tt_single_event")) 171 { 172 height = Math.ceil($td[0].getBoundingClientRect().height); 173 width = Math.ceil($td[0].getBoundingClientRect().width); 174 $td.find(".event_hour_booking_wrapper.on_hover").css({ 175 'top': $td.position().top+height-button_height, 176 'left': $td.position().left, 177 //On FF elements may have fractional height/width, 178 //we need to get the exact value and round it up. 179 'width': width, 180 }); 181 } 182 else 183 { 184 $td.find(".event_container").each(function() { 185 var $event_container = $(this), 186 $booking_wrapper = $event_container.find(".event_hour_booking_wrapper.on_hover"); 187 188 height = Math.ceil($event_container[0].getBoundingClientRect().height); 189 width = Math.ceil($event_container[0].getBoundingClientRect().width); 190 $booking_wrapper.css({ 191 'top': $event_container.position().top+height-button_height, 192 'left': $event_container.position().left, 193 //On FF elements may have fractional height/width, 194 //we need to get the exact value and round it up. 195 'width': width, 196 }); 197 }); 198 } 199 }); 200 201 //upcoming events 202 $(".tt_upcoming_events").each(function(){ 203 var self = $(this), 204 autoscroll = 0, 205 elementClasses = self.attr("class").split(" "); 206 207 for(var i=0; i<elementClasses.length; i++) 208 { 209 if(elementClasses[i].indexOf("autoscroll-")!=-1) 210 autoscroll = elementClasses[i].replace("autoscroll-", ""); 211 } 212 self.carouFredSel({ 213 direction: "up", 214 items: { 215 visible: (self.children().length>2 ? 3 : self.children().length), 216 height: "variable" 217 }, 218 scroll: { 219 items: 1, 220 easing: "swing", 221 pauseOnHover: true 222 }, 223 prev: {button: self.next().children("#upcoming_event_prev")}, 224 next: {button: self.next().children("#upcoming_event_next")}, 225 auto: { 226 play: (parseInt(autoscroll) ? true : false) 227 } 228 }); 229
230 self.find("li a.tt_upcoming_events_event_container, li>span").hover(function(){ 231 self.trigger("configuration", ["debug", false, true]); 232 }, 233 function(){ 234 setTimeout(function(){ 235 self.trigger("configuration", ["debug", false, true]); 236 }, 1); 237 }); 238 }); 239 $(window).resize(function(){ 240 $(".tt_upcoming_events").trigger("configuration", ["debug", false, true]); 241 }); 242 243 //timetable row heights 244 /*var maxHeight = Math.max.apply(null, $(".timetable:visible tr td:first-child").map(function () 245 { 246 return $(this).height(); 247 }).get()); 248 $(".timetable:visible tr td").css("height", maxHeight); 249 //timetable height fix 250 $(".timetable .event").each(function(){ 251 if($(this).children(".event_container").length>1) 252 { 253 var childrenHeight = 0; 254 $(this).children(".event_container").not(":last").each(function(){ 255 childrenHeight += $(this).innerHeight(); 256 }); 257 var height = $(this).height()-childrenHeight-($(this).parent().parent().width()<=750 ? 9 : 22); 258 if(height>$(this).children(".event_container").last().height()) 259 $(this).children(".event_container").last().css("height", height + "px"); 260 } 261 });*/ 262 263 //show/hide event hours on mobile device 264 $(document.body).on("click", ".tt_timetable.small .plus.box_header", function(event) { 265 var $this = $(this), 266 $list = $this.next("ul.tt_items_list"); 267 $list.slideDown(500); 268 $this.removeClass("plus"); 269 $this.addClass("minus"); 270 }); 271 $(document.body).on("click", ".tt_timetable.small .minus.box_header", function(event) { 272 var $this = $(this), 273 $list = $this.next("ul.tt_items_list"); 274 $list.slideUp(500, function() { 275 $this.removeClass("minus"); 276 $this.addClass("plus"); 277 }); 278 }); 279 280 if($(".tt_booking").length && $(".tt_booking_overlay").length) 281 { 282 $(".tt_booking_overlay").slice(1).remove(); 283 $(".tt_booking_overlay").appendTo("body"); 284 $(".tt_booking").slice(1).remove(); 285 $(".tt_booking").appendTo("body"); 286 } 287 288 if($(".tt_booking").length && in_iframe()) 289 { 290 $(".tt_booking").addClass("in_iframe"); 291 } 292 293 $(document.body).on("click", ".event_hour_booking:not(.redirect)", get_event_hour_details); 294 295 296 $(document.body).on("click", ".tt_booking_overlay", close_booking_popup); 297 //don't close popup if scroll occurs 298 var touchmoved; 299 $(document.body).on("touchend", ".tt_booking_overlay", function(event) { 300 if(touchmoved != true) 301 close_booking_popup(); 302 }).on("touchmove", ".tt_booking_overlay", function(event) { 303 touchmoved = true; 304 }).on("touchstart", ".tt_booking_overlay", function(event) { 305 touchmoved = false; 306 }); 307 308 309 function get_event_hour_details(event) 310 { 311 event.preventDefault(); 312 var $this = $(this), 313 $booking_popup = $('.tt_booking'), 314 $booking_popup_message = $booking_popup.find('.tt_booking_message'), 315 $booking_popup_preloader = $booking_popup.find('.tt_preloader'), 316 event_hour_id = $this.attr('data-event-hour-id'), 317 redirect_url = window.location.href; 318 319 $timetable = $this.closest('.tt_wrapper'); 320 tt_atts = $.parseJSON($timetable.find('.timetable_atts').val()); 321 322 if(redirect_url.indexOf('#')===-1) 323 redirect_url = redirect_url + '#book-event-hour-' + event_hour_id; 324 else 325 redirect_url = redirect_url.substr(0, redirect_url.indexOf('#')) + '#book-event-hour-' + event_hour_id; 326 327 if($this.hasClass('unavailable') || $this.hasClass('booked')) 328 return; 329 330 $booking_popup_message.html(''); 331 open_booking_popup(event); 332 resize_booking_popup(); 333 $booking_popup_message.attr('data-event-hour-id', event_hour_id); 334 335 $.post(tt_config.ajaxurl, 336 { 337 action: 'timetable_ajax_event_hour_details', 338 redirect_url: redirect_url, 339 event_hour_id: event_hour_id, 340 atts: tt_atts, 341 }, 342 function(result){ 343 $booking_popup_preloader.addClass('tt_hide'); 344 345 result = parse_server_response(result); 346 if(typeof(result.msg!=='undefined')) 347 { 348 if(!result.error) 349 $booking_popup_message.html(result.msg); 350 else 351 { 352 $booking_popup_message.html('<p>' + result.msg + '</p><div><a href="#" class="tt_btn cancel">' + tt_atts.cancel_popup_label + '</a></div>'); 353 } 354 resize_booking_popup(); 355 } 356 }, 357 "html" 358 ); 359 } 360 361 $(document.body).on('click', '.tt_booking .tt_btn.book', create_event_hour_booking); 362 363 function create_event_hour_booking(event) 364 { 365 event.preventDefault(); 366 var $this = $(this), 367 $booking_popup = $('.tt_booking'), 368 $booking_popup_message = $booking_popup.find('.tt_booking_message'), 369 $booking_popup_preloader = $booking_popup.find('.tt_preloader'), 370 slots_number = $booking_popup.find('.tt_slots_number').val(), 371 guest_name = $booking_popup.find('.tt_guest_name').val(), 372 guest_email = $booking_popup.find('.tt_guest_email').val(), 373 guest_phone = $booking_popup.find('.tt_guest_phone').val(), 374 guest_message = $booking_popup.find('.tt_guest_message').val(), 375 terms_checkbox = $booking_popup.find('.tt_terms_checkbox').is(':checked'), 376 event_hour_id = $booking_popup_message.attr('data-event-hour-id'); 377 378 $this.qtip('destroy').removeClass('tt-qtip2'); 379 380 $booking_popup_message.addClass('tt_hide'); 381 $booking_popup_preloader.removeClass('tt_hide'); 382 resize_booking_popup(); 383 384 $.post(tt_config.ajaxurl, 385 { 386 action: 'timetable_ajax_event_hour_booking', 387 event_hour_id: event_hour_id, 388 atts: tt_atts, 389 slots_number: slots_number, 390 guest_name: guest_name, 391 guest_email: guest_email, 392 guest_phone: guest_phone, 393 guest_message: guest_message, 394 terms_checkbox: terms_checkbox, 395 }, 396 function(result){ 397 $booking_popup_preloader.addClass('tt_hide'); 398 $booking_popup_message.removeClass('tt_hide'); 399 resize_booking_popup(); 400 result = parse_server_response(result); 401 if(typeof(result.msg)!=='undefined') 402 { 403 if(!result.error) 404 { 405 $booking_popup_message.html(result.msg); 406 resize_booking_popup(); 407 408 $timetable.find(".event_hour_booking.id-" + event_hour_id).parent().replaceWith(result.booking_button); 409 410 if(typeof(result.available_slots_label)!=='undefined') 411 { 412 $timetable.find('.available_slots.id-' + event_hour_id).html(result.available_slots_label); 413 } 414 } 415 else 416 { 417 $this.addClass('tt-qtip2').qtip( 418 { 419 style: 420 { 421 classes: 'ui-tooltip-error tt-qtip2' 422 }, 423 content: 424 { 425 text: result.msg 426 }, 427 position: 428 { 429 my: 'bottom center', 430 at: 'top center', 431 target: $this, 432 }, 433 }); 434 435 //show qtip after animation completes 436 setTimeout(function() { 437 $this.qtip('show'); 438 }, 200); 439 440 } 441 } 442 }, 443 "html" 444 ); 445 } 446 447 function handle_orinentation_change() 448 { 449 var no_change_count_to_end = 100, 450 no_end_timeout = 1000; 451 452 (function () { 453 var orientationchange_interval, 454 orientationchange_timeout, 455 end_timming, 456 curr_inner_width, 457 curr_inner_height, 458 last_inner_width, 459 last_inner_height, 460 no_change_count; 461 462 end_timming = function () 463 { 464 clearInterval(orientationchange_interval); 465 clearTimeout(orientationchange_timeout); 466 467 orientationchange_interval = null; 468 orientationchange_timeout = null; 469 470 //orientationchange has ended 471 resize_booking_popup(); 472 }; 473 474 orientationchange_interval = setInterval(function () 475 { 476 curr_inner_width = $(window).width(); 477 curr_inner_height = $(window).height(); 478 if (curr_inner_width === last_inner_width && curr_inner_height === last_inner_height) 479 { 480 no_change_count++; 481 482 if (no_change_count === no_change_count_to_end) 483 { 484 end_timming(); 485 } 486 } 487 else 488 { 489 last_inner_width = curr_inner_width; 490 last_inner_height = curr_inner_height; 491 no_change_count = 0; 492 } 493 }); 494 orientationchange_timeout = setTimeout(function () { 495 end_timming(); 496 }, no_end_timeout); 497 })(); 498 } 499 500 $(document.body).on('click', '.tt_guest_option a', function(event) { 501 event.preventDefault(); 502 var $booking = $('.tt_booking'), 503 $booking_form_user = $booking.find('.tt_booking_form.user'), 504 $booking_form_guest = $booking.find('.tt_booking_form.guest'); 505 506 $booking_form_user.addClass('tt_hide'); 507 $booking_form_guest.removeClass('tt_hide'); 508
509 $(this).parent().addClass('tt_hide') 510 .next('.tt_login_option').removeClass('tt_hide'); 511 $booking.find('.tt_btn.login').addClass('tt_hide'); 512 $booking.find('.tt_btn.book').removeClass('tt_hide'); 513 resize_booking_popup(); 514 }); 515 516 $(document.body).on('click', '.tt_slots_number_plus, .tt_slots_number_minus', function(event) { 517 event.preventDefault(); 518 var $booking = $('.tt_booking'), 519 $booking_form = $booking.find('.tt_booking_form'), 520 $slots_number = $booking_form.find('.tt_slots_number'), 521 slots_number = parseInt($slots_number.val()), 522 min = parseInt($slots_number.attr('min')), 523 max = parseInt($slots_number.attr('max')), 524 step = parseInt($slots_number.attr('step')); 525 526 if(isNaN(slots_number)) 527 slots_number = 1; 528 529 if($(this).hasClass('tt_slots_number_plus')) 530 { 531 if(slots_number<max) 532 slots_number += step; 533 else 534 slots_number = max; 535 } 536 537 if($(this).hasClass('tt_slots_number_minus')) 538 { 539 if(slots_number>min) 540 slots_number -= step; 541 else 542 slots_number = min; 543 } 544 545 $slots_number.val(slots_number); 546 }); 547 548 $(document.body).on('click', '.tt_btn.cancel, .tt_btn.continue', function(event) { 549 event.preventDefault(); 550 close_booking_popup(event); 551 }); 552 553 554 function calc_popup_params() 555 { 556 //init vars 557 var $booking_popup = $('.tt_booking'); 558 var booking_popup_margin_left = parseInt($booking_popup.css('margin-left')); 559 560 var booking_popup_width_new; 561 var booking_popup_width = $booking_popup.outerWidth(); 562 var booking_popup_width_auto = $booking_popup.css('width', '').outerWidth(); 563 $booking_popup.css('width', booking_popup_width) 564 565 var window_height = ($booking_popup.hasClass('in_iframe') ? $(parent.window).height() : $(window).height()); 566 var window_width = ($booking_popup.hasClass('in_iframe') ? $(parent.window).width() : $(window).width()); 567 var offset_top = ($(document).scrollTop()>=$(parent.document).scrollTop() ? $(document).scrollTop() : $(parent.document).scrollTop()); 568 569 570 //calc width 571 if((booking_popup_width_auto+booking_popup_margin_left*2)>=window_width) 572 booking_popup_width_new = window_width-booking_popup_margin_left*2; 573 else 574 booking_popup_width_new = booking_popup_width_auto; 575 576 //calc left position 577 var booking_popup_left = (window_width-booking_popup_width_new-booking_popup_margin_left*2)/2; 578 579 //calc height 580 var booking_popup_height = $booking_popup.outerHeight(); 581 var booking_popup_height_new = $booking_popup.css({ 582 'width': booking_popup_width_new, 583 'height': '', 584 }).outerHeight(); 585 $booking_popup.css({ 586 'width': booking_popup_width, 587 'height': booking_popup_height, 588 }); 589 590 //calc top position 591 var booking_popup_top = offset_top; 592 if(booking_popup_height_new<window_height) 593 booking_popup_top += (window_height-booking_popup_height_new)/2; 594 595 var result = { 596 'top': booking_popup_top, 597 'left': booking_popup_left, 598 'width': booking_popup_width_new, 599 'height': booking_popup_height_new, 600 }; 601 return result; 602 } 603 604 function open_booking_popup(event) 605 { 606 var 607 $booking_popup = $(".tt_booking"), 608 $booking_overlay = $(".tt_booking_overlay"), 609 $booking_popup_preloader = $booking_popup.find('.tt_preloader'); 610 611 $booking_overlay.removeClass("tt_hide"); 612 $booking_popup.removeClass("tt_hide"); 613 $booking_popup_preloader.removeClass('tt_hide'); 614 615 616 $booking_overlay.css({ 617 'height' : $(document).height(), 618 }); 619 620 var popup_params = calc_popup_params(); 621 622 $booking_popup.css({ 623 'top': popup_params.top, 624 'left': popup_params.left, 625 'width': popup_params.width, 626 'height': popup_params.height, 627 }); 628 } 629 630 function close_booking_popup() 631 { 632 var $booking_popup = $(".tt_booking"), 633 $booking_overlay = $(".tt_booking_overlay"); 634 635 $booking_popup.find('.tt-qtip2').qtip('destroy').removeClass('tt-qtip2'); 636 $booking_popup.addClass("tt_hide"); 637 $booking_overlay.addClass("tt_hide"); 638 639 $booking_popup.css({ 640 "top": "", 641 "left": "", 642 "width": "", 643 "height": "", 644 }); 645 if(window.location.href.indexOf("book-event-hour-")!==-1) 646 { 647 window.location.href = escape_str(window.location.href.substr(0, window.location.href.indexOf("#"))) + "#"; 648 } 649 return false;
650 } 651 652 function resize_booking_popup() 653 { 654 var $booking_popup = $('.tt_booking'), 655 $booking_overlay = $(".tt_booking_overlay"); 656 657 if($booking_popup.hasClass('tt_hide')) 658 return; 659 660 $booking_overlay.css({ 661 'height' : $(document).height(), 662 }); 663 664 var popup_params = calc_popup_params(); 665 $booking_popup.stop(false, true).animate({ 666 'top': popup_params.top, 667 'left': popup_params.left, 668 'width': popup_params.width, 669 'height': popup_params.height, 670 }, 200); 671 } 672 673 //IIFE: wait till resize event ends 674 (function() { 675 var last_resize, 676 timeout = false, 677 delta = 200; 678 679 $(window).resize(function() { 680 last_resize = new Date(); 681 if(timeout === false) 682 { 683 timeout = true; 684 setTimeout(resize_end, delta); 685 } 686 }); 687 688 function resize_end() 689 { 690 if(new Date()-last_resize<delta) 691 setTimeout(resize_end, delta); 692 else 693 { 694 timeout = false; 695 $(window).trigger('resize_end'); //trigger custom event 696 } 697 } 698 })(); 699 $(window).on('resize_end', resize_booking_popup); //handle custom event 700 701 window.addEventListener('orientationchange', handle_orinentation_change); 702 703 if(window.location.href.indexOf('book-event-hour-')!==-1) 704 { 705 var event_hour_id = window.location.href.substr(window.location.href.indexOf('book-event-hour-')+16), 706 $booking_link = $('a.event_hour_booking.id-' + event_hour_id).eq(0); 707 if($booking_link.length) 708 { 709 $('html, body').animate({scrollTop: $booking_link.offset().top-80}, 400); 710 $booking_link.click(); 711 } 712 } 713 714 function escape_str($text) 715 { 716 return $('<div/>').text($text).html(); 717 } 718 719 $('form.tt_generate_pdf').on('submit', function(event) { 720 var $this = $(this), 721 $timetable_copy, 722 timetable_html; 723 724 $timetable = $this.closest('.tt_wrapper'); 725 726 $timetable_copy = $timetable.find('.tt_tabs div.ui-tabs-panel:visible .tt_timetable.small').clone(); 727 $timetable_copy.find('*').attr('style', ''); //helps to remove the colors 728 timetable_html = $timetable_copy[0].outerHTML; 729 if($('body').hasClass('rtl')) 730 timetable_html = "<div class='rtl'>" + timetable_html + "</div>"; 731 $this.find("textarea[name='tt_pdf_html_content']").val(timetable_html); 732 return true; 733 }); 734 735 function in_iframe() 736 { 737 try { 738 return window.self !== window.top; 739 } catch (e) { 740 return true; 741 } 742 } 743 744 function parse_server_response(response) 745 { 746 var indexStart = response.indexOf('timetable_start')+15, 747 indexEnd = response.indexOf('timetable_end')-indexStart; 748 return $.parseJSON(response.substr(indexStart, indexEnd)); 749 } 750 751});
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.