1var $ = jQuery; 2var $window = $(window); 3var previousScrollTop = 0; 4var scrollLock = false; 5var time = .3; 6 7function calcHeight() { 8 let vh = window.innerHeight * 0.01; 9 document.documentElement.style.setProperty('--vh', vh + 'px'); 10} 11 12function pageLoader() { 13 loadAnimate = new TimelineMax(); 14 loadAnimate.to($('.loader'), 1, { 15 alpha: 0, 16 zIndex: -1, 17 ease: Power2.easeInOut 18 }); 19} 20 21function navigationControls() { 22 $(".sub-menu").each(function (i, e) { 23 let tl; 24 let submenu = $(e).find('> ul'); 25 26 if (submenu.length != 0) { 27 tl = new TimelineLite({ paused: true }); 28 29 tl.to(e, 0, { className: '+=open' }) 30 .to(submenu, time, { alpha: 1, visibility: 'visible', zIndex: 99, y: 0 }); 31 32 e.subMenuAnimation = tl; 33 34 $(e).hover(menuItemOver, menuItemOut); 35 } 36 37 if ($window.width() < 1200) { 38 $(this).find('span').click(function () { 39 $(this).parent().stop().toggleClass('open'); 40 $(this).siblings('ul').stop().toggleClass('open'); 41 }); 42 } 43 }); 44 45 $('.hamburger-menu').each(function () { 46 $(this).click(function () { 47 $(this).stop().toggleClass('open'); 48 $(this).find('> div').text($(this).find('> div').text() == 'Menu' ? closeLabel : 'Menu'); 49 $('#menu').stop().toggleClass('open'); 50 51 if ($(this).hasClass('open')) { 52 scrollLock = true; 53 } else { 54 scrollLock = false; 55 } 56 }); 57 }); 58 59 function menuItemOver() { 60 this.subMenuAnimation.play(); 61 } 62 63 function menuItemOut() { 64 this.subMenuAnimation.reverse(); 65 } 66} 67 68function convertSVG() { 69 $('.svg-path').each(function () { 70 let $img = $(this); 71 let imgID = $img.attr('id'); 72 let imgClass = $img.attr('class'); 73 let imgURL = $img.attr('src'); 74 75 $.get(imgURL, function (data) { 76 let $svg = $(data).find('svg'); 77 78 if (typeof imgID !== 'undefined') { 79 $svg = $svg.attr('id', imgID); 80 } 81 if (typeof imgClass !== 'undefined') { 82 $svg = $svg.attr('class', imgClass + ' replaced-svg'); 83 } 84 $svg = $svg.removeAttr('xmlns:a'); 85 86 if (!$svg.attr('viewBox') && $svg.attr('height') && $svg.attr('width')) { 87 $svg.attr('viewBox', '0 0 ' + $svg.attr('height') + ' ' + $svg.attr('width')); 88 } 89 $img.replaceWith($svg); 90 }, 'xml'); 91 }); 92} 93 94function webHandlerForm() { 95 let p = $('.intro form'); 96 let wfFrom = p.find('input[name=checkin]'); 97 let wfTo = p.find('input[name=checkout]'); 98 let wfDateFormat = "dd-mm-yy"; 99 100 wfFrom.attr('autocomplete', 'off'); 101 wfTo.attr('autocomplete', 'off'); 102 103 if (!isMobile) { 104 /* wfTo.prop("disabled", true);*/ 105 106 let dpFrom = wfFrom.datepicker({ 107 dateFormat: wfDateFormat, 108 minDate: 0 109 }).on("change", function () { 110 if (dpFrom.val()) { 111 /*dpTo.prop("disabled", false);*/ 112 let date = getDate(this); 113 let maxDate = new Date(date.getFullYear(), date.getMonth(), date.getDate() + 1); 114 dpTo.datepicker("option", "minDate", maxDate); 115 } else { 116 dpTo.val('')/*.prop("disabled", true);*/ 117 } 118 }); 119 120 let dpTo = p.find('input[name=checkout]').datepicker({ 121 dateFormat: wfDateFormat, 122 minDate: 0 123 }).on("change", function () { 124 dpFrom.datepicker("option", "maxDate", getDate(this)); 125 }); 126 127 function getDate(element) { 128 let date; 129 try { 130 date = $.datepicker.parseDate(wfDateFormat, element.value); 131 } catch (error) { 132 date = null; 133 } 134 return date; 135 } 136 } else { 137 wfFrom.attr('type', 'date'); 138 wfTo.attr('type', 'date'); 139 } 140 141 // funzione per renderizzare l'array guesttypes 142 function renderGuestsArray() { 143 let guestsArr = []; 144 let agesArr = []; 145 let totalAdults = 0; 146 let totalChilds = 0; 147 148 p.find('.ages > div.open .select').each(function () { 149 let age = parseInt($(this).text()); 150 151 agesArr.push(age); 152 }); 153 154 p.find('details[data-webform-key].open [be-id]').each(function () { 155 let id = parseInt($(this).attr('be-id')); 156 let qnt = parseInt($(this).val()); 157 158 totalAdults += parseInt(qnt, 10); 159 totalChilds += parseInt(qnt, 10); 160 161 // let item = guestsArr.find(x => x.id == id); 162 163 var item = $.grep(guestsArr, function (e) { 164 return e.id == id; 165 }); 166 167 168 if (item.length === 0) { 169 $.each(guestsArr, function (i, v) { 170 if (i === 0) { 171 v.quantity = totalAdults; 172 } else { 173 v.quantity = totalChilds; 174 } 175 }); 176 } else { 177 guestsArr.push({ id: id, quantity: qnt, ages: agesArr }); 178 } 179 }); 180 181 182 p.find('details[data-webform-key].open').each(function () { 183 let ages = ''; 184 let len = $(this).next().find('> div.open .select').length; 185 186 $(this).next().find('> div.open .select').each(function (i) { 187 ages += $(this).text() + (i !== (len - 1) ? ', ' : ''); 188 }); 189 190 $(this).find('[name*=ages]').val(ages); 191 }); 192 193 194 195 p.find('[name=guesttypes]').each(function () { 196 $(this).val(JSON.stringify(guestsArr)); 197 }); 198 } 199 200 function showAges(sel) {
201 let childSelect = sel.parent(); 202 let agesWrap = childSelect.parent().next(); 203 204 if (childSelect.attr('class').indexOf('childs') > -1) { 205 agesWrap.find('> div').removeClass('open'); 206 agesWrap.find('> div:lt(' + sel.val() + ')').addClass('open'); 207 } 208 209 renderGuestsArray(); 210 } 211 212 // il seguente ciclo serve per creare dinamicamente i campi età 213 p.find('details').each(function (i) { 214 let label = $(this).find('summary').text(); 215 216 $(this).find('summary').before('<div class="details-label">' + label + '</div>'); 217 218 $(this).after('<details class="ages" data-room="' + (i + 1) + '" open><summary></summary></details>'); 219 220 for (var i = 1; i < 5; i++) { 221 $(this).next('.ages').append([ 222 '<div class="age-' + i + '">', 223 ' <label>' + childAgeLabel + ' ' + i + '</label>', 224 ' <select>', 225 ' <option value="1">1</option>', 226 ' <option value="2">2</option>', 227 ' <option value="3">3</option>', 228 ' <option value="4">4</option>', 229 ' <option value="5">5</option>', 230 ' <option value="6">6</option>', 231 ' <option value="7">7</option>', 232 ' <option value="8">8</option>', 233 ' <option value="9">9</option>', 234 ' <option value="10">10</option>', 235 ' <option value="11">11</option>', 236 ' </select>', 237 '</div>' 238 ].join(' ')); 239 } 240 }); 241 242 243 // il seguente ciclo serve per creare lo spinner da una select 244 p.find('details select').each(function () { 245 let me = $(this); 246 247 me.before('<div class="select-btn select-minus"></div>'); 248 me.before('<div class="select">' + me.find('option:selected').val() + '</div>'); 249 me.after('<div class="select-btn select-plus"></div>'); 250 251 let minus = me.siblings('.select-minus'); 252 let plus = me.siblings('.select-plus'); 253 let select = me.siblings('.select'); 254 let minVal = me.find('option:first').val(); 255 let maxVal = me.find('option:last').val(); 256 257 if (me.val() <= minVal) { 258 minus.addClass('disabled'); 259 select.addClass('disabled'); 260 } 261 262 minus.click(function () { 263 let currentVal = parseInt(select.text()); 264 265 if (!isNaN(currentVal) && currentVal > minVal) { 266 me.val(currentVal - 1); 267 select.text(currentVal - 1); 268 } else { 269 me.val(minVal); 270 select.text(minVal); 271 } 272 273 if (me.val() === minVal) { 274 minus.addClass('disabled'); 275 } 276 277 if (me.val() < 1) { 278 select.addClass('disabled'); 279 } 280 plus.removeClass('disabled'); 281 282 showAges(me); 283 }); 284 285 plus.click(function () { 286 let currentVal = parseInt(select.text()); 287 288 if (!isNaN(currentVal) && currentVal < maxVal) { 289 me.val(currentVal + 1); 290 select.text(currentVal + 1); 291 } else { 292 $(this).addClass('disabled'); 293 } 294 295 if (me.val() === maxVal) { 296 plus.addClass('disabled'); 297 } 298 299 if (me.val() > 0) { 300 select.removeClass('disabled'); 301 } 302 minus.removeClass('disabled'); 303 304 showAges(me); 305 }); 306 }); 307 308 // controlli select / spinner bambini 309 p.find('.form-item-rooms select').each(function () { 310 let roomId = $(this).val(); 311 312 p.find('details[data-webform-key]:lt(' + roomId + ')').addClass('open'); 313 p.find('details[data-webform-key].open').each(function () { 314 let me = $(this); 315 316 me.find('select').each(function (i) { 317 if (i > 0) { 318 let childsValue = $(this).val(); 319 320 me.next().find('> div:lt(' + childsValue + ')').addClass('open'); 321 322 $.each($.parseJSON($('[name=guesttypes]').val()), function (index, value) { 323 $.each(value.ages, function (i, v) { 324 let parentDiv = $(p.find('.ages > div.open').get(i)); 325 parentDiv.find('.select').text(v); 326 parentDiv.find('select').trigger('change'); 327 328 if (v > 1) { 329 parentDiv.find('.select-btn').removeClass('disabled'); 330 } 331 }); 332 }); 333 } 334 }); 335 }); 336 337 $(this).change(function () { 338 let value = $(this).val(); 339 let childSelect = p.find('details[data-webform-key]'); 340 341 childSelect.find('[class*=childs] .select-minus').addClass('disabled'); 342 childSelect.find('[class*=childs] .select').text(0); 343 childSelect.find('[class*=childs] select').val(0).trigger('change'); 344 345 childSelect.removeClass('open').next().find('> div').removeClass('open'); 346 p.find('details[data-webform-key]:lt(' + value + ')').addClass('open'); 347 348 renderGuestsArray(); 349 }); 350 }); 351} 352 353(function ($, Drupal) { 354 Drupal.behaviors.basicWorks = { 355 attach: function (context, settings) { 356 $('.webform-submission-contact-form, .webform-submission-meeting-form, .webform-submission-wedding-form').each(function () { 357 webHandlerForm(); 358 }); 359 } 360 }; 361})(jQuery, Drupal); 362 363function sticker() { 364 $('.sticker').each(function () { 365 let tl = new TimelineMax({ paused: true, reversed: true });
366 let cl = new TimelineMax({ paused: true, reversed: true }); 367 let e = $(this); 368 let first = e.find('> div:first-child'); 369 let last = e.find('> div:last-child'); 370 let allW = e.innerWidth(); 371 let w = first.innerWidth(); 372 let target = $('.sticker-popup'); 373 let b = target.find('> div'); 374 let close = target.find('.sticker-popup-close'); 375 376 tl.to(target, .3, { alpha: 1, visibility: 'visible', zIndex: 999 }) 377 .to(b, time, { y: 0, alpha: 1, ease: Power2.easeInOut }) 378 .to(close, time, { y: 0, alpha: 1 }, '-=' + time); 379 380 new TimelineMax().set(e, { x: allW - w }); 381 382 if ($window.width() > 1023) { 383 cl.to(e, .6, { x: 0 }) 384 .to(last, .6, { alpha: 1 }, '-=.6'); 385 } 386 387 e.hover(function () { 388 cl.play(); 389 }, function () { 390 cl.timeScale(2).reverse(); 391 }); 392 393 if (e.hasClass('action')) { 394 e.click(function () { 395 tl.play(); 396 scrollLock = true; 397 }); 398 } 399 400 $('.sticker-popup-container').click(function (e) { 401 e.stopPropagation(); 402 }); 403 404 close.click(function () { 405 tl.timeScale(1.5).reverse(); 406 scrollLock = false; 407 }); 408 409 target.click(function () { 410 tl.timeScale(1.5).reverse(); 411 scrollLock = false; 412 }); 413 }); 414} 415 416// BROWSER DETECTION 417 418// Internet Explorer 6-11 419var isIE = /*@cc_on!@*/false || !!document.documentMode; 420 421// Edge 20+ 422var isEdge = !isIE && !!window.StyleMedia; 423 424// HANDLED DEVICE 425var isHandheld = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent); 426 427// MOBILE DETECTION 428var isMobile = false; 429if (/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|ipad|iris|kindle|Android|Silk|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(navigator.userAgent) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(navigator.userAgent.
429substr(0, 4))) 430 isMobile = true; 431 432$window.on('scroll mousewheel DOMMouseScroll touchmove', function () { 433 calcHeight(); 434 435 $('#header').each(function () { 436 let header = $(this); 437 438 if (!isMobile) { 439 if ($window.scrollTop() > 0) { 440 header.addClass('compact'); 441 } else { 442 header.removeClass('compact'); 443 } 444 } 445 }); 446 447 $('.sticker').each(function () { 448 let sticker = $(this); 449 450 if (!isMobile) { 451 if ($window.scrollTop() > 0) { 452 sticker.addClass('fixed'); 453 } else { 454 sticker.removeClass('fixed'); 455 } 456 } 457 }); 458 459 $('.grid-filters').each(function () { 460 let filters = $(this); 461 let grid = $('.grid-container'); 462 let header = $('#header'); 463 464 if ($window.scrollTop() > grid.offset().top - header.height()) { 465 filters.addClass('fixed'); 466 } else { 467 filters.removeClass('fixed'); 468 } 469 }); 470 471 if (scrollLock) { 472 $window.scrollTop(previousScrollTop); 473 } 474 475 previousScrollTop = $window.scrollTop(); 476}); 477 478if (isMobile) { 479 $('html').addClass('is-mobile'); 480} 481 482$('.accordion .header').click(function () { 483 $(this).toggleClass('opened'); 484 $(this).siblings('.description').toggleClass('visible'); 485}); 486 487$(document).ready(function () { 488 pageLoader(); 489 calcHeight(); 490 navigationControls(); 491 convertSVG(); 492 gallery(); 493 lazyload(); 494 sticker(); 495 496 $('.hero').addClass('loaded'); 497 498 if (!isMobile) { 499 $('html').addClass('no-touch'); 500 } else { 501 $('a[href^="tel:"]').each(function () { 502 $(this).click(function () { 503 gtag('event', 'Click', { 504 event_category: 'Website', 505 event_label: 'Mobile Phone' 506 }); 507 }); 508 }); 509 } 510 511 if (isIE) { 512 $('html').addClass('ie-browser'); 513 514 // fix per attributo object-fit in IE 11 515 $('.content-img-fit').each(function () { 516 let me = $(this); 517 let pos = $(this).data('pos'); 518 let source; 519 if (me.attr('src')) { 520 source = 'url(' + me.attr('src') + ')'; 521 } else { 522 source = 'url(' + me.data('src') + ')'; 523 } 524 525 let wrapper = $('<div class="content-img-ie bg-position-' + pos + '"></div>').css({ 526 backgroundImage: source, 527 backgroundSize: 'cover', 528 backgroundRepeat: 'no-repeat' 529 }); 530 me.hide(); 531 me.wrapAll(wrapper); 532 }); 533 } else if (isEdge) { 534 $('html').addClass('ie-edge'); 535 } 536 537 let controller = new ScrollMagic.Controller(); 538 539 $('.header-btn > div').each(function () { 540 let tl = new TimelineMax({ paused: true, reversed: true }); 541 let contactsPopup = $('.header-contacts'); 542 let contactsWrap = $('.header-contacts-wrap'); 543 544 tl.to(contactsPopup, isMobile ? .01 : time, { alpha: 1, visibility: 'visible', zIndex: 4, className: '+=open' }) 545 .to(contactsWrap, isMobile ? .01 : time, { alpha: 1, x: 0 }); 546 547 $(this).click(function () { 548 tl.play(); 549 550 $('.hamburger-menu.open').trigger('click'); 551 }); 552 553 contactsWrap.click(function (e) { 554 e.stopPropagation(); 555 }); 556 557 $('body').click(function () { 558 if (contactsPopup.hasClass('open')) { 559 tl.reverse(); 560 } 561 }); 562 }); 563 564 $('.hero').each(function () { 565 let slider = $(this).find('.swiper-container'); 566 let childs = slider.find('.swiper-slide').length; 567 568 let swiper = new Swiper(slider, { 569 autoplay: { 570 delay: 5000 571 }, 572 effect: 'fade', 573 fadeEffect: { 574 crossFade: true 575 }, 576 loop: childs > 1 ? true : false, 577 lazy: { 578 loadOnTransitionStart: true 579 }, 580 preloadImages: false, 581 speed: 1000 582 }); 583 584 $('.video-controls').click(function () { 585 $(this).find('i').toggleClass('fa-volume-mute fa-volume'); 586 $(this).toggleClass('muted'); 587 588 if ($(this).hasClass('muted')) { 589 $(this).siblings('video').prop('muted', false); 590 } else { 591 $(this).siblings('video').prop('muted', true); 592 } 593 }); 594 }); 595 596 $('.visual').each(function () { 597 $('#main-content .visual:last').css({ 598 marginBottom: 0 599 }); 600 }); 601 602 $('.boxes a').each(function () { 603 let box = $(this); 604 let boxWrap = box.find('.box-container');
605 let containerHeight = box.find('.box-inner').height(); 606 let open = false; 607 608 box.hover(function () { 609 if (open === false) { 610 TweenMax.to(boxWrap, time, { height: containerHeight, alpha: 1, scale: 1 }); 611 open = true; 612 } else { 613 TweenMax.to(boxWrap, time, { height: 0, alpha: 0, scale: .8 }); 614 open = false; 615 } 616 }); 617 }); 618 619 $('.reviews').each(function () { 620 let slider = $(this).find('.swiper-container'); 621 let bullets = slider.siblings('.swiper-pagination'); 622 let childs = slider.find('.swiper-slide').length; 623 624 let swiper = new Swiper(slider, { 625 effect: 'fade', 626 loop: childs > 1 ? true : false, 627 speed: 1000, 628 pagination: { 629 el: bullets, 630 clickable: true 631 } 632 }); 633 }); 634 635 $('.zig-zag').each(function () { 636 $('.page-room #main-content .room-head:first').show(); 637 }); 638 639 $('.content-slider').each(function () { 640 let slider = $(this).find('.swiper-container'); 641 let controls = slider.find('.swiper-controls'); 642 let progress = slider.find('.swiper-pagination'); 643 644 let swiper = new Swiper(slider, { 645 slidesPerView: 'auto', 646 speed: 1000, 647 navigation: { 648 nextEl: controls.find('.next')[0], 649 prevEl: controls.find('.prev')[0] 650 }, 651 pagination: { 652 el: progress, 653 type: 'progressbar' 654 }, 655 breakpoints: { 656 1600: { 657 spaceBetween: 60 658 }, 659 768: { 660 spaceBetween: 30 661 }, 662 0: { 663 spaceBetween: 12 664 } 665 } 666 }); 667 }); 668 669 $('.grid-filters').each(function () { 670 let slider = $(this).find('.swiper-container'); 671 let controls = slider.next('.swiper-controls'); 672 673 let swiper = new Swiper(slider, { 674 freeMode: true, 675 slidesPerView: 'auto', 676 navigation: { 677 nextEl: controls.find('.next')[0], 678 prevEl: controls.find('.prev')[0] 679 } 680 }); 681 682 $(this).find('.swiper-slide').each(function () { 683 let pos = $(this).parents('.grid-filters').siblings('.grid-container').offset().top; 684 685 $(this).click(function () { 686 let filterValue = $(this).attr('data-filter'); 687 let grid = $(this).parents('.grid-filters').siblings('.grid-container'); 688 let gallery = $(this).parents('.grid-filters').siblings('.gallery'); 689 690 $(this).addClass('active'); 691 $(this).siblings().removeClass('active'); 692 693 if (filterValue !== '*') { 694 grid.find('> a').addClass('hidden'); 695 696 gallery.find('.picture, .content-claim').addClass('hidden'); 697 gallery.find('.picture' + filterValue + ', .content-claim' + filterValue).removeClass('hidden'); 698 gallery.find('.picture' + filterValue).each(function (counter, element) { 699 $(this).attr('data-index', counter++); 700 }); 701 702 grid.find(filterValue).each(function () { 703 $(this).removeClass('hidden'); 704 }); 705 } else { 706 grid.find('> a').removeClass('hidden'); 707 gallery.find('.picture, .content-claim').removeClass('hidden'); 708 gallery.find('.picture').each(function (counter, element) { 709 $(this).attr('data-index', counter++); 710 }); 711 } 712 713 $('html, body').animate({ 714 scrollTop: pos - 60 - (isMobile ? ($window.width() > 767 ? 40 : 20) : 0) 715 }); 716 }); 717 }); 718 }); 719 720 $('.poi-slider').each(function () { 721 let slider = $(this); 722 let controls = slider.find('.swiper-controls'); 723 let progress = slider.find('.swiper-pagination'); 724 725 let swiper = new Swiper(slider, { 726 effect: 'fade', 727 lazy: { 728 loadOnTransitionStart: true 729 }, 730 speed: 1000, 731 navigation: { 732 nextEl: controls.find('.next')[0], 733 prevEl: controls.find('.prev')[0] 734 }, 735 pagination: { 736 el: progress, 737 type: 'progressbar' 738 } 739 }); 740 }); 741 742 $('.press-list a').each(function () { 743 let box = $(this); 744 let boxWrap = box.find('.box-container'); 745 let boxMarginTop = box.find('.box-btn').css('margin-top'); 746 let containerHeight = box.find('.box-inner').height() + parseInt(boxMarginTop); 747 let open = false;
748 749 box.hover(function () { 750 if (open === false) { 751 TweenMax.to(boxWrap, time, { height: containerHeight, alpha: 1 }); 752 open = true; 753 } else { 754 TweenMax.to(boxWrap, time, { height: 0, alpha: 0 }); 755 open = false; 756 } 757 }); 758 }); 759 760 // cookie message 761 /* if (!checkCookie()) { 762 var cont = $('#acceptcookie'); 763 var mask = $('<div class="cookie-mask">'); 764 var div = $('<div class="cookie-cont">'); 765 var divInner = $('<div></div>'); 766 var text = $('<div class="cookie-text">' + cookieTxt + '</div>'); 767 var button = $('<div class="cookie-button">' + okTxt + '</div>'); 768 button.click(function () { 769 createCookie(); 770 }); 771 mask.click(function () { 772 createCookie(); 773 }); 774 $window.scroll(function () { 775 createCookie(); 776 }); 777 divInner.append(text, button); 778 div.append(divInner); 779 cont.append(mask, div); 780 781 div.animate({ 782 opacity: 1 783 }, 1500); 784 } */ 785 786 function checkCookie() { 787 return (document.cookie.indexOf('_cookiepolicy') != -1) ? $('#acceptcookie').hide() : false; 788 } 789 790 function createCookie() { 791 var dt = new Date(); 792 dt.setDate(dt.getDate() + 365); 793 document.cookie = '_cookiepolicy=accept; path=/; expires=' + dt.toUTCString(); 794 $('#acceptcookie').remove(); 795 return false; 796 } 797}); 798; 799var itemHtml = itemHtml !== '' ? itemHtml : ''; 800 801function gallery() { 802 function buildPswdHtml() { 803 $("body").append([ 804 '<div class="pswp" tabindex="-1" role="dialog" aria-hidden="true">', 805 ' <div class="pswp__bg"></div>', 806 ' <div class="pswp__scroll-wrap">', 807 ' <div class="pswp__container">', 808 ' <div class="pswp__item"></div>', 809 ' <div class="pswp__item"></div>', 810 ' <div class="pswp__item"></div>', 811 ' </div>', 812 ' <div class="pswp__ui pswp__ui--hidden">', 813 ' <div class="pswp__top-bar">', 814 ' <div class="pswp__counter"></div>', 815 ' <button class="pswp__button pswp__button--close"></button>', 816 ' <button class="pswp__button pswp__button--share"></button>', 817 ' <button class="pswp__button pswp__button--fs"></button>', 818 ' <button class="pswp__button pswp__button--zoom"></button>', 819 ' <div class="pswp__preloader">', 820 ' <div class="pswp__preloader__icn">', 821 ' <div class="pswp__preloader__cut">', 822 ' <div class="pswp__preloader__donut"></div>', 823 ' </div>', 824 ' </div>', 825 ' </div>', 826 ' </div>', 827 ' <div class="pswp__share-modal pswp__share-modal--hidden pswp__single-tap">', 828 ' <div class="pswp__share-tooltip"></div> ', 829 ' </div>', 830 ' <button class="pswp__button pswp__button--arrow--left"></button>', 831 ' <button class="pswp__button pswp__button--arrow--right"></button>', 832 ' <div class="pswp__caption">', 833 ' <div class="pswp__caption__center"></div>', 834 ' </div>', 835 ' </div>', 836 ' </div>', 837 '</div>' 838 ].join("")); 839 } 840 841 function getGalleryItems($gallery) { 842 var items = []; 843 844 $gallery.find(".picture").not('.hidden').each(function () { 845 var $anchor = $(this), 846 size = $anchor.attr("data-size").split("x"), 847 title = $anchor.find('img').attr('alt'); 848 849 picture = { 850 el: $anchor.get(0), 851 src: $anchor.attr("data-src"), 852 w: parseInt(size[0]), 853 h: parseInt(size[1]) 854 }; 855 856 if (title) 857 picture.title = title; 858 859 items.push(picture); 860 }); 861 862 return items; 863 } 864 865 function openGallery($gallery, index, items, pswpOptions) { 866 var $pswp = $(".pswp"), 867 gallery = $gallery; 868 869 var options = $.extend(true, { 870 index: parseInt(index) 871 }, pswpOptions); 872 873 gallery = new PhotoSwipe($pswp.get(0), PhotoSwipeUI_Default, items, options); 874 gallery.init(); 875 } 876 877 function initializeGallery($elem, pswpOptions) { 878 if ($(".pswp").length === 0) { 879 buildPswdHtml(); 880 } 881 882 $elem.each(function (i) { 883 var $gallery = $(this), 884 uid = i + 1, 885 // items = getGalleryItems($gallery), 886 options = $.extend(true, {}, pswpOptions); 887 888 $(document).ready(function () { 889 $gallery.find('.picture').each(function () { 890 $(this).click(function () { 891 items = getGalleryItems($gallery); 892 893 openGallery($gallery, $(this).attr('data-index'), items.concat(), options); 894 return false;
895 }); 896 }); 897 }); 898 }); 899 } 900 901 var pswpOptions = { 902 arrowKeys: true, 903 barsSize: { 904 top: 0, 905 bottom: 0 906 }, 907 captionEl: false, 908 closeElClasses: '', 909 fullscreenEl: false, 910 zoomEl: false, 911 loop: true, 912 shareEl: false, 913 preloaderEl: false, 914 mouseUsed: true, 915 tapToClose: true, 916 tapToToggleControls: false, 917 showHideOpacity: true, 918 history: false, 919 hash: false, 920 maxSpreadZoom: 1, 921 getDoubleTapZoom: function (isMouseClick, item) { 922 return item.initialZoomLevel; 923 }, 924 pinchToClose: false 925 }; 926 927 initializeGallery($('.gallery'), pswpOptions); 928};
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.