1(function($) { 2 3 window.cart.cart_summary.update_callback = function() { 4 if ($('#store_cart_widget').length) { 5 var original_sub_total = $('#store_cart_widget .scw_total_price_amount_with_vat').text(); 6 if (original_sub_total != '' && typeof original_sub_total != 'undefined') { 7 var new_sub_total = original_sub_total.replace('.00', ''); 8 $('#store_cart_widget .scw_total_price_amount_with_vat').text(new_sub_total); 9 } 10 } 11 }; 12 13 window.cart.cart_summary.quick_cart_widget_open_callback = function() { 14 $('#container_outer').removeClass('scrolling-down'); 15 h.accessibility.on_popup_opening('#store_quick_cart_widget', '.sqcw_item_image a:first', '#sqcw_close'); 16 }; 17 window.cart.cart_summary.quick_cart_widget_close_callback = function() { 18 h.accessibility.on_popup_closing(); 19 }; 20 window.cart.wishlist_summary.quick_wishlist_cart_widget_open_callback = function() { 21 $('#container_outer').removeClass('scrolling-down'); 22 window.site.misc.init(); 23 // window.cart.init(); 24 $.pageload.refresh('#wishlist_quick_cart_widget'); 25 26 window.cart.remove_from_wishlist($('#wishlist_quick_cart_widget .product_detail .store_item .store_item_add_to_cart'), false); 27 h.accessibility.on_popup_opening('#wishlist_quick_cart_widget', false, '#wqcw_close'); 28 29 30 $('#wqcw_checkout #wqcw_enquiry_button, #wqcw_checkout #wqcw_share_button').unbind('click').bind('click', function() { 31 var button_instance = $(this); 32 enquire_items_json = []; 33 $('#wqcw_items_list li').each(function() { 34 if ($(this).attr('data-json') && typeof $(this).attr('data-json') != 'undefined') { 35 console.log(); 36 enquire_items_json.push($(this).attr('data-json')); 37 } 38 }).promise().done(function() { 39 enquire_items_string = '[' + enquire_items_json.join(',') + ']'; 40 button_instance.attr('data-items-json', enquire_items_string); 41 if (button_instance.attr('id') == 'wqcw_share_button') { 42 button_instance.attr('data-type', 'wishlist-share'); 43 } else { 44 button_instance.attr('data-type', 'wishlist'); 45 } 46 window.site.overlays.enquire.click_open(button_instance); 47 //window.site.overlays.enquire.open($(button_instance), {}, 'wishlist'); 48 }); 49 return false; 50 }); 51 }; 52 window.cart.wishlist_summary.quick_wishlist_cart_widget_close_callback = function() { 53 h.accessibility.on_popup_closing(); 54 }; 55 56 google_captcha_onload = function(token) { 57 setTimeout(function() { 58 try { 59 if (!$('body').hasClass('protected-path-login-mode')) { 60 $('#quick_contact_widget').each(function() { 61 if (!$(this).hasClass('initialized')) { 62 grecaptcha.render('quick_contact_captcha_button', { 63 sitekey: '6LcdHdEUAAAAACJBHg1ArzdGfVjaCIjyQ09QWv8x', 64 size: 'invisible', 65 badge: 'inline', 66 callback: function(token) { 67 $('#quick_contact_widget .button').removeClass('loading'); 68 $('body').removeClass('captcha-verify-mode'); 69 $('input[name="g-recaptcha-response"]').val(token); 70 window.site.overlays.enquire.submit_form($('#quick_contact_widget form')); 71 }, 72 expired_callback: function() { 73 h.alert('An error occurred, please refresh and try again. If you are still having difficulties please <a href="/contact/">contact us</a>.'); 74 }, 75 error_callback: function() { 76 h.alert('An error occurred, please refresh and try again. If you are still having difficulties please <a href="/contact/">contact us</a>.'); 77 } 78 }); 79 } 80 $(this).addClass('initialized'); 81 }); 82 } 83 } catch(err) { 84 85 } 86 }, 200, token); 87 } 88 89 window.site = { 90 91 init: function() { 92 93 if (false) { 94 95 setTimeout(function() { 96 97 $('body').addClass('page-transition-active'); 98 99 setTimeout(function() { 100 $('body').addClass('page-transition'); 101 }, 100); 102 setTimeout(function() { 103 $('body').addClass('page-transition-custom'); 104 }, 1000); 105 106 }, 300); 107 108 return; 109 } 110 111 112 window.site.device.init(); 113 window.site.pageload.init(); 114 window.site.setup(); 115 116 117 118 119 }, 120 121 setup: function() { 122 window.site.artworks.init(); 123 window.site.layout.init(); 124 window.site.video.init(); 125 window.site.slideshow.init(); 126 window.site.scroll.init(); 127 window.site.home.init() 128 window.site.overlays.init(); 129 window.site.lazy_load.init(); 130 window.site.artlogic_inview.init(); 131 window.site.social_media.init();
132 window.site.mailing_list_form.init(); 133 window.site.enquiry.init(); 134 window.site.quick_enquiry.init(); 135 window.site.tracking.init(); 136 window.site.store.init(); 137 window.site.translations.init(); 138 window.site.misc.init(); 139 window.site.artists.init(); 140 ///window.site.exhibitions.init(); 141 window.site.filters.init(); 142 window.site.objectfit_polyfill.init(); 143 window.site.vat_toggle.init(); 144 145 146 $('#container_outer').removeClass('page-short'); 147 if ($('#main_content').height() < $(window).height() * 2) { 148 $('#container_outer').addClass('page-short'); 149 } 150 151 152 }, 153 154 home: { 155 156 canvas_effect_enabled: false, 157 158 init: function() { 159 window.site.home.setup(); 160 }, 161 162 start_slideshow_pre_init: function() { 163 $('#main_slideshow .slide:eq(0) video').each(function() { 164 var video = $(this).get(0); 165 video.currentTime = 0; 166 video.play(); 167 }); 168 }, 169 170 start_slideshow: function(run_pre_init) { 171 run_pre_init = typeof run_pre_init != 'undefined' ? run_pre_init : true; 172 $('#main_slideshow').each(function() { 173 if (!$('#main_slideshow').hasClass('slideshow-paused-by-default')) { 174 setTimeout(function() { 175 $('#main_slideshow').cycle('resume'); 176 }, 100); 177 } 178 main_slideshow_cycle_before(false, false, false, $('#main_slideshow .slide:eq(0)'), false); 179 180 $('body').addClass('main_slideshow_active'); 181 182 setTimeout(function() { 183 if (run_pre_init) { 184 window.site.home.start_slideshow_pre_init(); 185 } 186 $('body').addClass('main_slideshow_animate'); 187 }, 400, run_pre_init); 188 }); 189 }, 190 191 setup: function() { 192 193 // Slideshow init 194 195 $('body').removeClass('main_slideshow_active main_slideshow_animate'); 196 197 $('#hero').each(function() { 198 199 $('body').addClass('layout-hero-active') 200 201 // Setup each slide (non-canvas) 202 if ($('#main_slideshow .slide', this).length == 1) { 203 $(this).addClass('cycle-single-slide'); 204 } 205 206 // Play all the videos to force them to load 207 $('xx#main_slideshow .slide video').each(function() { 208 $(this).get(0).play(); 209 }); 210 211 if ($('#main_slideshow .slide').length > 0) { 212 $(this).addClass('has-slideshow'); 213 } 214 215 $('#main_slideshow .slide', this).each(function() { 216 cycle_resume_timeout = false; 217 $('.store_item').hover(function() { 218 clearTimeout(cycle_resume_timeout); 219 if (!$('#main_slideshow').hasClass('cycle-paused')) { 220 $('#main_slideshow').stop().clearQueue(); 221 $('#main_slideshow').addClass('temporary-pause').cycle('pause'); 222 } 223 }, function() { 224 if ($('#main_slideshow').hasClass('temporary-pause')) { 225 clearTimeout(cycle_resume_timeout); 226 cycle_resume_timeout = setTimeout(function() { 227 $('#main_slideshow').removeClass('temporary-pause').cycle('resume'); 228 }, 500); 229 } 230 }); 231 232 if ($('a', this).length) { 233 $('.image, .image_hover_area', this).css('cursor', 'pointer').click(function() { 234 $(this).closest('.slide').find('a').trigger('click'); 235 }); 236 } 237 }); 238 239 $('.main_slideshow_quick_nav ul li button').click(function() { 240 main_slideshow_go_to_slide($(this).parent().attr('data-index')); 241 return false; 242 }); 243 244 $('#main_slideshow_nav .records_list_slider').on('select.flickity', function(event, index) { 245 if (!$('body').hasClass('resizing')) { 246 247 $('#main_slideshow_nav .records_list_slider').addClass('auto-change'); 248 $(this).find('.is-selected').addClass('active'); 249 main_slideshow_go_to_slide($(this).find('.is-selected').attr('data-index'), true); 250 } 251 }); 252 253 pad_number = function(num, size) { 254 if (String(num).length > size) { 255 var size = String(num).length; 256 } 257 var s = "000000" + num; 258 return s.substr(s.length-size); 259 } 260 261 main_slideshow_cycle_end = function(next_slide_index, forced) { 262 // Change image in the canvas element 263 if (!$('#hero').hasClass('cycle-single-slide')) { 264 if (next_slide_index && typeof next_slide_index != 'undefined') { 265 266 } else { 267 // assume it is the next slide 268 next_slide_index = parseInt($('#main_slideshow .slide.cycle-slide-active').attr('data-index')) + 1; 269 if (next_slide_index > $('#main_slideshow .slide').length) { 270 next_slide_index = 1; 271 } 272 } 273 274 $('#main_slideshow_nav li, .main_slideshow_quick_nav li').removeClass('active'); 275 $('#main_slideshow_nav li[data-index="' + next_slide_index + '"]').addClass('active'); 276 $('.main_slideshow_quick_nav li[data-index="' + next_slide_index + '"]').addClass('active'); 277 278 $('#main_slideshow').addClass('slide-changing'); 279 //$('.cycle-slide.cycle-slide-active').find('.text_animate').textillate('out'); 280 $('#main_slideshow, .scroll-container').addClass('slide-end'); 281 $('#main_slideshow, .scroll-container').removeClass('slide-active'); 282 } 283 } 284 285 main_slideshow_cycle_first_slide_change = true; 286 287 main_slideshow_cycle_before = function(event, optionHash, outgoingSlideEl, incomingSlideEl, forwardFlag) { 288 var forced = typeof forced != 'undefined' ? forced : false;
289 this_index = $(incomingSlideEl).attr('data-index'); 290 this_color = $(incomingSlideEl).attr('data-color'); 291 292 $('#main_slideshow').removeClass('slide-changing'); 293 294 $('#main_slideshow_nav li').removeClass('active'); 295 $('#main_slideshow_nav li[data-index="' + this_index + '"]').addClass('active'); 296 297 $('.main_slideshow_quick_nav li').removeClass('active'); 298 $('.main_slideshow_quick_nav li[data-index="' + this_index + '"]').addClass('active'); 299 300 $('#main_slideshow_progress .number').text(pad_number(this_index, 2)); 301 $('.main_slideshow_pagination .number').text(pad_number(this_index, 2)); 302 303 if (!$('#main_slideshow_nav .records_list_slider').hasClass('auto-change')) { 304 $('#main_slideshow_nav .records_list_inner').flickity('select', parseInt(this_index-1)); 305 } 306 $('#main_slideshow_nav .records_list_slider').removeClass('auto-change') 307 308 if (outgoingSlideEl) { 309 $('.text_animate', outgoingSlideEl).textillate('out'); 310 } 311 312 $('body').removeClass('color1 color2 color3 color4 color5 color6') 313 314 $('#main_slideshow, .scroll-container').removeClass('slide-begin slide-begin2 slide-active'); 315 $('#main_slideshow, .scroll-container').removeClass('slide-end'); 316 $('#main_slideshow, .scroll-container').addClass('slide-reset'); 317 318 $('#main_slideshow video').each(function() { 319 $(this).get(0).pause(); 320 }); 321 322 // Play video 323 324 if ($('video', incomingSlideEl).length) { 325 $('video', incomingSlideEl).get(0).play(); 326 } 327 328 // Note: textillate text needs to be brough in at this point because it will flicker if delayed 329 $('.xtext_animate', incomingSlideEl).textillate('in'); 330 331 var slideshow_delay = 4400; 332 if (main_slideshow_cycle_first_slide_change) { 333 var slideshow_delay = 4000; 334 } 335 $('#main_slideshow') 336 .stop().clearQueue() 337 .animate({'display':'block'}, 10, function() { 338 $('#main_slideshow, .scroll-container').addClass('slide-active'); 339 $('body').addClass(this_color); 340 $(window).resize(); 341 }) 342 .animate({'display':'block'}, 0, function() { 343 $('#main_slideshow').addClass('slide-begin'); 344 $('#main_slideshow, .scroll-container').removeClass('slide-reset'); 345 $('body').addClass(this_color); 346 }) 347 .animate({'display':'block'}, 10, function() { 348 $('#main_slideshow').addClass('slide-begin2'); 349 }) 350 .animate({'display':'block'}, slideshow_delay, function() { 351 352 }) 353 .animate({'display':'block'}, 2200, function() { 354 if (!$('#main_slideshow').hasClass('cycle-paused')) { 355 main_slideshow_cycle_end(); 356 } 357 }) 358 ; 359 main_slideshow_cycle_first_slide_change = false; 360 } 361 362 main_slideshow_pause_toggle = function() { 363 if (!$('#main_slideshow').hasClass('cycle-paused')) { 364 $('#main_slideshow').cycle('pause'); 365 $('#main_slideshow').stop().clearQueue(); 366 $('#main_slideshow_progress').addClass('paused'); 367 } else { 368 $('#main_slideshow').cycle('resume'); 369 main_slideshow_cycle_end(); 370 $('#main_slideshow_nav') 371 .stop().clearQueue() 372 .animate({'display':'block'}, 800, function() { 373 $('#main_slideshow').cycle('next'); 374 $('#main_slideshow_nav').removeClass('slide-changing'); 375 }) 376 ; 377 $('#main_slideshow_progress').removeClass('paused'); 378 } 379 $('#main_slideshow a').focusin(function(){ 380 $('#main_slideshow').cycle('pause'); 381 }); 382 } 383 384 main_slideshow_go_to_slide = function(slide_index, forced) { 385 var forced = typeof forced != 'undefined' ? forced : false;
386 if (slide_index && typeof slide_index != 'undefined') { 387 if (!$('#main_slideshow .slide[data-index="' + slide_index + '"]').not('.cycle-sentinel').hasClass('cycle-slide-active')) { 388 main_slideshow_cycle_end(slide_index, forced); 389 $('#main_slideshow_nav li').removeClass('active'); 390 $('.main_slideshow_quick_nav li').removeClass('active'); 391 if (!forced) { 392 $('#main_slideshow').stop().clearQueue(); 393 $('#main_slideshow').cycle('pause'); 394 } 395 $('#main_slideshow_nav') 396 .stop().clearQueue() 397 .animate({'display':'block'}, 200, function() { 398 $('#main_slideshow').cycle(parseInt(slide_index) -1); 399 $('#main_slideshow_nav').removeClass('slide-changing'); 400 }) 401 ; 402 } 403 } 404 } 405 406 main_slideshow_change_slide = function(direction) { 407 408 if (direction == 'next') { 409 //$('#main_slideshow').cycle('pause'); 410 $('#main_slideshow').stop().clearQueue(); 411 $('#main_slideshow_nav').addClass('slide-changing'); 412 next_slide_index = parseInt($('#main_slideshow .slide.cycle-slide-active').attr('data-index')) + 1; 413 if (next_slide_index > $('#main_slideshow .slide').length) { 414 next_slide_index = 1; 415 } 416 main_slideshow_cycle_end(next_slide_index); 417 //$(this).addClass('active'); 418 $('#main_slideshow_nav') 419 .stop().clearQueue() 420 .animate({'display':'block'}, 200, function() { 421 $('#main_slideshow').cycle('next'); 422 }) 423 .animate({'display':'block'}, 800, function() { 424 $('#main_slideshow_nav').removeClass('slide-changing'); 425 }) 426 ; 427 } else if (direction == 'previous') { 428 //$('#main_slideshow').cycle('pause'); 429 $('#main_slideshow').stop().clearQueue(); 430 $('#main_slideshow_nav').addClass('slide-changing'); 431 next_slide_index = $('#main_slideshow .slide.cycle-slide-active').attr('data-index') - 1; 432 if (next_slide_index < 1) { 433 next_slide_index = $('#main_slideshow .slide').length; 434 } 435 main_slideshow_cycle_end(next_slide_index); 436 //$(this).addClass('active'); 437 $('#main_slideshow_nav') 438 .stop().clearQueue() 439 .animate({'display':'block'}, 200, function() { 440 $('#main_slideshow').cycle('prev'); 441 }) 442 .animate({'display':'block'}, 800, function() { 443 $('#main_slideshow_nav').removeClass('slide-changing'); 444 }) 445 ; 446 } 447 } 448 449 var cycle_timeout = 2600; // 6620 450 cycle_timeout_type = 'standard'; 451 452 var cycle_settings = { 453 fx: 'fade', 454 speed: 800, 455 timeout: cycle_timeout, 456 paused: false, 457 slides: '>', 458 autoHeight: 'container', 459 swipe: true 460 }; 461 $('#main_slideshow').unbind().cycle(cycle_settings); 462 $('#main_slideshow').on('cycle-before', function(event, optionHash, outgoingSlideEl, incomingSlideEl, forwardFlag) { 463 main_slideshow_cycle_before(event, optionHash, outgoingSlideEl, incomingSlideEl, forwardFlag); 464 }); 465 if ($('#main_slideshow >').length == 1 || $('#main_slideshow').hasClass('cycle-paused') || $('#main_slideshow').hasClass('slideshow-paused-by-default')) { 466 $('#main_slideshow').stop().clearQueue(); 467 $('#main_slideshow').cycle('pause'); 468 $('#main_slideshow_progress').addClass('paused'); 469 } 470 471 $('.main_slideshow_pagination .prev').unbind().click(function() { 472 $('#main_slideshow').cycle('pause'); 473 main_slideshow_change_slide('previous'); 474 }); 475 $('.main_slideshow_pagination .next').unbind().click(function() { 476 $('#main_slideshow').cycle('pause'); 477 main_slideshow_change_slide('next'); 478 }); 479 480 $('#main_slideshow_progress .pause').click(function() { 481 main_slideshow_pause_toggle(); 482 }); 483 484 // Once setup, pause slideshow and wait for start_slideshow function to be called 485 main_slideshow_pause_toggle(); 486 487 var total_slides = $('#main_slideshow >').length; 488 $('#main_slideshow_progress .total').text(pad_number(total_slides, 2)); 489 $('.main_slideshow_pagination .total').text(pad_number(total_slides, 2)); 490 491 $('#main_slideshow_nav li') 492 .click(function() { 493 $('#main_slideshow').stop().clearQueue(); 494 $('#main_slideshow').cycle('pause'); 495 slide_index = $(this).attr('data-index'); 496 if (!$(this).hasClass('active') && !$('#main_slideshow_nav').hasClass('slide-changing') && !$('body').hasClass('slider-
496drag')) { 497 $('#main_slideshow_nav').addClass('slide-changing'); 498 $('#main_slideshow_nav .records_list_inner').flickity('select', parseInt(slide_index-1)); 499 main_slideshow_go_to_slide(slide_index); 500 501 if ($(window).scrollTop() > $(window).height() / 2) { 502 window.site.commands.scrollto(0); 503 } 504 } else { 505 var related_slide_link = $('#main_slideshow .slide[data-index="' + slide_index + '"] a:eq(0)'); 506 if (related_slide_link.length) { 507 $.pageload.load(related_slide_link.attr('href'), true); 508 } 509 } 510 }) 511 ; 512 $("#main_slideshow_nav li .content").focusin(function(){ 513 var slide_index = $(this).closest('li').attr('data-index'); 514 main_slideshow_go_to_slide(slide_index); 515 }); 516 517 $("#main_slideshow_nav li .content").keydown(function(e) { 518 var slide_index = $(this).closest('li').attr('data-index'); 519 var related_slide_link = $('#main_slideshow .slide[data-index="' + slide_index + '"] a:eq(0)'); 520 if (e.which == 13){ 521 if (related_slide_link.length) { 522 $.pageload.load(related_slide_link.attr('href'), true); 523 } 524 } 525 }); 526 527 $(document).keydown(function(e) { 528 if (e.which == 38 && $('#main_slideshow .cycle-slide-active a').is(":focus")) { 529 // Up 530 main_slideshow_change_slide('previous'); 531 e.preventDefault(); // prevent the default action (scroll) 532 setTimeout(function(){ 533 $('#main_slideshow .cycle-slide-active a')[0].focus() 534 }, 1000); 535 } else if (e.which == 40 && $('#main_slideshow a').is(":focus")) { 536 // Down 537 main_slideshow_change_slide('next'); 538 e.preventDefault(); // prevent the default action (scroll) 539 setTimeout(function(){ 540 $('#main_slideshow .cycle-slide-active a')[0].focus() 541 }, 1000); 542 } 543 }); 544 545 if ($('body').hasClass('first-load-complete')) { 546 window.site.home.start_slideshow(); 547 } 548 549 }); 550 551 } 552 553 }, 554 555 slideshow: { 556 557 init: function() { 558 window.site.slideshow.header(); 559 window.site.slideshow.cascading(); 560 window.site.slideshow.slider.init(); 561 }, 562 563 slider: { 564 565 init: function() { 566 $('.records_list_slider').each(function() { 567 568 var instance = $(this).find('.records_list_inner'); 569 var slider_infinite = $(this).hasClass('slider_infinite'); 570 var slider_cellalign = $(this).hasClass('slider_center') ? 'center' : 'left'; 571 var slider_draggable = $(this).hasClass('slider_drag_disabled') ? false : true; 572 var lazyload_amount = 3; 573 if ($(instance).find('.item').length) { 574 575 $(instance).find('.item').each(function(){ 576 if ($(this).find('.image').length) { 577 var current_height = $(this).find('.image').height(); 578 } else { 579 var current_height = $(this).height(); 580 } 581 var ratio_width = $(this).find('.image').attr('data-width'); 582 var ratio_height = $(this).find('.image').attr('data-height'); 583 if (current_height > 0 && ratio_width && ratio_height) { 584 var new_width = 0; 585 var ratio = (ratio_height / current_height); 586 var new_width = ratio_width / ratio; 587 if (new_width > 0) { 588 $(this).find('.image').css('min-width', new_width + 'px'); 589 } 590 } 591 }); 592 593 $(instance).flickity({ 594 cellAlign: slider_cellalign, 595 resize: true,
596 prevNextButtons: false, 597 //groupCells: 'auto', 598 draggable: slider_draggable, 599 pageDots: false, 600 contain: true, 601 wrapAround: slider_infinite, 602 imagesLoaded: true, //required for height on first load 603 adaptiveHeight: false, //Change height on each slide change 604 lazyLoad: lazyload_amount, 605 setGallerySize: true //Auto set the slideshow height 606 }); 607 608 var flkty = $(instance).data('flickity'); 609 var item_count = $(instance).find('.item').length; 610 var item_width = Math.floor($(instance).find('.item:eq(0)')[0].getBoundingClientRect().width); 611 var instance_width = $(instance).width(); 612 var items_per_group = instance_width / item_width; 613 614 // If there are not enough items to be scrolled, disable pagination and unbind the drag 615 if (items_per_group) { 616 if (flkty.cells.length <= items_per_group) { 617 flkty.unbindDrag(); 618 $(instance).closest('.records_list_slider').addClass('slider_disabled'); 619 $(instance).closest('.panel_type_records_slider').addClass('slider_disabled'); 620 } 621 } 622 623 // Initialise controls 624 $(this).closest('.panel_type_records_slider').find('.pagination_controls > button').click(function() { 625 if ($(this).hasClass('pagination_controls_prev')) { 626 $(this).closest('.panel_type_records_slider').find('.records_list_inner').flickity('previous'); 627 $(instance).trigger('dragEnd'); 628 } else if ($(this).hasClass('pagination_controls_next')) { 629 $(this).closest('.panel_type_records_slider').find('.records_list_inner').flickity('next'); 630 $(instance).trigger('dragEnd'); 631 } 632 }); 633 634 // Event on start of drag 635 $(instance).on('dragStart.flickity', function() { 636 $('body').addClass('slider-drag'); 637 }); 638 639 // Event on end of drag 640 $(instance).on('dragEnd.flickity', function() { 641 642 // Find the tallest slide in the current set and scale slider height to this height 643 644 tallest_item = 0; 645 646 var item_count = $(instance).find('.item').length; 647 var item_width = Math.floor($(instance).find('.item:eq(0)')[0].getBoundingClientRect().width); 648 var instance_width = $(instance).width(); 649 var items_per_group = Math.floor(instance_width / item_width); 650 var items_in_viewport = $(instance).find('.item.is-selected').nextAll().andSelf().slice(0, items_per_group); 651 var additional_items_in_viewport = {}; 652 653 var current_index = $(instance).find('.item.is-selected').index(); 654 655 if (current_index == 0) { 656 $(instance).closest('.panel_type_records_slider').addClass('slider_first'); 657 $(instance).closest('.area_wrapper').find('.pagination_controls_prev').prop("disabled", true); 658 } else { 659 $(instance).closest('.panel_type_records_slider').removeClass('slider_first'); 660 $(instance).closest('.area_wrapper').find('.pagination_controls_prev').prop("disabled", false); 661 } 662 if (current_index >= item_count-items_per_group) { 663 $(instance).closest('.panel_type_records_slider').addClass('slider_last'); 664 $(instance).closest('.area_wrapper').find('.pagination_controls_next').prop("disabled", true); 665 } else { 666 $(instance).closest('.panel_type_records_slider').removeClass('slider_last'); 667 $(instance).closest('.area_wrapper').find('.pagination_controls_next').prop("disabled", false); 668 } 669 670 if ($(instance).closest('.records_list_slider').hasClass('slider_infinite')) { 671 // In an infinite slideshow, the end of the slider will include images from the beginning of the list 672 // This means we need to check the height of the items at the beginning of the list. 673 // Work out the deficit of items in the existing selector then add the items from the beginning of the slider to the end. 674 if (items_in_viewport.length < items_per_group) { 675 var item_deficit = (items_per_group - items_in_viewport.length); 676 var additional_items_in_viewport = $(instance).find('.item').slice(0, item_deficit); 677 if (additional_items_in_viewport.length) { 678 var items_in_viewport = $(items_in_viewport).add(additional_items_in_viewport); 679 } 680 } 681 } 682 683 $(window).trigger('resize'); 684 685 }); 686 687 // Event when slider stops moving completely 688 $(instance).on('settle.flickity', function() {
689 $('body').removeClass('slider-drag'); 690 window.site.slideshow.slider.after_change($(this)); 691 }); 692 693 // Event on a new slide being moved into view 694 $(instance).on('select.flickity', function() { 695 window.site.slideshow.slider.after_change($(this)); 696 }); 697 698 // Allow horizontal scrolling with mousewheel 699 $(instance).wheel(function(e) { 700 var instance = $(this).closest('.panel_type_records_slider').find('.records_list_inner'); 701 if ($('#container_outer').hasClass('not-scrolling')) { 702 if (e.deltaX > 5) { 703 if (!instance.hasClass('wheel-drag')) { 704 instance.addClass('wheel-drag'); 705 instance.flickity('next').trigger('dragEnd'); 706 setTimeout(function() { 707 instance.removeClass('wheel-drag'); 708 }, 800, instance); 709 } 710 } else if (e.deltaX < -5) { 711 if (!instance.hasClass('wheel-drag')) { 712 instance.addClass('wheel-drag'); 713 instance.flickity('previous').trigger('dragEnd'); 714 setTimeout(function() { 715 instance.removeClass('wheel-drag'); 716 }, 800, instance); 717 } 718 } 719 } 720 }); 721 722 // Fire events once initially to make sure processes have been run on the initial view before a transition has been made 723 $(instance).trigger('dragEnd.flickity'); 724 window.site.slideshow.slider.after_change($(instance), true); 725 } 726 727 728 }); 729 730 $('.records_list_slider.feature_list_slider .item').each(function() { 731 if ($('.content', this).index() == 0) { 732 $('.content', this).addClass('responsive-hidden'); 733 $(this).append('<div class="content responsive-only">' + $('.content', this).html() + '</div>'); 734 } 735 }); 736 737 738 }, 739 740 after_change: function(instance, forced) { 741 var flkty = $(instance).data('flickity'); 742 var target = flkty.selectedCell.target; 743 var caption = $(flkty.selectedCell.element).attr('data-caption'); 744 $(instance).closest('.records_list_slider').find('.records_list_slider_caption').html(''); 745 if (caption && typeof caption != 'undefined') { 746 $(instance).closest('.records_list_slider').find('.records_list_slider_caption').html(caption); 747 } 748 749 if (false) { 750 // Get tallest height *in viewport* and apply to all items 751 tallest_height = -1; 752 $('.item.visible .image', instance).each(function() { 753 $(this).css('height', ''); 754 tallest_height = tallest_height < parseInt($(this).attr('data-proportional-height')) ? parseInt($(this).attr('data-proportional-height')) : tallest_height; 755 }); 756 $('.item .image', instance).each(function() { 757 $(this).css('height', tallest_height + 'px'); 758 }); 759 } 760 761 if (false) { 762 // Not relevant because slider is continuous 763 if (!$(instance).closest('.records_list_slider').hasClass('slider_infinite')) { 764 if (target == flkty.cells[0].target) { 765 $(instance).closest('.records_list_slider').find('.pagination_controls .pagination_controls_prev').addClass('disabled'); 766 } else if (target == flkty.getLastCell().target) { 767 $(instance).closest('.records_list_slider').find('.pagination_controls .pagination_controls_next').addClass('disabled'); 768 } else { 769 // both buttons enabled 770 $(instance).closest('.records_list_slider').find('.pagination_controls .pagination_controls_prev').removeClass('disabled'); 771 $(instance).closest('.records_list_slider').find('.pagination_controls .pagination_controls_next').removeClass('disabled'); 772 } 773 } 774 } 775 } 776 777 }, 778 779 header: function() { 780 $('.full_feature_slideshow').each(function() { 781 if ($(this).find('> .item').length == 1) { 782 $(this).addClass('single-slide'); 783 } 784 var mastersettings = { 785 fx: 'fade', 786 speed: 600, 787 timeout: 6000, 788 pause: 0, 789 slides: '> .item', 790 autoHeight: 'calc', 791 swipe: true 792 } 793 $(this).cycle(mastersettings); 794 $('.pagination_controls .pagination_controls_prev', this).unbind().bind('click', function() { 795 $(this).closest('.content_slideshow').cycle('pause').cycle('prev'); 796 return false;
797 }); 798 $('.pagination_controls .pagination_controls_next', this).unbind().bind('click', function() { 799 $(this).closest('.content_slideshow').cycle('pause').cycle('next'); 800 return false; 801 }); 802 if ($(this).hasClass('content_slideshow_paused')) { 803 $(this).cycle('pause'); 804 } 805 806 $('.full_feature_slideshow_pagination .prev').click(function() { 807 $(this).closest('.full_feature_slideshow').cycle('pause'); 808 $(this).closest('.full_feature_slideshow').cycle('prev'); 809 }); 810 $('.full_feature_slideshow_pagination .next').click(function() { 811 $(this).closest('.full_feature_slideshow').cycle('pause'); 812 $(this).closest('.full_feature_slideshow').cycle('next'); 813 }); 814 }); 815 816 if ($('.full_feature_slideshow').length) { 817 $(document).one( 'keyup', function(e) { 818 if ( e.which == 9 && !e.target.form) { 819 $('.full_feature_slideshow').each(function() { 820 $(this).cycle('pause'); 821 }); 822 } 823 }); 824 } 825 }, 826 827 cascading: function() { 828 $('.content_slideshow').each(function() { 829 if ($(this).find('> .item').length == 1) { 830 $(this).addClass('single-slide'); 831 } 832 var mastersettings = { 833 fx: 'fade', 834 speed: 1200, 835 timeout: 3000, 836 pause: 0, 837 slides: '> .item', 838 autoHeight: 'calc', 839 swipe: true 840 } 841 $(this).cycle(mastersettings); 842 $('.pagination_controls .pagination_controls_prev', this).unbind().bind('click', function() { 843 $(this).closest('.content_slideshow').cycle('pause').cycle('prev'); 844 return false; 845 }); 846 $('.pagination_controls .pagination_controls_next', this).unbind().bind('click', function() { 847 $(this).closest('.content_slideshow').cycle('pause').cycle('next'); 848 return false; 849 }); 850 if ($(this).hasClass('content_slideshow_paused')) { 851 $(this).cycle('pause'); 852 } 853 }); 854 } 855 856 }, 857 858 video: { 859 860 init: function() { 861 862 // Object-fit for IE/Edge 863 objectFitVideos(); 864 865 if ($('body').fitVids) { 866 $('body').fitVids({ ignore: '.video_inline'}); 867 } 868 869 if (window.site.device.video_inline()) { 870 $('body').addClass('device-video-inline-enabled'); 871 } else { 872 $('body').addClass('device-video-inline-disabled'); 873 } 874 875 if (!window.site.device.video_inline()) { 876 $('body').addClass('device-video-fallback'); 877 } 878 879 $('.media_wrapper').each(function() { 880 var wrapper = $(this); 881 if (!$(this).hasClass('media_wrapper_has_canvas') || ($(this).hasClass('media_wrapper_has_canvas') && !window.site.device.canvas_enabled())){ 882 // Each media wrapper may be disabled if there is an outside alternative which is currently active (in this case, video within canvas) 883 if ($(this).hasClass('media_has_video') && window.site.device.video_mode()) { 884 if ($('video', this).length) { 885 $(this).addClass('video_loading'); 886 $('video', this).unbind().get(0).oncanplay = function() { 887 var instance = $(this); 888 window.setTimeout(function() { 889 instance.closest('.media_wrapper').addClass('video_can_start'); 890 instance.closest('.media_wrapper').removeClass('video_loading'); 891 wrapper.closest('.media_wrapper').addClass('media_started'); 892 }, 000, instance); 893 }; 894 } 895 window.setTimeout(function() { 896 if (!wrapper.hasClass('video_can_start')) { 897 wrapper.addClass('show_fallback'); 898 wrapper.closest('.media_wrapper').addClass('media_started'); 899 } 900 }, 1400, wrapper); 901 } else { 902 //wrapper.find('video').remove(); 903 if (wrapper.find('.slideshow').length) { 904 wrapper.addClass('show_slideshow'); 905 } else { 906 wrapper.addClass('show_fallback'); 907 } 908 wrapper.closest('.media_wrapper').addClass('media_started'); 909 } 910 } 911 }); 912 913 914 if (!window.site.device.video_mode()) { 915 916 video_fallback_html = '<div class="link video_fallback_button prevent_scroll"><span class="video_fallback_paused prevent_scroll">Play video</span><span class="video_fallback_play prevent_scroll">Stop video</span></div>'; 917 if ($('.media_wrapper .video_background video').length) { 918 $('.media_wrapper').append(video_fallback_html); 919 } 920 $('.video_fallback_button').unbind('click').bind('click', function() { 921 if (window.site.device.video_mode()) { 922 var section_element = $(this).closest('.media_wrapper'); 923 if (section_element.hasClass('video_fallback_playing')) { 924 section_element.find('.video_background video').get(0).pause(); 925 section_element.removeClass('video_fallback_playing'); 926 } else { 927 section_element.find('.video_background video').get(0).play(); 928 section_element.addClass('video_fallback_playing'); 929 } 930 } else { 931 var video_src = $(this).closest('.media_wrapper').find('.video_background video source').attr('src'); 932 var video_data_src = $(this).closest('section').find('.video_background video source').attr('data-src'); 933 if (video_src && typeof video_src != 'undefined') { 934 var video_file = video_src; 935 } else { 936 var video_file = video_data_src; 937 } 938 if (video_file && typeof video_file != 'undefined') { 939 window.open(video_file); 940 } 941 } 942 }); 943 } else { 944 video_loading_html = '<div class="video_loading_icon"><span class="loader"></span>Video loading</div>'; 945 if ($('.media_wrapper .video_background video').length) { 946 $('.media_wrapper .video_background').append(video_loading_html); 947 } 948 } 949 950 951 952 var vimeo_embeds = $('.video_embed_vimeo'); 953 vimeo_embeds.each(function() { 954 var player = $f(this); // Froogaloop selector 955 956 $(this).closest('.video_embed_wrapper').find('.video_embed_play').click(function() { 957 var player = $f($(this).closest('.video_embed_wrapper').find('iframe').get(0)); // Froogaloop selector 958 player.api("play"); 959 }); 960 $(this).closest('.video_embed_wrapper').find('.video_embed_pause').click(function() { 961 var player = $f($(this).closest('.video_embed_wrapper').find('iframe').get(0)); // Froogaloop selector 962 player.api("pause"); 963 }); 964 }); 965 966 } 967 968 }, 969 970 layout: { 971 972 init: function() { 973 window.site.layout.textillate(); 974 window.site.layout.grids.init(); 975 window.site.layout.feature_panels(); 976 window.site.layout.navigation(); 977 window.site.layout.hero.init(); 978 979 980 if ($('.scroll_section:eq(1)').length && !$('body').hasClass('section-artists') && !$('body').hasClass('section-exhibitions')) { 981 $('#hero .hero_nav').append('<button class="scroll_to_content clear_button_styles" aria-label="Scroll to content">Read more</button>'); 982 $('#hero .scroll_to_content').click(function() { 983 window.site.commands.scrollto($('.scroll_section:eq(1)').offset().top); 984 return false;
985 }); 986 } 987 988 989 $('#hero.hero_full_width .hero-inner').css('cursor', 'pointer').click(function() { 990 window.site.commands.scrollto($('.scroll_section_panels:eq(0)').offset().top); 991 }); 992 993 $('#main_content').css('min-height', window.site.layout.window_height()); 994 995 $('.notify_panel_mask').unbind().click(function() { 996 if ($('#store_quick_cart_widget').hasClass('active')) { 997 $('#sqcw_close').trigger('click'); 998 } 999 if ($('#wishlist_quick_cart_widget').hasClass('active')) { 1000 $('#wishlist_quick_cart_widget .notify_panel_close').trigger('click'); 1001 } 1002 if ($('.content-overlay').hasClass('active')) { 1003 $('.content-overlay .overlay-close-button').trigger('click'); 1004 } 1005 if ($('.enquire-overlay').hasClass('active')) { 1006 $('.enquire-overlay .enquire-close-button').trigger('click'); 1007 } 1008 }); 1009 1010 var timer, el = $('#container_outer'), flag = false; 1011 $(window).add('#popup_content').scroll(function() { 1012 var scrolling_element = $(this); 1013 if (!flag) { 1014 flag = true; 1015 //if (!$('body').hasClass('content-swipe')) { 1016 el.addClass('scrolling').removeClass('not-scrolling'); 1017 $(scrolling_element).addClass('scrolling').removeClass('not-scrolling'); 1018 //} 1019 } 1020 clearTimeout(timer); 1021 timer = setTimeout(function() { 1022 el.removeClass('scrolling').addClass('not-scrolling'); 1023 $(scrolling_element).removeClass('scrolling').addClass('not-scrolling'); 1024 flag = false; 1025 }, 300, scrolling_element); 1026 }); 1027 $('#container_outer').removeClass('scrolling').addClass('not-scrolling'); 1028 1029 $('#popup_content').bind('scroll', window.site.throttle(50, function() { 1030 if ($('#popup_content').scrollTop() > 10) { 1031 $('body').addClass('popup-scrolled'); 1032 $('body').removeClass('popup-not-scrolled'); 1033 } else { 1034 $('body').removeClass('popup-scrolled'); 1035 $('body').addClass('popup-not-scrolled'); 1036 } 1037 })); 1038 $('#popup_content').bind('scroll', window.site.debounce(200, function() { 1039 if ($('#popup_content').scrollTop() > 10) { 1040 $('body').addClass('popup-scrolled'); 1041 $('body').removeClass('popup-not-scrolled'); 1042 } else { 1043 $('body').removeClass('popup-scrolled'); 1044 $('body').addClass('popup-not-scrolled'); 1045 } 1046 })); 1047 1048 $('.search-overlay .overlay-container-inner').bind('scroll', window.site.throttle(50, function() { 1049 if ($('.search-overlay .overlay-container-inner').scrollTop() > 30) { 1050 $('body').addClass('popup-scrolled'); 1051 $('body').removeClass('popup-not-scrolled'); 1052 } else { 1053 $('body').removeClass('popup-scrolled'); 1054 $('body').addClass('popup-not-scrolled'); 1055 } 1056 })); 1057 $('.search-overlay .overlay-container-inner').bind('scroll', window.site.debounce(200, function() { 1058 if ($('.search-overlay .overlay-container-inner').scrollTop() > 30) { 1059 $('body').addClass('popup-scrolled'); 1060 $('body').removeClass('popup-not-scrolled'); 1061 } else { 1062 $('body').removeClass('popup-scrolled'); 1063 $('body').addClass('popup-not-scrolled'); 1064 } 1065 })); 1066 1067 if (!$('.scroll-container .faux_footer').length && $('#footer').length) { 1068 $('.scroll-container').append('<div class="faux_footer"></div>'); 1069 } 1070 1071 window.site.misc.extended_click_area(); 1072 1073 $(window).resize(function() { 1074 window.site.layout.resize(); 1075 }); 1076 window.site.layout.resize(); 1077 }, 1078 1079 resize: function() { 1080 1081 $('body').addClass('resizing'); 1082 1083 1084 if (false) { 1085 if (window.site.device.breakpoint() <= 3 || $('body').hasClass('section-contact')) { 1086 $('body').removeClass('fixed-footer'); 1087 $('#footer').css('min-height', '') 1088 $('.faux_footer').css('height', ''); 1089 } else { 1090 if ($('#footer .inner').outerHeight() <= $(window).height()) { 1091 $('body').addClass('fixed-footer'); 1092 $('#footer').each(function() { 1093 $(this).css('min-height', $('#footer .wrap_inner').height()); 1094 }); 1095 $('.faux_footer').each(function() { 1096 $(this).css('height', $('#footer .wrap_inner').height()); 1097 }); 1098 } else { 1099 $('body').removeClass('fixed-footer'); 1100 $('#footer').css('min-height', '') 1101 $('.faux_footer').css('height', ''); 1102 } 1103 } 1104 } 1105 1106 if ($('.subsection-store-basket').length) { 1107 var new_min_height = $(window).height(); 1108 $('#content_module').css('min-height', '0'); 1109 $('#sidebar').css('min-height', '0'); 1110 if ($('#sidebar').outerHeight() > $('#content_module').outerHeight()) { 1111 var sidebar_height = $('#sidebar').outerHeight(); 1112 if (sidebar_height > new_min_height) { 1113 var sidebar_height = sidebar_height; 1114 } 1115 } 1116 if ($('#content_module').outerHeight() > $('#sidebar').outerHeight()) { 1117 var content_height = $('#content_module').outerHeight(); 1118 if (content_height > new_min_height) { 1119 var new_min_height = content_height; 1120 } 1121 } 1122 $('#content_module, #sidebar').css('min-height', new_min_height); 1123 } 1124 1125 $('.feature_panels_sidebar_outer').each(function() { 1126 if ($('.feature_panels_sidebar', this).outerHeight() > $(window).height()) { 1127 $(this).closest('.scroll_section_panels').removeClass('feature_panels_sidebar_fixed'); 1128 } else { 1129 $(this).closest('.scroll_section_panels').addClass('feature_panels_sidebar_fixed'); 1130 } 1131 }); 1132 1133 if (typeof resizing_timeout != 'undefined') { 1134 clearTimeout(resizing_timeout); 1135 } 1136 resizing_timeout = setTimeout(function() { 1137 $('body').removeClass('resizing'); 1138 }, 600); 1139 }, 1140 1141 window_height: function() { 1142 var window_height = $(window).height(); 1143 var toolbar_height = $('body').hasClass('cms-frontend-toolbar-active') ? 28 : 0; 1144 return window_height - toolbar_height; 1145 }, 1146 1147 window_height_extended: function() { 1148 var extended_height = (window.site.layout.window_height() / 100) * 10; 1149 return window.site.layout.window_height() + extended_height; 1150 }, 1151 1152 feature_panels: function() { 1153 feature_panels_index = 0; 1154 $('.scroll_section_panels section').each(function() { 1155 feature_panels_index = feature_panels_index + 1; 1156 $(this).attr('data-scrollinner-index', feature_panels_index); 1157 $(this).addClass('panel_index_' + feature_panels_index); 1158 if ($('.panel_heading', this).length && !$('.panel_heading', this).hasClass('visually-hidden')) { 1159 $(this).addClass('has_panel_heading'); 1160 } 1161 }); 1162 }, 1163 1164 navigation: function() { 1165 1166 }, 1167 1168 grids: { 1169 1170 init: function() { 1171 1172 $('.records_grid').each(function() { 1173 var item_count = $(this).find('> ul > li, .item').length; 1174 $(this).addClass('records_grid_item_count_' + item_count); 1175 }); 1176 1177 $('.image_list ul li') 1178 .each(function() { 1179 if ($(this).find("video").length) { 1180 var el = $(this).find('video')[0]; 1181 el.currentTime = 0; 1182 el.pause(); 1183 } 1184 }) 1185 .hover(function () { 1186 if (!window.site.device.handheld()) { 1187 if ($(this).find("video").length) { 1188 var el = $(this).find('video')[0]; 1189 el.currentTime = 0; 1190 el.play(); 1191 $(this).addClass('video-reveal'); 1192 } 1193 } 1194 }, function () { 1195 if (!window.site.device.handheld()) { 1196 $(this).removeClass('video-reveal'); 1197 if ($(this).find("video").length) { 1198 var el = $(this).find('video')[0]; 1199 el.pause(); 1200 } 1201 } 1202 }) 1203 ; 1204 1205 $('.column_list').each(function() { 1206 $(this).delay(500).queue(function() { 1207 $('.column_list ul:not(.visible)').each(function(i){ 1208 var $item = $(this); 1209 setTimeout(function() { 1210 $item.addClass('visible'); 1211 }, 200*i); 1212 }); 1213 $(this).clearQueue(); 1214 }); 1215 }); 1216 1217 $('.text_columns').each(function() { 1218 $('.content_extended_text', this).each(function() { 1219 if ($(this).closest('.content').find('.content_reveal_more_link button').length) { 1220 $(this).closest('.content').addClass('extended_text_hidden'); 1221 $(this).closest('.content').find('.content_reveal_more_link button').unbind().click(function() { 1222 $(this).closest('.content').removeClass('extended_text_hidden'); 1223 $(this).closest('.content').addClass('extended_text_show'); 1224 $(this).closest('.content').find('.content_extended_text .inner').focus(); 1225 1226 return false;
1227 }); 1228 } 1229 }); 1230 }); 1231 1232 $('.records_grid.tile_grid').each(function() { 1233 if (!$('.tile_grid_original', this).length) { 1234 var original_html = $(this).html(); 1235 $(this).html(''); 1236 $(this).append('<div class="tile_grid_formatted"></div>'); 1237 $(this).append('<div class="tile_grid_original"></div>'); 1238 $('.tile_grid_original', this).html(original_html).css('visibility', 'hidden'); 1239 } 1240 }); 1241 1242 window.site.layout.grids.resize(); 1243 setTimeout(function() { 1244 window.site.layout.grids.resize(); 1245 }, 200); 1246 1247 var grids_resize_viewport_width = $(window).width(); 1248 $(window).on('resize', function(){ 1249 if ($(this).width() != grids_resize_viewport_width){ 1250 grids_resize_viewport_width = $(this).width(); 1251 window.site.layout.grids.resize(); 1252 } 1253 }); 1254 1255 $('.records_grid.tile_grid') 1256 .each(function() { 1257 if ($('.tile_grid_formatted .item.revealable', this).length) { 1258 if (!$(this).find('.panel_footer_revealable_link').length) { 1259 $(this).append('<div class="panel_footer panel_footer_revealable_link"><div class="button link_more"><button>
1259View more</button></div></div>'); 1260 $(this).find('.link_more button').click(function() { 1261 var link_original_top_offset = $(this).offset().top - ($(window).height() / 2); 1262 var current_offset_top = $(window).scrollTop() - ($(window).height() / 2); 1263 var items_to_reveal = ($(this).closest('.records_grid').attr('data-rows-to-reveal') && typeof $(this).closest('.records_grid').attr('data-rows-to-reveal') != 'undefined' ? $(this).closest('.records_grid').attr('data-rows-to-reveal') : 6); 1264 if (window.site.device.breakpoint() <= 2) { 1265 var items_to_reveal = parseInt(items_to_reveal) * 2; 1266 } 1267 $('body').addClass('scroll_event_disabled, window-forced-scroll-up'); 1268 1269 // Extend the height of the container for a smoother opening effect 1270 var containing_group = $(this).closest('.records_grid').find('.tile_grid_formatted'); 1271 var new_row_to_be_revealed = $(this).closest('.records_grid').find('.item.revealable').filter(':eq(0)'); 1272 var containing_group_new_height = containing_group.height() + (new_row_to_be_revealed.height() * items_to_reveal); 1273 containing_group.css('height', containing_group.height()); 1274 1275 window.setTimeout(function() { 1276 containing_group.css('height', containing_group_new_height); 1277 }, 20, containing_group); 1278 1279 // Reveal the items 1280 $(this).closest('.tile_grid').find('.tile_grid_formatted > .group').each(function() { 1281 $('.item.revealable:lt(' + items_to_reveal + ')', this).removeClass('revealable'); 1282 }); 1283 var remaining_revealable_items = $(this).closest('.tile_grid').find('.tile_grid_formatted > .group .item.revealable', this).length; 1284 if (remaining_revealable_items == 0) { 1285 $(this).closest('.panel_footer_revealable_link').addClass('disabled'); 1286 } 1287 1288 window.site.commands.scrollto(link_original_top_offset, function() { 1289 window.setTimeout(function() { 1290 $('body').removeClass('scroll_event_disabled, window-forced-scroll-up'); 1291 $(new_row_to_be_revealed[0]).find('.content a, .caption a').focus(); 1292 }, 500); 1293 $(window).trigger('scroll'); 1294 window.setTimeout(function() { 1295 containing_group.css('height', ''); 1296 }, 20, containing_group); 1297 }); 1298 return false; 1299 }); 1300 } 1301 } 1302 }) 1303 ; 1304 1305 // Progressive grid format 1306 1307 $('.records_grid.progressive_grid').each(function() { 1308 if ($('.item.revealable', this).length) { 1309 if (!$(this).find('.panel_footer_revealable_link').length) { 1310 $(this).append('<div class="panel_footer panel_footer_revealable_link"><div class="link alt link_more"><a href="#">View more</a></div></div>'); 1311 $(this).find('.link_more a').unbind('click.records_grid').bind('click.records_grid', function() { 1312 var link_original_top_offset = $(this).offset().top - ($(window).height() / 4); 1313 var rows_to_reveal = ($(this).closest('.records_grid').attr('data-rows-to-reveal') && typeof $(this).closest('.records_grid').attr('data-rows-to-reveal') != 'undefined' ? $(this).closest('.records_grid').attr('data-rows-to-reveal') : 6); 1314 if (window.site.device.breakpoint() == 1) { 1315 var rows_to_reveal = rows_to_reveal * 2; 1316 } 1317 var current_visible_row = $(this).closest('.records_grid').find('.item').not('.revealable').last().attr('data-row-number'); 1318 $('body').addClass('scroll_event_disabled'); 1319 1320 // Extend the height of the container for a smoother opening effect 1321 var containing_group = $(this).closest('.records_grid').find('.group'); 1322 var new_row_to_be_revealed = $(this).closest('.records_grid').find('.item.revealable').filter(':eq(0)'); 1323 var containing_group_new_height = containing_group.height() + (new_row_to_be_revealed.height() * rows_to_reveal); 1324 containing_group.css('height', containing_group.height()); 1325 window.setTimeout(function() { 1326 containing_group.css('height', containing_group_new_height); 1327 }, 20, containing_group); 1328 1329 // Reveal the items 1330 $(this).closest('.records_grid').each(function() { 1331 for(var i=0; i < rows_to_reveal; i++){ 1332 var row_index = parseInt(current_visible_row) + (i + 1); 1333 $('.item.revealable[data-row-number="' + row_index + '"]', this).addClass('revealed').removeClass('revealable'); 1334 } 1335 }); 1336 var remaining_revealable_items = $(this).closest('.records_grid').find('.item.revealable', this).length; 1337 if (remaining_revealable_items == 0) { 1338 $(this).closest('.panel_footer_revealable_link').addClass('disabled'); 1339 } 1340 1341 window.site.commands.scrollto(link_original_top_offset, function() { 1342 $('body').removeClass('scroll_event_disabled'); 1343 $(window).trigger('scroll'); 1344 containing_group.css('height', ''); 1345 }); 1346 1347 $(window).trigger('resize'); 1348 return false;
1349 }); 1350 } 1351 } 1352 }); 1353 1354 1355 // Aligned grid format 1356 1357 $('.records_grid.detail_grid, .records_grid.aligned_grid, .records_list_slider').each(function() { 1358 if ($('.item.revealable', this).length) { 1359 if (!$(this).find('.panel_footer_revealable_link').length) { 1360 $(this).append('<div class="panel_footer panel_footer_revealable_link"><div class="button link_more"><a href="#">View more</a></div></div>'); 1361 $(this).find('.link_more a').unbind('click.records_grid').bind('click.records_grid', function() { 1362 var link_original_top_offset = $(this).offset().top - ($(window).height() / 4); 1363 var rows_to_reveal = ($(this).closest('.records_grid').attr('data-rows-to-reveal') && typeof $(this).closest('.records_grid').attr('data-rows-to-reveal') != 'undefined' ? $(this).closest('.records_grid').attr('data-rows-to-reveal') : 6); 1364 if (window.site.device.breakpoint() == 1) { 1365 var rows_to_reveal = rows_to_reveal * 2; 1366 } 1367 var current_visible_row = $(this).closest('.records_grid').find('.item').not('.revealable').last().attr('data-row-number'); 1368 $('body').addClass('scroll_event_disabled'); 1369 $(this).closest('.records_grid').each(function() { 1370 for(var i=0; i < rows_to_reveal; i++){ 1371 var row_index = parseInt(current_visible_row) + (i + 1); 1372 $('.item.revealable[data-row-number="' + row_index + '"]', this).addClass('revealed').removeClass('revealable'); 1373 } 1374 }); 1375 var remaining_revealable_items = $(this).closest('.records_grid').find('.item.revealable', this).length; 1376 if (remaining_revealable_items == 0) { 1377 $(this).closest('.panel_footer_revealable_link').addClass('disabled'); 1378 } 1379 1380 window.site.commands.scrollto(link_original_top_offset, function() { 1381 $('body').removeClass('scroll_event_disabled'); 1382 $(window).trigger('scroll'); 1383 }); 1384 1385 $(window).trigger('resize'); 1386 return false; 1387 }); 1388 } 1389 } 1390 }); 1391 1392 }, 1393 1394 resize: function() { 1395 1396 $('.image_list, .records_grid.medium_grid, .records_grid.standard_grid_high_volume, .records_grid.detail_grid, .records_grid.large_grid, .records_grid.full_grid, .records_grid.full_feature, #artist_image_preview').each(function() { 1397 $('.item', this).each(function() { 1398 $(this).addClass('force_show'); 1399 var item_width = $(this).find('.image').width(); 1400 var unrestricted_height = $(this).attr('data-unrestricted-height') && typeof $(this).attr('data-unrestricted-height') != 'undefined' ? true: false; 1401 var image_width = $(this).attr('data-width'); 1402 var image_height = $(this).attr('data-height'); 1403 var image_width_proportional = 0; 1404 var image_height_proportional = 0; 1405 console.log($(this).find('img').css('max-height')); 1406 if (image_width && image_height) { 1407 var image_width_proportional = item_width / image_width; 1408 var image_height_proportional = image_height * image_width_proportional; 1409 if ($(this).find('img').length) { 1410 if ($(this).find('img').css('max-height')) { 1411 var image_max_height = $(this).find('img').css('max-height'); 1412 if (parseInt(image_max_height) < parseInt(image_height_proportional)) { 1413 var image_height_proportional = image_max_height 1414 } 1415 } 1416 } 1417 $(this).find('.image').not('.has_video').find('img').css('max-height', ''); 1418 if (image_height_proportional > item_width && !unrestricted_height) { 1419 // Set a maximum height based on a square proportion 1420 var image_height_proportional = item_width; 1421 $(this).find('.image').not('.has_video').css('max-height', image_height_proportional); 1422 $(this).find('.image').not('.has_video').find('img').css('max-height', image_height_proportional); 1423 } 1424 if (image_height_proportional) { 1425 $(this).find('.image').not('.has_video').css('min-height', image_height_proportional); 1426 } 1427 } 1428 $(this).removeClass('force_show'); 1429 }); 1430 }); 1431 1432 1433 $('.records_grid.tile_grid').each(function() { 1434 1435 if ($('.tile_grid_original .group', this).length) { 1436 1437 // Check if the script has already been run before and set variables 1438 if ($(this).hasClass('initialised')) { 1439 init_rerun = true; 1440 existing_formatted_list_column_count = $('.tile_grid_formatted .group', this).length; 1441 } else { 1442 $(this).addClass('initialised'); 1443 init_rerun = false;
1444 } 1445 1446 // Start initialising the new list 1447 1448 init_allowed = true; 1449 1450 $('.tile_grid_original', this).removeClass('hidden'); 1451 1452 tile_list_instance = $(this); 1453 tile_list_width = $(this).width(); 1454 tile_list_column_width = Math.floor($('.tile_grid_original .group', this)[0].getBoundingClientRect().width + parseInt($('.tile_grid_original .group', this).css('margin-left')) + parseInt($('.tile_grid_original .group', this).css('margin-right'))); 1455 var column_count = 3; 1456 var column_count_calculated = Math.floor(tile_list_width / tile_list_column_width); 1457 if (column_count_calculated < 7) { 1458 var column_count = column_count_calculated; 1459 } 1460 1461 if (init_rerun) { 1462 // If the script is being run again, check if the column count is different to before. If not, stop the list from being rebuilt. 1463 if (existing_formatted_list_column_count == column_count) { 1464 init_allowed = false; 1465 } 1466 } 1467 1468 if (init_allowed) { 1469 var columns = {} 1470 var fixed_list_order = $(this).closest('.tile_grid').attr('data-list-order') == 'fixed' ? true : false; 1471 column_loop = 0; 1472 column_count = Array(column_count).length; 1473 $.each(Array(column_count), function(index, value) { 1474 var this_height = 0; 1475 columns[index] = {'height': this_height, 'objects': []}; 1476 }); 1477 $('.tile_grid_original .item', this).each(function() { 1478 var content_height = $(this).find('.area').height(); 1479 var item_index = $(this).index()+1; 1480 var total_item_count = $('.tile_grid_original .item').length; 1481 if (!$(this).attr('data-width') || !$(this).attr('data-height')) { 1482 $(this).attr('data-width', '400'); 1483 $(this).attr('data-height', '400'); 1484 console.log('Width and height of each image is required as a data attribute for this script work.'); 1485 } 1486 var height_to_width_factor = parseInt($(this).attr('data-width')) / tile_list_column_width; 1487 var relative_item_height = Math.ceil(parseInt($(this).attr('data-height')) / height_to_width_factor); 1488 1489 if (Object.keys(columns).length) { 1490 if (fixed_list_order) { 1491 // Fixed order, do not automatically find lowest height 1492 lowest_height_index = column_loop; 1493 column_loop = column_loop + 1; 1494 if (column_loop >= column_count) { 1495 column_loop = 0; 1496 } 1497 } else { 1498 // Dynamic order based on shortest column height 1499 lowest_height_index = 0; 1500 loop_current_lowest_height = columns[0]['height']; 1501 $.each(columns, function(index, value) { 1502 if (item_index == total_item_count && total_item_count > 3) { 1503 // If last item, behave in a different way 1504 // It is more likely the item should be placed on the left hand side 1505 // Check the final height 'after' the item would be placed to determine if it should revert to the first column 1506 if (index == 0) { 1507 lowest_height_index = index; 1508 loop_current_lowest_height = value.height; 1509 } 1510 var first_column_height = columns[0].height; 1511 if ((value.height + (relative_item_height * 0.2) < loop_current_lowest_height)) { 1512 lowest_height_index = index; 1513 loop_current_lowest_height = value.height; 1514 } 1515 } else { 1516 if ((value.height < loop_current_lowest_height)) { 1517 lowest_height_index = index; 1518 loop_current_lowest_height = value.height; 1519 } 1520 } 1521 }); 1522 } 1523 columns[lowest_height_index]['height'] = columns[lowest_height_index]['height'] + relative_item_height + content_height; 1524 columns[lowest_height_index]['objects'].push($(this).clone().find('.video_inline').remove().end()); 1525 } 1526 }); 1527 1528 $('.tile_grid_formatted', tile_list_instance).html(''); 1529 $.each(columns, function(index, value) { 1530 $('.tile_grid_formatted', tile_list_instance).append('<div class="group"></div>'); 1531 $('.tile_grid_formatted', tile_list_instance).find('.group:last-child').append(value.objects); 1532 }); 1533 $('.tile_grid_formatted', tile_list_instance).find('.group:last-child').addClass('last'); 1534 1535 $('.tile_grid_formatted', tile_list_instance).find('.group').each(function() { 1536 var column_count = $(this).closest('.tile_grid_formatted').find('.group').length; 1537 if ($(this).closest('.tile_grid').attr('data-initial-items') == '0') { 1538 1539 } else if (parseInt($(this).closest('.tile_grid').attr('data-initial-rows'))) { 1540 var initial_items = $(this).closest('.tile_grid').attr('data-initial-rows'); 1541 var initial_items_per_column = parseInt(initial_items); 1542 if (window.site.device.breakpoint() <= 2) { 1543 var initial_items_per_column = parseInt(initial_items_per_column) * 2; 1544 } 1545 $('.item', this).addClass('revealable'); 1546 $('.item:lt(' + initial_items_per_column + ')', this).removeClass('revealable'); 1547 } else { 1548 var initial_items_per_column = window.site.lists.tile_list_options().initial_items_per_column; 1549 if (window.site.device.breakpoint() <= 2) { 1550 var initial_items_per_column = parseInt(initial_items_per_column) * 2; 1551 } 1552 $('.item', this).addClass('revealable'); 1553 $('.item:lt(' + initial_items_per_column + ')', this).removeClass('revealable'); 1554 } 1555 }); 1556 1557 // Re-initialise functions necessary on the newly created tile list 1558 window.site.artlogic_inview.init(); 1559 $.pageload.refresh(tile_list_instance); 1560 window.site.overlays.enquire.setup(); 1561 window.cart.add_to_cart($(tile_list_instance).find('.store_item .store_item_add_to_cart')); 1562 window.cart.add_to_wishlist($(tile_list_instance).find('.add_to_wishlist')); 1563 window.cart.remove_from_wishlist($(tile_list_instance).find('.store_item_remove_from_wishlist')); 1564 $(".extended_click_area").removeClass('click_event_added') 1565 window.site.misc.extended_click_area(); 1566 } 1567 1568 $('.tile_grid_original', this).addClass('hidden'); 1569 } 1570 1571 // Set the heights of each image based on the proportion, this defines the available area before the images have loaded 1572 $('.tile_grid_formatted .item', this).each(function() { 1573 var item_width = $(this).find('.image').width(); 1574 var image_width = $(this).attr('data-width'); 1575 var image_height = $(this).attr('data-height'); 1576 var image_width_proportional = 0; 1577 var image_height_proportional = 0; 1578 if (image_width && image_height) { 1579 var image_width_proportional = item_width / image_width; 1580 var image_height_proportional = image_height * image_width_proportional; 1581 if ($(this).find('img').length) { 1582 if ($(this).find('img').css('max-height')) { 1583 var image_max_height = $(this).find('img').css('max-height'); 1584 if (parseInt(image_max_height) < parseInt(image_height_proportional)) { 1585 var image_height_proportional = image_max_height 1586 } 1587 } 1588 } 1589 if (image_height_proportional) { 1590 $(this).find('.image').css('min-height', image_height_proportional); 1591 } 1592 } 1593 }); 1594 1595 if (false) { 1596 // If there are as many or less items than there are columns, align the items by the bottom of each image 1597 if ($('.tile_grid_formatted .group', this).length >= $('.tile_grid_formatted .item', this).length) { 1598 $('.tile_grid_formatted .item', this).each(function() { 1599 var this_image_height = $(this).find('.image').height(); 1600 $(this).closest('.tile_grid_formatted').find('.item').each(function() { 1601 if ($(this).find('.image').height() < this_image_height) { 1602 $(this).find('.image').css('min-height', this_image_height); 1603 } 1604 }); 1605 }); 1606 } 1607 } 1608 }); 1609 1610 1611 // Detail grid 1612 1613 $('.records_grid.detail_grid, .records_grid.aligned_grid').each(function() { 1614 initial_rows = $(this).attr('data-initial-rows') && typeof $(this).attr('data-initial-rows') != 'undefined' ? $(this).attr('data-initial-rows') : false;
1615 if (window.site.device.breakpoint() <= 2) { 1616 initial_rows = parseInt(initial_rows) * 4; 1617 } 1618 1619 row_number = 0; 1620 row_offset = 0; 1621 1622 $('.item', this).each(function() { 1623 // Find adjacent elements 1624 1625 $(this).addClass('force_show'); 1626 var offset_top = $(this).offset().top; 1627 var this_image_height = $(this).find('.image').height(); 1628 if (offset_top > row_offset) { 1629 row_number = row_number + 1; 1630 row_offset = offset_top; 1631 } 1632 $(this).attr('data-row-number', row_number); 1633 $(this).removeClass('force_show'); 1634 }); 1635 $('.item', this).not('.revealed').each(function() { 1636 // Hide revealable elements 1637 1638 var row_number = $(this).attr('data-row-number'); 1639 if (row_number && parseInt(row_number) > parseInt(initial_rows)) { 1640 $(this).addClass('revealable'); 1641 } 1642 }); 1643 }); 1644 1645 1646 // Progressive grid format 1647 1648 $('.records_grid.progressive_grid').each(function() { 1649 1650 initial_rows = $(this).attr('data-initial-rows') && typeof $(this).attr('data-initial-rows') != 'undefined' ? $(this).attr('data-initial-rows') : false; 1651 if (window.site.device.breakpoint() <= 2) { 1652 initial_rows = parseInt(initial_rows) * 4; 1653 } 1654 row_number = 0; 1655 row_offset = 0; 1656 1657 $('.item', this).each(function() { 1658 var item_width = $(this).find('.image').width(); 1659 var image_width = $(this).attr('data-width'); 1660 var image_height = $(this).attr('data-height'); 1661 var image_width_proportional = 0; 1662 var image_height_proportional = 0; 1663 if (image_width && image_height) { 1664 var image_width_proportional = item_width / image_width; 1665 var image_height_proportional = image_height * image_width_proportional; 1666 if (image_height_proportional) { 1667 $(this).find('.image').css('min-height', image_height_proportional); 1668 } 1669 } 1670 $(this).removeClass('revealable'); 1671 }); 1672 1673 $('.item', this).each(function() { 1674 // Find adjacent elements 1675 1676 $(this).addClass('parallax-resizing'); 1677 var offset_top = $(this).offset().top; 1678 var this_image_height = $(this).find('.image').height(); 1679 if (offset_top > row_offset) { 1680 row_number = row_number + 1; 1681 row_offset = offset_top; 1682 } 1683 $(this).attr('data-row-number', row_number); 1684 $(this).removeClass('parallax-resizing'); 1685 }); 1686 $('.item', this).not('.revealed').each(function() { 1687 // Hide revealable elements 1688 1689 var row_number = $(this).attr('data-row-number'); 1690 if (row_number && parseInt(row_number) > parseInt(initial_rows)) { 1691 $(this).addClass('revealable'); 1692 } 1693 }); 1694 }); 1695 1696 1697 // Records list slider 1698 1699 $('.records_list_slider').each(function() { 1700 1701 initial_rows = $(this).attr('data-initial-rows') && typeof $(this).attr('data-initial-rows') != 'undefined' ? $(this).attr('data-initial-rows') : false; 1702 row_number = 0; 1703 row_offset = 0; 1704 tallest_image = 0; 1705 1706 $('.item', this).each(function() { 1707 $(this).removeClass('revealable'); 1708 var item_width = $(this).find('.image').width(); 1709 var image_width = $(this).attr('data-width'); 1710 var image_height = $(this).attr('data-height'); 1711 var image_width_proportional = 0; 1712 var image_height_proportional = 0; 1713 if (image_width && image_height) { 1714 var image_width_proportional = item_width / image_width; 1715 var image_height_proportional = image_height * image_width_proportional; 1716 if (image_height_proportional) { 1717 $(this).find('.image').css('height', image_height_proportional); 1718 $(this).find('.image').attr('data-proportional-height', image_height_proportional); 1719 } 1720 if (image_height_proportional > tallest_image) { 1721 tallest_image = image_height_proportional; 1722 } 1723 } 1724 }); 1725 $('.item', this).each(function() { 1726 $(this).find('.image').css('height', tallest_image); 1727 }); 1728 $('.item', this).not('.revealed').each(function() { 1729 // Hide revealable elements 1730 1731 var row_number = $(this).attr('data-row-number'); 1732 if (row_number && parseInt(row_number) > parseInt(initial_rows)) { 1733 $(this).addClass('revealable'); 1734 } 1735 }); 1736 }); 1737 1738 1739 1740 $('.works_grid .item, .standard_grid .item, .medium_grid .item, .large_grid .item').unbind() 1741 // tile mouse actions 1742 .on('mouseover', function(){ 1743 var image_width = $(this).find('.image').width(); 1744 var scale = '1.02'; 1745 if (image_width > 400) { 1746 var scale = '1.01'; 1747 } 1748 if (image_width > 600) { 1749 var scale = '1.05'; 1750 } 1751 //$(this).find('.image img').css({'transform': 'scale(' + scale + ')'}); 1752 }) 1753 .on('mouseout', function(){ 1754 //$(this).find('.image img').css({'transform': 'scale(1)'}); 1755 }) 1756 .on('mousemove', function(e){ 1757 // Move image around when moving the mouse $(this).find('.image img').css({'transform-origin': ((e.pageX - $(this).offset().left) / $(this).width()) * 100 + '% ' + ((e.pageY - $(this).offset().top) / $(this).height()) * 100 +'%'}); 1758 }) 1759 ; 1760 1761 }, 1762 1763 tile_list_append_refresh: function(tile_list_instance) { 1764 // console.log(tile_list_instance); 1765 //Refreshes the visible tile list (tile_list_formatted) after manually appending list items to the tile_list_original, for example after list-ajax-load-more button is used 1766 var column_count = tile_list_instance.find('.tile_grid_formatted .group').length; 1767 var $tile_list_formatted = $('.tile_grid_formatted', tile_list_instance); 1768 1769 var columns = {} 1770 $.each(Array(column_count), function(index, value) { 1771 columns[index] = {'height': 0, 'objects': []}; 1772 }); 1773 1774 1775 // Work out columns with all items in tile_list_original, not just the incoming ones. 1776 // This ensures that we retain all of the correct column heights - exactly as if we were building the list from scratch. 1777 1778 //TODO this code that sorts items into columns is basically a duplication of the same funcationality in tile_list_init. 1779 $('.tile_grid_original .item', tile_list_instance).each(function(index) { 1780 1781 if ($(this).attr('data-width') && $(this).attr('data-height')) { 1782 var data_width = $(this).attr('data-width'); 1783 var data_height = $(this).attr('data-height'); 1784 } else { 1785 var data_width, data_height = '400'; 1786 console.warn('tile_list_init: Width and height of each image is required as a data attribute for this script to work.'); 1787 } 1788 var height_to_width_factor = parseInt(data_width) / tile_list_column_width;
1789 var relative_item_height = Math.ceil(parseInt(data_height) / height_to_width_factor); 1790 var lowest_height_index = 0; 1791 if (columns[0] && typeof columns[0] != 'undefined') { 1792 var loop_current_lowest_height = columns[0]['height']; 1793 $.each(columns, function(index, value) { 1794 if ((value.height < loop_current_lowest_height)) { 1795 lowest_height_index = index; 1796 loop_current_lowest_height = value.height; 1797 } 1798 }); 1799 columns[lowest_height_index]['height'] = columns[lowest_height_index]['height'] + relative_item_height; 1800 columns[lowest_height_index]['objects'].push($(this).clone().find('.video_inline').remove().end()); 1801 } 1802 }); 1803 1804 1805 $.each(columns, function(index, value) { 1806 1807 var $formatted_column = $tile_list_formatted.find('.group:eq('+index+')'); 1808 1809 //Check how many items are already in the visible column 1810 var existing_items_in_visible_col = $formatted_column.find('.item').length; 1811 1812 //Append all items in column object from the existing length to the total length 1813 $formatted_column.append(value.objects.slice( existing_items_in_visible_col, value.objects.length)); 1814 1815 $tile_list_formatted.find('.video_inline').remove(); 1816 $tile_list_formatted.find('.item').each(function() { 1817 //window.galleries.responsive.set_item_min_height($(this)); 1818 }); 1819 1820 }); 1821 1822 } 1823 1824 }, 1825 1826 textillate: function() { 1827 1828 $('.xtext_animate').textillate({ 1829 // the default selector to use when detecting multiple texts to animate 1830 selector: '.texts', 1831 1832 // enable looping 1833 loop: false, 1834 1835 // sets the minimum display time for each text before it is replaced 1836 minDisplayTime: 2000, 1837 1838 // sets the initial delay before starting the animation 1839 // (note that depending on the in effect you may need to manually apply 1840 // visibility: hidden to the element before running this plugin) 1841 initialDelay: 0, 1842 1843 // set whether or not to automatically start animating 1844 autoStart: true, 1845 1846 // in animation settings 1847 in: { 1848 // set the effect name 1849 effect: 'fadeInDown', 1850 1851 // set the delay between each character 1852 delay: 12, 1853 1854 // set to true to animate all the characters at the same time 1855 sync: false, 1856 1857 // randomize the character sequence 1858 // (note that shuffle doesn't make sense with sync = true) 1859 shuffle: false, 1860 1861 // reverse the character sequence 1862 // (note that reverse doesn't make sense with sync = true) 1863 reverse: false, 1864 1865 // callback that executes once the animation has finished 1866 callback: function () {} 1867 }, 1868 1869 // out animation settings. 1870 out: { 1871 // set the effect name 1872 effect: 'fadeOutUp', 1873 1874 // set the delay between each character 1875 delay: 3, 1876 sync: false, 1877 shuffle: false, 1878 reverse: false, 1879 callback: function () {} 1880 }, 1881 1882 // callback that executes once textillate has finished 1883 callback: function () {}, 1884 1885 // set the type of token to animate (available types: 'char' and 'word') 1886 type: 'char' 1887 }); 1888 1889 }, 1890 1891 hero: { 1892 1893 init: function() { 1894 1895 $('#hero').each(function() { 1896 1897 $('#hero .slide .image').each(function() { 1898 var related_link = $(this).closest('.slide').find('a:eq(0)'); 1899 if (related_link && typeof related_link != 'undefined' && related_link.length) { 1900 $(this).css('cursor', 'pointer').unbind('click').bind('click', function() { 1901 related_link.trigger('click'); 1902 }); 1903 } 1904 }); 1905 1906 $('#hero .content .content_header h1, #hero .content .content_header .faux_h1').each(function() { 1907 var context = $('.h1_heading', this).length ? $('.h1_heading', this) : $(this); 1908 var trimmed_text = $.trim($(context).text().replace(/ /g, '').replace(/(\r\n|\n|\r)/gm, "")); 1909 if (trimmed_text.length > 62) { 1910 $(this).addClass('text-length-4 text-length-limit-active'); 1911 } else if (trimmed_text.length > 42) { 1912 $(this).addClass('text-length-3 text-length-limit-active'); 1913 } else if (trimmed_text.length > 22) { 1914 $(this).addClass('text-length-2 text-length-limit-active'); 1915 } 1916 }); 1917 1918 scroll_to_content = function() { 1919 var scroll_offset = $('.scroll_section').not('.scroll_section_top').filter(':eq(0)').offset().top - ($(window).height() * 0.05); 1920 setTimeout(function() { 1921 $('html, body').on('scroll mousedown wheel DOMMouseScroll mousewheel keyup touchmove', function(){ 1922 $('html, body').stop(); 1923 }); 1924 }, 400); 1925 $('html, body').animate({'scrollTop': scroll_offset}, 1200, 'easeInOutExpo', function() { 1926 $('html, body').off('scroll mousedown wheel DOMMouseScroll mousewheel keyup touchmove'); 1927 }); 1928 }; 1929 $('#hero .scroll').click(function() { 1930 scroll_to_content(); 1931 return false;
1932 }); 1933 1934 $('#hero .arrow').click(function() { 1935 scroll_to_content(); 1936 return false; 1937 }); 1938 }); 1939 1940 } 1941 1942 } 1943 1944 }, 1945 1946 scroll: { 1947 1948 smooth_scroll_enabled: false, // true 1949 smooth_scroll_active: false, 1950 1951 settings: { 1952 'scroll_section_elements': '.scroll-section', 1953 'scroll_parallax_elements': '.scroll-parallax', // Enable parallax functionality on these elements 1954 'scroll_parallax_overflow_elements': '.scroll-parallax-overflow' // List parallax elements which need to overflow e.g. full screen backgrounds 1955 }, 1956 1957 init: function() { 1958 window.site.scroll.layout(); 1959 window.site.scroll.smooth_scroll.init(); 1960 window.site.scroll.events.init(); 1961 window.site.scroll.navigation(); 1962 window.site.scroll.dropdown_navigation.init(); 1963 }, 1964 1965 layout: function() { 1966 1967 curslide = 0; 1968 1969 last_scroll_position = $(window).scrollTop(); 1970 $('#container_outer').removeClass('scrolling-down scrolling-up'); 1971 1972 $('.pageload-content-area').each(function() { 1973 scroll_section_index = 0; 1974 $('.scroll_section', this).each(function() { 1975 //$(this).css('min-height', window.site.layout.window_height()); 1976 scroll_section_index = scroll_section_index + 1; 1977 $(this).attr('data-scrollinner-index', scroll_section_index); 1978 $(this).addClass('section_index_' + scroll_section_index); 1979 }); 1980 }); 1981 1982 if (typeof page_intro_timeout != 'undefined') { 1983 clearTimeout(page_intro_timeout); 1984 clearTimeout(page_intro_timeout2); 1985 } 1986 $('#container_outer').addClass('page-intro page-intro-start'); 1987 page_intro_timeout = setTimeout(function() { 1988 $('#container_outer').addClass('page-intro-1'); 1989 }, 400); 1990 page_intro_timeout = setTimeout(function() { 1991 $('#container_outer').removeClass('page-intro-start'); 1992 }, 1800); 1993 page_intro_timeout2 = setTimeout(function() { 1994 $('#container_outer').removeClass('page-intro page-intro-1 page-intro-start'); 1995 }, 2800); 1996 1997 $('#container') 1998 .addClass('scroll-section-setup') 1999 .delay(1000) 2000 .queue(function () { 2001 $('#container') 2002 .removeClass('scroll-section-setup') 2003 ; 2004 $(this).dequeue(); 2005 }) 2006 ; 2007 2008 loopcount = 0; 2009 $('.scroll_section').each(function(i) { 2010 $(this).attr('data-scroll-index', i+1); 2011 if (parseInt($(this).offset().top) == $(window).scrollTop()) { 2012 $(this).addClass('active active_completed'); 2013 } 2014 }); 2015 }, 2016 2017 events: { 2018 2019 init: function() { 2020 2021 $('#container_outer').removeClass('page-top-proximity page-top-visible'); 2022 2023 last_scroll_position = 0; 2024 scrolling_down_offset = 50; 2025 // This improves scroll performance in chrome, why? 2026 $(window).bind('scroll', function() { 2027 if ($('.artwork_hero_image_container_outer').length && !$('#popup_content .artwork_hero_image_container_outer').length) { 2028 var hero_max_height = ($(window).height() - $(window).scrollTop()) + 200; 2029 if (hero_max_height < 0) { 2030 var hero_max_height = 0; 2031 } 2032 $('.artwork_hero_image_container_outer').css('max-height', hero_max_height); 2033 } 2034 }); 2035 $(window).bind('scroll', window.site.throttle(50, function() { 2036 window.site.scroll.events.run(); 2037 })); 2038 $(window).bind('scroll', window.site.debounce(200, function() { 2039 window.site.scroll.events.run(); 2040 })); 2041 window.site.scroll.events.run(); 2042 }, 2043 2044 run: function() { 2045 if ($(window).scrollTop() > 0) { 2046 if (last_scroll_position > $(window).scrollTop()) { 2047 if (last_scroll_position - 30 > $(window).scrollTop()) { 2048 if (!$('body').hasClass('window-forced-scroll-up')) { 2049 if (!$('body').hasClass('page-popup-active') && !$('body').hasClass('overlay-open')) { 2050 $('#container_outer').addClass('scrolling-up'); 2051 $('#container_outer').removeClass('scrolling-down'); 2052 } 2053 } 2054 } 2055 } else { 2056 if ($(window).scrollTop() > last_scroll_position) { 2057 if ($(window).scrollTop() > scrolling_down_offset) { 2058 if (!$('body').hasClass('page-popup-active') && !$('body').hasClass('overlay-open')) { 2059 $('#container_outer').removeClass('scrolling-up'); 2060 $('#container_outer').addClass('scrolling-down'); 2061 if ($('body').hasClass('dropdown-nav-active')) { 2062 window.site.scroll.dropdown_navigation.close(); 2063 } 2064 } 2065 } 2066 } 2067 } 2068 } else { 2069 $('#container_outer').removeClass('scrolling-down scrolling-up'); 2070 } 2071 if ($('body').hasClass('page-popup-visible')) { 2072 $('#container_outer').removeClass('page-top'); 2073 $('body').removeClass('page-top'); 2074 } else { 2075 if ($(window).scrollTop() > 90) { 2076 if (!$('#container_outer').hasClass('page-scrolled')) { 2077 $('#container_outer').addClass('page-scrolled'); 2078 } 2079 if ($('#container_outer').hasClass('page-top')) { 2080 $('#container_outer').removeClass('page-top'); 2081 $('body').removeClass('page-top'); 2082 } 2083 } else { 2084 if (!$('#container_outer').hasClass('page-top')) { 2085 $('#container_outer').removeClass('page-scrolled'); 2086 $('#container_outer').addClass('page-top'); 2087 $('body').addClass('page-top'); 2088 } 2089 if ($('#container_outer').hasClass('page-scrolled')) { 2090 $('#container_outer').removeClass('page-scrolled'); 2091 } 2092 } 2093 if (true || $('#hero').length) { 2094 if ($(window).scrollTop() > $(window).height() / 2) { 2095 if ($('#container_outer').hasClass('page-top-proximity')) { 2096 $('#container_outer').removeClass('page-top-proximity'); 2097 } 2098 } else { 2099 if (!$('#container_outer').hasClass('page-top-proximity')) { 2100 $('#container_outer').addClass('page-top-proximity'); 2101 } 2102 } 2103 } 2104 if (true || $('#hero').length) { 2105 if ($(window).scrollTop() > $(window).height()) { 2106 if ($('#container_outer').hasClass('hero-section-visible')) { 2107 $('#container_outer, #container').addClass('hero-section-not-visible'); 2108 $('#container_outer, #container').removeClass('hero-section-visible'); 2109 } 2110 } else { 2111 if (!$('#container_outer').hasClass('hero-section-visible')) { 2112 $('#container_outer, #container').removeClass('hero-section-not-visible'); 2113 $('#container_outer, #container').addClass('hero-section-visible'); 2114 } 2115 } 2116 } 2117 } 2118 window.site.scroll.subnav_active_change(); 2119 last_scroll_position = $(window).scrollTop(); 2120 } 2121 2122 }, 2123 2124 dropdown_navigation: { 2125 init: function() { 2126 if ($('#dropdown_nav').length) { 2127 $('#top_nav li').each(function() { 2128 var this_path_name = $(this).find('a').attr('href').replace('/', '').replace('/', ''); 2129 $(this).attr('data-dropdown-id', this_path_name); 2130 if ($('#dropdown_nav .dropdown_nav_item[data-related-nav-item="' + this_path_name + '"]').length) { 2131 $(this).addClass('has_dropdown'); 2132 } 2133 }); 2134 2135 $('.dropdown_menu_mask').unbind().bind('click', function() { 2136 window.site.scroll.dropdown_navigation.close(); 2137 }); 2138 2139 $('#header').addClass('dropdown-nav-not-hover'); 2140 $('#top_nav li.has_dropdown, #dropdown_nav').each(function() { 2141 $(this).unbind('mouseover.dropnav, mouseout.dropnav').bind('mouseover.dropnav', function() { 2142 if (!$('body').hasClass('page-transition-delay') && !$('body').hasClass('page-transition') && !$('body').hasClass('scrolling-down')) { 2143 2144 var instance = $(this); 2145 2146 if (typeof dropdown_nav_hover_initial_display_timeout != 'undefined') { 2147 clearTimeout(dropdown_nav_hover_initial_display_timeout); 2148 } 2149 if (typeof dropdown_nav_close_timeout != 'undefined') { 2150 clearTimeout(dropdown_nav_close_timeout); 2151 } 2152 2153 var hover_open_delay = 300; 2154 if ($('body').hasClass('dropdown-nav-active')) { 2155 var hover_open_delay = 100; 2156 } 2157 2158 2159 dropdown_nav_hover_initial_display_timeout = setTimeout(function() { 2160 2161 if (typeof previous_item_timeout != 'undefined') { 2162 clearTimeout(previous_item_timeout); 2163 $('#dropdown_nav .dropdown_nav_item.active').removeClass('active animate animate-out'); 2164 previous_item_timeout = undefined; 2165 } 2166 2167 var this_dropdown_id = $(instance).attr('data-dropdown-id'); 2168 if (this_dropdown_id && typeof this_dropdown_id != 'undefined') { 2169 var dropdown_element = $('#dropdown_nav .dropdown_nav_item[data-related-nav-item="' + this_dropdown_id + '"]'); 2170 if (dropdown_element.length) { 2171 2172 if ($('#dropdown_nav .dropdown_nav_item.active').length && this_dropdown_id != $('#dropdown_nav .dropdown_nav_item.active').attr('data-related-nav-item')) { 2173 var previous_active_item = $('#dropdown_nav .dropdown_nav_item.active'); 2174 previous_active_item.removeClass('animate').addClass('animate-out'); 2175 previous_item_timeout = setTimeout(function() { 2176 previous_active_item.removeClass('active animate-out'); 2177 previous_item_timeout = undefined; 2178 }, 400, previous_active_item); 2179 } 2180 2181 dropdown_element.addClass('active'); 2182 var dropdown_element_height = dropdown_element.height(); 2183 setTimeout(function() { 2184 dropdown_element.addClass('animate'); 2185 $('#dropdown_nav').height(dropdown_element_height); 2186 }, 50, dropdown_element); 2187 } else { 2188 $('#dropdown_nav .dropdown_nav_item.animate').removeClass('animate'); 2189 $('#dropdown_nav').height('0'); 2190 dropdown_nav_close_timeout = setTimeout(function() { 2191 $('#dropdown_nav .dropdown_nav_item.active').removeClass('active'); 2192 }, 800); 2193 } 2194 } 2195 2196 $(instance).addClass('hovering'); 2197 $('body').addClass('dropdown-nav-active'); 2198 if (typeof dropdown_nav_hover_timeout != 'undefined') { 2199 clearTimeout(dropdown_nav_hover_timeout); 2200 } 2201 2202 if (typeof dropdown_nav_hover_over_timeout != 'undefined') { 2203 clearTimeout(dropdown_nav_hover_over_timeout); 2204 } 2205 dropdown_nav_hover_over_timeout = setTimeout(function() { 2206 $('body').addClass('dropdown-nav-animate'); 2207 $('#header').addClass('dropdown-nav-hover'); 2208 $('#header').removeClass('dropdown-nav-not-hover'); 2209 }, 10); 2210 2211 }, hover_open_delay, instance); 2212 } 2213 }).bind('mouseout.dropnav', function() { 2214 if (window.location.search == '?fixnav=1') { 2215 return; 2216 } 2217 $(this).removeClass('hovering'); 2218 if (!$('#header.hovering').length) { 2219 if (typeof dropdown_nav_hover_over_t
2219imeout != 'undefined') { 2220 clearTimeout(dropdown_nav_hover_over_timeout); 2221 } 2222 if (typeof dropdown_nav_hover_timeout != 'undefined') { 2223 clearTimeout(dropdown_nav_hover_timeout); 2224 } 2225 dropdown_nav_hover_timeout = setTimeout(function() { 2226 window.site.scroll.dropdown_navigation.close(); 2227 }, 1000); 2228 } 2229 2230 if (typeof dropdown_nav_hover_initial_display_timeout != 'undefined') { 2231 clearTimeout(dropdown_nav_hover_initial_display_timeout); 2232 } 2233 }); 2234 }); 2235 } 2236 }, 2237 2238 close: function() { 2239 $('#header').removeClass('dropdown-nav-hover'); 2240 $('#header').addClass('dropdown-nav-not-hover'); 2241 $('body').removeClass('dropdown-nav-animate'); 2242 2243 $('#dropdown_nav .dropdown_nav_item.animate').removeClass('animate'); 2244 $('#dropdown_nav').height('0'); 2245 dropdown_nav_close_timeout = setTimeout(function() { 2246 $('#dropdown_nav .dropdown_nav_item.active').removeClass('active'); 2247 $('body').removeClass('dropdown-nav-active'); 2248 }, 800); 2249 } 2250 }, 2251 2252 navigation: function() { 2253 2254 $('#header #page_header').remove(); 2255 $('#header').removeClass('page-header-subsections'); 2256 $('#hero').removeClass('page-hero-subsections'); 2257 2258 if ($('.scroll_section_panels').hasClass('scroll_section_panels_has_nav')) { 2259 2260 if (!$('#feature_panel_section_nav').length) { 2261 $('.scroll_section_panels:last').after('<div id="feature_panel_section_nav"><h2></h2><ul></ul></div><div id="feature_panel_section_heading"><div id="feature_panel_section_heading_content" class="splash_heading"></div></div>') 2262 } 2263 2264 if ($('#main_content h1').length) { 2265 var page_heading_element = $('#main_content h1:eq(0)'); 2266 if ($('body').hasClass('section-home')) { 2267 var page_heading = 'Home'; 2268 } else if (page_heading_element.find('.text_animate .texts li').length) { 2269 var page_heading = page_heading_element.find('.text_animate .texts li:eq(0)').text(); 2270 } else { 2271 if ($('#main_content h1:eq(0) a').length) { 2272 var page_heading = $('#main_content h1:eq(0) a').html(); 2273 } else { 2274 var page_heading = $('#main_content h1:eq(0)').html(); 2275 } 2276 } 2277 $('#feature_panel_section_nav h2').html(page_heading); 2278 } 2279 2280 if ($('#feature_panel_section_nav').length && !$('#feature_panel_section_nav').hasClass('side_nav_filters')) { 2281 jQuery.fn.reverse = [].reverse; 2282 2283 $('.feature_panels section').each(function() { 2284 var this_label = $(this).attr('data-label'); 2285 var this_index = $(this).attr('data-scrollinner-index'); 2286 if (this_label && this_index && typeof this_label != 'undefined' && typeof this_index != 'undefined') { 2287 $('#feature_panel_section_nav ul').append('<li data-index="' + this_index + '"><button class="clear_button_styles" aria-label="Scroll to the ' + this_label +' section of the page">' + this_label + '</button></li>'); 2288 } else { 2289 $('#feature_panel_section_nav ul').append('<li data-index="' + this_index + '" class="no-label"></li>'); 2290 } 2291 }); 2292 2293 if ($('.scroll_section_panels').hasClass('scroll_section_panels_has_nav_top')) { 2294 $('#feature_panel_section_nav ul').append('<li class="link_back_to_top"><button class="clear_button_styles" aria-label="Scroll to top of the page">Back to top</button></li>'); 2295 } 2296 2297 if ($('#feature_panel_section_nav ul li').not('.no-label').length <= 1) { 2298 $('#feature_panel_section_nav').addClass('nav-hidden'); 2299 } else { 2300 $('#feature_panel_section_nav').removeClass('nav-hidden'); 2301 } 2302 } 2303 2304 if ($('#feature_panel_section_nav ul li:not(.no-label)').length > 1 || $('.scroll_section_panels').hasClass('scroll_section_panels_has_nav_top')) { 2305 2306 $('#hero .hero_content_additional').show(); 2307 2308 var new_page_header_content = $('#feature_panel_section_nav').length ? $('#feature_panel_section_nav').html() : ''; 2309 2310 var new_page_hero_nav = $('#feature_panel_section_nav ul').length ? '<ul>' + $('#feature_panel_section_nav ul').html() + '</ul>' : ''; 2311 2312 if (!$('#header #page_header').length) { 2313 $('#header_main_inner').append('<div id="page_header"></div>') 2314 } 2315 2316 $('#header #page_header').html(new_page_header_content); 2317 if (new_page_header_content != '') {
2318 $('#header').addClass('page-header-subsections'); 2319 } 2320 2321 $('#hero .hero_nav').html(new_page_hero_nav); 2322 if (new_page_hero_nav != '') { 2323 $('#hero').addClass('page-hero-subsections'); 2324 } 2325 } else { 2326 $('#hero .hero_content_additional').hide(); 2327 } 2328 } 2329 $('.panel_filters_exhibition_status ul li a').unbind().click(function() { 2330 $(this).parent().trigger('click'); 2331 return false; 2332 }); 2333 2334 $('#feature_panel_section_nav ul li, #page_header ul li, .hero_nav ul li, .panel_filters_exhibition_status ul li').unbind().click(function(e) { 2335 $('body').addClass('window-forced-scroll-up'); 2336 var this_index = $(this).attr('data-index'); 2337 if ($(this).hasClass('link_back_to_top')) { 2338 var related_item = $('#main_content'); 2339 } else { 2340 var related_item = $('.feature_panels section[data-scrollinner-index="' + this_index + '"]'); 2341 } 2342 if (related_item.length) { 2343 var direction = (related_item.offset().top > $(window).scrollTop() ? 'down' : 'up'); 2344 if (false && $('#header').length > 0 && direction == 'up') { 2345 var offset = 100; 2346 var offset = offset + $('#header').outerHeight(); 2347 } else { 2348 var offset = 100; 2349 } 2350 if ($('#cms-frontend-toolbar-container').length > 0) { 2351 var offset = offset + $('#cms-frontend-toolbar-container').outerHeight(); 2352 } 2353 var related_item_offset = related_item.offset().top - offset; 2354 var related_item_offset = (related_item_offset < 1 ? 0 : related_item_offset); 2355 window.site.commands.scrollto(related_item_offset, function() { 2356 $('body').delay(100).queue(function() { 2357 $(this).removeClass('window-forced-scroll-up'); 2358 $(this).dequeue(); 2359 }); 2360 window.site.scroll.subnav_active_change(); 2361 }); 2362 2363 if ($('body').hasClass('tabbing-detected')) { 2364 setTimeout(function(){ $(related_item)[0].focus(); }, 1000); 2365 } 2366 } 2367 return false; 2368 }); 2369 2370 }, 2371 2372 subnav_active_change: function() { 2373 var windowPos = $(window).scrollTop(); // get the offset of the window from the top of page 2374 var windowHeight = $(window).height(); // get the height of the window 2375 var docHeight = $(document).height(); 2376 $('#feature_panel_section_nav ul li, #page_header ul li, .panel_filters_exhibition_status ul li') 2377 .each(function() { 2378 var this_index = $(this).attr('data-index'); 2379 var related_item = $('.feature_panels section[data-scrollinner-index="' + this_index + '"]'); 2380 if (related_item.length) { 2381 var item_theme = related_item.attr('data-theme'); 2382 var offset = windowHeight/2; 2383 if ($('#cms-frontend-toolbar-container').length > 0) { 2384 var offset = offset + $('#cms-frontend-toolbar-container').outerHeight(); 2385 } 2386 var divPos = related_item.offset().top - offset; // get the offset of the div from the top of page 2387 var divHeight = related_item.outerHeight(); // get the height of the div in question 2388 if (windowPos >= divPos && windowPos < (divPos + divHeight)) { 2389 // This item is active 2390 if (!$("#feature_panel_section_nav ul li[data-index='" + this_index + "']").hasClass('active')) { 2391 $("#feature_panel_section_nav ul li[data-index='" + this_index + "']").closest('li').addClass("active"); 2392 $("#page_header ul li[data-index='" + this_index + "']").closest('li').addClass("active"); 2393 $(".panel_filters_exhibition_status ul li[data-index='" + this_index + "']").closest('li').addClass("active"); 2394 2395 var link_text = $(".panel_filters_exhibition_status ul li[data-index='" + this_index + "']").find('a').text(); 2396 $(".panel_filters_exhibition_status ul li[data-index='" + this_index + "']").find('a').attr("aria-label", link_text + " (Selected)"); 2397 } 2398 } else { 2399 // This item is not active 2400 $("#feature_panel_section_nav ul li[data-index='" + this_index + "']").closest('li').removeClass("active"); 2401 $("#page_header ul li[data-index='" + this_index + "']").closest('li').removeClass("active"); 2402 $(".panel_filters_exhibition_status ul li[data-index='" + this_index + "']").closest('li').removeClass("active"); 2403 $(".panel_filters_exhibition_status ul li[data-index='" + this_index + "']").find('a').removeAttr("aria-label"); 2404 } 2405 } 2406 }) 2407 .promise() 2408 .done(function() { 2409 2410 }) 2411 ; 2412 2413 // General events - revert or figure out what to do if no items are active 2414 if ($('#feature_panel_section_nav li').length > 1 && $('#feature_panel_section_nav .active').length < 1) { 2415 var first_item = $('#feature_panel_section_nav li').filter(':eq(0)'); 2416 var first_item_index = first_item.attr('data-index'); 2417 var related_item = $('.feature_panels section[data-scrollinner-index="' + first_item_index + '"]').length ? $('.feature_panels section[data-scrollinner-index="' + first_item_index + '"]') : false;
2418 var related_item_below_scroll = false; 2419 if (related_item) { 2420 if (related_item.offset().top > $(window).scrollTop()) { 2421 var related_item_below_scroll = true; 2422 } 2423 } 2424 if (related_item_below_scroll) { 2425 // We are above the first item, the initial theme should be set as the first item theme 2426 var item_theme = related_item.attr('data-theme'); 2427 if (item_theme == 'reversed') { 2428 $('body').addClass('content-type-reversed'); 2429 } else { 2430 $('body').removeClass('content-type-reversed'); 2431 } 2432 } else { 2433 // No items are active, revert theme 2434 $('body').removeClass('content-type-reversed'); 2435 $('#feature_panel_section_heading').removeClass('visible'); 2436 if (typeof section_intro_timeout != 'undefined') { 2437 clearTimeout(section_intro_timeout); 2438 clearTimeout(section_intro_timeout2); 2439 } 2440 } 2441 } 2442 2443 if(windowPos + windowHeight == docHeight) { 2444 if (!$("#feature_panel_section_nav ul li:last-child").closest('li').hasClass("active")) { 2445 var navActiveCurrent = $(".active").attr("href"); 2446 $("#feature_panel_section_nav ul li[href='" + navActiveCurrent + "']").closest('li').removeClass("active"); 2447 $("#feature_panel_section_nav ul l li:last-child").closest('li').addClass("active"); 2448 } 2449 } 2450 }, 2451 2452 smooth_scroll: { 2453 2454 init: function() { 2455 $(window).bind('resize', window.site.scroll.smooth_scroll.resize); 2456 window.site.scroll.smooth_scroll.scroll_init(); 2457 if (window.site.scroll.smooth_scroll.device_enabled()) { 2458 window.site.scroll.smooth_scroll.setup(); 2459 window.site.scroll.smooth_scroll.resize_container(); 2460 $(window).load(function() { 2461 window.site.scroll.smooth_scroll.resize_container(); 2462 }); 2463 } else { 2464 window.site.scroll.smooth_scroll.fallback(); 2465 } 2466 }, 2467 2468 setup: function() { 2469 $('.scroll-container').addClass('active'); 2470 $('body').addClass('smooth-scroll-enabled'); 2471 window.site.scroll.smooth_scroll_active = true; 2472 requestAnimationFrame(window.site.scroll.smooth_scroll.loop); 2473 }, 2474 2475 fallback: function() { 2476 $('.scroll-container').addClass('standard'); 2477 $('body').addClass('smooth-scroll-fallback'); 2478 window.site.scroll.smooth_scroll_active = false; 2479 }, 2480 2481 resize: function() { 2482 $(window).trigger('scroll'); 2483 if (window.site.scroll.smooth_scroll_active) { 2484 window.site.scroll.smooth_scroll.resize_container(); 2485 } 2486 window.site.scroll.smooth_scroll.resize_elements(); 2487 }, 2488 2489 scroll_init: function() { 2490 var scrollElements = $(window.site.scroll.settings.scroll_parallax_elements); 2491 scrollElements.each(function() { 2492 if (!$(this).attr('data-level') || typeof $(this).attr('data-level') == 'undefined') { 2493 var level = $(this).css('zIndex'); 2494 if (level == 0) { 2495 var level = 1; 2496 } 2497 $(this).attr('data-level', level); 2498 } 2499 }); 2500 window.site.scroll.smooth_scroll.resize_elements(); 2501 }, 2502 2503 resize_elements: function() { 2504 if (window.site.scroll.smooth_scroll_active) { 2505 $(window.site.scroll.settings.scroll_parallax_elements + ', ' + window.site.scroll.settings.scroll_section_elements).each(function() { 2506 var element = $(this); 2507 var transform = element.css('transform'); 2508 element.addClass('parallax-resizing'); 2509 element.attr('data-top', element.offset().top); 2510 element.attr('data-scrollheight', window.site.layout.window_height()); 2511 element.attr('data-bottom', element.offset().top + element.outerHeight()); 2512 element.attr('data-start', element.offset().top - window.site.layout.window_height()); 2513 element.attr('data-stop', element.offset().top + element.outerHeight()); 2514 element.css({ 2515 transform: transform, 2516 backgroundColor: 'transparent' 2517 }); 2518 element.removeClass('parallax-resizing'); 2519 }); 2520 $(window.site.scroll.settings.scroll_parallax_overflow_elements).each(function() { 2521 var element = $(this); 2522 var wh = $(window).height(); 2523 var offsetTop = element.attr('data-top'); 2524 var offsetBottom = element.attr('data-bottom'); 2525 var level = Number(element.attr('data-level')); 2526 var amplitude = -wh; 2527 var movement = amplitude / (5 / level); 2528 var start = element.attr('data-start'); 2529 var stop = element.attr('data-stop'); 2530 var percent = (start - start) / (stop - start); 2531 percent = percent - 0.5; 2532 var maximum_offset = movement * percent; 2533 var maximum_offset_top = maximum_offset; 2534 if (element.offset().top < 20) { 2535 var maximum_offset_top = 0; 2536 } 2537 element.css({'top': -maximum_offset_top + 'px', 'bottom': -maximum_offset + 'px'}); 2538 }); 2539 } 2540 }, 2541 2542 translate_y: function(element) { 2543 var style = window.getComputedStyle(element.get(0)); 2544 var matrix = style.getPropertyValue("-webkit-transform") || style.getPropertyValue("-moz-transform") || style.getPropertyValue("-ms-transform") || style.getPropertyValue("-o-transform") || style.getPropertyValue("transform"); 2545 if (matrix === 'none') { 2546 matrix = 'matrix(0,0,0,0,0)'; 2547 } 2548 var values = matrix.match(/([-+]?[\d\.]+)/g); 2549 return values[14] || values[5] || 0; 2550 }, 2551 2552 new_translate_y: function(element) { 2553 var computed_style = window.getComputedStyle(element.get(0)); 2554 var position = computed_style.getPropertyValue('-webkit-transform') || computed_style.getPropertyValue('-moz-transform') || computed_style.getPropertyValue('-ms-transform') || computed_style.getPropertyValue('-o-transform') || computed_style.getPropertyValue('transform'); 2555 if (!position || typeof position == 'undefined' || position === 'none') { 2556 return 0; 2557 } else { 2558 var split_position_keys = position.replace(/matrix(3d)?\(|\)/g, '').split(','); 2559 if (split_position_keys[14]) { 2560 return split_position_keys[14]; 2561 } else if (split_position_keys[5]) { 2562 return split_position_keys[5]; 2563 } else { 2564 return 0; 2565 } 2566 } 2567 }, 2568 2569 loop: function() { 2570 var container = $('.scroll-container'); 2571 var wh = $(window).height(); 2572 var windowScrollTop = $(window).scrollTop(); 2573 var activeOffset = $(window).height() / 2; 2574 var windowScrollTopActiveOffset = windowScrollTop + activeOffset; 2575 var destY = windowScrollTop; 2576 var currentY = -window.site.scroll.smooth_scroll.translate_y(container); 2577 var containerY = -window.site.scroll.smooth_scroll.translate_y(container); 2578 2579 if (Math.round(currentY) != Math.round(destY)) { 2580 var newY = Math.round(currentY + ((destY - currentY) * 0.1)); 2581 container.css({ 2582 transform: 'translate3d(0, -' + newY + 'px, 0)' 2583 }); 2584 $(window).trigger('smoothscroll'); 2585 } 2586 var parallax_elements = $(window.site.scroll.settings.scroll_parallax_elements); 2587 if (parallax_elements != null) { 2588 parallax_elements.each(function() { 2589 var element = $(this); 2590 var offsetTop = element.attr('data-top'); 2591 var offsetBottom = element.attr('data-bottom'); 2592 var level = Number(element.attr('data-level')); 2593 var amplitude = -wh; 2594 var movement = amplitude / (5 / level); 2595 if (offsetTop > (windowScrollTop + (wh * 1.3))) { 2596 element.css({ 2597 transform: 'translate3d(0, ' + (-movement * 0.5) + 'px, 0)' 2598 }); 2599 } else if (offsetBottom < (windowScrollTop * 0.7)) { 2600 element.css({ 2601 transform: 'translate3d(0, ' + (movement * 0.5) + 'px, 0)' 2602 }); 2603 } else { 2604 var start = element.attr('data-start'); 2605 var stop = element.attr('data-stop'); 2606 var percent = (windowScrollTop - start) / (stop - start); 2607 percent = percent - 0.5; 2608 var destY = movement * percent; 2609 var currentY = 0; 2610 var transform = element.css('transform'); 2611 if (transform != 'none') 2612 currentY = parseFloat(element.css('transform').split(',')[5]); 2613 if (level > 0) 2614 var newY = currentY + ((destY - currentY) * 0.1); 2615 else 2616 var newY = currentY + ((destY - currentY) * 0.5); 2617 element.css({ 2618 transform: 'translate3d(0, ' + (newY) + 'px, 0)' 2619 }); 2620 var image = element.find('> .image, .image-container > .image').not('.fixed'); 2621 if (image.length == 1) { 2622 image.css({ 2623 top: 100 * percent 2624 }); 2625 } 2626 } 2627 }); 2628 } 2629 2630 requestAnimationFrame(window.site.scroll.smooth_scroll.loop); 2631 }, 2632 2633 resize_container: function() { 2634 var container = $('.scroll-container'); 2635 $('body').css({ 2636 height: container.outerHeight() 2637 }); 2638 }, 2639 2640 device_enabled: function() { 2641 if (window.site.scroll.smooth_scroll_enabled) { 2642 var mobile_version = window.site.device.handheld() || $(window).width() < 900 || ($.browser.msie && $.browser.version < 10); 2643 return !mobile_version; 2644 } else { 2645 return false;
2646 } 2647 } 2648 2649 } 2650 }, 2651 2652 pageload: { 2653 2654 splash_dev_mode: false, 2655 splash_act_as_server: false, 2656 2657 init: function() { 2658 if ($('body').hasClass('section-error')) { 2659 $('body').addClass('first-load-complete'); 2660 return false; 2661 } 2662 if ('scrollRestoration' in history) { 2663 if (window.site.scroll.smooth_scroll_enabled) { 2664 history.scrollRestoration = 'manual'; 2665 } else { 2666 history.scrollRestoration = 'auto'; 2667 } 2668 } 2669 $('a[href^="/shop/artworks/"], a[href^="/video/"], a[href^="/shop/publications/"], a[href^="/publications/"], a[href^="/news/"]').each(function() { 2670 // a[href^="/news/"], 2671 if (!$(this).closest('.artwork_detail').length && $(this).attr('href') != '/store/artworks/' && $(this).attr('href') != '/news/' && $(this).attr('href') != '/video/') { 2672 if (!$(this).hasClass('pageload-link-type-popup-enabled-content')) { 2673 $(this).addClass('pageload-link-type-popup-enabled-content'); 2674 } 2675 } 2676 }); 2677 $('a[href^="/content/feature/"]').each(function() { 2678 if ($(this).attr('href').indexOf('/detail/') > -1) { 2679 if (!$(this).closest('.artwork_detail').length) { 2680 if (!$(this).hasClass('pageload-link-type-popup-enabled-content')) { 2681 $(this).addClass('pageload-link-type-popup-enabled-content'); 2682 } 2683 } 2684 } 2685 }); 2686 2687 $('a.pageload-link-type-popup-enabled-content').click(function() { 2688 // Assume background will be reversed - popups are reversed by default 2689 //$('body').addClass('content-type-reversed-popup'); 2690 }); 2691 2692 $.pageload({ 2693
2694 /////////////////////////////////// 2695 // Ajax navigation removed for development 2696 /////////////////////////////////// 2697 'ajax_navigation_enabled': true, 2698 2699 2700 'splash_screen_enabled': true, 2701 2702 'splash_screen_always_enabled': true || !$('body').hasClass('site-version-development-mode') || window.site.pageload.splash_dev_mode || window.site.pageload.splash_act_as_server ? true : false, 2703 'development_mode': window.site.pageload.splash_dev_mode ? true : false, 2704 'development_mode_pause_splash_screen': window.site.pageload.splash_dev_mode ? true : false, 2705 'development_mode_show_splash_screen_on_refresh': false, 2706 2707 'splash_screen_cookie_expiry': 300, // 5m 2708 'splash_screen_delay_after_complete': 0, 2709 'splash_screen_auto_delays_enabled': false, 2710 //'page_transition_delay': 1200, 2711 'page_transition_delay': 400, // 810, 2712 'popup_content_enabled': true, 2713 'verbose': false, 2714 'content_area_selector': '.pageload-content-area', 2715 'content_load_adjacent': false, 2716 2717 'body_classes_to_retain': 'page-transition-custom', 2718 2719 'disable_ajax_param': true, 2720 2721 'splash_screen_primary_preload_images_selector': '', 2722 'preload_images_selector': '', 2723 'preload_videos_selector': '', 2724 'x_popstate_custom_functions': { 2725 '/artworks/': function(e) { 2726 var relative_id = e.originalEvent.state.customArtworksDefaultCategory; 2727 $('.artworks-overlay-button:eq(0)').trigger('click'); 2728 if (relative_id) { 2729 $('.artworks-overlay .artwork-nav-top-level[data-id="' + relative_id + '"]').trigger('click'); 2730 } 2731 } 2732 }, 2733 'after_load_complete': function() { 2734 2735 //update link active class and aria labels in mobile nav after load 2736 var element_href = window.location.pathname; 2737 if (element_href == '/') { 2738 var target_top_level = '[href="' + element_href + '"]'; 2739 } else { 2740 target_top_level = element_href.split('/')[1]; 2741 target_top_level = '/' + target_top_level + '/'; 2742 target_top_level = '[href^="' + target_top_level + '"]'; 2743 } 2744 2745 $('.nav-overlay .nav-wrapper ul li a').removeClass('active'); 2746 $('.nav-overlay .nav-wrapper ul li a').removeAttr('aria-label'); 2747 $('.nav-overlay .nav-wrapper ul li a' + target_top_level + '').addClass('active'); 2748 var nav_label = $('.nav-overlay .nav-wrapper ul li a' + target_top_level + '').text(); 2749 $('.nav-overlay .nav-wrapper ul li a' + target_top_level + '').attr('aria-label', ( nav_label + ' (current nav item)' )); 2750 }, 2751 'destroy_after_load': function() { 2752 if ($('.artworks-overlay').hasClass('active')) { 2753 var default_category = false; 2754 if ($('.artwork-navigation .artwork-nav-top-level.active').length) { 2755 var default_category = $('.artwork-navigation .artwork-nav-top-level.active').attr('data-id'); 2756 } 2757 history.pushState({'ajaxPageLoad': true, 'customArtworksDefaultCategory': default_category}, null, '/artworks/'); 2758 } 2759 2760 if ($('body').hasClass('page-popup-active')) { 2761 // A popup is open, close it 2762 $.pageload.popup_close(true); 2763 } 2764 2765 if ($('body').hasClass('dropdown-nav-active')) { 2766 window.site.scroll.dropdown_navigation.close(); 2767 } 2768 2769 if ($('.artworks-overlay').hasClass('active')) { 2770 $('.artworks-overlay-close-button').trigger('click'); 2771 } 2772 2773 $('body').removeClass('wishlist-open-after-popup-close'); 2774 2775 $('video').remove(); 2776 $('.image_gallery_multiple').cycle('destroy'); 2777 $('#hero_slideshow').cycle('destroy'); 2778 $('.content_slideshow').cycle('destroy'); 2779 $('#main_slideshow').cycle('destroy'); 2780 $('#hero_slideshow').stop().clearQueue().unbind(); 2781 $('body').removeClass('page-transition-delay'); 2782 window.site.artlogic_inview.destroy(); 2783 }, 2784 'popup_before': function() { 2785 window.site.pageload.popup_after_open('before'); 2786 }, 2787 'popup_after': function() { 2788 window.site.pageload.popup_after_open('after'); 2789 }, 2790 'popup_after_close': function() { 2791 window.site.pageload.popup_after_close(); 2792 }, 2793 'before_load': function() {
2794 if (typeof mailings_popup_timeout != 'undefined') { 2795 clearTimeout(mailings_popup_timeout); 2796 } 2797 if ($('.search-overlay').hasClass('active') && !$('.search-overlay').hasClass('search-loading')) { 2798 window.site.overlays.search.close(); 2799 } 2800 if ($('.enquire-overlay').hasClass('active')) { 2801 window.site.overlays.enquire.close(); 2802 } 2803 if ($('.content-overlay').hasClass('active')) { 2804 window.site.overlays.content.close(); 2805 } 2806 if ($('#main_slideshow').length) { 2807 if (window.window.canvasSlideshowInitialized) { 2808 window.canvasPauseVideo(parseInt($('#main_slideshow .slide.cycle-slide-active').attr('data-index'))-1); 2809 } 2810 } 2811 if ($('#store_quick_cart_widget').hasClass('active')) { 2812 $('#store_quick_cart_widget .notify_panel_close').trigger('click'); 2813 } 2814 if ($('#wishlist_quick_cart_widget').hasClass('active')) { 2815 $('body').addClass('wishlist-open-after-popup-close'); 2816 $('#wishlist_quick_cart_widget .notify_panel_close').trigger('click'); 2817 } 2818 }, 2819 'preloader_in': function(short_load) { 2820 if (!short_load) { 2821 window.site.splash_screen.init(); 2822 } else { 2823 // Start the homepage slideshow (can be done anywhere in the code, e.g. after the splash screen has finished) 2824 window.site.home.start_slideshow(); 2825 } 2826 }, 2827 'splash_screen_in': function() { 2828 }, 2829 'splash_screen_out': function() { 2830 window.site.splash_screen.splash_screen_end(); 2831 }, 2832 'init_after_splash_screen': function() { 2833 }, 2834 'page_transition_start': function() { 2835 if (typeof custom_page_transition_in != 'undefined') { 2836 clearTimeout(custom_page_transition_in); 2837 } 2838 if (typeof custom_page_transition_out != 'undefined') { 2839 clearTimeout(custom_page_transition_out); 2840 } 2841 custom_page_transition_in = setTimeout(function() { 2842 $('body').addClass('page-transition-custom'); 2843 }, 50); 2844 }, 2845 'page_transition_end': function() { 2846 custom_page_transition_out = setTimeout(function() { 2847 $('body').removeClass('page-transition-custom'); 2848 window.site.layout.resize(); 2849 }, 400); 2850 } 2851 }); 2852 $('.nav-overlay .nav-wrapper ul li a').unbind().click(function() { 2853 if (!$(this).hasClass('link-no-ajax')) { 2854 $('.nav-close-button').trigger('click'); 2855 var link = $(this).attr('href'); 2856 setTimeout(function() { 2857 $.pageload.load(link, true, false); 2858 }, 200, link); 2859 } 2860 return false; 2861 }); 2862 $('#sqcw_checkout a').unbind().click(function() { 2863 $.pageload.load($(this).attr('href'), true, function() { 2864 $('#sqcw_close').trigger('click'); 2865 }); 2866 return false; 2867 }); 2868 window.site.pageload.load_more_pagination.init(); 2869 }, 2870 2871 close_popup: function() { 2872 window.history.back(); 2873 //$('#popup_box > .inner > .close').trigger('click'); 2874 $('body').removeClass('content-reversed content-not-reversed content-type-reversed-popup'); 2875 $('body').removeClass('user-distraction-free') 2876 $('body').removeClass('page-artwork-detail-standard'); 2877 $('#popup_box').animate({'scrollTop': 0}, 600); 2878 $('#popup_content').html(''); 2879 }, 2880 2881 popup_after_open: function(type) { 2882 $('body').addClass('popup-not-scrolled'); 2883 2884 if ($('body').hasClass('dropdown-nav-active')) { 2885 window.site.scroll.dropdown_navigation.close(); 2886 } 2887 2888 if (type == 'after' && $('#popup_content .content-reversed').length) { 2889 $('#popup_container').addClass('popup-content-reversed'); 2890 $('body').addClass('content-type-reversed-popup'); 2891 } 2892 $('body').removeClass('user-inactive user-idle window-scrolled'); 2893 $('#container_outer').removeClass('scrolling-down scrolling-up'); 2894 window.cart.init(); 2895 window.cart.cart_summary.get_summary(false); 2896 2897 window.site.social_media.init();
2898 window.site.overlays.enquire.init(); 2899 2900 window.site.lazy_load.setup(); 2901 window.site.lazy_load.fire('#popup_box .inview_element'); 2902 2903 window.site.artworks.setup(); 2904 2905 $(window).trigger('resize'); 2906 window.site.misc.init('popup'); 2907 window.site.vat_toggle.init(); 2908 }, 2909 2910 popup_after_close: function() { 2911 $('body').removeClass('content-type-reversed-popup'); 2912 $('body').removeClass('popup-hidable-content user-distraction-free'); 2913 $('body').removeClass('content-reversed content-not-reversed'); 2914 $('body').removeClass('zoom-active user-distraction-free'); 2915 $('body').removeClass('popup-scrolled popup-not-scrolled'); 2916 $('#popup_box .artwork_detail.artwork_detail_variant_video .video').html(''); 2917 $('.image_gallery_multiple').cycle('destroy'); 2918 window.site.scroll.events.run(); 2919 $('#popup_content').scrollTop(0); 2920 2921 if ($('body').hasClass('wishlist-open-after-popup-close')) { 2922 $('#wishlist_cart_widget .wcw_checkout_link').trigger('click'); 2923 $('body').removeClass('wishlist-open-after-popup-close'); 2924 } 2925 }, 2926 2927 load_more_pagination: { 2928 2929 // Dynamically loads in new items into a records_list, rather than traditional pagination 2930 2931 init: function() { 2932 2933 var verbose_mode = true; 2934
2935 ///////////////////////////////////////// 2936 ///////////////////////////////////////// 2937 // WHY DOESNT THIS GET REMOVED.... 2938 ///////////////////////////////////////// 2939 ///////////////////////////////////////// 2940 $('.list-ajax-load-previous-wrapper').remove(); 2941 // console.log('test'); 2942 // console.log($('.list-ajax-load-previous-wrapper')); 2943 2944 window.site.pageload.load_more_pagination.setup(verbose_mode); 2945 2946 }, 2947 2948 setup: function (verbose_mode) { 2949 2950 $('.page_stats').each(function(i, element) { 2951 2952 var $this = $(this), 2953 incoming_url = $this.find('.ps_next').attr('href'); 2954 page_stats_id = $this.attr('id'), 2955 corresponding_list_ref = $this.attr('id'), 2956 $list = $('[data-pagestats-id="'+corresponding_list_ref+'"]'); 2957 2958 if (!$list.length && verbose_mode){ 2959 console.log("Can't find a corresponding list that relates to your pagination. Supply 'data-
2959pagestats-id' to list that matches your page_stats_id.") 2960 } 2961 2962 if (typeof incoming_url !== 'undefined' && typeof page_stats_id !== 'undefined' && $list.length){ 2963 2964 //Hide the original pagination 2965 $this.addClass('hidden'); 2966 2967 //Create our new dynamic button 2968 $this.after('<div class="list-ajax-load-more-wrapper clearwithin"><div class="list-ajax-load-less link link_back" data-list="'+page_stats_id+'" aria-label="Show less items"><button href="#" class="clear_button_styles button_inner list-ajax-load-less-label">Show less</button></div><div class="list-ajax-load-more button" data-list="'+page_stats_id+'" data-url="'+incoming_url+'" aria-label="Load more items"><button href="#" class="button_inner list-ajax-load-more-label">Load more</button><div class="loader"></div></div></div>'); 2969 2970 $('.list-ajax-load-more').attr('data-original-url', $('.list-ajax-load-more').attr('data-url')); 2971 $('.list-ajax-load-more button').unbind().bind("click", function(e) { 2972 e.preventDefault(); 2973 var $button = $(this).closest('.button'); 2974 var incoming_url = $button.attr('data-url'); // URL detected at this level, later may be data-attr or any value 2975 var corresponding_list_ref = $(this).closest('.list-ajax-load-more').attr('data-list'); 2976 var list = $('[data-pagestats-id="'+corresponding_list_ref+'"]'); 2977 if (!list.length && verbose_mode){ 2978 console.log("Can't find a corresponding list that relates to your pagination. Supply 'data-
2978pagestats-id' to list that matches your page_stats_id.") 2979 } 2980 window.site.pageload.load_more_pagination.load_content($button, incoming_url, list, verbose_mode); 2981 return false; 2982 }); 2983 2984 $('.list-ajax-load-less button').unbind().bind("click", function(e) { 2985 e.preventDefault(); 2986 var $button = $(this).closest('.list-ajax-load-less'); 2987 var corresponding_list_ref = $(this).closest('.list-ajax-load-less').attr('data-list'); 2988 var list = $('[data-pagestats-id="'+corresponding_list_ref+'"]'); 2989 if (!list.length && verbose_mode){ 2990 console.log("Can't find a corresponding list that relates to your pagination. Supply 'data-pagestats-id' to list that matches your page_stats_id.") 2991 } 2992 2993 2994 var load_more_button = $button.closest('.list-ajax-load-more-wrapper').find('.list-ajax-load-more'); 2995 var updated_url = load_more_button.attr('data-original-url'); 2996 $button.closest('.list-ajax-load-more-wrapper').find('.list-ajax-load-more').attr('data-url', updated_url); 2997 $button.closest('.list-ajax-load-more-wrapper').removeClass('ajax-items-loaded'); 2998 2999 3000 window.site.commands.scrollto(list.offset().top, function() { 3001 }); 3002 3003 setTimeout(function() { 3004 list.find('.ajax-loaded-list-item').remove(); 3005 }, 400, list); 3006 3007 return false; 3008 }); 3009 3010 } else { 3011 $this.addClass('hidden'); 3012 } 3013 3014 // If this URL already has a skip value, prepend a load previous button 3015 if (window.location.search && typeof window.location.search != 'undefined') { 3016 if (window.location.search.indexOf('skip=') != -1) { 3017 $list.before('<div class="list-ajax-load-previous-wrapper clearwithin"><div class="list-ajax-load-previous button button_compact" data-list="'+page_stats_id+'" aria-label="Load previous items"><span class="list-ajax-load-previous-label">Load previous items</span></div></div>'); 3018 3019 $('.list-ajax-load-previous').bind("click", function(e) { 3020 e.preventDefault(); 3021 //Load the initial records list 3022 $.pageload.load(window.location.pathname, true); 3023 }); 3024 } 3025 } 3026 }); 3027 3028 }, 3029 3030 load_content: function ($button, incoming_url, $list, verbose_mode) { 3031 3032 var incoming_content_type = 'inner', 3033 current_button_offset = $button.offset().top - ($(window).height() / 3), 3034 corresponding_list_ref = $list.data('pagestats-id'), 3035 inner_content_selector = '[data-pagestats-id="'+corresponding_list_ref+'"]'; 3036 3037 $button.addClass('loading'); 3038 3039 $.pageload.load(incoming_url, true, function() { 3040 3041 $button.removeClass('loading'); 3042 3043 if (new_page_inner_content) { 3044 3045 $new_page_inner_content = $(new_page_main_content); 3046 3047 var updated_url = $new_page_inner_content.find('.page_stats#'+corresponding_list_ref).find('.ps_next').attr('href'), 3048 $new_list = $new_page_inner_content.find('[data-pagestats-id="'+corresponding_list_ref+'"]'), 3049 $new_list_items = $new_list.find('.item').addClass('ajax-loaded-list-item'); 3050 3051 if ($list.hasClass('tile_grid')){ 3052 $list.find('.tile_grid_original .group').append($new_list_items); 3053 } else if ($list.find('.group').length) { 3054 $list.find('.group').append($new_list_items); 3055 } else { 3056 $list.append($new_list_items); 3057 } 3058 3059 $button.closest('.list-ajax-load-more-wrapper').addClass('ajax-items-loaded'); 3060 3061 3062 if (updated_url){ 3063 $button.attr('data-url', updated_url); 3064 } else { 3065 $button.attr('data-url', ''); 3066 $button.addClass('disabled'); 3067 $button.closest('.list-ajax-load-more-wrapper').addClass('disabled').remove(); 3068 } 3069 $('.first_new_item').removeClass('first_new_item'); 3070 $($new_list_items[0]).addClass('first_new_item'); 3071 3072 // General resets 3073 $(window).trigger('resize'); 3074 $(window).trigger('scroll'); 3075 3076 window.site.layout.grids.tile_list_append_refresh($list); 3077 window.site.layout.grids.init(); 3078 window.site.lazy_load.setup(); 3079 window.site.artlogic_inview.init(); 3080 $.pageload.refresh('.ajax-loaded-list-item:not(.pageload-refreshed)'); 3081 $('.ajax-loaded-list-item').addClass('pageload-refreshed'); 3082 window.site.overlays.enquire.setup(); 3083 window.cart.add_to_cart($list.find('.store_item .store_item_add_to_cart')); 3084 window.cart.add_to_wishlist($list.find('.add_to_wishlist')); 3085 window.cart.remove_from_wishlist($list.find('.store_item_remove_from_wishlist')); 3086 window.site.misc.init(); 3087 3088 setTimeout(function() { 3089 window.site.commands.scrollto(current_button_offset, function() { 3090 }); 3091 }, 100); 3092 3093 if ($('body').hasClass('tabbing-detected')) { 3094 $list.find('.first_new_item a').focus(); 3095 } 3096 window.site.misc.extended_click_area(); 3097 } 3098 3099 }, null, null, null, incoming_content_type, inner_content_selector); 3100 } 3101 3102 } 3103 3104 }, 3105 3106 splash_screen: { 3107 init: function() { 3108 3109 $('body').addClass('main-content-hide'); 3110 window.setTimeout(function() { 3111 $('body').addClass('active-init'); 3112 $('body').addClass('splash-init'); 3113 }, 10); 3114 window.setTimeout(function() { 3115 $('.splash-bg').addClass('open start'); 3116 $('body').addClass('splash-open'); 3117 // start letter transition 3118 $('.hero video').each(function() { 3119 $(this).get(0).pause(); 3120 }); 3121 }, 500); 3122 window.setTimeout(function() { 3123 window.site.splash_screen.splash_screen_start(); 3124 }, 400); 3125 }, 3126 3127 splash_screen_start: function() { 3128 setTimeout(function() { 3129 $('.splash-container').addClass('start'); 3130 }, 0); 3131 3132 setTimeout(function() { 3133 $(".location-item").each(function(i){ 3134 var $item = $(this); 3135 setTimeout(function() { 3136 $item.addClass('visible') 3137 }, 200*i); 3138 }); 3139 }, 900); 3140 3141 }, 3142 3143 splash_screen_end: function() { 3144 setTimeout(function() { 3145 3146 3147 // Start the homepage slideshow 3148 setTimeout(function() { 3149 window.site.home.start_slideshow_pre_init(); 3150 main_slideshow_cycle_first_slide_change = false;
3151 }, 1000); 3152 setTimeout(function() { 3153 window.site.home.start_slideshow(false); 3154 }, 1500); 3155 3156 setTimeout(function() { 3157 $('body').removeClass('main-content-hide'); 3158 $('.splash-container').addClass('end'); 3159 window.site.splash_screen.hide_splash(); 3160 }, 1500); 3161 }, 0); 3162 }, 3163 3164 hide_splash: function() { 3165 $('.splash-bg').removeClass('open start'); 3166 // stop letter transition 3167 $('body').removeClass('splash-open'); 3168 3169 $('body').delay(1200).queue(function() { 3170 $('body').removeClass('active-init'); 3171 $('body').removeClass('splash-init'); 3172 3173 window.site.overlays.mailings.auto(); 3174 3175 $(window).trigger('resize'); 3176 $(this).dequeue(); 3177 }); 3178 } 3179 3180 }, 3181 3182 overlays: { 3183 3184 init: function() { 3185 window.site.overlays.content.init(); 3186 window.site.overlays.search.init(); 3187 window.site.overlays.enquire.init(); 3188 window.site.overlays.mailings.init(); 3189 window.site.overlays.navigation(); 3190 window.site.overlays.artworks(); 3191 }, 3192 3193 search: { 3194 3195 init: function() { 3196 window.site.overlays.search_form.init(); 3197 window.site.overlays.search.setup(); 3198 window.site.overlays.search.filters(); 3199 }, 3200 3201 filters: function() { 3202 3203 $('.panel_filters_search_sections li button').unbind().click(function() { 3204 $(this).closest('.panel_filters_search_sections').find('li').removeClass('active'); 3205 $(this).closest('li').addClass('active'); 3206 if ($(this).attr('data-section') == '') { 3207 $('.panel_filters_search_section_results .item').removeClass('hidden'); 3208 } else if ($(this).attr('data-section') != '' && typeof $(this).attr('data-section') != '' != 'undefined') { 3209 $('.panel_filters_search_section_results .item').removeClass('hidden'); 3210 $('.panel_filters_search_section_results .item[data-section!="' + $(this).attr('data-section') + '"]').addClass('hidden'); 3211 } 3212 }); 3213 3214 }, 3215 3216 setup: function() { 3217 3218 //window.site.overlays.search.open($('#search')); 3219 3220 $('#search_menu, .search-close-button').unbind().click(function() { 3221 // For accessibility - tracks which element to refocus on 3222 try { 3223 h.accessibility.global_variables.element_to_refocus_to = $(this); 3224 } catch(error) { 3225 console.error(error); 3226 } 3227 var clicked_element = $(this); 3228 $('body').addClass('active-init'); 3229 const $vat_toggle = $('.vat-toggle'); 3230 window.setTimeout(function() { 3231 if ($('.search-overlay').hasClass('active')) { 3232 window.site.overlays.search.close(); 3233 h.accessibility.on_popup_closing('#search_menu'); 3234 $vat_toggle.fadeIn(400, () => $vat_toggle.attr('style', '')); 3235 } else { 3236 window.site.overlays.search.open(clicked_element); 3237 h.accessibility.on_popup_opening('.search-overlay', false, '.search-close-button'); 3238 $vat_toggle.hide(); 3239 } 3240 }, 50, clicked_element); 3241 return false; 3242 }); 3243 3244 $('#sw_form').each(function() { 3245 if (!$(this).find('.form_row .loader').length) { 3246 $(this).find('.form_row').append('<span class="loader"></span>'); 3247 } 3248 }); 3249 3250 $('#quick_search_widget .button a').unbind().click(function() { 3251 window.site.overlays.search.submit_form($(this).closest('#quick_search_widget').find('form')); 3252 return false;
3253 }); 3254 3255 }, 3256 3257 close: function() { 3258 window.setTimeout(function() { 3259 $('body').removeClass('active-init'); 3260 }, 600); 3261 $('.search-overlay .overlay-bg').removeClass('open'); 3262 $('.search-overlay').removeClass('active'); 3263 $('body, html').removeClass('overlay-open'); 3264 $('.search-wrapper.visible').removeClass('visible'); 3265 }, 3266 3267 open: function(clicked_element, data) { 3268 $('#container_outer').removeClass('scrolling-down scrolling-up'); 3269 $('.search-overlay .overlay-bg').addClass('open'); 3270 $('.search-overlay').addClass('active'); 3271 $('body, html').addClass('overlay-open'); 3272 3273 $('.search-wrapper:not(.visible)').each(function(i) { 3274 var $item = $(this); 3275 setTimeout(function() { 3276 $item.addClass('visible') 3277 }, 300*i); 3278 }); 3279 3280 if (window.ga) { 3281 // Track the click in Analytics 3282 analytics_params = { 3283 'hitType': 'event', 3284 'eventCategory': 'Search form opened', 3285 'eventAction': window.location.pathname, 3286 'eventLabel': $(document).attr('title') 3287 }; 3288 ga('send', analytics_params); 3289 ga('tracker2.send', analytics_params); 3290 } 3291 3292 $('input#sw_field_search')[0].focus(); 3293 3294 }, 3295 3296 clear_form: function() { 3297 window.site.overlays.search_form.reset_form(); 3298 }, 3299 3300 submit_form: function(instance) { 3301 3302 }, 3303 3304 after_submit: function() { 3305 3306 } 3307 3308 }, 3309 3310 search_form: { 3311 3312 init: function() { 3313 3314 window.site.overlays.search_form.setup(); 3315 3316 }, 3317 3318 setup: function() { 3319 3320 3321 $('input#sw_field_search') 3322 .unbind() 3323 .each(function() { 3324 3325 }) 3326 .blur(function() { 3327 if ($(this).val() == '') { 3328 $(this).removeClass('active'); 3329 } 3330 }) 3331 .focus(function() { 3332 if ($(this).val() == '') { 3333 $(this).addClass('active'); 3334 } 3335 }) 3336 .keypress(function(e) { 3337 window.site.overlays.search_form.form_submit(); 3338 }) 3339 ; 3340 3341 $('#sw_field_search_button').unbind().bind('click', function() { 3342 window.site.overlays.search_form.form_submit(); 3343 return false; 3344 }); 3345 3346 $('input#sw_field_search').closest('form').submit(function() { 3347 return false; 3348 }); 3349 3350 $('#sw_more').unbind('click.search_view_more_actions').bind('click.search_view_more_actions', function() { 3351 3352 }); 3353 3354 }, 3355 3356 form_submit: function() { 3357 var search_value = $('input#sw_field_search').val(); 3358 if (search_value && search_value.length >= 2) { 3359 $('input#sw_field_search').stop().clearQueue(); 3360 $('.search-overlay').addClass('search-loading'); 3361 $('input#sw_field_search') 3362 .animate({'opacity': '1'}, 600, function() { 3363 var element_href = '/search/results/?s=' + search_value + '&instant=1'; 3364 $.pageload.load(element_href, true, function() { 3365 if (new_page_inner_content) { 3366 $('#quick_search_widget .notify_panel_content').scrollTop(0); 3367 $('#sw_results').html(new_page_inner_content); 3368 $('.search-overlay').removeClass('search-loading search-results-active').addClass(' search-first-interaction'); 3369 if ($('#sw_results .item').not('.search-grid-no-results').length) { 3370 $('.search-overlay').addClass('search-results-active'); 3371 $('#sw_more').attr('href', element_href.replace('&instant=1', '')); 3372 } 3373 window.site.overlays.search.filters(); 3374 window.site.layout.grids.init(); 3375 window.site.lazy_load.setup(); 3376 //window.site.lazy_load.fire($('#sw_results .image_lazy_load')); 3377 window.site.artlogic_inview.init(); 3378 $(window).trigger('resize'); 3379 $.pageload.refresh($('#quick_search_widget')); 3380 } 3381 }, null, null, null, 'inner', '.site-ajax-enabled-inner-content'); 3382 }) 3383 ; 3384 } 3385 }, 3386 3387 reset_form: function(instance) { 3388 $('input#sw_field_search').val($('input#sw_field_search').attr('data-default-value')); 3389 $('#sw_results').html(''); 3390 } 3391 3392 }, 3393 3394 mailings: { 3395 3396 init: function() { 3397 window.site.overlays.mailings.setup(); 3398 }, 3399 3400 setup: function() { 3401 3402 $('#mailinglist_signup_button, .mailing-close-button').unbind().click(function() { 3403 var clicked_element = $(this); 3404 $('body').addClass('active-init'); 3405 window.setTimeout(function() { 3406 if ($('.mailing-overlay').hasClass('active')) { 3407 window.site.overlays.mailings.close(); 3408 } else { 3409 window.site.overlays.mailings.open(clicked_element); 3410 } 3411 }, 50, clicked_element); 3412 return false;
3413 }); 3414 3415 window.site.overlays.mailings.auto(); 3416 3417 }, 3418 3419 auto: function() { 3420 3421 // Do not automatically open 3422 return false; 3423 3424 // Auto open on all pages other than the homepage 3425 if (window.location.pathname != '/') { 3426 3427 var cookie_info = h.getCookie('mailinglist_signup_generic_shown'); 3428 var popup_shown = cookie_info && typeof cookie_info != 'undefined' ? true : false; 3429 3430 if (!popup_shown) { 3431 mailings_popup_timeout = setTimeout(function() { 3432 if (!$('body').hasClass('loader-active') && !$('body').hasClass('splash-init') && !$('body').hasClass('splash-open')) { 3433 window.site.scroll.dropdown_navigation.close(); 3434 $('body').addClass('active-init'); 3435 window.setTimeout(function() { 3436 if (window.location.pathname == '/store/') { 3437 window.site.overlays.mailings.open(null, null, 'prints'); 3438 } else { 3439 window.site.overlays.mailings.open(); 3440 } 3441 }, 50); 3442 h.setCookie('mailinglist_signup_generic_shown', true, 30); 3443 } 3444 }, 2000); 3445 } 3446 3447 } 3448 3449 }, 3450 3451 close: function() { 3452 window.setTimeout(function() { 3453 if (!$('.overlay.active').not('.mailing-overlay').length) { 3454 $('body').removeClass('active-init'); 3455 } 3456 }, 600); 3457 3458 if (!$('.overlay.active').not('.mailing-overlay').length) { 3459 $('body, html').removeClass('overlay-open'); 3460 } 3461 3462 //$('body').removeClass('quick_contact_widget_active'); 3463 $('.mailing-overlay .overlay-bg').removeClass('open'); 3464 $('.mailing-overlay').removeClass('active'); 3465 3466 $(".mailing-input-wrapper.visible, .mailing-contact-wrapper.visible").removeClass('visible'); 3467 }, 3468 3469 open: function(clicked_element, data, form_type) { 3470 $('#container_outer').removeClass('scrolling-down scrolling-up'); 3471 $('.mailing-overlay .overlay-bg').addClass('open'); 3472 $('.mailing-overlay').addClass('active'); 3473 $('body, html').addClass('overlay-open'); 3474 3475 $(".mailing-input-wrapper:not(.visible),.mailing-contact-wrapper:not(.visible)").each(function(i){ 3476 var $item = $(this); 3477 setTimeout(function() { 3478 $item.addClass('visible') 3479 }, 300); 3480 }); 3481 3482 if (window.ga) { 3483 // Track the click in Analytics 3484 analytics_params = { 3485 'hitType': 'event', 3486 'eventCategory': 'Mailing list form opened', 3487 'eventAction': window.location.pathname, 3488 'eventLabel': $(document).attr('title') 3489 }; 3490 ga('send', analytics_params); 3491 ga('tracker2.send', analytics_params); 3492 } 3493 3494 var form_type = form_type && typeof form_type != 'undefined' ? form_type : 'standard'; 3495 var data = data && typeof data != 'undefined' ? data : {}; 3496 3497 // Reset form 3498 $('#mailinglist_signup .form_checkboxes input').prop('checked', false); 3499 $('#mailinglist_signup').removeClass('variant_prints variant_collector'); 3500 3501 // Load fields as required 3502 if (form_type == 'prints') { 3503 $('#mailinglist_signup').addClass('variant_prints'); 3504 $('#mailinglist_signup .form_checkboxes input.checkbox_required_prints').prop('checked', true); 3505 } else if (form_type == 'collector') { 3506 $('#mailinglist_signup').addClass('variant_collector'); 3507 $('#mailinglist_signup .form_checkboxes input.checkbox_required_collector').prop('checked', true); 3508 } else { 3509 $('#mailinglist_signup .form_checkboxes input').prop('checked', false); 3510 $('#mailinglist_signup .form_checkboxes input.checkbox_required_standard').prop('checked', true); 3511 } 3512 3513 } 3514 3515 }, 3516 3517 enquire: { 3518 3519 init: function() { 3520 window.site.overlays.enquire.setup(); 3521 }, 3522 3523 click_open: function(clicked_element) { 3524 $('body').addClass('active-init'); 3525 window.setTimeout(function() { 3526 if ($('.enquire-overlay').hasClass('active')) { 3527 window.site.overlays.enquire.close(); 3528 } else { 3529 // For accessibility - tracks which element to refocus on 3530 try { 3531 h.accessibility.global_variables.element_to_refocus_to = clicked_element; 3532 } catch(error) { 3533 console.error(error); 3534 }
3535 window.site.overlays.enquire.open(clicked_element, {}, clicked_element.attr('data-type')); 3536 } 3537 }, 50, clicked_element); 3538 }, 3539 3540 setup: function() { 3541 3542 $('.enquire_link_custom, .enquire_link_custom_small').not('.initialized').each(function() { 3543 $(this).addClass('initialized'); 3544 if ($(this).find('button').length == 0) { 3545 $(this).wrapInner('<button class="clear_button_styles">'); 3546 } 3547 }) 3548 3549 $('.enquire_wishlist_link').unbind().click(function() { 3550 $(this).parent().find('.add_to_wishlist').trigger('click'); 3551 }); 3552 3553 $('.enquire_link, .enquire-close-button, .enquire_link_custom button, .enquire_link_custom_small button').unbind().click(function() { 3554 window.site.overlays.enquire.click_open($(this)); 3555 return false; 3556 }); 3557 3558 $('input, textarea', '#quick_contact_widget') 3559 .each(function() { 3560 $(this).attr('default-value', $(this).parent().find('> label').text()); 3561 $(this).attr('placeholder', $(this).parent().find('> label').text()); 3562 if ($(this).val() != '' && $(this).val() != $(this).attr('default-value')) { 3563 $(this).addClass('active'); 3564 } else { 3565 $(this).val($(this).attr('default-value')); 3566 } 3567 }) 3568 .change(function() { 3569 $(this).closest('.form_row').removeClass('error'); 3570 }) 3571 .focus(function() { 3572 $(this).closest('.form_row').removeClass('error'); 3573 if ($(this).val() == $(this).attr('default-value')) { 3574 $(this).addClass('active'); 3575 $(this).val(''); 3576 } 3577 var field_offset_top = $(this).offset().top - 200; 3578 $('#quick_contact_widget .notify_panel_content').animate({'scrollTop': field_offset_top}, 0); 3579 }) 3580 .blur(function() { 3581 $(this).attr('default-value', $(this).parent().find('label').text()); 3582 if ($(this).val() == '' || $(this).val() == $(this).attr('default-value')) { 3583 $(this).val($(this).attr('default-value')); 3584 $(this).removeClass('active'); 3585 } 3586 }) 3587 ; 3588 3589 $('select', '#quick_contact_widget') 3590 .each(function() { 3591 $(this).attr('default-value', $(this).val()); 3592 $(this).attr('placeholder', $(this).val()); 3593 }) 3594 .change(function() { 3595 if ($(this).val() != '') { 3596 $(this).addClass('active'); 3597 } else { 3598 $(this).removeClass('active'); 3599 } 3600 }) 3601 ; 3602 3603 $('#quick_contact_widget .notify_panel_close').unbind().click(function() { 3604 window.site.enquiry.close(); 3605 }); 3606 3607 $('#quick_contact_widget .button a, #quick_contact_widget button').unbind().click(function() { 3608 window.site.overlays.enquire.submit_form_validate($(this).closest('#quick_contact_widget').find('form')); 3609 return false; 3610 }); 3611 3612 }, 3613 3614 close: function() { 3615 window.setTimeout(function() { 3616 if (!$('.overlay.active').not('.enquire-overlay').length) { 3617 $('body').removeClass('active-init'); 3618 } 3619 }, 600); 3620 3621 if (!$('.overlay.active').not('.enquire-overlay').length) { 3622 $('body, html').removeClass('overlay-open'); 3623 } 3624 3625 $('body').removeClass('quick_contact_widget_active'); 3626 $('.enquire-overlay .overlay-bg').removeClass('open'); 3627 $('.enquire-overlay').removeClass('active'); 3628 3629 $(".enquire-input-wrapper.visible, .enquire-contact-wrapper.visible").removeClass('visible'); 3630 h.accessibility.on_popup_closing(); 3631 }, 3632 3633 open: function(clicked_element, data, form_type) { 3634 3635 if ($(clicked_element).closest('.enquire_link_custom').length) { 3636 clicked_element = $(clicked_element).closest('.enquire_link_custom'); 3637 } 3638 if ($(clicked_element).closest('.enquire_link_custom_small').length) { 3639 clicked_element = $(clicked_element).closest('.enquire_link_custom_small'); 3640 } 3641 3642 3643 $('#container_outer').removeClass('scrolling-down scrolling-up'); 3644 $('.enquire-overlay .overlay-bg').addClass('open'); 3645 $('.enquire-overlay').addClass('active'); 3646 $('body, html').addClass('overlay-open'); 3647 3648 $('#qcw_field_item').val(''); 3649 $('#quick_contact_widget form #qcw_field_artist_interest').val(''); 3650 $('#quick_contact_widget form #qcw_field_artwork_interest').val(''); 3651 3652 $(".enquire-input-wrapper:not(.visible),.enquire-contact-wrapper:not(.visible)").each(function(i){ 3653 var $item = $(this); 3654 setTimeout(function() { 3655 $item.addClass('visible') 3656 }, 500); 3657 }); 3658 3659 if (window.ga) { 3660 // Track the click in Analytics 3661 analytics_params = { 3662 'hitType': 'event', 3663 'eventCategory': 'Enquiry form opened', 3664 'eventAction': window.location.pathname, 3665 'eventLabel': $(document).attr('title') 3666 }; 3667 ga('send', analytics_params); 3668 ga('tracker2.send', analytics_params); 3669 } 3670 3671 var form_type = form_type && typeof form_type != 'undefined' ? form_type : 'standard'; 3672 var data = data && typeof data != 'undefined' ? data : {}; 3673 var item_table = ''; 3674 var item_id = ''; 3675 var items_json = ''; 3676 3677 3678 $('body').addClass('quick_contact_widget_active'); 3679 $('#quick_contact_widget').addClass('active'); 3680 $('#quick_contact_widget').clearQueue().delay(10).queue(function() { 3681 $(this).addClass('animate').dequeue(); 3682 }); 3683 $('#quick_contact_widget').removeClass('success').removeClass (function (index, className) { 3684 return (className.match (/(^|\s)enquiry-type-\S+/g) || []).join(' '); 3685 }); 3686 3687 $('#quick_contact_widget form #qcw_field_originating_page').val(window.location.pathname); 3688 3689 if (clicked_element && typeof clicked_element != 'undefined') { 3690 var additional_field_content = $(clicked_element).attr('data-contact-form-details'); 3691 var additional_field_image = $(clicked_element).attr('data-contact-form-image'); 3692 var additional_field_parent_id = $(clicked_element).attr('data-contact-form-parent-id'); 3693 3694 var items_json = $(clicked_element).attr('data-items-json') && typeof $(clicked_element).attr('data-items-json') != 'undefined' ? $(clicked_element).attr('data-items-json') : ''; 3695 3696 var item_table = $(clicked_element).attr('data-item-table') && typeof $(clicked_element).attr('data-item-table') != 'undefined' ? $(clicked_element).attr('data-item-table') : ''; 3697 var item_id = $(clicked_element).attr('data-item-id') && typeof $(clicked_element).attr('data-item-id') != 'undefined' ? $(clicked_element).attr('data-item-id') : ''; 3698 3699 var additional_field_artist_interest = $(clicked_element).attr('data-contact-form-artist-interest') && typeof $(clicked_element).attr('data-contact-form-artist-interest') != 'undefined' ? $(clicked_element).attr('data-contact-form-artist-interest') : ''; 3700 var additional_field_artwork_interest = $(clicked_element).attr('data-contact-form-artwork-interest') && typeof $(clicked_element).attr('data-contact-form-artwork-interest') != 'undefined' ? $(clicked_element).attr('data-contact-form-artwork-interest') : ''; 3701 var form_type = $(clicked_element).attr('data-type') && typeof $(clicked_element).attr('data-type') != 'undefined' ? $(clicked_element).attr('data-type') : form_type; 3702 var form_subtype = $(clicked_element).attr('data-subtype') && typeof $(clicked_element).attr('data-subtype') != 'undefined' ? $(clicked_element).attr('data-subtype') : ''; 3703 3704 } 3705 3706 $('#qcw_field_items').val(items_json); 3707 $('#qcw_field_contact_type').val(form_type); 3708 $('#qcw_field_item_table').val(item_table); 3709 $('#qcw_field_item_id').val(item_id); 3710 3711 if (form_type && typeof form_type != 'undefined') { 3712 $('#quick_contact_widget').addClass('enquiry-type-' + form_type); 3713 } 3714 3715 $('#quick_contact_widget .notify_panel_items').html(''); 3716 3717 if (additional_field_content || form_type == 'sales') { 3718 3719 // Sales / artwork enquiry form type 3720 if (additional_field_content) { 3721 $('#quick_contact_widget form #qcw_field_artist_interest').val(additional_field_artist_interest); 3722 $('#quick_contact_widget form #qcw_field_artwork_interest').val(additional_field_artwork_interest); 3723 3724 if ($('#quick_contact_widget .notify_panel_items').length) { 3725 $('#quick_contact_widget .notify_panel_items').html('<ul><li></li></ul>'); 3726 $('#quick_contact_widget .notify_panel_items li').html('<div class="content">' + decodeURIComponent(additional_field_content) + '</div>'); 3727 if (additional_field_image) { 3728 var website_domain = ''; 3729 if (additional_field_image.substr(0,7) != 'http://' && additional_field_image.substr(0,8) != 'https://') { 3730 var website_domain = 'http://' + document.location.host; 3731 } 3732 $('#quick_contact_widget .notify_panel_items li').prepend('<div class="image"><div><img alt="" src="' + website_domain + additional_field_image + '"/></div></div>'); 3733 } 3734 $('#quick_contact_widget form #qcw_field_item').val(encodeURIComponent($('#quick_contact_widget .notify_panel_items li').html())); 3735 } 3736 } 3737 } 3738 3739 3740 if ($('input[name="contact_type"]').length && $('input[name="contact_type"]').val() == 'wishlist-share') { 3741 setTimeout(function() { 3742 grecaptcha.reset(); 3743 }, 1000); 3744 } 3745 3746 // focus trap the popup 3747 h.accessibility.on_popup_opening('.enquire-overlay', '#qcw_field_name', '.enquire-overlay .enquire-close-button'); 3748 }, 3749 3750 clear_form: function() { 3751 grecaptcha.reset(); 3752 3753 $('#qcw_field_item').val(''); 3754 $('#quick_contact_widget form #qcw_field_artist_interest').val(''); 3755 $('#quick_contact_widget form #qcw_field_artwork_interest').val(''); 3756 $('#qcw_field_message', '#quick_contact_widget').each(function() { 3757 $(this).val($(this).attr('default-value')).removeClass('active'); 3758 }); 3759 $('#qcw_field_subject', '#quick_contact_widget').each(function() { 3760 $(this).val('').removeClass('active'); 3761 }); 3762 $('#quick_contact_widget .notify_panel_items').html(''); 3763 3764 }, 3765 3766 submit_form_validate: function(instance) { 3767 3768 if ($('input[name="contact_type"]').length && $('input[name="contact_type"]').val() == 'wishlist-share') {
3769 // Wishlist share requires captcha 3770 $('body').addClass('captcha-verify-mode'); 3771 $('#quick_contact_widget .button').addClass('loading'); 3772 grecaptcha.execute(); 3773 } else { 3774 window.site.overlays.enquire.submit_form(instance); 3775 } 3776 3777 }, 3778 3779 submit_form: function(instance) { 3780 3781 if (instance) { 3782 3783 $('#quick_contact_widget .button').addClass('loading'); 3784 $('.error_row', instance).removeClass('active'); 3785 3786 data = 'submit=1&'; 3787 $('input, select, textarea', instance).each(function() { 3788 var field_value = $(this).val(); 3789 if ($(this).attr('type') == 'radio') { 3790 if ($(this).is(':checked')) { 3791 data = data + $(this).attr('name') + '=' + field_value.replace(/\n/g, '<br />') + '&'; 3792 } 3793 } else { 3794 if (field_value != $(this).attr('default-value')) { 3795 if ($(this).attr('type') == 'checkbox') { 3796 if ($(this).attr('name') == 'terms') { 3797 var field_value = $(this).is(':checked') ? '1' : ''; 3798 } else { 3799 var field_value = $(this).is(':checked') ? 'Yes' : 'No'; 3800 } 3801 } 3802 3803 if ($(this).attr('name') == 'message') { 3804 data = data + $(this).attr('name') + '=' + field_value.replace(/\n/g, '<br />').replace('%', 'percent') + '&'; 3805 } else { 3806 data = data + $(this).attr('name') + '=' + field_value.replace(/\n/g, '<br />') + '&'; 3807 } 3808 } 3809 } 3810 }); 3811 3812 data = data + 'originating_page=' + encodeURIComponent(window.location.pathname + window.location.search) + '&'; 3813 3814 $.ajax({ 3815 url: "/enquiry/", 3816 data: data, 3817 cache: false, 3818 method: 'POST', 3819 dataType: 'json', 3820 success: function(data) { 3821 setTimeout(function() { 3822 $('#quick_contact_widget .button').removeClass('loading'); 3823 }, 1600); 3824 $('#quick_contact_widget') 3825 .delay(400) 3826 .queue(function() { 3827 if (data['success'] == 1) { 3828 3829 quick_contact_enquiry_type = 'standard'; 3830 if ($('#quick_contact_widget').hasClass('enquiry-type-wishlist-share')) { 3831 quick_contact_enquiry_type = 'wishlist-share'; 3832 } 3833 3834 window.archimedes.archimedes_core.analytics.track_campaigns.save_form_data($('#quick_contact_widget')); 3835 3836 $('#quick_contact_widget').addClass('success'); 3837 if (window.ga) { 3838 // Track in Analytics 3839 analytics_params = { 3840 'hitType': 'event', 3841 'eventCategory': (quick_contact_enquiry_type == 'wishlist-share' ? 'Enquiry form submit success' : 'Wishlist send to a friend success'), 3842 'eventAction': window.location.pathname, 3843 'eventLabel': $(document).attr('title') 3844 }; 3845 ga('send', analytics_params); 3846 ga('tracker2.send', analytics_params); 3847 } 3848 3849 window.site.overlays.enquire.close(); 3850 3851 $('#quick_contact_widget') 3852 .delay(200) 3853 .queue(function() { 3854 if (quick_contact_enquiry_type == 'wishlist-share') { 3855 h.alert('<h2>List sent</h2><div>Your list has been sent.</div>'); 3856 } else { 3857 h.alert('<h2>Thank you</h2><div>Your enquiry has been sent.</div>'); 3858 } 3859 $(this).dequeue(); 3860 }) 3861 ; 3862 3863 } else { 3864 grecaptcha.reset(); 3865 var error_message = ''; 3866 if (data['error_message'] && typeof data['error_message'] != 'undefined') { 3867 var error_message = data['error_message']; 3868 } 3869 var field_errors = []; 3870 if (data['field_errors'] && typeof data['field_errors'] != 'undefined') { 3871 var field_errors = data['field_errors']; 3872 } 3873 $.each(field_errors, function(i, v) { 3874 $('#quick_contact_widget').find('[name="' + v + '"]').closest('.form_row').addClass('error'); 3875 }); 3876 if (error_message) { 3877 h.alert(error_message); 3878 } 3879 3880 if (window.ga) { 3881 // Track in Analytics 3882 analytics_params = { 3883 'hitType': 'event', 3884 'eventCategory': 'Inquiry form submit error', 3885 'eventAction': window.location.pathname, 3886 'eventLabel': $(document).attr('title') 3887 }; 3888 ga('send', analytics_params); 3889 ga('tracker2.send', analytics_params); 3890 } 3891 3892 } 3893 $(this).dequeue(); 3894 }) 3895 ; 3896 } 3897 }); 3898 } 3899 3900 }, 3901 3902 after_submit: function() { 3903 3904 } 3905 3906 }, 3907 3908 content: { 3909 3910 init: function() { 3911 window.site.overlays.content.setup(); 3912 }, 3913 3914 setup: function() { 3915 3916 $('.content_overlay_link_example, .content-overlay .overlay-close-button').unbind().click(function() { 3917 var clicked_element = $(this); 3918 3919 if ($('.content-overlay').hasClass('active')) { 3920 window.site.overlays.content.close(); 3921 } else { 3922 window.site.overlays.content.open(cl
3922icked_element); 3923 } 3924 3925 return false; 3926 }); 3927 3928 }, 3929 3930 close: function() { 3931 window.setTimeout(function() { 3932 $('body').removeClass('active-init'); 3933 }, 600); 3934 $('.content-overlay .overlay-bg').removeClass('open'); 3935 $('.content-overlay').removeClass('active'); 3936 $('body, html').removeClass('overlay-open content-overlay-open'); 3937 $(".content-overlay-wrapper.visible").removeClass('visible'); 3938 3939 $('.content-overlay .overlay-container-inner').scrollTop(0); 3940 3941 $('.list-preview-track-list .item').removeClass('active'); 3942 $('.list-preview-track-list').removeClass('item-preview-active'); 3943 }, 3944 3945 open: function(clicked_element, received_html) { 3946 var received_html = (received_html && typeof received_html != 'undefined' ? received_html : ''); 3947 3948 $('#content-overlay-content').html(received_html); 3949 3950 $('body').addClass('active-init'); 3951 3952 $(clicked_element).closest('.item').addClass('active'); 3953 $(clicked_element).closest('.list-preview-track-list').addClass('item-preview-active'); 3954 3955 setTimeout(function() { 3956 $('#container_outer').removeClass('scrolling-down scrolling-up'); 3957 $('.content-overlay .overlay-bg').addClass('open'); 3958 $('.content-overlay').addClass('active'); 3959 $('body, html').addClass('overlay-open content-overlay-open'); 3960 3961 setTimeout(function() { 3962 $('.content-overlay-wrapper:not(.visible)').each(function(i){ 3963 $(this).addClass('visible') 3964 }); 3965 }, 700, clicked_element); 3966 }, 50, clicked_element); 3967 3968 if (window.ga) { 3969 // Track the click in Analytics 3970 analytics_params = { 3971 'hitType': 'event', 3972 'eventCategory': 'Whats on event preview opened', 3973 'eventAction': window.location.pathname, 3974 'eventLabel': $(document).attr('title') 3975 }; 3976 ga('send', analytics_params); 3977 ga('tracker2.send', analytics_params); 3978 } 3979 3980 } 3981 3982 }, 3983 3984 navigation: function() { 3985 $('#menu, .nav-close-button').unbind().click(function() { 3986 $('#container_outer').removeClass('scrolling-down scrolling-up'); 3987 $('body').addClass('active-init'); 3988 window.setTimeout(function() { 3989 const $header_vat_toggle = $('#header_items_inner .vat-toggle'); 3990 if ($('.nav-overlay').hasClass('active')) { 3991 window.setTimeout(function() { 3992 $('body').removeClass('active-init'); 3993 }, 600); 3994 $('.nav-overlay .overlay-bg').removeClass('open'); 3995 $('.nav-overlay').removeClass('active'); 3996 $('body, html').removeClass('overlay-open nav-overlay-open'); 3997 setTimeout( 3998 () => $header_vat_toggle.fadeIn(400, () => $header_vat_toggle.attr('style', '')), 3999 200 4000 ); 4001 4002 $(".nav-contact-module.visible, .nav-wrapper li.visible").removeClass('visible'); 4003 h.accessibility.on_popup_closing('#menu'); 4004 } else { 4005 $('.nav-overlay .overlay-bg').addClass('open'); 4006 $('.nav-overlay').addClass('active'); 4007 $('body, html').addClass('overlay-open nav-overlay-open'); 4008 $header_vat_toggle.fadeOut(); 4009 4010 setTimeout(function() { 4011 $(".nav-contact-module:not(.visible)").each(function(i){ 4012 var $item = $(this); 4013 setTimeout(function() { 4014 $item.addClass('visible') 4015 }, 300*i); 4016 }); 4017 $(".nav-wrapper li:not(.visible)").each(function(i){ 4018 var $item = $(this); 4019 setTimeout(function() { 4020 $item.addClass('visible') 4021 }, 100*i); 4022 }); 4023 }, 400); 4024 4025 h.accessibility.on_popup_opening('.nav-overlay', '.nav-wrapper a:first', '.nav-close-button'); 4026 } 4027 }, 50); 4028 4029 }); 4030 4031 $('.fire-pageload').unbind().click(function() { 4032 4033 var this_link = $(this).attr('data-link'); 4034 4035 $('.nav-overlay').addClass('animate-out').removeClass('active'); 4036 4037 $(".nav-contact-module.visible").each(function(i){ 4038 var $item = $(this); 4039 setTimeout(function() { 4040 $item.removeClass('visible'); 4041 }, 300*i); 4042 }); 4043 $(".nav-wrapper li.visible").each(function(i){ 4044 var $item = $(this); 4045 setTimeout(function() { 4046 $item.removeClass('visible'); 4047 }, 100*i); 4048 }); 4049 4050 window.setTimeout(function() { 4051 window.location.href = this_link; 4052 }, 1500, this_link); 4053 }); 4054 4055 }, 4056 4057 artworks: function() { 4058 //history.pushState({'ajaxPageLoad': true}, null, '/artworks/'); 4059 //$('body').addClass('page-popup-clicked-close'); 4060 //window.history.back(); 4061 $('.artworks-overlay-button, .artworks-overlay-close-button').unbind('click.artworks-overlay-click').bind('click.artworks-overlay-click', function(e) { 4062 var clicked_element = $(this); 4063 $('#container_outer').removeClass('scrolling-down scrolling-up'); 4064 $('body').addClass('active-init'); 4065 window.setTimeout(function() { 4066 if ($('.artworks-overlay').hasClass('active')) { 4067 $('.artworks-overlay').removeClass('show-content'); 4068 4069 $(".nav-contact-module.visible, .nav-wrapper li.visible").removeClass('visible'); 4070 4071 4072 setTimeout(function() { 4073 $('.artworks-overlay .overlay-bg').removeClass('open'); 4074 $('.artworks-overlay').removeClass('active'); 4075 $('body, html').removeClass('overlay-open artworks-overlay-open'); 4076 4077 setTimeout(function() { 4078 $('body').removeClass('active-init'); 4079 $('.artwork-nav-top-level').removeClass('active not-active'); 4080 $('.artworks-overlay-content').removeClass('second-level-active'); 4081 }, 600); 4082 }, 200); 4083 4084 $('.artwork-nav-top-level .artwork-nav-hero').each(function() { 4085 $(this).find('.image').filter(':eq(0)').addClass('active'); 4086 }); 4087 } else { 4088 var relative_id = clicked_element.attr('data-relative-id') && typeof clicked_element.attr('data-relative-id') != 'undefined' ? clicked_element.attr('data-relative-id') : false;
4089 window.site.lazy_load.fire($('.artworks-overlay .image_lazy_load')); 4090 $('.artworks-overlay .overlay-bg').addClass('open'); 4091 $('.artworks-overlay').addClass('active'); 4092 $('body, html').addClass('overlay-open artworks-overlay-open'); 4093 4094 setTimeout(function() { 4095 $('.artworks-overlay').addClass('show-content'); 4096 }, 400); 4097 4098 setTimeout(function() { 4099 if ($('body, html').hasClass('nav-overlay-open')) { 4100 $('.nav-overlay .overlay-bg').removeClass('open'); 4101 $('.nav-overlay').removeClass('active'); 4102 $('body, html').removeClass('nav-overlay-open'); 4103 $('.nav-contact-module.visible, .nav-wrapper li.visible').removeClass('visible'); 4104 } 4105 }, 800); 4106 4107 if (relative_id) { 4108 $('.artworks-overlay .artwork-nav-top-level[data-id="' + relative_id + '"]').trigger('click'); 4109 } 4110 } 4111 }, 50, clicked_element); 4112 return false; 4113 }); 4114 4115 $('.artwork-navigation a').unbind().click(function() { 4116 var selected_element = $(this).closest('li'); 4117 var this_href = $(this).attr('href'); 4118 //$('.artworks-overlay-close-button').trigger('click'); 4119 $(this).closest('li').addClass('selected'); 4120 //$(this).closest('ul').find('li').not('.selected').each(function() { 4121 // $(this).slideUp(800); 4122 //}); 4123 4124 $('.artwork-navigation').addClass('nav-selected'); 4125 //setTimeout(function() { 4126 // $(selected_element).addClass('selected2') 4127 //}, 600, selected_element); 4128 //setTimeout(function() { 4129 $.pageload.load(this_href, true, false); 4130 //}, 1200, this_href); 4131 return false; 4132 }); 4133 4134 $('.artworks-overlay-content').each(function() { 4135 $('.artwork-nav-top-level').unbind().bind('click.artist-nav-click', function() { 4136 var this_instance = $(this); 4137 if (!this_instance.hasClass('active') && !$('.artworks-overlay-content').hasClass('nav-transitioning')) { 4138 $(this).closest('.artworks-overlay-content').find('.artwork-nav-top-level').not(this_instance).removeClass('active').addClass('not-active'); 4139 $(this).addClass('active').removeClass('not-active'); 4140 $(this).closest('.artworks-overlay-content').addClass('second-level-active'); 4141 4142 $(this).closest('.artworks-overlay-content').find('.artwork-nav-top-level').not(this_instance).find('.artwork-nav-wrapper li.visible').each(function(i){ 4143 var $item = $(this); 4144 setTimeout(function() { 4145 $item.removeClass('visible'); 4146 }, 100*i); 4147 }); 4148 4149 $(this).closest('.artwork-nav-top-level').find('.artwork-nav-wrapper li').each(function(i){ 4150 var $item = $(this); 4151 setTimeout(function() { 4152 $item.addClass('visible'); 4153 }, 100*i); 4154 }); 4155 4156 if (false) { 4157 $('.artworks-overlay-content').addClass('nav-transitioning'); 4158 $('.artworks-overlay-content').removeClass('nav-not-transitioning'); 4159 setTimeout(function() { 4160 $('.artworks-overlay-content').removeClass('nav-transitioning'); 4161 $('.artworks-overlay-content').addClass('nav-not-transitioning'); 4162 }, 600); 4163 } 4164 4165 var this_top_level_category_offset_top = $(this).offset().top - $('.artwork-navigation').offset().top; 4166 if (this_top_level_category_offset_top > 0) { 4167 $('.overlay-container-inner').animate({'scrollTop': this_top_level_category_offset_top}, 600, 'easeInOutExpo'); 4168 } 4169 } 4170 }); 4171 $('.artwork-nav-top-level').hover( 4172 function() { 4173 $('.artworks-overlay-content').addClass('top-level-hover'); 4174 $(this).parent().find('.artwork-nav-top-level').not(this).removeClass('last-hover'); 4175 //$(this).addClass('last-hover'); 4176 }, 4177 function() { 4178 $('.artworks-overlay-content').removeClass('top-level-hover'); 4179 } 4180 ); 4181 4182 if (!window.site.device.handheld() && window.site.device.breakpoint() > 2) { 4183 $('.artwork-nav-top-level .artwork-nav-wrapper ul li').hover( 4184 function() { 4185 if (!$('.artwork-navigation').hasClass('nav-selected')) { 4186 var hero_instance = $(this).closest('.artwork-nav-top-level').find('.artwork-nav-hero'); 4187 var this_index = $(this).index() + 1; 4188 hero_instance.find('.artwork-image').removeClass('active'); 4189 hero_instance.find('.artwork-image').filter(':eq(' + this_index + ')').addClass('active'); 4190 $(this).closest('.artwork-nav-top-level').addClass('subnav-hover'); 4191 } 4192 }, 4193 function() { 4194 if (!$('.artwork-navigation').hasClass('nav-selected')) { 4195 var hero_instance = $(this).closest('.artwork-nav-top-level').find('.artwork-nav-hero'); 4196 hero_instance.find('.artwork-image').removeClass('active'); 4197 hero_instance.find('.artwork-image').filter(':eq(0)').addClass('active'); 4198 $(this).closest('.artwork-nav-top-level').removeClass('subnav-hover'); 4199 } 4200 } 4201 ); 4202 } 4203 4204 // Reset everything in case we have loaded from a previous page and some of the settings remain from before 4205 $('.artwork-nav-top-level .artwork-nav-hero').each(function() { 4206 $(this).find('.artwork-image').filter(':eq(0)').addClass('active'); 4207 }); 4208 $('.artwork-navigation').removeClass('nav-selected'); 4209 $('.artwork-nav-wrapper ul li').removeClass('selected').attr('style', ''); 4210 }); 4211 4212 // Artwork menu permalink page 4213 if (window.location.pathname.indexOf('/artworks/section/') == 0) { 4214 var relative_id = window.location.pathname.replace('/artworks/section/', '').replace('/', ''); 4215 if (relative_id) { 4216 $('.artwork-nav-top-level[data-id="' + relative_id + '"]').trigger('click'); 4217 } 4218 } 4219 if (window.location.pathname == '/artworks/' || window.location.pathname.indexOf('/artworks/section/') == 0) { 4220 window.site.lazy_load.fire($('.artwork-navigation .image_lazy_load')); 4221 } 4222
4223 /////////////////////////////////////////// 4224 /////////////////////////////////////////// 4225 // OPEN AUTOMATICALLY FOR DEVELOPMENT 4226 //$('.artworks-overlay-button').trigger('click'); 4227 /////////////////////////////////////////// 4228 /////////////////////////////////////////// 4229 /* 4230 $('.fire-pageload').unbind().click(function() { 4231 4232 var this_link = $(this).attr('data-link'); 4233 4234 $('.nav-overlay').addClass('animate-out').removeClass('active'); 4235 4236 $(".nav-contact-module.visible").each(function(i){ 4237 var $item = $(this); 4238 setTimeout(function() { 4239 $item.removeClass('visible'); 4240 }, 300*i); 4241 }); 4242 $(".nav-wrapper li.visible").each(function(i){ 4243 var $item = $(this); 4244 setTimeout(function() { 4245 $item.removeClass('visible'); 4246 }, 100*i); 4247 }); 4248 4249 window.setTimeout(function() { 4250 window.location.href = this_link; 4251 }, 1500, this_link); 4252 }); 4253 */ 4254 4255 4256 4257 } 4258 4259 }, 4260 4261 artlogic_inview: { 4262 4263 default_elements: '.inview_element, .hide-off-screen, .scroll_section_top, .faux_footer, .records_slider_panel', 4264 4265 options: { 4266 rootMargin: '0px', //Viewport margins 10px 20px 30px 40px 4267 threshold: [0, 0.1, 0.3, 0.5, 0.7, 1] //how much needs to be showing. Fires IN and Out by that amount 4268 }, 4269 4270 init: function(context) { 4271 4272 $('#container').removeClass('hero-section-visible'); 4273 $('#container').addClass('hero-section-not-visible'); 4274 $('#container_outer').removeClass('page-enquiry-visible'); 4275 $('#container_outer').addClass('page-enquiry-not-visible'); 4276 4277 if (window.site.device.handheld_not_ios()) { 4278 // Compatability mode if intersection observer does not work 4279 // $.browser.name == 'mozilla' 4280 window.site.lazy_load.fire($('.image_lazy_load')); 4281 setTimeout(function() { 4282 $(window.site.artlogic_inview.default_elements).each(function() { 4283 var $entry = $(this); 4284 4285 if ($entry.hasClass('inview_element')) { 4286 $entry.addClass('visible'); 4287 var video_element = $entry.find('video'); 4288 var lazy_load_context = $('.image_lazy_load'); 4289 var lazy_load_element = $entry.find('.image_lazy_load').not('.loaded, .loading'); 4290 var position_of_lazy_load_element = lazy_load_context.index($entry.find('.image_lazy_load')); 4291 4292 var lazy_load_element_to_fire = lazy_load_element; 4293 //if (position_of_lazy_load_element > 0) { 4294 // var adjacent_lazy_load_elements = lazy_load_context.slice(position_of_lazy_load_element, position_of_lazy_load_element + 4); 4295 // lazy_load_element_to_fire = adjacent_lazy_load_elements; 4296 //} 4297 4298 if (lazy_load_element_to_fire.length) { 4299 window.site.lazy_load.fire(lazy_load_element_to_fire); 4300 } 4301 4302 if (video_element.length && window.site.device.video_inline()) { 4303 video_element.get(0).play(); 4304 } 4305 } 4306 }); 4307 $(window).bind('scroll', window.site.throttle(50, function() { 4308 $(window.site.artlogic_inview.default_elements).each(function() { 4309 var $entry = $(this); 4310 if ($entry.hasClass('faux_footer')) { 4311 if ($(window).scrollTop() + $(window).height() > $entry.offset().top) { 4312 $('#container').addClass('footer-visible'); 4313 } else { 4314 $('#container').removeClass('footer-visible'); 4315 } 4316 } 4317 if ($entry.hasClass('scroll_section_top') && $entry.hasClass('hide-off-screen')) { 4318 if ($(window).scrollTop() > $(window).height()) { 4319 if (!$entry.hasClass('hidden-off-screen')) { 4320 $entry.addClass('hidden-off-screen') 4321 } 4322 if (!$('#container').hasClass('hero-section-not-visible')) { 4323 $('#main_slideshow').cycle('pause'); 4324 } 4325 } else { 4326 if ($entry.hasClass('hidden-off-screen')) { 4327 $entry.removeClass('hidden-off-screen ') 4328 } 4329 } 4330 } 4331 }); 4332 })); 4333 }, 50); 4334 } else { 4335 4336 var default_context = window.site.artlogic_inview.default_elements; 4337 var context = (context && typeof context != 'undefined' ? context : default_context); 4338 4339 // SETUP THE OBSERVER 4340 artlogic_observer = new IntersectionObserver(window.site.artlogic_inview.callback, window.site.artlogic_inview.options); 4341 4342 /// SET TARGETS 4343 var targets = document.querySelectorAll(context); 4344 // Watch the targets 4345 for (var i = targets.length - 1; i >= 0; i--) { 4346 // UNBIND OBSERVERS IF THEY ARE ALREADY RUNNING 4347 artlogic_observer.unobserve(targets[i]); 4348 } 4349 for (var i = targets.length - 1; i >= 0; i--) { 4350 // OBSERVE ELEMENTS 4351 artlogic_observer.observe(targets[i]); 4352 } 4353 $('.inview_element').addClass('animate-from-bottom'); 4354 } 4355 4356 4357 }, 4358 4359 destroy: function() { 4360 if (typeof artlogic_observer == 'undefined') { 4361 artlogic_observer = false;
4362 } 4363 if (artlogic_observer && typeof artlogic_observer != 'undefined') { 4364 var elements = window.site.artlogic_inview.default_elements; 4365 var targets = document.querySelectorAll(elements); 4366 for (var i = targets.length - 1; i >= 0; i--) { 4367 artlogic_observer.unobserve(targets[i]); 4368 } 4369 } 4370 }, 4371 4372 callback: function(entries, observer) { 4373 4374 entries.forEach(function(entry) { 4375 4376 var $entry = $(entry.target); 4377 var ratio_onscreen = entry.intersectionRatio; 4378 4379 /////GALLERY SECTIONS 4380 if ($entry.hasClass('inview_element')) { 4381 var video_element_embed = $entry.find('.video_embed_wrapper'); 4382 var video_element = $entry.find('video'); 4383 var intro_content = $entry.hasClass('inview_element_intro'); 4384 $entry.attr('data-ratio_onscreen', ratio_onscreen); 4385 if (!entry.isIntersecting) { 4386 // SETTING ABOVE AND BELOW CLASSES 4387 if (entry.boundingClientRect.top >= 0){ 4388 //Scrolling down 4389 $entry.addClass('animate-from-bottom').removeClass('animate-from-top'); 4390 } else { 4391 //Scrolling up 4392 $entry.addClass('animate-from-top').removeClass('animate-from-bottom'); 4393 } 4394 $entry.removeClass('visible'); 4395 if (video_element.length) { 4396 video_element.get(0).pause(); 4397 } 4398 if (video_element_embed.length) { 4399 if (video_element_embed.hasClass('video_playing')) { 4400 //video_element_embed.removeClass('video_playing'); 4401 //video_element_embed.find('.video_embed_pause').trigger('click'); 4402 } 4403 } 4404 if (intro_content) { 4405 //$entry.removeClass('inview_element_intro_timeout'); 4406 } 4407 if ($entry.hasClass('page_enquiry_widget')) { 4408 if (!entry.boundingClientRect.top >= 0){ 4409 $('#container_outer').removeClass('page-enquiry-visible'); 4410 $('#container_outer').addClass('page-enquiry-not-visible'); 4411 } 4412 } 4413 } else { 4414 $entry.addClass('visible'); 4415 var lazy_load_context = $('.image_lazy_load'); 4416 var lazy_load_element = $entry.find('.image_lazy_load').not('.loaded, .loading'); 4417 var position_of_lazy_load_element = lazy_load_context.index($entry.find('.image_lazy_load')); 4418 4419 var lazy_load_element_to_fire = lazy_load_element; 4420 if (position_of_lazy_load_element > 0) { 4421 var adjacent_lazy_load_elements = lazy_load_context.slice(position_of_lazy_load_element, position_of_lazy_load_element + 12); 4422 lazy_load_element_to_fire = adjacent_lazy_load_elements; 4423 } 4424 4425 if (lazy_load_element_to_fire.length) { 4426 window.site.lazy_load.fire(lazy_load_element_to_fire); 4427 } 4428 4429 if (video_element.length && window.site.device.video_inline()) { 4430 video_element.get(0).play(); 4431 } 4432 4433 if (video_element_embed.length) { 4434 if (!video_element_embed.hasClass('video_playing')) { 4435 //video_element_embed.addClass('video_playing'); 4436 //video_element_embed.find('.video_embed_play').trigger('click'); 4437 } 4438 } 4439 4440 if (intro_content) { 4441 window.setTimeout(function() { 4442 $entry.addClass('inview_element_intro_timeout'); 4443 }, 2000, $entry); 4444 } 4445 if ($entry.hasClass('page_enquiry_widget')) { 4446 $('#container_outer').addClass('page-enquiry-visible'); 4447 $('#container_outer').removeClass('page-enquiry-not-visible'); 4448 } 4449 } 4450 } 4451 4452 ///// Footer 4453 if ($entry.hasClass('faux_footer')) { 4454 if (entry.isIntersecting) { 4455 $('#container').addClass('footer-visible'); 4456 if ( ratio_onscreen > 0.5) { 4457 $('#container').addClass('footer-visible2'); 4458 } 4459 if ( ratio_onscreen > 0.75) { 4460 $('#container').addClass('footer-visible3'); 4461 } 4462 } else { 4463 $('#container').removeClass('footer-visible footer-visible2 footer-visible3'); 4464 } 4465 } 4466 4467 ///// DEACTIVATE EXPENSIVE STUFF WHEN OUT OF SITE 4468 if ($entry.hasClass('hide-off-screen')) { 4469 if (entry.isIntersecting) { 4470 $entry.removeClass('hidden-off-screen'); 4471 } else { 4472 $entry.addClass('hidden-off-screen'); 4473 } 4474 } 4475 4476 4477 }); 4478 } 4479 }, 4480 4481 lazy_load: { 4482 4483 init: function() { 4484 window.site.lazy_load.setup(); 4485 // Fire lazy load on the first few elements 4486 //window.site.lazy_load.fire($('.image_lazy_load').slice(0,3)); 4487 }, 4488 4489 setup: function() { 4490 $('.image_lazy_load').each(function() { 4491 // Only process lazy load images if they do not already have a loading class 4492 if ($(this).find('img').length && !$(this).hasClass('loading') && !$(this).hasClass('initialized')) { 4493 if (false) { 4494 // Development functionality to show an initial low resolution image before the high-res is lazy-loaded 4495 var image_src_init = $(this).find('img').attr('data-src-init'); 4496 if (image_src_init && typeof image_src_init != 'undefined') { 4497 $(this).append('<img class="init_img" src="' + image_src_init + '" />'); 4498 } 4499 } else { 4500 $(this).append('<span class="loader"><svg viewBox="25 25 50 50" focusable="false"><circle class="path" cx="50" cy="50" r="20" fill="none" stroke-width="3" stroke-miterlimit="10"/></svg></span>'); 4501 } 4502 } 4503 $(this).addClass('initialized'); 4504 }); 4505 }, 4506 4507 fire: function(element) { 4508 $(element).each(function() { 4509 if ((!$(this).hasClass('loaded') && !$(this).hasClass('loading')) && $(this).hasClass('initialized')) { 4510 $(this).addClass('loading'); 4511 $(this).find('img[data-src]').each(function() { 4512 var image_src = $(this).attr('data-src'); 4513 $(this) 4514 .bind('load', function() { 4515 $(this).closest('.image_lazy_load').trigger('change.lazyload'); 4516 $(this).trigger('change.lazyload'); 4517 if ($(this).closest('.image_lazy_load').hasClass('loading')) { 4518 $(this) 4519 .delay(100) 4520 .queue(function() { 4521 $(this).closest('.image_lazy_load').removeClass('loading').addClass('loaded'); 4522 if ($(this).closest('.artwork_detail').length) { 4523 $(window).trigger('resize'); 4524 } 4525 $(this).dequeue(); 4526 }) 4527 .delay(500) 4528 .queue(function() { 4529 $(this).closest('.image_lazy_load').removeClass('loading-init'); 4530 $(this).closest('.image_lazy_load').find('.loader').remove(); 4531 $(this).dequeue(); 4532 4533 //Quick implimentation of caption alignment on image panels 4534 if ($(this).siblings('.caption').add('.caption', this).length) { 4535 var $caption = $(this).siblings('.caption').add('.caption', this); 4536 var img_width = $(this).find('img').width(); 4537 $caption.css('max-width', img_width); 4538 } 4539 4540 }) 4541 ; 4542 } 4543 }) 4544 .each(function() { 4545 var instance = $(this); 4546 if (instance[0].complete) { 4547 $(instance).trigger('load'); 4548 } 4549 setTimeout(function() { 4550 if (instance[0].complete) { 4551 $(instance).trigger('load'); 4552 } 4553 }, 500, instance); 4554 setTimeout(function() { 4555 if (instance[0].complete) { 4556 $(instance).trigger('load'); 4557 } 4558 }, 1000, instance); 4559 setTimeout(function() { 4560 if (instance[0].complete) { 4561 $(instance).trigger('load'); 4562 } 4563 }, 1500, instance); 4564 setTimeout(function() { 4565 if (instance[0].complete) { 4566 $(instance).trigger('load'); 4567 } 4568 }, 2500, instance); 4569 }) 4570 ; 4571 var instance = $(this); 4572 setTimeout(function() { 4573 $(instance).attr('src', image_src); 4574 }, 100, instance); 4575 4576 }); 4577 } 4578 }); 4579 } 4580 4581 }, 4582 4583 artworks: { 4584 4585 init: function() { 4586 window.site.artworks.setup(); 4587 }, 4588 4589 setup: function() { 4590 4591 window.site.artworks.resize(); 4592 $(window).resize(function() { 4593 window.site.artworks.resize(); 4594 }); 4595 4596 $('.artwork_detail').each(function() { 4597 $(this).addClass('visible'); 4598 window.site.lazy_load.fire($('.artwork_hero_image_container')); 4599 window.site.lazy_load.fire($('.artwork_detail .image_lazy_load')); 4600 4601 if ($('.artwork_detail_add_to_cart_wrapper .fallback_cart_wrapper', this).length) { 4602 $('.tools .enquire_link', this).parent().remove(); 4603 } 4604 }); 4605 4606 4607 if ($(".roomview-image").length) { 4608 $(".roomview-image").each(function(){ 4609 4610 const rv_options = { 4611 furniture_type: 'ac_bench', 4612 wall_type: 'standard', // Options: 'standard', 'concrete', 'brick' 4613 verbose_mode: false, 4614 hanging_height_cm: 150, 4615 furniture_items: { 4616 'ac_bench': { 4617 classname_suffix: 'ac_bench', 4618 furniture_width_cm: 300 4619 } 4620 } 4621 4622 } 4623 4624 // Supply a json config in the html: data-roomview-custom-config='{"furniture_type":"my_chair","furniture_items": {"rs_chair":{"classname_suffix":"my_chair","furniture_width_cm":148}}}' 4625 var custom_config = $(this).data('roomview-custom-config'); 4626 4627 if (custom_config && typeof custom_config != 'undefined') { 4628 if (custom_config.furniture_type && typeof custom_config.furniture_type != 'undefined') { 4629 rv_options["furniture_type"] = custom_config.furniture_type; 4630 } 4631 if (custom_config.furniture_items && typeof custom_config.furniture_items != 'undefined') { 4632 rv_options.furniture_items = custom_config.furniture_items; 4633 } 4634 } 4635 4636 $(this).roomView(rv_options); 4637 }); 4638 } 4639 4640 4641 $('.roomview-button-custom').unbind().click(function(e) { 4642 e.preventDefault(); 4643 4644 $(this).closest('.artwork_detail_main').find('.image_gallery_multiple').cycle('pause'); 4645 // For accessibility - tracks which element to refocus on 4646 try { 4647 h.accessibility.global_variables.element_to_refocus_to = $(this).children('a'); 4648 } catch(error) { 4649 console.error(error); 4650 } 4651 4652 var roomview_id = $(this).attr('data-roomview-id'); 4653 if (roomview_id && typeof roomview_id != 'undefined') { 4654 if ($('.artwork_detail_main .image_container').find('.image_gallery_multiple').length) { 4655 var roomview_instance = $('.artwork_detail_main .image_container .image:not(.cycle-sentinel) .roomview-image[data-roomview-id="' + roomview_id + '"]'); 4656 4657 } else { 4658 var roomview_instance = $('.artwork_detail_main .image_container .roomview-image[data-roomview-id="' + roomview_id + '"]'); 4659 } 4660 if ($('.artwork_detail_main .image_container').find('.image_gallery_multiple').length && !$('.image_gallery_multiple .item:not(.cycle-sentinel) .roomview-image[data-roomview-id="' + roomview_id + '"]').closest('.item').hasClass('cycle-slide-active')) { 4661 // Change slide before view in a room starts 4662 var this_slide_index = roomview_instance.closest('.cycle-slide').index($('.artwork_detail_main .image_container .image_gallery_multiple .cycle-slide').not('.cycle-sentinel')); 4663 var timeout_length = 600; 4664 if (roomview_instance.closest('.cycle-slide').hasClass('cycle-slide-active')) {
4664 4665 var timeout_length = 0; 4666 } 4667 if (this_slide_index > -1) { 4668 $('.image_gallery_multiple').cycle(this_slide_index); 4669 setTimeout(function() { 4670 roomview_instance.roomView('open'); 4671 }, timeout_length, roomview_instance); 4672 } 4673 } else { 4674 roomview_instance.roomView('open'); 4675 } 4676 } 4677 }); 4678 4679 if (false && $('body').hasClass('site-version-development-mode')) { 4680 $('.artwork_detail .image').unbind('click.zoom-activate').bind('click.zoom-activate', function() { 4681 if (window.site.device.breakpoint() >= 3) { 4682 if (!$('body').hasClass('user-distraction-free')) { 4683 $('body').addClass('user-distraction-free'); 4684 } else if (!$('body').hasClass('zoom-active') && $(this).hasClass('super_zoom_enabled')) { 4685 $(this).closest('.artwork_detail').addClass('zoom-active'); 4686 $('body').addClass('zoom-active'); 4687 } else { 4688 $(this).closest('.artwork_detail').removeClass('zoom-active'); 4689 setTimeout(function() { 4690 $('body').removeClass('zoom-active user-distraction-free'); 4691 }, 400); 4692 } 4693 } 4694 }); 4695 } 4696 4697 $('.artwork_detail .image_container, .artwork_detail .image_container .image .image_inner').each(function() { 4698 if (!window.site.device.handheld()) { 4699 // Disabled on handheld as this stops users from swiping through the works. 4700 var zoom_image = $(this).attr('data-zoom-url'); 4701 var zoom_type = $('.artwork_detail_type_standard').length || window.site.device.handheld() ? 'click' : 'mouseover'; 4702 if (zoom_image && typeof zoom_image != 'undefined') { 4703 $(this).zoom({ 4704 url: zoom_image, 4705 duration: 400, 4706 on: zoom_type, 4707 onZoomIn: function(){ 4708 $('body').addClass('zoom-active'); 4709 }, 4710 onZoomOut: function(){ 4711 $('body').removeClass('zoom-active'); 4712 }} 4713 ); 4714 } 4715 } 4716 }); 4717 4718 $('.image_gallery_multiple') 4719 .each(function() { 4720 4721 var $caption_element = $(this).closest('.full_bleed_panel_slideshow').siblings('.full_bleed_slideshow_caption'); 4722 4723 $(this) 4724 .cycle({ 4725 fx: 'fade', 4726 speed: 600, 4727 timeout: 12000, 4728 paused: true, 4729 slides: '>', 4730 autoHeight: 'container', 4731 swipe: true 4732 }) 4733 .on('cycle-before', function(event, optionHash, outgoingSlideEl, incomingSlideEl, forwardFlag) { 4734 4735 $caption_element.html(''); 4736 $caption_element.html($(incomingSlideEl).find('.caption').html()); 4737 4738 var hero_slide = $(incomingSlideEl).hasClass('image_hero_placeholder'); 4739 if (hero_slide) { 4740 $('.artwork_hero_image_container').addClass('active'); 4741 } else { 4742 $('.artwork_hero_image_container').removeClass('active'); 4743 } 4744 }) 4745 4746 ; 4747 4748 $(this).parent().find('.pagination_controls_previous').unbind().bind('click', function() { 4749 $(this).closest('.image_gallery_multiple_container').find('.image_gallery_multiple').cycle('pause').cycle('prev'); 4750 return false;
4751 }); 4752 $(this).parent().find('.pagination_controls_next').unbind().bind('click', function() { 4753 $(this).closest('.image_gallery_multiple_container').find('.image_gallery_multiple').cycle('pause').cycle('next'); 4754 return false; 4755 }); 4756 }) 4757 ; 4758 4759 if (false) { 4760 // Add shipping info next to add to cart buttons 4761 $('.artwork_detail .store_item').each(function() { 4762 if (!$('.delivery_info', this).length && !$('.price.sold_out', this).length) { 4763 $(this).append('<div class="delivery_info">Free UK shipping</div>') 4764 } 4765 }); 4766 } 4767 4768 $('.artwork_detail').each(function() { 4769 $('.artwork_detail_type_editions').append('<div class="footer">' + $('#footer').html() + '</div>'); 4770 window.site.mailing_list_form.init(); 4771 }); 4772 4773 $('.artwork_hero_image_container').on('change.lazyload', function() { 4774 var hero_image_path = $(this).find('.image_hero_full_image_duplicate').attr('src'); 4775 $('.artwork_hero_image_container .image').css({'background-image': "url('" + hero_image_path + "')"}); 4776 }); 4777 4778 $('.image_gallery_multiple .image:eq(0)') 4779 .each(function() { 4780 var hero_slide = $(this).hasClass('image_hero_placeholder'); 4781 if (hero_slide) { 4782 $('.artwork_hero_image_container').addClass('active'); 4783 } 4784 }) 4785 ; 4786 4787 $('.image_gallery_multiple_thumbnails a') 4788 .unbind() 4789 .click(function() { 4790 $('.artwork_detail').removeClass('zoom-active'); 4791 if ($('body').hasClass('page-popup-active')) { 4792 var container_scroll_top = $('#popup_content').scrollTop(); 4793 var scroll_context = $('#popup_content'); 4794 } else { 4795 var container_scroll_top = $(window).scrollTop(); 4796 var scroll_context = $('html,body'); 4797 } 4798 if (container_scroll_top > $('.image_gallery_multiple').offset().top - scroll_context.offset().top + 20) { 4799 scroll_context.animate({'scrollTop': 0}, 600, 'easeInOutExpo'); 4800 } 4801 $('.image_gallery_multiple').cycle(parseInt($(this).attr('data-index'))); 4802 return false; 4803 }) 4804 ; 4805 4806 if (window.site.device.handheld()) { 4807 prevous_drag_percentage = 0; 4808 var x; 4809 4810 var freezeVp = function(e) { 4811 e.preventDefault(); 4812 }; 4813 function stopBodyScrolling (bool) { 4814 if (bool === true) { 4815 document.body.addEventListener("touchmove", function(e) { 4816 e.preventDefault(); 4817 }, {passive: false}); 4818 } else { 4819 document.body.removeEventListener("touchmove", function(e) { 4820 e.preventDefault(); 4821 }, {passive: false}); 4822 } 4823 } 4824 4825 $('.artwork_detail') 4826 .on('touchstart', function(e) { 4827 x = e.originalEvent.targetTouches[0].pageX // anchor point 4828 }) 4829 .on('touchmove', function(e) { 4830 $('.artwork_detail').addClass('dragging'); 4831 var change = e.originalEvent.targetTouches[0].pageX - x; 4832 var percentage = 100 * change / window.innerWidth; 4833 var drag_element = $('.artwork_detail .draginner'); 4834 if (change < -10 || change > 10) { 4835 var condition_context = $('.artwork_detail').closest('#popup_content').length ? '#popup_content' : '#container_outer'; 4836 var condition = !$(condition_context).hasClass('scrolling'); 4837 if (condition) { 4838 // not yet working ios: stopBodyScrolling(true); 4839 $('body').addClass('content-swipe'); 4840 drag_element.css({'transform': 'translate3d(' + percentage + '%, 0, 0)'}); 4841 $('.artwork_detail .draginner').attr('data-left', percentage); 4842 prevous_drag_percentage = percentage; 4843 } else { 4844 4845 } 4846 } 4847 }) 4848 .on('touchend', function(e) { 4849 // not yet working ios: stopBodyScrolling(false); 4850 $('.artwork_detail').removeClass('dragging'); 4851 var percentage = $('.artwork_detail .draginner').attr('data-left'); 4852 var drag_element = $('.artwork_detail .draginner'); 4853 $('.artwork_detail').removeClass('dragging'); 4854 window.setTimeout(function() { 4855 $('body').removeClass('content-swipe'); 4856 }, 200); 4857 if (percentage > 30) { 4858 // Previous 4859 if ($('body').hasClass('page-popup-active')) { 4860 var link = $('#popup_box > .inner > .pagination_controls .previous').not('.disabled'); 4861 } else { 4862 var link = $('.artwork_detail .pagination_controls .previous a').not('.disabled'); 4863 } 4864 if (link.length) { 4865 drag_element.css({'transform': 'translate3d(201%, 0, 0)'}); 4866 link.trigger('click'); 4867 } else { 4868 prevous_drag_percentage = 0; 4869 drag_element.css({'transform': 'translate3d(0, 0, 0)'}); 4870 $('.artwork_detail .draginner').attr('data-left', '0'); 4871 } 4872 } else if (percentage < -30) { 4873 // Next 4874 if ($('body').hasClass('page-popup-active')) { 4875 var link = $('#popup_box > .inner > .pagination_controls .next').not('.disabled'); 4876 } else { 4877 var link = $('.artwork_detail .pagination_controls .next a').not('.disabled'); 4878 } 4879 if (link.length) { 4880 drag_element.css({'transform': 'translate3d(-201%, 0, 0)'}); 4881 link.trigger('click'); 4882 } else { 4883 prevous_drag_percentage = 0; 4884 drag_element.css({'transform': 'translate3d(0, 0, 0)'}); 4885 $('.artwork_detail .draginner').attr('data-left', '0'); 4886 } 4887 } else { 4888 prevous_drag_percentage = 0; 4889 drag_element.css({'transform': 'translate3d(0, 0, 0)'}); 4890 $('.artwork_detail .draginner').attr('data-left', '0'); 4891 } 4892 }) 4893 ; 4894 } 4895 }, 4896 4897 resize: function() { 4898 4899 4900 $('.artwork_detail .image_container .images .image').each(function() { 4901 var current_width = $(this).width(); 4902 var ratio_width = $(this).attr('data-width'); 4903 var ratio_height = $(this).attr('data-height'); 4904 if (current_width > 0 && ratio_width && ratio_height) { 4905 var new_width = 0; 4906 var ratio = (ratio_width / current_width); 4907 var new_height = ratio_height / ratio; 4908 if (new_height > current_width) { 4909 var new_height = current_width; 4910 } 4911 if (new_height > 0) { 4912 $(this).css('height', new_height + 'px'); 4913 } 4914 } 4915 }); 4916 4917 $('.artwork_detail .artwork_detail_main').each(function() { 4918 var min_height = $(window).width() * 0.62; 4919 if (min_height < 850) { 4920 var min_height = 850; 4921 } 4922 if (min_height > $(window).height()) { 4923 var min_height = $(window).height(); 4924 } 4925 if (min_height < 500) { 4926 var min_height = 500; 4927 } 4928 $(this).css('min-height', min_height); 4929 $('.artwork_hero_image_container').css('height', min_height); 4930 4931 $(this).find('.image_container').css('min-height', min_height); 4932 4933 var pagination_controls_height = $(this).height(); 4934 if (pagination_controls_height > $(window).height()) { 4935 var pagination_controls_height = $(window).height(); 4936 } else if (pagination_controls_height < min_height) { 4937 var pagination_controls_height = min_height; 4938 } 4939 $('#popup_box .pagination_controls > div, .artwork_detail .pagination_controls > div').css('height', pagination_controls_height - 170); 4940 4941 if ($(window).width() <= 900) { 4942 $(".image_gallery_multiple_thumbnails_container.mobile-only .image_gallery_multiple_thumbnails a").removeClass('focustrap-ignore'); 4943 } else { 4944 $(".image_gallery_multiple_thumbnails_container.mobile-only .image_gallery_multiple_thumbnails a").addClass('focustrap-ignore'); 4945 } 4946 4947 }); 4948 } 4949 4950 }, 4951 4952 social_media: { 4953 4954 init: function() { 4955 4956 $('.share_links').each(function() { 4957 $('.link a', this) 4958 .unbind() 4959 .blur(function() { 4960 if (false) {
4961 var element_context = $(this).closest('.share_links'); 4962 if (element_context.hasClass('active')) { 4963 element_context.addClass('closing').removeClass('animate active'); 4964 element_context.delay(400).queue(function() { 4965 $(this).removeClass('closing'); 4966 $(this).dequeue(); 4967 }); 4968 } 4969 } 4970 }) 4971 .click(function() { 4972 var instance = $(this); 4973 if ($(this).closest('.share_links').hasClass('active') || $(this).closest('.share_links').hasClass('closing')) { 4974 $(this).closest('.share_links').removeClass('active animate'); 4975 } else { 4976 $(this).closest('.share_links').addClass('active'); 4977 share_links_timeout = setTimeout(function() { 4978 $(instance).closest('.share_links').addClass('animate'); 4979 }, 20, instance); 4980 $(this).focus(); 4981 } 4982 return false; 4983 }) 4984 ; 4985 $('.social_links_item a', this).unbind().click(function() { 4986 if ($(this).attr('href').indexOf('http') == 0) { 4987 var new_window = window.open($(this).attr('href'), 'social_media_share', 'width=600,height=500'); 4988 return false; 4989 } 4990 }); 4991 }); 4992 4993 } 4994 4995 }, 4996 4997 enquiry: { 4998 4999 init: function() { 5000 window.site.enquiry.setup(); 5001 }, 5002 5003 setup: function() { 5004 5005 $('.form_row_types', '#contact_enquiry_form').each(function() { 5006 $(this).find('li').click(function() { 5007 $('#qcw_field_contact_variant').val($(this).attr('data-type')); 5008 $(this).parent().find('li').removeClass('active'); 5009 $(this).addClass('active'); 5010 }); 5011 $(this).find('li:eq(0)').addClass('active'); 5012 }); 5013 5014 $('input, textarea', '#contact_enquiry_form') 5015 .each(function() { 5016 $(this).attr('default-value', $(this).parent().find('> label').text()); 5017 $(this).attr('placeholder', $(this).parent().find('> label').text()); 5018 if ($(this).val() != '' && $(this).val() != $(this).attr('default-value')) { 5019 $(this).addClass('active'); 5020 } else { 5021 $(this).val($(this).attr('default-value')); 5022 } 5023 }) 5024 .change(function() { 5025 $(this).closest('.form_row').removeClass('error'); 5026 }) 5027 .focus(function() { 5028 $(this).closest('.form_row').removeClass('error'); 5029 if ($(this).val() == $(this).attr('default-value')) { 5030 $(this).addClass('active'); 5031 $(this).val(''); 5032 } 5033 }) 5034 .blur(function() { 5035 $(this).attr('default-value', $(this).parent().find('label').text()); 5036 if ($(this).val() == '' || $(this).val() == $(this).attr('default-value')) { 5037 $(this).val($(this).attr('default-value')); 5038 $(this).removeClass('active'); 5039 } 5040 }) 5041 ; 5042 5043 $('select', '#contact_enquiry_form') 5044 .each(function() { 5045 $(this).attr('default-value', $(this).val()); 5046 }) 5047 .change(function() { 5048 if ($(this).val() != '') { 5049 $(this).addClass('active'); 5050 } else { 5051 $(this).removeClass('active'); 5052 } 5053 }) 5054 ; 5055 5056 $('#contact_enquiry_form .button a, #contact_enquiry_form button').click(function() { 5057 window.site.enquiry.submit_form($(this).closest('.enquiry_form').find('form')); 5058 return false;
5059 }); 5060 5061 $('#contact_enquiry_form form').submit(function(e) { 5062 e.preventDefault(); 5063 }); 5064 5065 $('#contact_enquiry_form').each(function() { 5066 if (!$(this).hasClass('initialized')) { 5067 5068 } 5069 $(this).addClass('initialized'); 5070 }); 5071 5072 }, 5073 5074 clear_form: function() { 5075 $('#ecw_field_item').val(''); 5076 $('#ecw_field_message', '#contact_enquiry_form').each(function() { 5077 $(this).val($(this).attr('default-value')).removeClass('active'); 5078 }); 5079 $('#ecw_field_subject', '#contact_enquiry_form').each(function() { 5080 $(this).val('').removeClass('active'); 5081 }); 5082 $('#contact_enquiry_form .notify_panel_items').html(''); 5083 }, 5084 5085 submit_form: function(instance) { 5086 5087 if (instance) { 5088 $('.button', instance).addClass('loading'); 5089 $('.error_row', instance).removeClass('active'); 5090 data = 'submit=1&'; 5091 $('input, select, textarea', instance).each(function() { 5092 var field_value = $(this).val(); 5093 if ($(this).attr('type') == 'radio') { 5094 if ($(this).is(':checked')) { 5095 data = data + $(this).attr('name') + '=' + field_value.replace(/\n/g, '<br />') + '&'; 5096 } 5097 } else { 5098 if ($(this).attr('type') == 'checkbox') { 5099 if ($(this).attr('name') == 'terms') { 5100 var field_value = $(this).is(':checked') ? '1' : ''; 5101 } else { 5102 var field_value = $(this).is(':checked') ? 'Yes' : 'No'; 5103 } 5104 } 5105 if ($(this).attr('name') == 'message') { 5106 data = data + $(this).attr('name') + '=' + field_value.replace(/\n/g, '<br />').replace('%', 'percent') + '&'; 5107 } else { 5108 data = data + $(this).attr('name') + '=' + field_value.replace(/\n/g, '<br />') + '&'; 5109 } 5110 } 5111 }); 5112 5113 data = data + 'originating_page=' + encodeURIComponent(window.location.pathname + window.location.search) + '&'; 5114 5115 $.ajax({ 5116 url: "/enquiry/", 5117 data: data, 5118 cache: false, 5119 method: 'POST', 5120 dataType: 'json', 5121 success: function(data) { 5122 $('#contact_enquiry_form .button').removeClass('loading'); 5123 $('#contact_enquiry_form') 5124 .delay(400) 5125 .queue(function() { 5126 if (data['success'] == 1) { 5127 5128 window.archimedes.archimedes_core.analytics.track_campaigns.save_form_data($('#contact_enquiry_form')); 5129 5130 $('#contact_enquiry_form').addClass('success'); 5131 h.alert('<h2>Thank you</h2><div>Your enquiry has been sent.</div>'); 5132 if (window.ga) { 5133 // Track in Analytics 5134 analytics_params = { 5135 'hitType': 'event', 5136 'eventCategory': 'Enquiry form submit success', 5137 'eventAction': window.location.pathname, 5138 'eventLabel': $(document).attr('title') 5139 }; 5140 ga('send', analytics_params); 5141 ga('tracker2.send', analytics_params); 5142 } 5143 5144 $('#contact_enquiry_form') 5145 .delay(2000) 5146 .queue(function() { 5147 $(this).dequeue(); 5148 }) 5149 ; 5150 5151 } else { 5152 var error_message = ''; 5153 if (data['error_message'] && typeof data['error_message'] != 'undefined') { 5154 var error_message = data['error_message']; 5155 } 5156 var field_errors = []; 5157 if (data['field_errors'] && typeof data['field_errors'] != 'undefined') { 5158 var field_errors = data['field_errors']; 5159 } 5160 $.each(field_errors, function(i, v) { 5161 $('#contact_enquiry_form').find('[name="' + v + '"]').closest('.form_row').addClass('error'); 5162 }); 5163 if (error_message) { 5164 h.alert(error_message); 5165 } 5166 5167 if (window.ga) { 5168 // Track in Analytics 5169 analytics_params = { 5170 'hitType': 'event', 5171 'eventCategory': 'Enquiry form submit error', 5172 'eventAction': window.location.pathname, 5173 'eventLabel': $(document).attr('title') 5174 }; 5175 ga('send', analytics_params); 5176 ga('tracker2.send', analytics_params); 5177 } 5178 5179 } 5180 $(this).dequeue(); 5181 }) 5182 ; 5183 } 5184 }); 5185 } 5186 5187 }, 5188 5189 after_submit: function() { 5190 5191 } 5192 5193 }, 5194 5195 tracking: { 5196 5197 init: function() { 5198 5199 5200 } 5201 5202 }, 5203 5204 quick_enquiry: { 5205 5206 // Quick mailing list signup form 5207 5208 init: function() { 5209 window.site.quick_enquiry.setup(); 5210 }, 5211 5212 setup: function() { 5213 5214 $('input, textarea', '.page_enquiry_widget') 5215 .each(function() { 5216 $(this).attr('default-value', $(this).parent().find('> label').text()); 5217 if ($(this).val() != '' && $(this).val() != $(this).attr('default-value')) { 5218 $(this).addClass('active'); 5219 } else { 5220 $(this).val($(this).attr('default-value')); 5221 } 5222 }) 5223 .change(function() { 5224 $(this).closest('.form_row').removeClass('error'); 5225 }) 5226 .focus(function() { 5227 $(this).closest('.form_row').removeClass('error'); 5228 if ($(this).val() == $(this).attr('default-value')) { 5229 $(this).addClass('active'); 5230 $(this).val(''); 5231 } 5232 }) 5233 .blur(function() { 5234 $(this).attr('default-value', $(this).parent().find('label').text()); 5235 if ($(this).val() == '' || $(this).val() == $(this).attr('default-value')) { 5236 $(this).val($(this).attr('default-value')); 5237 $(this).removeClass('active'); 5238 } 5239 }) 5240 .keypress(function(event) { 5241 if (event.which == 13) { 5242 window.site.quick_enquiry.submit_form($(this).closest('.page_enquiry_widget').find('form')); 5243 return false;
5244 } 5245 }) 5246 ; 5247 5248 $('.page_enquiry_widget .page_enquiry_widget_submit button').unbind().click(function() { 5249 window.site.quick_enquiry.submit_form($(this).closest('.page_enquiry_widget').find('form')); 5250 return false; 5251 }); 5252 5253 $('.page_enquiry_widget').each(function() { 5254 if (!$(this).hasClass('initialized')) { 5255 5256 } 5257 $(this).addClass('initialized'); 5258 }); 5259 5260 }, 5261 5262 clear_form: function() { 5263 $('#pew_field_item').val(''); 5264 $('#pew_field_email', '.page_enquiry_widget').each(function() { 5265 $(this).val($(this).attr('default-value')).removeClass('active'); 5266 }); 5267 }, 5268 5269 email_is_valid: function(email) { 5270 flag = false; 5271 if (email.indexOf('@') > -1 && email.split('@')[1].indexOf('.') > -1 && email.indexOf(' ') == -1) { 5272 flag = true; 5273 } 5274 if (!flag) { 5275 return false 5276 } 5277 return flag; 5278 }, 5279 5280 submit_form: function(instance) { 5281 5282 if (instance) { 5283 $('.page_enquiry_widget_submit', instance).addClass('loading'); 5284 $('.error_row', instance).removeClass('active'); 5285 data = 'submit=1&'; 5286 email_string = instance.find('input[name="email"]').val(); 5287 verify_email = window.site.quick_enquiry.email_is_valid(email_string); 5288 5289 if (!verify_email) { 5290 $('.page_enquiry_widget .page_enquiry_widget_submit').removeClass('loading'); 5291 h.alert('Please enter a valid email address.'); 5292 return false; 5293 } 5294 5295 $('input, select, textarea', instance).each(function() { 5296 var field_value = $(this).val(); 5297 if (field_value != $(this).attr('default-value')) { 5298 if ($(this).attr('type') == 'checkbox') { 5299 if ($(this).attr('name') == 'terms') { 5300 var field_value = $(this).is(':checked') ? '1' : ''; 5301 } else { 5302 var field_value = $(this).is(':checked') ? 'Yes' : 'No'; 5303 } 5304 } 5305 if ($(this).attr('name') == 'message') { 5306 data = data + $(this).attr('name') + '=' + field_value.replace(/\n/g, '<br />').replace('%', 'percent') + '&'; 5307 } else { 5308 data = data + $(this).attr('name') + '=' + field_value.replace(/\n/g, '<br />') + '&'; 5309 } 5310 } 5311 }); 5312 5313 data = data + 'type=send&originating_page=' + encodeURIComponent(window.location.pathname + window.location.search) + '&contact_type=quick&mailing_list_signup=1'; 5314 5315 $.ajax({ 5316 url: "/mailing-list/signup/", 5317 data: data, 5318 cache: false, 5319 method: 'POST', 5320 dataType: 'json', 5321 success: function(data) { 5322 $('.page_enquiry_widget') 5323 .delay(400) 5324 .queue(function() { 5325 $('.page_enquiry_widget .page_enquiry_widget_submit').removeClass('loading'); 5326 if (data['success']) { 5327 window.archimedes.archimedes_core.analytics.track_campaigns.save_form_data($('.page_enquiry_widget')); 5328 5329 $('.page_enquiry_widget').addClass('success'); 5330 h.alert('<h2>Thank you</h2><div>You have been added to our mailing list.</div>'); 5331 if (window.ga) { 5332 // Track in Analytics 5333 analytics_params = { 5334 'hitType': 'event', 5335 'eventCategory': 'Enquiry form submit success', 5336 'eventAction': window.location.pathname, 5337 'eventLabel': $(document).attr('title') 5338 }; 5339 ga('send', analytics_params); 5340 ga('tracker2.send', analytics_params); 5341 } 5342 5343 } else { 5344 var error_message = '<h2>Sorry</h2>There was a problem signing up to the mailing list. Please try again or c
5344ontact us for assistance.'; 5345 if (data['error_message'] && typeof data['error_message'] != 'undefined') { 5346 var error_message = data['error_message']; 5347 } 5348 var field_errors = []; 5349 if (data['field_errors'] && typeof data['field_errors'] != 'undefined') { 5350 var field_errors = data['field_errors']; 5351 } 5352 $.each(field_errors, function(i, v) { 5353 $('.page_enquiry_widget').find('[name="' + v + '"]').closest('.form_row').addClass('error'); 5354 }); 5355 5356 if (error_message) { 5357 h.alert(error_message); 5358 } 5359 5360 if (window.ga) { 5361 // Track in Analytics 5362 analytics_params = { 5363 'hitType': 'event', 5364 'eventCategory': 'Enquiry form submit error', 5365 'eventAction': window.location.pathname, 5366 'eventLabel': $(document).attr('title') 5367 }; 5368 ga('send', analytics_params); 5369 ga('tracker2.send', analytics_params); 5370 } 5371 5372 } 5373 $(this).dequeue(); 5374 }) 5375 ; 5376 } 5377 }); 5378 } 5379 5380 }, 5381 5382 after_submit: function() { 5383 5384 } 5385 5386 }, 5387 5388 mailing_list_form: { 5389 5390 _send_url: '/mailing-list/signup/', 5391 _error_messages: '', 5392 5393 init: function() { 5394 var self = this; 5395 $('.mailing_list_form') 5396 .unbind() 5397 .each(function() { 5398 $('.field', this) 5399 .unbind() 5400 .each(function() { 5401 $(this).val($(this).attr('data-default-value')); 5402 }) 5403 .focus(function() { 5404 if ($(this).val() == $(this).attr('data-default-value')) { 5405 $(this).addClass('active').val(''); 5406 } 5407 }) 5408 .blur(function() { 5409 if ($(this).val() == '') { 5410 $(this).removeClass('active').val($(this).attr('data-default-value')); 5411 } 5412 }) 5413 ; 5414 $('.submit_button', this).unbind().click(function() { 5415 $(this).closest('form').submit(); 5416 return false; 5417 }); 5418 $('input, textarea', this).keypress(function(event) { 5419 if (event.which == 13) { 5420 $(this).closest('form').submit(); 5421 return false; 5422 } 5423 }); 5424 }) 5425 .submit(function(e){ 5426 e.preventDefault(); 5427 self._send_form($(this).closest('form')); 5428 }) 5429 ; 5430 }, 5431 5432 _form_data: function(instance) { 5433 5434 var data = {} 5435 $('input, textarea', instance).each(function() { 5436 if ($(this).val() != $(this).attr('data-default-value')) { 5437 data[$(this).attr('name')] = $(this).val(); 5438 } else { 5439 data[$(this).attr('name')] = ''; 5440 } 5441 }); 5442 return data; 5443 }, 5444 5445 _clear_form_data: function(instance) { 5446 $('input, textarea', instance).each(function() { 5447 $(this).val($(this).attr('data-default-value')); 5448 }); 5449 $('.error', instance).text('').hide(); 5450 }, 5451 5452 _mandatory_fields: function() { 5453 5454 }, 5455 5456 _email_is_valid: function(instance) { 5457 var self = this, 5458 flag = false, 5459 email = self._form_data(instance)['email']; 5460 5461 if (!self._form_data(instance)['email']) { 5462 flag = false;
5463 } else if (email.indexOf('@') > -1 && email.split('@')[1].indexOf('.') > -1 && email.indexOf(' ') == -1) { 5464 flag = true; 5465 } 5466 5467 /* Set error message */ 5468 if (!flag) { 5469 self._set_error('Please enter a valid email address.'); 5470 return false 5471 } 5472 return flag; 5473 5474 5475 }, 5476 5477 _emails_match: function(instance) { 5478 5479 // We are NOT matching the emails on this form 5480 return true; 5481 5482 var self = window.site.mailing_list_form, 5483 flag = false; 5484 5485 self._form_data(instance)['email2'] == self._form_data(instance)['email'] ? flag = true : flag = false; 5486 5487 /* Set error message */ 5488 if (!flag) { 5489 self._set_error('Your email addresses do not match.'); 5490 } 5491 return flag; 5492 }, 5493 5494 _email_not_exists: function(instance) { 5495 5496 return true; 5497 5498 }, 5499 5500 _set_error: function(error) { 5501 this._error_messages = error; 5502 }, 5503 5504 _display_error: function(instance) { 5505 var self = this; 5506 error_messages_str = '' + self._error_messages + '' 5507 error_element = $('.error', instance); 5508 if (!error_element.length) { 5509 // Fall back to error container outside the mailing list form 5510 error_element = $('.error'); 5511 } 5512 $(error_element).text(error_messages_str); 5513 $(error_element).fadeOut(1); 5514 $(error_element).fadeIn(200); 5515 }, 5516 5517 _send_form: function(instance) { 5518 5519 var self = this; 5520 5521 if (self._email_is_valid(instance) && self._email_not_exists(instance) && self._emails_match(instance)) { 5522 $.ajax({ 5523 url: self._send_url, 5524 type: "POST", 5525 dataType: 'json', 5526 data: self._form_data(instance), 5527 success: function(data) { 5528 if (data.success) { 5529 h.alert('<h2>Thank you</h2> You have been added to our mailing list.'); 5530 self._clear_form_data(instance); 5531 window.site.overlays.mailings.close(); 5532 } else { 5533 self._set_error('There was a problem adding you to the mailing list, please check the form and try again.'); 5534 self._display_error(instance); 5535 } 5536 } 5537 }); 5538 } else { 5539 self._display_error(instance); 5540 } 5541 } 5542 }, 5543 5544 artists: { 5545 5546 init: function() { 5547 $('#artist_list_grid_selector li').click(function() { 5548 var this_type = $(this).attr('data-type'); 5549 5550 $('#artist_list_grid_selector li').removeClass('active'); 5551 $('#artist_list_grid_selector li button').removeAttr('aria-label'); 5552 $(this).addClass('active'); 5553 var button_label = $(this).find('button').text(); 5554 $(this).find('button').attr('aria-label', (button_label + ' (selected)')); 5555 5556 $('#artist_list_grid_container .artist_list_section').removeClass('active animate').addClass('disabled'); 5557 $('#artist_list_grid_container .artist_list_section[data-type="' + this_type + '"]').addClass('active').removeClass('disabled'); 5558 setTimeout(function() { 5559 $('#artist_list_grid_container .artist_list_section[data-type="' + this_type + '"]').addClass('animate'); 5560 }, 10, this_type); 5561 }); 5562 5563 $('#artist_list_grid_selector li[data-type="list"]').trigger('click'); 5564 5565 $('#artist_names_list li a').hover(function() { 5566 var this_index = $(this).attr('data-index'); 5567 if (!$('#artist_image_preview li[data-index="' + this_index + '"]').hasClass('active')) { 5568 window.site.artists.list_hover(this_index); 5569 } 5570 }, function() { 5571 if (typeof artist_name_hover_timeout != 'undefined') { 5572 clearTimeout(artist_name_hover_timeout); 5573 } 5574 }); 5575 5576 var random = Math.floor(Math.random()*10); 5577 $('#artist_names_list li a').eq(random).each(function() { 5578 var this_index = $(this).attr('data-index'); 5579 window.site.artists.list_hover(this_index, true); 5580 }); 5581 }, 5582 5583 list_hover: function(this_index, auto) { 5584 var auto = auto && typeof auto != 'undefined' ? true : false;
5585 if (this_index && typeof this_index != 'undefined') { 5586 if (typeof artist_name_hover_timeout != 'undefined') { 5587 clearTimeout(artist_name_hover_timeout); 5588 } 5589 if (typeof artist_name_hover_timeout2 != 'undefined') { 5590 clearTimeout(artist_name_hover_timeout2); 5591 } 5592 if (typeof artist_name_hover_timeout3 != 'undefined') { 5593 clearTimeout(artist_name_hover_timeout3); 5594 } 5595 artist_name_hover_timeout = setTimeout(function() { 5596 if (!auto) { 5597 $('#artist_names_list').addClass('item-hovering'); 5598 $('#artist_names_list li a').removeClass('active'); 5599 $('#artist_names_list li a[data-index="' + this_index + '"]').addClass('active'); 5600 } 5601 $('#artist_image_preview li').removeClass('animate'); 5602 artist_name_hover_timeout2 = setTimeout(function() { 5603 $('#artist_image_preview li').removeClass('active'); 5604 $('#artist_image_preview li[data-index="' + this_index + '"]').addClass('active'); 5605 artist_name_hover_timeout3 = setTimeout(function() { 5606 $('#artist_image_preview li[data-index="' + this_index + '"]').addClass('animate'); 5607 }, 20); 5608 }, 100); 5609 }, 350, auto); 5610 } 5611 } 5612 5613 }, 5614 5615 exhibitions: { 5616 5617 }, 5618 5619 store: { 5620 5621 init: function() { 5622 5623 if ($('#wishlist_enquiry_submitted_confirmation').length) { 5624 h.alert($('#wishlist_enquiry_submitted_confirmation').html()); 5625 } 5626 5627 $('#wishlist_enquiry_form_submit_button').addClass('alt'); 5628 5629 $('#shipping_container_loader').addClass('loader'); 5630 $('#stripe_loader').addClass('loader'); 5631 5632 if (false) { 5633 $('input, textarea', '#sc_additional_fields, #wishlistEnquiryForm') 5634 .each(function() { 5635 $(this).attr('default-value', $(this).parent().find('> label').text()); 5636 if ($(this).val() != '' && $(this).val() != $(this).attr('default-value')) { 5637 $(this).addClass('active'); 5638 } else { 5639 $(this).val($(this).attr('default-value')); 5640 } 5641 }) 5642 .focus(function() { 5643 if ($(this).val() == $(this).attr('default-value')) { 5644 $(this).addClass('active'); 5645 $(this).val(''); 5646 } 5647 }) 5648 .blur(function() { 5649 $(this).attr('default-value', $(this).parent().find('label').text()); 5650 if ($(this).val() == '' || $(this).val() == $(this).attr('default-value')) { 5651 $(this).val($(this).attr('default-value')); 5652 $(this).removeClass('active'); 5653 } 5654 }) 5655 ; 5656 } 5657 } 5658 5659 }, 5660 5661 commands: { 5662 5663 scrollto: function(offset, callback) { 5664 if ((offset && typeof offset != 'undefined') || offset == 0) { 5665 $(window).bind('mousewheel.scrollcancel', function() { 5666 $('html,body').stop().clearQueue(); 5667 $(window).trigger('scroll'); 5668 if (callback && typeof callback != 'undefined') { 5669 callback(); 5670 } 5671 $(window).unbind('mousewheel.scrollcancel'); 5672 }) 5673 $('html,body').animate( 5674 {scrollTop: offset}, 5675 800, 5676 'easeInOutExpo', 5677 function() { 5678 $(window).unbind('mousewheel.scrollcancel'); 5679 $(window).trigger('scroll'); 5680 if (callback && typeof callback != 'undefined') { 5681 callback(); 5682 } 5683 } 5684 ); 5685 } 5686 } 5687 5688 }, 5689 5690 translations: { 5691 5692 init: function() { 5693 if (window.location.pathname == '/zh/') { 5694 $('#top_nav a').each(function() { 5695 if ($(this).attr('data-zh') && typeof $(this).attr('data-zh') != 'undefined') { 5696 $(this).text($(this).attr('data-zh')).addClass('translated'); 5697 } 5698 }); 5699 } else { 5700 $('#top_nav a.translated').each(function() { 5701 if ($(this).attr('data-en') && typeof $(this).attr('data-en') != 'undefined') { 5702 $(this).text($(this).attr('data-en')).removeClass('translated'); 5703 } 5704 }); 5705 } 5706 } 5707 5708 }, 5709 5710 misc: { 5711 5712 init: function(call_type) { 5713 5714 $('.item .buy_now_fallback').css('cursor', 'pointer').unbind().click(function() { 5715 $(this).closest('.item').find('a').trigger('click'); 5716 }); 5717 5718 $('.item .button_lazy_load').click(function() { 5719 let link; 5720 5721 if ($(this).hasClass('artworks_grid')) { 5722 link = $(this).closest('.item').find('.caption a[href]'); 5723 } else { 5724 link = $(this).closest('.item').find('.content a[href]'); 5725 } 5726 5727 const href = link.attr('href'); 5728 5729 const is_buy_now = $(this).hasClass('buy_now');
5730 if (is_buy_now) { 5731 let buy_button = $(this).closest('.item').find('.cart_content .store_items_container .store_item_add_to_cart'); 5732 if (buy_button.length) { 5733 buy_button.click(); 5734 return false; 5735 } 5736 } else { 5737 let enquire = $(this).closest('.item').find('.cart_content .artwork_detail_add_to_cart_wrapper a.enquire_link'); 5738 if (enquire.length) { 5739 window.site.overlays.enquire.click_open(enquire); 5740 return false; 5741 } 5742 } 5743 5744 $(this).addClass('loading'); 5745 fetch(href) 5746 .then(response => response.text()) 5747 .then((data) => { 5748 const parsed_html = $.parseHTML(data); 5749 const add_to_cart_wrapper = parsed_html.map( 5750 element => $(element).find('.artwork_detail_add_to_cart_wrapper') 5751 ).find(element => element.length); 5752 5753 add_to_cart_wrapper.css('display', 'none'); 5754 5755 const cart_content = $(this).closest('.item').find('.cart_content'); 5756 cart_content.append(add_to_cart_wrapper); 5757 5758 const buy_button = cart_content.find('.store_item_add_to_cart'); 5759 window.cart.add_to_cart(buy_button); 5760 5761 if (is_buy_now) { 5762 buy_button.click(); 5763 setTimeout(() => $(this).removeClass('loading'), 2000); 5764 } else { 5765 const enquire_button = cart_content.find('a.enquire_link'); 5766 window.site.overlays.enquire.click_open(enquire_button); 5767 $(this).removeClass('loading'); 5768 } 5769 }).catch(() => $(this).removeClass('loading')); 5770 return false; 5771 }); 5772 5773 //$('#shipping_zones option[value=""]').text($('#shipping_zones_container label').text().replace('*', '')); 5774 //$('#shipping_options option[value=""]').text($('#shipping_options_container label').text().replace('*', '')); 5775 //$('#shipping_zones_container label').addClass('visually-hidden'); 5776 //$('#shipping_options_container label').addClass('visually-hidden'); 5777 5778 $('#logo').hover(function() { 5779 if (typeof logo_hover_timeout != 'undefined') { 5780 clearTimeout(logo_hover_timeout); 5781 } 5782 $('#logo').addClass('hover'); 5783 logo_hover_timeout = setTimeout(function () { 5784 $('#logo').removeClass('hover'); 5785 }, 400); 5786 }, function() { 5787 5788 }); 5789 5790 var call_type = (call_type && typeof call_type != 'undefined' ? call_type : 'standard'); 5791 5792 $('.store_item_add_to_cart').each(function() { 5793 if (!$('.loader', this).length) { 5794 $(this).append('<div class="loader"></div>'); 5795 } 5796 }); 5797 5798 $('.button').each(function() { 5799 if (!$(this).find('.loader').length) { 5800 $(this).append('<span class="loader"></span>'); 5801 } 5802 }); 5803 5804 $('.loader, .loader_simple').each(function() { 5805 if (!$(this).find('svg').length) { 5806 $(this).append('<svg viewBox="25 25 50 50" focusable="false"><circle class="path" cx="50" cy="50" r="20" fill="none" stroke-width="3" stroke-miterlimit="10"/></svg>'); 5807 } 5808 }); 5809 5810 $('a').each(function() { 5811 var el = $(this); 5812 var href = el.attr('href'); 5813 if (href && href.indexOf('http') == 0 && !el.hasClass('noPopup') 5814 && !el.hasClass('nopopup') 5815 && !$('body').hasClass('no_pop_ups') 5816 && !$('body').hasClass('nopopups') 5817 && href.indexOf(window.location.hostname) == -1) { 5818 el.attr('target', '_blank').addClass('external').append("<span class='visually-hidden'>. (This link opens in a new tab).</span>"); 5819 } 5820 }); 5821 5822 if (call_type != 'popup') { 5823 $('body').removeClass('content-type-reversed'); 5824 if ($('#container .content-reversed').length) { 5825 $('body').addClass('content-type-reversed'); 5826 } 5827 } 5828 5829 //CLICK FOR MOBILE ONLY 5830 $('body.device-handheld button.store_item_multiple_button').unbind().click(filter_handler); 5831 5832 //KEYDOWN FOR accessibility 5833 $('button.store_item_multiple_button').unbind().keydown(filter_handler); 5834 5835 5836 function filter_handler(e){ 5837 5838 if(e.type == "keydown"){ 5839 5840 var keyCode = e.which; 5841 if ($("this:focus") && (keyCode == 13 || keyCode == 32)) { 5842 if ($(this).parent().hasClass('active')) { 5843 $(this).attr("aria-expanded", "false"); 5844 $(this).parent().removeClass('active'); 5845 } else { 5846 $(this).attr("aria-expanded", "true"); 5847 $(this).parent().addClass("active"); 5848 } 5849 } else if ($("this:focus") && (keyCode == 9 && e.shiftKey) && $(this).parent().hasClass('active')) { 5850 $(this).attr("aria-expanded", "false"); 5851 $(this).parent().removeClass('active'); 5852 } 5853 5854 } else if (e.type == "click") { 5855 if ($(this).parent().hasClass('active')) { 5856 $(this).attr("aria-expanded", "false"); 5857 $(this).parent().removeClass('active'); 5858 } else { 5859 $(this).attr("aria-expanded", "true"); 5860 $(this).parent().addClass("active"); 5861 } 5862 } 5863 } 5864 5865 // Close dropdown menu if tab focus goes off dropdown menu 5866 $('.store_item_group_options .store_item_add_to_cart').on('keydown', function (e) { 5867 var keyCode = e.which; 5868 if ($(this).closest('.data_div').hasClass('first_item') && $("this:focus") && (keyCode == 9 && e.shiftKey)) { 5869 $(this).closest('.store_item_group').removeClass("active"); 5870 $(this).closest('.store_item_group').attr("aria-expanded", "false"); 5871 } else if ($(this).closest('.data_div').hasClass('last_item') && $("this:focus") && (keyCode == 9 && !e.shiftKey)) { 5872 $(this).closest('.store_item_group').removeClass("active"); 5873 $(this).closest('.store_item_group').attr("aria-expanded", "false"); 5874 } else if ($("this:focus") && (keyCode == 27)) { 5875 $(this).closest('.store_item_group').removeClass("active"); 5876 $(this).closest('.store_item_group').find('.store_item_multiple_button').attr("aria-expanded", "false"); 5877 $(this).closest('.store_item_group').find('.store_item_multiple_button').focus(); 5878 } 5879 }); 5880 5881 $('.store_item_group_options .store_item_add_to_cart').each(function() { 5882 var aria_label = $(this).closest('.data_div').attr('data-aria'); 5883 $(this).attr("aria-label", aria_label); 5884 }); 5885 5886 window.site.misc.map(); 5887 }, 5888 5889 map: function() { 5890 if ($('.map_area').length){ 5891 $('.map_area').each(function() { 5892 var latlng = $(this).attr('data-latlng').split(','); 5893 5894 if (latlng.length == 2) { 5895 var lat = $(this).attr('data-latlng').split(',')[0]; 5896 var lng = $(this).attr('data-latlng').split(',')[1]; 5897 var centerlat = $(this).attr('data-centerlatlng').split(',')[0]; 5898 var centerlng = $(this).attr('data-centerlatlng').split(',')[1]; 5899 var map_title = $(this).attr('data-title'); 5900 var map_link = $(this).attr('data-url'); 5901 var new_styles = [ { "featureType": "all", "elementType": "labels.text.fill", "stylers": [ { "saturation": 36 }, { "color": "#333333" }, { "lightness": 40 } ] }, { "featureType": "all", "elementType": "labels.text.stroke", "stylers": [ { "visibility": "off" }, { "color": "#ffffff" }, { "lightness": 16 } ] }, { "featureType": "all", "elementType": "labels.icon", "stylers": [ { "visibility": "off" } ] }, { "featureType": "administrative", "elementType": "all", "stylers": [ { "visibility": "off" } ] }, { "featureType": "administrative", "elementType": "geometry.fill", "stylers": [ { "lightness": "74" }, { "visibility": "on" }, { "color": "#F4F2F1" } ] }, { "featureType": "landscape", "elementType": "geometry", "stylers": [ { "color": "#F4F2F1" }, { "lightness": 20 } ] }, { "featureType": "landscape.man_made", "elementType": "all", "stylers": [ { "visibility": "off" } ] }, { "featureType": "poi", "elementType": "all", "stylers": [ { "visibility": "off" } ] }, { "featureType": "poi", "elementType": "geometry", "stylers": [ { "color": "#f5f5f5" }, { "lightness": 21 } ] }, { "featureType": "poi.park", "elementType": "geometry", "stylers": [ { "color": "#dedede" }, { "lightness": 21 } ] }, { "featureType": "road.highway", "elementType": "geometry.fill", "stylers": [ { "color": "#ffffff" }, { "lightness": 17 } ] }, { "featureType": "road.highway", "elementType": "geometry.stroke", "stylers": [ { "color": "#ffffff" }, { "lightness": 29 }, { "weight": 0.2 }, { "visibility": "off" } ] }, { "featureType": "road.arterial", "elementType": "geometry", "stylers": [ { "color": "#ffffff" }, { "lightness": 18 }, { "visibility": "on" } ] }, { "featureType": "road.arterial", "elementType": "geometry.fill", "stylers": [ { "visibility": "simplified" }, { "weight": "2.13" } ] }, { "featureType": "road.local", "elementType": "geometry", "stylers": [ { "color": "#ffffff" }, { "lightness": 16 } ] }, { "featureType": "road.local", "elementType": "geometry.fill", "stylers": [ { "visibility": "on" }, { "weight": "2.33" } ] }, { "featureType": "road.local", "elementType": "geometry.stroke", "stylers": [ { "weight": "0.33" }, { "visibility": "off" } ] }, { "featureType": "transit", "elementType": "geometry", "stylers": [ { "color": "#f2f2f2" }, { "lightness": 19 } ] }, { "featureType": "transit.station.rail", "elementType": "labels", "stylers": [ { "visibility": "on" } ] }, { "featureType": "water", "elementType": "geometry", "stylers": [ { "color": "#e9e9e9" }, { "lightness": 17 } ] }]; 5902 var position = new google.maps.LatLng(lat, lng); 5903 if (window.site.device.breakpoint() <= 2) { 5904 var center = new google.maps.LatLng(lat, lng); 5905 var zoomLevel = 15; 5906 } else { 5907 var center = new google.maps.LatLng(centerlat, centerlng); 5908 var zoomLevel = 16; 5909 } 5910 var markerImage = { 5911 url: '/images/marker_2x.png', 5912 size: new google.maps.Size(29, 45), 5913 scaledSize: new google.maps.Size(19, 30), 5914 origin: new google.maps.Point(0, 0), 5915 anchor: new google.maps.Point(15, 45) 5916 }; 5917 var myOptions = { 5918 zoom: zoomLevel, 5919 center: center, 5920 mapTypeId: google.maps.MapTypeId.ROADMAP, 5921 panControl: false, 5922 //panControl: true, 5923 //panControlOptions: { 5924 // position: google.maps.ControlPosition.TOP_RIGHT 5925 //}, 5926 zoomControl: false, 5927 zoomControlOptions: { 5928 style: google.maps.ZoomControlStyle.SMALL, 5929 position: google.maps.ControlPosition.LEFT_TOP 5930 }, 5931 scaleControl: false, 5932 streetViewControl: false, 5933 overviewMapControl: false, 5934 scrollwheel: false, 5935 draggable: true, 5936 styles: new_styles, 5937 mapTypeControl: false, 5938 fullscreenControl: false, 5939 backgroundColor: '#f7f4f2' 5940 } 5941 5942 //insert the map into the id on page using map options etc 5943 var map = new google.maps.Map($(this)[0], myOptions); 5944 5945 //each marker config 5946 var marker = new google.maps.Marker({ 5947 position: position, 5948 map: map, 5949 url: map_link, 5950 title: map_title, 5951 icon: markerImage 5952 }); 5953 5954 if (map_link != '') { 5955 google.maps.event.addListener(marker, 'click', function() { 5956 window.open( 5957 marker.url, 5958 '_blank' 5959 ); 5960 }); 5961 } 5962 google.maps.event.trigger(map, 'resize'); 5963 } 5964 }); 5965 5966 5967 5968 5969 $( window ).load(function() { 5970 setTimeout(function() { 5971 $("img[src$='google_white2.png']").css({ opacity: 0.4 }); 5972 $(".gm-style-cc").css({ opacity: 0.4 }); 5973 $(".gm-style-cc div, .gm-style-cc a").css({background: 'none', color: '#333'}); 5974 $('.gmnoprint, .gm-style-cc').remove(); 5975 }, 300); 5976 setTimeout(function() { 5977 $("img[src$='google_white2.png']").css({ opacity: 0.4 }); 5978 $(".gm-style-cc").css({ opacity: 0.4 }); 5979 $(".gm-style-cc div, .gm-style-cc a").css({background: 'none', color: '#333'}); 5980 $('.gmnoprint, .gm-style-cc').remove(); 5981 }, 400); 5982 }); 5983 } 5984 }, 5985 5986 extended_click_area: function() { 5987 $(".extended_click_area:not(.click_event_added)").addClass('click_event_added').click(function(){ 5988 var link_element = $(this).closest('.item, .slide, .sc_cell_item').find('a'); 5989 if (link_element.length) { 5990
5990 link_element[0].click(); 5991 } else { 5992 $(this).removeClass('extended_click_area'); 5993 } 5994 }); 5995 } 5996 5997 }, 5998 5999 filters: { 6000 6001 init: function() { 6002 6003 window.site.filters.checked_items(); 6004 window.site.filters.clear_filters(); 6005 window.site.filters.responsive_filter_btn(); 6006 // Responsive show/hide filter menu handler 6007 $('.artwork-filter-responsive-btn').on('click', function(e){ 6008 $('#artwork-filter-panel').toggleClass('show') 6009 }); 6010 6011 // Stop enter key from submitting the form and make it trigger checkbox change instead 6012 $('#filterpanel_form input').off().on('keydown', function (e) { 6013 var keyCode = e.which; 6014 if ($("this:focus") && (keyCode == 13)) { 6015 e.preventDefault(); 6016 if ($(this).attr('checked')) { 6017 $(this).attr('checked', false); 6018 $(this).trigger("change"); 6019 } else { 6020 $(this).attr('checked', true); 6021 $(this).trigger("change"); 6022 } 6023 return false; 6024 } 6025 }); 6026 6027 $('#filterpanel_form .fp-checkbox-item a').on('keydown', function (e) { 6028 if ((e.type == "keydown" && e.which == 13)){ 6029 $(this).closest('.fp-module').removeClass('open').find('.fp-module-button').attr("aria-expanded", "false");e.preventDefault(); 6030 6031 var checkbox = $(this).find('input[type="checkbox"]'); 6032 6033 if (checkbox.is(':checked')) { 6034 checkbox.attr('checked', false); 6035 checkbox.trigger("change"); 6036 } else { 6037 checkbox.attr('checked', true); 6038 checkbox.trigger("change"); 6039 } 6040 return false; 6041 } 6042 }); 6043 6044 // Submit button 6045 $('#filterpanel_form .fp-module-button-submit').off().on('click', function (e) { 6046 window.site.filters.checked_items(); 6047 window.site.filters.processUniqueOptionCheckbox($(this)); 6048 window.site.filters.load_works(); 6049 }); 6050 6051 $('#filterpanel_form input[type="checkbox"].sort-checkbox').on('change', function(event) { 6052 $('#filterpanel_form input[type="checkbox"].sort-checkbox').each(function (_, checkbox) { 6053 if (checkbox !== event.target) { 6054 $(checkbox).prop('checked', false); 6055 } 6056 }); 6057 }); 6058 6059 // Individual filter item click handler 6060 $('#filterpanel_form input[type="checkbox"]').on('change', function(e){ 6061 window.site.filters.checked_items(); 6062 window.site.filters.processUniqueOptionCheckbox($(this)); 6063 window.site.filters.load_works(); 6064 }); 6065 6066 $('#filterpanel_form label').on('click', function(e) { 6067 // Prevents a bug where the checkbox click event was triggered twice. 6068 e.stopPropagation(); 6069 }); 6070 6071 $('#filterpanel_form .fp-module.fp-module--keyword input[type="text"]') 6072 .keydown(function(e) { 6073 if(e.type == "keydown"){ 6074 if ($("this:focus") && (e.which == 13)) { 6075 window.site.filters.checked_items(); 6076 window.site.filters.processUniqueOptionCheckbox($(this)); 6077 window.site.filters.load_works(); 6078 } 6079 } 6080 }) 6081 .each(function() { 6082 if ($(this).val() != $(this).attr('data-default-value')) { 6083 $(this).addClass('active'); 6084 $(this).closest('.fp-module').addClass('active'); 6085 } 6086 }) 6087 .focus(function() { 6088 if ($(this).val() == $(this).attr('data-default-value')) { 6089 $(this).addClass('active').val(''); 6090 $(this).closest('.fp-module').addClass('active'); 6091 } 6092 }) 6093 .blur(function() { 6094 if ($(this).val() == '') { 6095 $(this).removeClass('active').val($(this).attr('data-default-value')); 6096 $(this).closest('.fp-module').removeClass('active'); 6097 } 6098 }) 6099 ; 6100 6101 // Accessibility functions -------------------------- // 6102 6103 $('.fp-module button').keydown(filter_handler); 6104 6105 function filter_handler(e){ 6106 6107 if(e.type == "keydown"){ 6108 6109 var keyCode = e.which; 6110 var dropdown_type = '.fp-module--' + $(this).attr("data-dropdown"); 6111 if ($("this:focus") && (keyCode == 13 || keyCode == 32)) { 6112 $('.fp-module').not(dropdown_type).removeClass('open'); 6113 if ($(dropdown_type).hasClass('open')) { 6114 $(this).attr("aria-expanded", "false"); 6115 $(dropdown_type).removeClass('open'); 6116 } else { 6117 $(this).attr("aria-expanded", "true"); 6118 $(dropdown_type).addClass("open"); 6119 } 6120 } else if ($("this:focus") && (keyCode == 9 && e.shiftKey) && $(dropdown_type).hasClass('open')) { 6121 $(this).attr("aria-expanded", "false"); 6122 $(dropdown_type).removeClass('open'); 6123 } 6124 6125 } else if(e.type == "click") { 6126 var $fpmodule = $(this).closest('.fp-module'); 6127 $('.fp-module').not(dropdown_type).removeClass('open'); 6128 if ($fpmodule.hasClass('open')) { 6129 $(this).attr("aria-expanded", "false"); 6130 $fpmodule.removeClass('open'); 6131 } else { 6132 $('.fp-module').removeClass('open'); 6133 $(this).attr("aria-expanded", "true"); 6134 $fpmodule.addClass("open"); 6135 } 6136 } 6137 } 6138 6139 function closeFilterDropdown(dropdown_name) { 6140 $('.fp-module--' + dropdown_name).removeClass("open"); 6141 $('.fp-module--' + dropdown_name + ' button').attr("aria-expanded", "false"); 6142 } 6143 6144 // Close dropdown menu if tab focus goes off dropdown menu 6145 $('.filters_panel .fp-module-content a').on('keydown', function (e) { 6146 var keyCode = e.which; 6147 if ($(this).closest('li').is(':first-child') && (keyCode == 9 && e.shiftKey)) { 6148 closeFilterDropdown($(this).closest('.fp-module').find('.fp-module-button').attr("data-dropdown")); 6149 } else if ($(this).closest('li').is(':last-child') && (keyCode == 9 && !e.shiftKey)) { 6150 closeFilterDropdown($(this).closest('.fp-module').find('.fp-module-button').attr("data-dropdown")); 6151 } else if ($("this:focus") && (keyCode == 27)) { 6152 closeFilterDropdown( $(this).closest('.fp-module').find('.fp-module-button').attr("data-dropdown")); 6153 $(this).closest('.fp-module').find('.fp-module-button').focus(); 6154 } 6155 }); 6156 6157 // Close keyword dropdown menu if tab focus goes off input 6158 $('.filters_panel .fp-module--keyword input').on('keydown', function (e) { 6159 var keyCode = e.which; 6160 if ($("this:focus") && (keyCode == 9)) { 6161 var dropdown_name = $(this).attr("data-dropdown") 6162 $('.fp-module--keyword').removeClass("open"); 6163 $('.fp-module--keyword button').attr("aria-expanded", "false"); 6164 } 6165 }); 6166 }, 6167 6168 checked_items: function(){ 6169 6170 $('#filterpanel_form .fp-module').each(function() {
6171 var checked_count = $(this).find('input:checked').length; 6172 if(checked_count > 0) { 6173 $(this).find('.group-count').html('('+ String(checked_count) + ')'); 6174 } else { 6175 $(this).find('.group-count').html(''); 6176 } 6177 6178 if (!$(this).hasClass('fp-module--keyword')) { 6179 if ($(this).find('input:checked').length) { 6180 $(this).addClass('active'); 6181 } else { 6182 $(this).removeClass('active'); 6183 } 6184 } 6185 }); 6186 6187 if ($('#filterpanel_form .fp-module.active').length) { 6188 $('#filterpanel_form').addClass('filters_active'); 6189 } else { 6190 $('#filterpanel_form').removeClass('filters_active'); 6191 } 6192 6193 }, 6194 6195 processUniqueOptionCheckbox: function(instance) { 6196 if (instance && instance.length) { 6197 if (instance.closest('.unique-option-parent').length) { 6198 instance.closest('.unique-option-parent').find('input').not(instance).prop('checked', false); 6199 } 6200 } 6201 }, 6202 6203 processRangeCheckbox: function(){ 6204 /** 6205 * This function requires: data-min and data-max to be set on the checkbox input and 2 hidden inputs, .range_min and .range_max to be added as children of .range_parent. The hidden inputs need to be disabled by default. 6206 * For all the selected checkboxes find the data-min and data-max values(which should be set on the input element). 6207 * Assign the min/max values to relevant array selectedMins/selectedMaxs and then use the ARRAY.sort() func to order them in ascending order. 6208 * Set the min value as the FIRST item in the sorted selectedMins array. Set the max value as the LAST item in the selectedMaxs array. 6209 * Assign these to the hidden inputs so they are passed when the form is serialized/submitted. 6210 */ 6211 $('.range-parent').each(function(){ 6212 var selectedRanges = $(this).find('input:checked'); 6213 6214 if(!selectedRanges.length){ 6215 $(this).find('.range_min, .range_max').attr('disabled', true); // Disable the min and max fields so the empty values aren't sent when the form is submitted. 6216 return; // Don't bother to process if there aren't any checked checkboxes 6217 } 6218 6219 // Remove the disabled attribute for the min and max inputs as a checkbox is selected 6220 $(this).find('.range_min, .range_max').removeAttr('disabled'); 6221 6222 var parent = $(this).closest('.range-parent'); 6223 var selectedMins = []; 6224 var selectedMaxs = []; 6225 for (var i = 0; i < selectedRanges.length; i++) { 6226 selectedMins.push(parseInt( ($(selectedRanges[i]).data('min') || 0) )); 6227 selectedMaxs.push(parseInt( ($(selectedRanges[i]).data('max') || 100000000) )); 6228 } 6229 // Order the min and max arrays in ascending order 6230 var selectedMinsSorted = selectedMins.sort(function(a,b){return a-b}); // By default the sort is alphabetical, the weird callback function forces it to sort numerically. 6231 var selectedMaxsSorted = selectedMaxs.sort(function(a,b){return a-b}); // By default the sort is alphabetical, the weird callback function forces it to sort numerically. 6232 6233 var minValue = selectedMinsSorted[0]; 6234 var maxValue = selectedMaxsSorted[selectedMaxsSorted.length - 1]; // the last item 6235
6236 // Update the hidden inputs with the corresponding values 6237 $(this).find('.range_min').val(minValue); 6238 $(this).find('.range_max').val(maxValue); 6239 }); 6240 }, 6241 6242 load_works: function($filterPanelForm) { 6243 /** 6244 * Serializes and submits the form. 6245 * The result will be loaded into the inner_content_selector element. 6246 */ 6247 if(typeof $filterPanelForm == 'undefined') { 6248 $filterPanelForm = $('#filterpanel_form'); 6249 } 6250 6251 $filterPanelForm.addClass('filter-results-loaded'); 6252 6253 var pathToSubmitForm = $filterPanelForm.attr('action'); 6254 if (pathToSubmitForm){ 6255 window.site.filters.processRangeCheckbox(); 6256 window.site.filters.processUniqueOptionCheckbox(); 6257 6258 if ($filterPanelForm.find('#filter_keyword').val() == $filterPanelForm.find('#filter_keyword').attr('data-default-value')) { 6259 $filterPanelForm.find('#filter_keyword').attr('disabled', 'disabled'); 6260 } 6261 6262 var serializedForm = $filterPanelForm.serialize(); 6263 6264 if(serializedForm.length){ 6265 var updated_url = pathToSubmitForm + '?filter=1&' + serializedForm; 6266 } else { 6267 var updated_url = pathToSubmitForm 6268 } 6269 6270 $filterPanelForm.find('#filter_keyword').removeAttr('disabled'); 6271 6272 } 6273 6274 var incoming_content_type = 'inner'; 6275 6276 $.pageload.load(updated_url, false, function(new_page_inner_content, element_href, new_page_main_content) { 6277 6278 if (new_page_inner_content) { 6279 $('.filter_results') 6280 .addClass('filter_transition') 6281 .delay(400) 6282 .queue(function() { 6283 6284 history.replaceState({'ajaxPageLoad': true}, null, updated_url); 6285 6286 if ($('.filter_results').closest('.panel_filter_results_pending').length) { 6287 $('.filter_results').closest('.panel_filter_results_pending').closest('.scroll_section_panels').addClass('panel_filters_active'); 6288 $('.filter_results').closest('.panel_filter_results_pending').removeClass('panel_filter_results_pending').addClass('panel_filter_results_active'); 6289 } 6290 6291 $('html,body').animate( 6292 {scrollTop: 0}, 6293 1200, 6294 'easeInOutExpo' 6295 ); 6296 6297 var full_html = $(new_page_main_content); 6298 var results_html = full_html.find('.filter_results').html(); 6299 var footer_html = full_html.find('.panel_footer').length ? '<div class="panel_footer inview_element animate-from-bottom">' + full_html.find('.panel_footer').html() + '</div>' : ''; 6300 var pagestats_id = full_html.find('.filter_results').attr('data-pagestats-id'); 6301 6302 $('.filter_results').html(results_html).attr('data-pagestats-id', pagestats_id); 6303 $('.filter_results').removeClass('filter_transition'); 6304 6305 $('.filter_results').parent().find('.panel_footer').remove(); 6306 $('.filter_results').parent().append(footer_html); 6307 6308 const featured_slideshow_selector = '.records_grid.full_feature.full_feature_slideshow'; 6309 const $new_hero_slideshow = $(new_page_inner_content).find(featured_slideshow_selector); 6310 6311 if ($new_hero_slideshow.length) { 6312 $(featured_slideshow_selector).replaceWith($new_hero_slideshow); 6313 $(featured_slideshow_selector).show() 6314 window.site.slideshow.header(); 6315 } else { 6316 $(featured_slideshow_selector).hide() 6317 } 6318 6319 window.site.pageload.load_more_pagination.setup(); 6320 6321 window.cart.init(); 6322 window.site.misc.init(); 6323 window.site.enquiry.init(); 6324 window.site.overlays.enquire.init(
6324); 6325 window.site.lazy_load.setup(); 6326 window.site.artlogic_inview.init(); 6327 window.site.layout.grids.init(); 6328 window.site.misc.extended_click_area(); 6329 6330 $('.filter_results .item:eq(0) a:eq(0)').focus(); 6331 6332 $(window).trigger('resize'); 6333 $.pageload.refresh(); 6334 6335 6336 $(this).dequeue(); 6337 }) 6338 ; 6339 } 6340 }, null, null, null, incoming_content_type); 6341 6342 }, 6343 6344 clear_filters: function(){ 6345 6346 $('.clear_filters').on('click', function(e){ 6347 e.preventDefault(); 6348 $('#filterpanel_form input[type="text"]').each(function() { 6349 $(this).val($(this).attr('data-default-value')); 6350 }); 6351 6352 $('#filterpanel_form input').prop('checked', false); 6353 $('#filterpanel_form').find('.group-count').html(''); 6354 window.site.filters.checked_items(); 6355 window.site.filters.load_works(); 6356 }); 6357 6358 }, 6359 6360 responsive_filter_btn: function() { 6361 6362 $('.artwork-filter-open-btn').on('click', function() { 6363 console.log('open responsive'); 6364 if($('#filterpanel_form').hasClass('open')){ 6365 $('#filterpanel_form').removeClass('open'); 6366 $('#filterpanel_form').attr('style','') 6367 } else { 6368 $('#filterpanel_form').addClass('open'); 6369 window.site.helpers.animate_height($('#filterpanel_form')); 6370 } 6371 }); 6372 6373 } 6374 6375 }, 6376 6377 6378 device: { 6379 6380 init: function() { 6381 6382 // Find out the current browser 6383 if ($.browser.name) { 6384 var browserVersion = parseInt($.browser.version); 6385 var browserName = $.browser.name; 6386 if (browserVersion) { 6387 $('body').addClass('browser-' + browserName); 6388 $('body').addClass('browser-' + browserName + '-' + browserVersion); 6389 } 6390 if ($.browser.platform) { 6391 $('body').addClass('platform-' + $.browser.platform); 6392 } 6393 } 6394 6395 // Find out if this is the Android default browser and add a class to the body 6396 // This is NOT a very good way of testing for this browser, but there does not seem to be a conclusive way to do it 6397 var nua = navigator.userAgent; 6398 var is_android_default_browser = ((nua.indexOf('Mozilla/5.0') > -1 && nua.indexOf('Android ') > -1 && nua.indexOf('AppleWebKit') > -1) && !(nua.indexOf('Chrome') > -1)); 6399 if (is_android_default_browser) { 6400 $('body').addClass('browser-android-internet'); 6401 } 6402 6403 // Find outo if this is a high res device and add a class to the body 6404 // This allows us to change graphics to high-res versions on compatible devices 6405 if (window.devicePixelRatio > 1) { 6406 $('body').addClass('device-highres'); 6407 } 6408 6409 if (window.site.device.handheld()) { 6410 $('body').addClass('device-handheld'); 6411 } else { 6412 $('body').addClass('device-desktop'); 6413 } 6414 6415 }, 6416 6417 breakpoint: function() { 6418 if ($(window).width() <= 459) { 6419 return 1; 6420 } else if ($(window).width() <= 767) { 6421 return 2; 6422 } else if ($(window).width() <= 900) { 6423 return 2.5; 6424 } else if ($(window).width() <= 1023) { 6425 return 3; 6426 } else { 6427 return 4; 6428 } 6429 }, 6430 6431 canvas_enabled: function() { 6432 // Check if canvas should be enabled 6433 if (window.location.search.indexOf("canvasdisabled=1") != -1 || !window.site.home.canvas_effect_enabled) { 6434 return false;
6435 } 6436 return window.site.device.video_mode() && window.site.device.video_inline() && window.site.device.breakpoint() > 2; 6437 }, 6438 6439 video_fallback: function() { 6440 // Does this device run in video fallback mode, e.g. usually non desktop devices 6441 return window.site.device.handheld() || !window.site.device.video_inline(); 6442 }, 6443 6444 video_mode: function() { 6445 // Do we want to show video on this device 6446 return window.site.device.video_inline(); 6447 }, 6448 6449 video_inline: function() { 6450 // Check if video content can be displayed inline (e.g. as a background physically on the page) 6451 if (window.location.search.indexOf("disablevideoinline=1") != -1) { 6452 return false; 6453 } 6454 return navigator.userAgent.match(/(iPhone|iPod)/g) ? ('playsInline' in document.createElement('video')) : true; 6455 }, 6456 6457 handheld: function() { 6458 6459 /* Detect mobile device */ 6460 return ( 6461 //Uncomment to force for testing 6462 //true || 6463 6464 //Dev mode 6465 (window.location.search.indexOf("handheld=1") != -1) || 6466 //Detect iPhone 6467 (navigator.platform.indexOf("iPhone") != -1) || 6468 //Detect iPod 6469 (navigator.platform.indexOf("iPod") != -1) || 6470 //Detect iPad 6471 (navigator.platform.indexOf("iPad") != -1) || 6472 //Detect Android 6473 (navigator.userAgent.toLowerCase().indexOf("android") != -1) || 6474 //Detect Surface (ARM chip version e.g. low powered tablets) will also detect other windows tablets with the same chip 6475 (navigator.userAgent.toLowerCase().indexOf("arm;") != -1 && navigator.userAgent.toLowerCase().indexOf("windows nt") != -1) || 6476 //Detect Opera Mini 6477 (navigator.userAgent.toLowerCase().indexOf("opera mini") != -1) || 6478 //Detect Blackberry 6479 (navigator.userAgent.toLowerCase().indexOf("blackberry") != -1) || 6480 //Detect webos 6481 (navigator.userAgent.toLowerCase().indexOf("webos") != -1) || 6482 //Detect iemobile (old version of windows phone) 6483 (navigator.userAgent.toLowerCase().indexOf("iemobile") != -1) 6484 ); 6485 6486 }, 6487 6488 handheld_not_ios: function() { 6489 6490 /* Detect mobile device */ 6491 ios_devices = ( 6492 (navigator.platform.indexOf("iPhone") != -1) || 6493 //Detect iPod 6494 (navigator.platform.indexOf("iPod") != -1) || 6495 //Detect iPad 6496 (navigator.platform.indexOf("iPad") != -1) 6497 ); 6498 6499 if (window.site.device.handheld() && !ios_devices && $.browser.name != 'chrome' && $.browser.name != 'webkit') { 6500 return true; 6501 } else { 6502 return false; 6503 } 6504 6505 } 6506 6507 }, 6508 6509 throttle: function(delay, callback) { 6510 var previousCall = new Date().getTime(); 6511 return function() { 6512 var time = new Date().getTime(); 6513 if ((time - previousCall) >= delay) { 6514 previousCall = time; 6515 callback.apply(null, arguments); 6516 } 6517 }; 6518 }, 6519 6520 debounce: function(wait, func, immediate) { 6521 var timeout; 6522 return function() { 6523 var context = this, args = arguments; 6524 var later = function() { 6525 timeout = null; 6526 if (!immediate) func.apply(context, args); 6527 }; 6528 var callNow = immediate && !timeout; 6529 clearTimeout(timeout); 6530 timeout = setTimeout(later, wait);
6531 if (callNow) func.apply(context, args); 6532 }; 6533 }, 6534 6535 objectfit_polyfill: { 6536 /* 6537 Simple polyfill for image grids that use object-fit css for 'soft' cropping. 6538 Mostly required for all versions of Internet Explorer and older versions of Edge. 6539 */ 6540 init: function() { 6541 6542 var polyfill_images = '.hero_inner .media_wrapper .image img, .artwork-nav-hero img'; 6543 6544 if ($(polyfill_images).length){ 6545 6546 var supportsObjectfit; 6547 6548 // Detect whether '@supports' CSS is supported, preventing errors in IE 6549 var supports_supportsCSS = !!((window.CSS && window.CSS.supports) || window.supportsCSS || false); 6550 6551 if (supports_supportsCSS){ 6552 // Older Edge supports '@supports' but not object-fit 6553 supportsObjectfit = CSS.supports('object-fit','cover'); 6554 } else { 6555 //IE doesn't support '@supports' or 'object-fit', so we can consider them the same 6556 supportsObjectfit = false; 6557 } 6558 6559 if (!supportsObjectfit || typeof supportsObjectfit == 'undefined') { 6560 6561 $(polyfill_images).each(function() { 6562 var $img = $(this); 6563 var imageURL = false; 6564 if ($img.attr('src') && typeof $img.attr('src') != 'undefined') { 6565 var imageURL = $img.attr('src'); 6566 } else if ($img.attr('data-src') && typeof $img.attr('data-src') != 'undefined') { 6567 var imageURL = $img.attr('data-src'); 6568 } 6569 if (imageURL) { 6570 var bg_positioning = '50% 50%'; 6571 if ($img.css('object-position')) { 6572 var positioning = $img.css('object-position'); 6573 } 6574 $img.parent().addClass('objectfit-fallback-bg').css({'background-image':'url('+imageURL+')','background-position':bg_positioning}); 6575 $img.css('visibility','hidden'); 6576 6577 if (!$('body').hasClass('objectfit-polyfill-active')){ 6578 $('body').addClass('objectfit-polyfill-active') 6579 } 6580 } 6581 }); 6582 } 6583 } 6584 }, 6585 }, 6586 vat_toggle: { 6587 update_prices: function (include_vat) { 6588 const price_attr = include_vat ? 'data-price-inc-vat' : 'data-price-ex-vat'; 6589 $(`[${price_attr}]`).each(function () { 6590 const price = $(this).attr(price_attr); 6591 $(this).find('.price:not(.old-price):not(.sold_out)').text(price); 6592 }); 6593 6594 const old_price_attr = include_vat ? 'data-old-price-inc-vat' : 'data-old-price-ex-vat'; 6595 $(`[${old_price_attr}]`).each(function () { 6596 const old_price = $(this).attr(old_price_attr); 6597 $(this).find('.price.old-price').text(old_price); 6598 }); 6599 }, 6600 attach_event_listener: function () { 6601 $('.vat-toggle input').unbind().change(function() { 6602 localStorage.setItem('include_vat', (this.checked).toString()); 6603 window.site.vat_toggle.update_prices(this.checked); 6604 }); 6605 }, 6606 init: function () { 6607 window.site.vat_toggle.attach_event_listener(); 6608 if (localStorage.getItem('include_vat') === 'true') { 6609 window.site.vat_toggle.update_prices(true); 6610 $('.vat-toggle input')[0].checked = true; 6611 } 6612 } 6613 } 6614 6615 }; 6616 6617 $(document).ready(function() { 6618
6619 window.site.init(); 6620 6621 }); 6622 6623 6624})(jQuery); 6625 6626 6627 6628 6629 6630 6631 6632(function( $ ){ 6633 6634 'use strict'; 6635 6636 $.fn.fitVids = function( options ) { 6637 var settings = { 6638 customSelector: null, 6639 ignore: null 6640 }; 6641 6642 if(!document.getElementById('fit-vids-style')) { 6643 // appendStyles: https://github.com/toddmotto/fluidvids/blob/master/dist/fluidvids.js 6644 var head = document.head || document.getElementsByTagName('head')[0]; 6645 var css = '.fluid-width-video-wrapper{width:100%;position:relative;padding:0;}.fluid-width-video-wrapper iframe,.fluid-width-video-wrapper object,.fluid-width-video-wrapper embed {position:absolute;top:0;left:0;width:100%;height:100%;}'; 6646 var div = document.createElement("div"); 6647 div.innerHTML = '<p>x</p><style id="fit-vids-style">' + css + '</style>'; 6648 head.appendChild(div.childNodes[1]); 6649 } 6650 6651 if ( options ) { 6652 $.extend( settings, options ); 6653 } 6654 6655 return this.each(function(){ 6656 var selectors = [ 6657 'iframe[src*="player.vimeo.com"]', 6658 'iframe[src*="player.vimeo.com"]', 6659 'iframe[src*="youtube.com"]', 6660 'iframe[src*="youtube-nocookie.com"]', 6661 'iframe[src*="kickstarter.com"][src*="video.html"]', 6662 'iframe[src*="player.youku.com"]', 6663 'iframe[src*="mpembed.com"]', 6664 'iframe[src*="yumpu.com"]', 6665 'iframe[src*="www.yumpu.com"]', 6666 6667 6668 'object', 6669 'embed' 6670 ]; 6671 6672 if (settings.customSelector) { 6673 selectors.push(settings.customSelector); 6674 } 6675 6676 var ignoreList = '.fitvidsignore'; 6677 6678 if(settings.ignore) { 6679 ignoreList = ignoreList + ', ' + settings.ignore; 6680 } 6681 6682 var $allVideos = $(this).find(selectors.join(',')); 6683 $allVideos = $allVideos.not('object object'); // SwfObj conflict patch 6684 $allVideos = $allVideos.not(ignoreList); // Disable FitVids on this video. 6685 6686 $allVideos.each(function(){ 6687 var $this = $(this); 6688 if($this.parents(ignoreList).length > 0) { 6689 return; // Disable FitVids on this video. 6690 } 6691 if (this.tagName.toLowerCase() === 'embed' && $this.parent('object').length || $this.parent('.fluid-width-video-wrapper').length) { return; } 6692 if ((!$this.css('height') && !$this.css('width')) && (isNaN($this.attr('height')) || isNaN($this.attr('width')))) 6693 { 6694 $this.attr('height', 9); 6695 $this.attr('width', 16); 6696 } 6697 var height = ( this.tagName.toLowerCase() === 'object' || ($this.attr('height') && !isNaN(parseInt($this.attr('height'), 10))) ) ? parseInt($this.attr('height'), 10) : $this.height(), 6698 width = !isNaN(parseInt($this.attr('width'), 10)) ? parseInt($this.attr('width'), 10) : $this.width(), 6699 aspectRatio = height / width; 6700 if(!$this.attr('id')){ 6701 var videoID = 'fitvid' + Math.floor(Math.random()*999999); 6702 $this.attr('id', videoID); 6703 } 6704 var padding_top = aspectRatio * 100; 6705 if (padding_top > 100) { 6706 var padding_top = 100; 6707 } 6708 $this.wrap('<div class="fluid-width-video-wrapper"></div>').parent('.fluid-width-video-wrapper').css('padding-top', padding_top + '%'); 6709 $this.removeAttr('height').removeAttr('width'); 6710 }); 6711 }); 6712 }; 6713// Works with either jQuery or Zepto 6714})( window.jQuery || window.Zepto ); 6715 6716 6717(function($){$.prompt=function(message,options){options=$.extend({},$.prompt.defaults,options);$.prompt.currentPrefix=options.prefix;var ie6=($.browser.msie&&$.browser.version<7);var $body=$(document.body);var $window=$(window);var msgbox='<div class="'+options.prefix+'box" id="'+options.prefix+'box">';if(options.useiframe&&(($('object, applet').length>0)||ie6)){msgbox+='<iframe src="javascript:false;" style="display:block;position:absolute;z-index:-1;" class="'+options.prefix+'fade" id="'+options.prefix+'fade"></iframe>';}else{if(ie6){$('select').css('visibility','hidden');}msgbox+='<div class="'+options.prefix+'fade" id="'+options.prefix+'fade"></div>';}msgbox+='<div class="'+options.prefix+'" id="'+options.prefix+'"><div class="'+options.prefix+'container"><div class="';msgbox+=options.prefix+'close">X</div><div id="'+options.prefix+'states"></div>';msgbox+='</div></div></div>';var $jqib=$(msgbox).appendTo($body);
6717var $jqi=$jqib.children('#'+options.prefix);var $jqif=$jqib.children('#'+options.prefix+'fade');if(message.constructor==String){message={state0:{html:message,buttons:options.buttons,focus:options.focus,submit:options.submit}};}var states="";$.each(message,function(statename,stateobj){stateobj=$.extend({},$.prompt.defaults.state,stateobj);message[statename]=stateobj;states+='<div id="'+options.prefix+'_state_'+statename+'" class="'+options.prefix+'_state" style="display:none;"><div class="'+options.prefix+'message">'+stateobj.html+'</div><div class="'+options.prefix+'buttons">';$.each(stateobj.buttons,function(k,v){states+='<button name="'+options.prefix+'_'+statename+'_button'+k+'" id="'+options.prefix+'_'+statename+'_button'+k+'" value="'+v+'">'+k+'</button>';});states+='</div></div>';});$jqi.find('#'+options.prefix+'states').html(states).children('.'+options.prefix+'_state:first').css('display','block');$jqi.find('.'+options.prefix+'buttons:empty').css('display','none');$.each(message,function(statename,stateobj){var $state=$jqi.find('#'+options.prefix+'_state_'+statename);$state.children('.'+options.prefix+'buttons').children('button').click(function(){var msg=$state.children('.'+options.prefix+'message');var clicked=stateobj.buttons[$(this).text()];var forminputs={};$.each($jqi.find('#'+options.prefix+'states :input').serializeArray(),function(i,obj){if(forminputs[obj.name]===undefined){forminputs[obj.name]=obj.value;}else if(typeof forminputs[obj.name]==Array){forminputs[obj.name].push(obj.value);}else{forminputs[obj.name]=[forminputs[obj.name],obj.value];}});var close=stateobj.submit(clicked,msg,forminputs);if(close===undefined||close){removePrompt(true,clicked,msg,forminputs);}});$state.find('.'+options.prefix+'buttons button:eq('+stateobj.focus+')').addClass(options.prefix+'defaultbutton');});var ie6scroll=function(){$jqib.css({top:$window.scrollTop()});};var fadeClicked=function(){if(options.persistent){var i=0;$jqib.addClass(options.prefix+'warning');var intervalid=setInterval(function(){$jqib.toggleClass(options.prefix+'warning');if(i++>1){clearInterval(intervalid);$jqib.removeClass(options.prefix+'warning');}},100);}else{removePrompt();}};var keyPressEventHandler=function(e){var key=(window.event)?event.keyCode:e.keyCode;if(key==27){removePrompt();}if(key==9){var $inputels=$(':input:enabled:visible',$jqib);var fwd=!e.shiftKey&&e.target==$inputels[$inputels.length-1];var back=e.shiftKey&&e.target==$inputels[0];if(fwd||back){setTimeout(function(){if(!$inputels)return;var el=$inputels[back===true?$inputels.length-1:0];if(el)el.focus();},10);return false;}}};var positionPrompt=function(){$jqib.css({position:(ie6)?"absolute":"fixed",height:$window.height(),width:"100%",top:(ie6)?$window.scrollTop():0,left:0,right:0,bottom:0});$jqif.css({position:"absolute",height:$window.height(),width:"100%",top:0,left:0,right:0,bottom:0});$jqi.css({position:"absolute",top:options.top,left:"50%",marginLeft:(($jqi.outerWidth()/2)*-1)});};var stylePrompt=function(){$jqif.css({zIndex:options.zIndex,display:"none",opacity:options.opacity});$jqi.css({zIndex:options.zIndex+1,display:"none"});$jqib.css({zIndex:options.zIndex});};var removePrompt=function(callCallback,clicked,msg,formvals){$jqi.remove();if(ie6){$body.unbind('scroll',ie6scroll);}$window.unbind('resize',positionPrompt);$jqif.fadeOut(options.overlayspeed,function(){$jqif.unbind('click',fadeClicked);$jqif.remove();if(callCallback){options.callback(clicked,msg,formvals);}$jqib.unbind('keypress',keyPressEventHandler);$jqib.remove();if(ie6&&!options.useiframe){$('select').css('visibility','visible');}});};positionPrompt();stylePrompt();if(ie6){$window.scroll(ie6scroll);}$jqif.click(fadeClicked);$window.resize(positionPrompt);$jqib.bind("keydown keypress",keyPressEventHandler);$jqi.find('.'+options.prefix+'close').click(removePrompt);$jqif.fadeIn(options.overlayspeed);$jqi[options.show](options.promptspeed,options.loaded);$jqi.find('#'+options.prefix+'states .'+options.prefix+'_state:first .'+options.prefix+'defaultbutton').focus();if(options.timeout>0)setTimeout($.prompt.close,options.timeout);return $jqib;};$.prompt.defaults={prefix:'jqi',buttons:{Ok:true},loaded:function(){},submit:function(){return true;},callback:function(){},opacity:0.6,zIndex:999,overlayspeed:'slow',promptspeed:'fast',show:'fadeIn',focus:0,useiframe:false,top:"15%",persistent:true,timeout:0,state:{html:'',buttons:{Ok:true},focus:0,submit:function(){return true;}}};$.prompt.currentPrefix=$.prompt.defaults.prefix;$.prompt.setDefaults=function(o){$.prompt.defaults=$.extend({},$.prompt.defaults,o);};$.prompt.setStateDefaults=function(o){$.prompt.defaults.state=$.extend({},$.prompt.defaults.state,o);};$.prompt.getStateContent=function(state){return $('#'+$.prompt.currentPrefix+'_state_'+state);};$.prompt.getCurrentState=function(){return $('.'+$.prompt.currentPrefix+'_state:visible');};$.prompt.getCurrentStateName=function(){var stateid=$.prompt.getCurrentState().attr('id');return stateid.replace($.prompt.currentPrefix+'_state_','');};$.prompt.goToState=function(state){$('.'+$.prompt.currentPrefix+'_state').slideUp('slow');$('#'+$.prompt.currentPrefix+'_state_'+state).slideDown('slow',function(){$(this).find('.'+$.prompt.currentPrefix+'defaultbutton').focus();});};$.prompt.nextState=function(){var $next=$('.'+$.prompt.currentPrefix+'_state:visible').next();$('.'+$.prompt.currentPrefix+'_state').slideUp('slow');$next.slideDown('slow',function(){$next.find('.'+$.prompt.currentPrefix+'defaultbutton').focus();});};$.prompt.prevState=function(){var $next=$('.'+$.prompt.currentPrefix+'_state:visible').prev();$('.'+$.prompt.currentPrefix+'_state').slideUp('slow');$next.slideDown('slow',function(){$next.find('.'+$.prompt.currentPrefix+'defaultbutton').focus();});};$.prompt.close=function(){$('#'+$.prompt.currentPrefix+'box').fadeOut('fast',function(){$(this).remove();});};})(jQuery); 6718// set up defaults for artlogic 6719jQuery.prompt.setDefaults({ 6720 prefix: 'arprompt', 6721 useiframe: true 6722}); 6723 6724 6725
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.