1/** 2 * Main JS 3 * @version 2015 4 * @author vioma GmbH - www.vioma.de 5 * @license this code is distributed under the terms of the WTFPL 6 */ 7var responsive = function ( $ ) { 8 "use strict"; 9 10 // globally accessible for external template calls 11 var me = window.nst2015 = {}; 12 13 me.browser = { 14 nua: navigator.userAgent, 15 Android: function () { 16 return me.browser.nua.match( /Android/i ); 17 }, 18 AndroidVanilla: function () { 19 return me.browser.nua.match( /^(?=.*\bMozilla\/5\.0\b)(?=.*\bAndroid\b)(?=.*\bAppleWebKit\b)(?!.*\bChrome\b).*$/ ); 20 }, 21 BlackBerry: function () { 22 return me.browser.nua.match( /BlackBerry/i ); 23 }, 24 iOS: function () { 25 return me.browser.nua.match( /iPhone|iPad|iPod/i ); 26 }, 27 OperaMini: function () { 28 return me.browser.nua.match( /Opera Mini/i ); 29 }, 30 OperaWebkit: function () { 31 return me.browser.nua.match( /^(?=.*\bOPR\/\b)(?!.*\bMobile\b)/ ); 32 }, 33 Chrome: function () { 34 return me.browser.nua.match( /^(?=.*\bAppleWebKit\b)(?=.*\bChrome\b).*$/ ); 35 }, 36 Safari: function () { 37 return me.browser.nua.match( /^(?=.*\bAppleWebKit\b)(?!.*\bChrome\b)(?=.*\bSafari\b).*$/ ); 38 }, 39 Webkit: function () { 40 return ( me.browser.Chrome() || me.browser.Safari() || me.browser.OperaWebkit() ); 41 }, 42 IE8: function () { 43 return me.browser.nua.match( /^(?=.*\bmsie\b)(?=.*\b8\.\b).*$/ ); 44 }, 45 IE10: function () { 46 return me.browser.nua.match( /^(?=.*\bmsie\b)(?=.*\b10\.\b).*$/ ); 47 }, 48 IE11: function () { 49 return me.browser.nua.match( /^(?=.*\bTrident\b)(?=.*\b11\.\b).*$/ ); 50 }, 51 WinPhone: function () { 52 return me.browser.nua.match( /IEMobile/i ); 53 }, 54 mobile: function () { 55 return (me.browser.Android() || me.browser.BlackBerry() || me.browser.iOS() || me.browser.OperaMini() || me.browser.WinPhone()); 56 } 57 }; 58 59 me.id = function ( el, js_node ) { 60 var node = document.getElementById( el ); 61 return js_node ? node : $( node ); 62 }; 63 64 me.opt = { 65 variants: { 66 template: '', 67 header: '', 68 navigation: '' 69 }, 70 dnt: navigator['doNotTrack'] == '1' || navigator['doNotTrack'] == 'yes', 71 window: $( window ), 72 body_scroll: $( 'html,body' ), 73 is_mobile: me.browser.mobile(), 74 html: $( 'html' ), 75 site: $( '#site' ), 76 head: $( 'head' ), 77 header: $( '#header' ).add( '#header_c' ), 78 hash: '', 79 nav: $( '#nav_0' ), 80 menu: $( '#nav_menu' ), 81 menu_open: false, 82 menu_fade_delay: 1000, 83 menu_animating: false, 84 menu_animation: 700, // timing (ms) 85 menu_button: $( '#nav_menu_button' ), 86 main: $( '#main' ), 87 scroll: 0, 88 scroll_breakpoint: function(){ 89 return (me.opt.scroll >= me.opt.main_top * 0.5); 90 }, 91 already_scrolled: false, 92 noscript_afterload: $('noscript.styleafterscroll'), 93 std_domain: '', 94 mq: { 95 obj: $( '#layout' ), 96 width: 0, 97 portrait: false 98 }, 99 gals: [], 100 gal_std_ratio: 16 / 9, 101 gal_parallax: [], 102 gal_parallax_listening: false, 103 gmaps_styles: undefined, 104 fancyboxDefaultPadding: undefined, 105 ytLinks: false, /* true/false, jQuery object or selector as string */ 106 ytLinksSel: 'a[href*="youtube"],a[href*="youtu.be"]', 107 flex_layouts: { 108 'roomtype-slider': function () { 109 this.options = $.extend( { 110 slideshow: false, 111 animation: 'slide', 112 prevText: '', 113 nextText: '' 114 }, this.options ); 115 }, 116 'content-slider-wide': function () { 117 this.resp_img_src = true; 118 this.w = Math.min( 1200, me.opt.mq.width ); 119 this.h = this.w * 580 / 1200; 120 this.options = $.extend( { 121 slideshow: false, 122 animation: 'slide', 123 prevText: '', 124 nextText: '', 125 controlNav: true, 126 directionNav: true 127 }, this.options ); 128 }, 129 'content-slider-images': function () { 130 this.options = $.extend( { 131 slideshow: false, 132 animation: 'fade', 133 prevText: '', 134 nextText: '', 135 directionNav: true 136 }, this.options ); 137 }, 138 'content-slider-texts': function () { 139 this.options = $.extend( { 140 slideshow: false, 141 animation: 'slide', 142 prevText: '', 143 nextText: '', 144 smoothHeight: true, 145 controlNav: true, 146 directionNav: true 147 }, this.options ); 148 }, 149 'tiles-slider': function () { 150 var columns = { '1920': 3, '1600': 3, '1280': 3, '959': 2, '768': 2, '640': 1, '480': 1, '320': 1 }; 151 this.options = $.extend( { 152 slideshow: false, 153 animation: 'slide', 154 prevText: '', 155 nextText: '', 156 selector: '.slides > .tile-gallery', 157 controlNav: false, 158 directionNav: true, 159 itemWidth: 380, 160 itemMargin: 30, 161 minItems: columns[me.opt.mq.width], 162 maxItems: columns[me.opt.mq.width], 163 start: function ( slider ) { 164 $( window ).bind( 'resize.tiles_slider', function () { 165 slider.vars.smoothHeight = ( columns[me.opt.mq.width] === 1 ); 166 slider.vars.minItems = columns[me.opt.mq.width]; 167 slider.vars.maxItems = columns[me.opt.mq.width]; 168 } ); 169 } 170 }, this.options ); 171 } 172 }, 173 urlSearchParameters: window.location.search ? new URLSearchParams(window.location.search) : null, 174 }; 175 176 me.setup = function () { 177 if ( window.Modernizr === undefined ) { 178 window.Modernizr = { touchevents: false }; 179 } 180 if ( window.devicePixelRatio === undefined ) { 181 window.devicePixelRatio = 1; 182 } 183 me.opt.touch = window.Modernizr.touchevents; 184 me.opt.lang = me.opt.html.attr( 'lang' ); 185 me.opt.dev = me.opt.html.data('dev') === 'yes'; 186 me.opt.std_domain = me.opt.html.data('dev-domain') || ''; 187 me.opt.main_menu_items = me.opt.menu.find( '.main-menu-item' ); 188 me.opt.variants.header = me.opt.header.data( 'variant' ); 189 me.opt.variants.template_id = me.opt.site.data( 'template' ); 190 me.opt.variants.navigation = me.opt.nav.data( 'variant' ); 191 me.opt.banner = me.opt.header.children().filter( '.banner' ); 192 me.opt.logo = me.opt.banner.children().filter( '.logo' ); 193 me.opt.nav_hover = ( me.opt.nav.data( 'hover' ) === 'yes' ); 194 me.opt.smoothscroll = ( me.opt.site.data( 'smoothscroll' ) !== 'no' ); 195 me.opt.main_top = me.opt.main.length ? me.opt.main.offset().top : 0; 196 me.opt.scroll = me.opt.window.scrollTop(); 197 me.opt.mq.width = me.opt.mq.obj.width(); 198 me.opt.gmaps_markers = window['nst_markers'] || [ { 199 marker_1x: '/static/template-' + me.opt.variants.template_id + '/i/marker.png', 200 marker_2x: '/static/template-' + me.opt.variants.template_id + '/i/marker_2x.png' 201 } ]; 202 if ( me.opt.dev ) { 203 window.me = me; 204 } 205 206 me.nst_accessibility(); 207 me.nst_website_help(); 208 }; 209 210 me.init = function() { 211 me.content_place(); 212 me.listeners(); 213 me.custom_events(); 214 }; 215 216 me.content_place = function () { 217 me.scroll_event(); 218 me.accordion_build(); 219 me.fancybox_build(); 220 me.resp_iframe_build(); 221 me.text_ellipsis(); 222 223 if ( document.location.hash && !document.location.hash.match(/^#\//) ){ 224 me.opt.hash = document.location.hash; 225 } 226 227 document.addEventListener( 'DOMContentLoaded', function () { 228 me.fancyboxVersionConverter(); 229 }, false ); 230 }; 231 232 me.text_ellipsis = function(){ 233 if ( $.fn.dotdotdot !== undefined ) { 234 me.opt.main.find( '.dotdotdot' ).dotdotdot( { 235 watch: 'window' 236 } ); 237 } 238 }; 239 240 me.resp_iframe_build = function(){ 241 242 if( me.opt.ytLinks ){ 243 var ytLinks; 244 try{ 245 if( me.opt.ytLinks instanceof $ ){ 246 ytLinks = me.opt.ytLinks 247 } 248 if( typeof me.opt.ytLinks === 'string' || me.opt.ytLinks instanceof String ){ 249 ytLinks = $(me.opt.ytLinks ).find( me.opt.ytLinksSel ); 250 } 251 else { 252 ytLinks = me.opt.main.find( me.opt.ytLinksSel ); 253 } 254 ytLinks.each( function ( i, el ) { 255 var $el = $(el); 256 var videoID = el.href.match( /youtube.*v=([^&]*|.*$)/ ) || el.href.match( /youtu\.be\/(.*)$/ ); 257 if ( videoID !== null ) { 258 var iframe = $( '<iframe frameborder="0" width="1200" height="675" sandbox="allow-scripts allow-same-origin allow-presentation" allowfullscreen="allowfullscreen" mozallowfullscreen="mozallowfullscreen" webkitallowfullscreen="webkitallowfullscreen" src="https://www.youtube-nocookie.com/embed/' + videoID[1] + '"></iframe>' ); 259 iframe.attr( 'title', $el.text() + ' (YouTube)' ); 260 if( $el.parent().is('p') ){ 261 $el = $el.parent(); 262 } 263 $el.replaceWith( iframe ); 264 } 265 } ); 266 } 267 catch(e){ 268 console.warn( e ); 269 } 270 } 271 272 var css = ''; 273 //.yt-frames = legacy for cms 3113 274 me.opt.site.find( ':not(.yt-frame, .yt-iframe) > iframe' ).each( function ( i, el ) { 275 var $iframe = $( el ), 276 iframe_w = $iframe.attr( 'width' ) || 0, 277 iframe_h = $iframe.attr( 'height' ) || 0; 278 if( $iframe.data('src') ){ 279 $iframe.attr('src', $iframe.data('src') ); 280 } 281 if ( iframe_w * iframe_h > 0 ) { 282 var iframe_id = 'yt-' + Math.round( 1000000 * Math.random() ); 283 $iframe.wrap( '<div class="yt-iframe ' + iframe_id + '"/>' ); 284 css += '.' + iframe_id + '{max-width:' + iframe_w + 'px}.' + iframe_id + '::before{padding-bottom:' + ( 100 * iframe_h / iframe_w ) + '%}'; 285 } 286 } ); 287 if( css.length > 0 ){ 288 var styletag = document.createElement( 'style' ); 289 styletag.type = 'text/css'; 290 if (styletag.styleSheet){ // IE 291 styletag.styleSheet.cssText = css; 292 } else { // W3 293 styletag.appendChild( document.createTextNode( css ) ); 294 } 295 document.head.appendChild( styletag ); 296 } 297 }; 298 299 me.accordion_build = function( context ){ 300 if ( $.fn.accordion !== undefined ) { 301 context = context || me.opt.main; 302 var accordions = context.find( '.accordion, .accordion-open, .accordion-open-desktop' ); 303 accordions.addClass( 'accordion' ).each( function ( i, el ) { 304 var accHeader = $( el ); 305 var accContainer, accContent, nextElement, accFragment, currentFragment; 306 var accActive = false;
307 var nextSelector = ':not(.accordion, .accordion-stop)'; 308 309 if( accHeader.parent().hasClass('.accordion-article') ){ 310 return; 311 } 312 313 if( accHeader.next().is('div.accordion-content') ){ 314 accContainer = accHeader.parent().addClass('accordion-article'); 315 } 316 else { 317 accContainer = $( document.createElement('div') ).addClass( 'accordion-article' ); 318 accContent = document.createElement('div'); 319 accContent.className = 'accordion-content'; 320 321 accFragment = document.createDocumentFragment(); 322 nextElement = accHeader.next( nextSelector ); 323 324 while ( nextElement.length != 0 ) { 325 currentFragment = nextElement.get(0); 326 nextElement = nextElement.next( nextSelector ); 327 accFragment.appendChild( currentFragment ); 328 } 329 accContainer.insertAfter( accHeader ); 330 accContent.appendChild( accFragment ); 331 accContainer.append( accHeader, accContent ); 332 } 333 334 if( accHeader.hasClass( 'accordion-open' ) 335 || ( accHeader.hasClass( 'accordion-open-desktop' ) && me.opt.mq.width > 959 ) ){ 336 accActive = 0; 337 } 338 339 accContainer.accordion( { 340 icons: false, 341 active: accActive, 342 header: '> .accordion', 343 heightStyle: 'content', 344 autoHeight: false, 345 collapsible: true 346 } ); 347 } ); 348 } 349 }; 350 351 me.fancyboxAfterShow = function() { 352 if( $.fn.sti !== undefined ){ 353 $('img','.fancybox-outer' ).sti({ 354 selector: '.fancybox-outer', 355 style: 'flat', 356 orientation: 'horizontal' 357 }); 358 } 359 if ( me.opt.touch && typeof $.fn.swipe == 'function') { 360 $( '.fancybox-nav' ).css( 'display', 'none' ); 361 $( '.fancybox-wrap' ).swipe( { 362 swipe: function ( event, direction ) { 363 if ( direction === 'left' || direction === 'up' ) { 364 $.fancybox.next( direction ); 365 } 366 else { 367 $.fancybox.prev( direction ); 368 } 369 } 370 } ); 371 } 372 }; 373 374 me.fancybox_build = function( context ){ 375 376 context = context || me.opt.main; 377 378 if ( $.fn.fancybox !== undefined ) { 379 380 // single 381 var fb_links = context.find( '.fancybox, .cms-zoom-content' ); 382 fb_links.not('[rel],[data-fancybox-group]' ).each( function (i,el) { 383 var fb_options = { 384 helpers: { 385 title: { type: 'inside' } 386 }, 387 afterShow: me.fancyboxAfterShow 388 }, 389 $this = $( el ), 390 height = parseInt( $this.data( 'height' ), 10 ), 391 width = parseInt( $this.data( 'width' ), 10 ), 392 padding = parseInt( $this.attr( 'data-fancybox-padding' ), 10 ); 393 394 if( $this.attr('onclick' ) && $this.attr('onclick').indexOf('hs.expand') > -1){ 395 $this.removeAttr('onclick'); 396 } 397 if( !$this.attr('data-fancybox-type') && $this.hasClass('cms-zoom-content') && el.href ){ 398 if( el.href.indexOf('/media/') > -1 ){ 399 fb_options.type = 'image'; 400 $this.attr('data-fancybox-type','image'); 401 } 402 else if( el.href.indexOf('http') === 0 ){ 403 fb_options.type = 'iframe'; 404 $this.attr('data-fancybox-type','iframe'); 405 } 406 } 407 if ( height > 0 && width > 0 ) { 408 fb_options.height = height; 409 fb_options.width = width; 410 } 411 if ( padding >= 0 ) { 412 fb_options.padding = padding; 413 } 414 else if ( me.opt.fancyboxDefaultPadding >= 0 ) { 415 fb_options.padding = me.opt.fancyboxDefaultPadding; 416 } 417 $this.fancybox( fb_options ); 418 } ); 419 420 // grouped 421 var fb_group = fb_links.filter('[rel],[data-fancybox-group]' ); 422 var fb_group_options = ( function( $this ){ 423 var height = parseInt( $this.data( 'height' ), 10 ), 424 width = parseInt( $this.data( 'width' ), 10 ), 425 padding = parseInt( $this.attr( 'data-fancybox-padding' ), 10 ); 426 var fb_default = { 427 helpers: { 428 title: { type: 'inside' } 429 }, 430 afterShow: me.fancyboxAfterShow 431 }; 432 433 if ( height > 0 && width > 0 ) { 434 fb_default.height = height; 435 fb_default.width = width; 436 } 437 if ( padding >= 0 ) { 438 fb_default.padding = padding; 439 } 440 else if ( me.opt.fancyboxDefaultPadding >= 0 ) { 441 fb_default.padding = me.opt.fancyboxDefaultPadding; 442 } 443 444 return fb_default; 445 } )( fb_group.eq(0) ); 446 fb_group.fancybox( fb_group_options ); 447 448 // grouped with thumbnail 449 450 var fb_thumb = context.find( '.fancybox-thumb' ); 451 var fb_thumb_options = ( function( $this ){ 452 var height = parseInt( $this.data( 'height' ), 10 ), 453 width = parseInt( $this.data( 'width' ), 10 ), 454 padding = parseInt( $this.attr( 'data-fancybox-padding' ), 10 ); 455 var fb_default = { 456 helpers: { 457 title: { type: 'inside' }, 458 thumbs: { 459 width: 50, 460 height: 50, 461 source: function ( current ) { 462 return $( current.element ).attr( 'data-fancybox-thumb' ); 463 } 464 } 465 }, 466 afterShow: me.fancyboxAfterShow 467 }; 468 469 if ( height > 0 && width > 0 ) { 470 fb_default.height = height; 471 fb_default.width = width; 472 } 473 if ( padding >= 0 ) { 474 fb_default.padding = padding; 475 } 476 else if ( me.opt.fancyboxDefaultPadding >= 0 ) { 477 fb_default.padding = me.opt.fancyboxDefaultPadding; 478 } 479 480 return fb_default; 481 } )( fb_thumb.eq(0) ); 482 fb_thumb.fancybox( fb_thumb_options ); 483 } 484 }; 485 486 me.listeners = function () { 487 if ( me.opt.variants.header == 'C' ) { 488 me.opt.headc_chk = $('#header_c_nav_chk'); 489 $('.main-menu-handle').on( 'click', function(){ 490 var handle = $(this); 491 var item = handle.closest('.main-menu-item'); 492 493 if(me.opt.mq.width <= 768) { 494 item.toggleClass('open-mobile'); 495 } 496 }); 497 498 if (!me.opt.headc_no_accessibility) { 499 me.opt.headc_chk.checked = false; // If user presses back button 500 let $nav = $('#nav_menu'); 501 $nav.attr('inert', ''); 502 me.opt.headc_chk.attr('aria-controls', 'nav_menu').attr('aria-expanded', 'false').attr('aria-label', me.opt.headc_chk.data('label') || 'Toggle navigation menu'); 503 504 me.opt.headc_chk.on('change', function() { 505 if (this.checked) { 506 $nav.removeAttr('inert'); 507 $nav.find('.main-menu a').first().focus(); 508 me.opt.headc_chk.attr('aria-expanded', 'true'); 509 me.opt.headc_chk._escKeyPressed = false;
510 } 511 else { 512 $nav.attr('inert', ''); 513 me.opt.headc_chk.focus(); 514 me.opt.headc_chk.attr('aria-expanded', 'false'); 515 me.opt.headc_chk._escKeyPressed = true; 516 } 517 }); 518 519 $(document).on('keydown', function(e) { 520 if (!me.opt.headc_chk._escKeyPressed && e.key === 'Escape') { 521 me.opt.headc_chk.prop('checked', false).trigger('change'); 522 me.opt.headc_chk._escKeyPressed = false; 523 } 524 }); 525 } 526 527 $( 'a' ).on( 'click', me.smooth_scroll ); 528 } 529 else if ( me.opt.variants.navigation && ('ABC').indexOf( me.opt.variants.navigation ) > -1 ) { 530 531 me.opt.menu_button.on('click focus', function ( ev ) { 532 ev.preventDefault(); 533 ev.stopPropagation(); 534 if ( !me.opt.menu_animating ) { 535 me.opt.menu_animating = true; 536 setTimeout( function () { 537 me.opt.menu_animating = false; 538 }, me.opt.menu_animation + 100 ); 539 me.opt.window.scrollTop( 0 ); 540 if ( !me.opt.menu_open ) { 541 me.opt.site.addClass( 'open open-delay' ); 542 } 543 else { 544 me.opt.site.removeClass( 'open' ); 545 setTimeout( function () { 546 me.opt.site.removeClass( 'open-delay' ); 547 }, me.opt.menu_animation + 100 ); 548 } 549 me.opt.menu_open = !me.opt.menu_open; 550 } 551 } ); 552 553 $( 'a' ).not( '.main-menu-link' ).on( 'click', me.smooth_scroll ); 554 555 me.menu_fade_cancel = $.noop; 556 557 if ( !me.opt.touch && me.opt.mq.width >= 960 && me.opt.nav_hover ) { 558 me.opt.submenus = me.opt.main_menu_items.find( '.sub-menu' ); 559 560 me.menu_fade = function () { 561 me.menu_fade_cancel(); 562 if( me.opt.menu_fade_delay > 0 ){ 563 me.opt.menu_fade_timer = setTimeout( function () { 564 me.opt.main_menu_items.removeClass( 'open' ); 565 me.opt.submenus.removeClass( 'overlay' ).attr( 'style', '' ); 566 }, me.opt.menu_fade_delay ); 567 } 568 else { 569 me.opt.main_menu_items.removeClass( 'open' ); 570 me.opt.submenus.removeClass( 'overlay' ).attr( 'style', '' ); 571 } 572 }; 573 me.menu_fade_cancel = function () { 574 if ( me.opt.menu_fade_timer ) { 575 clearTimeout( me.opt.menu_fade_timer ); 576 } 577 }; 578 me.opt.main_menu_items.on( 'mouseenter', me.menu_fade_cancel ) 579 .not( '.single' ).on( 'mouseenter', me.menu_click ); 580 me.opt.nav.find( '.main-menu' ).on( 'mouseleave', me.menu_fade ); 581 me.opt.submenus.on( 'mouseenter', me.menu_fade_cancel ); 582 } 583 else { 584 me.opt.main_menu_items.on( 'click', me.menu_click ); 585 } 586 587 me.opt.main_menu_items.find( '.close' ).on( 'click', function ( ev ) { 588 ev.preventDefault(); 589 ev.stopPropagation(); 590 if ( me.menu_fade_timer ) { 591 clearTimeout( me.menu_fade_timer ); 592 } 593 me.opt.main_menu_items.removeClass( 'open' ); 594 $( ev.target ).closest( '.sub-menu' ).removeClass( 'overlay' ).attr( 'style', '' ); 595 } ); 596 597 me.opt.body_scroll.on( 'click touchstart', function ( ev ) { 598 if ( me.opt.mq.width >= 960 && !$( ev.target ).closest( me.opt.menu ).length ) { 599 me.opt.menu.find( '.close' ).trigger( 'click' ); 600 } 601 } ); 602 603 if( me.opt.touch && typeof $.fn.swipe == 'function'){ 604 me.opt.site.swipe({ 605 preventDefaultEvents: false, 606 swipe: function ( event, direction ) { 607 if ( me.opt.site.hasClass('open') && direction === 'right' ) { 608 me.opt.menu_button.click(); 609 } 610 } 611 }); 612 } 613 614 // Accessibility Erreichbarkeit Menüpunkte Header A und B 615 // Input, damit auch im Widget was angesprochen werden kann, um den letzten Menüpunkt wieder zu schlieÃen. 616 me.opt.header.find( 'a, input' ).on( 'focus', function () { 617 if ( $( this ).hasClass( 'main-menu-link' ) || $( this ).closest( '.open' ).length ) { 618 me.opt.menu.find('.main-menu-item').each(function() { 619 $(this).removeClass('open open-delay'); 620 }) 621 $(this).closest('.main-menu-item').addClass( 'open open-delay' ); 622 } 623 else { 624 me.opt.menu.find('.main-menu-item').each(function() { 625 $(this).removeClass('open open-delay'); 626 }) 627 } 628 }); 629 630 // Close mobile navigation if focus is lost 631 $('a', me.opt.nav).on('focusout', function() { 632 var $this = $(this); 633 setTimeout(function() { 634 if (!me.opt.nav.find('a:focus').length) { 635 me.opt.menu_button.click(); 636 } 637 }, 0); 638 }); 639 } 640 641 me.opt.header.find( '.widget-handle' ).click( function ( ev ) { 642 $( ev.target ).closest( '.nst15-widget' ).toggleClass( 'open' ); 643 } ); 644
645 me.opt.window.on( 'resize orientationchange', function () { 646 me.opt.main_top = me.opt.main.length ? me.opt.main.offset().top : 0; 647 var layout_prev = me.opt.mq.width; 648 me.opt.mq.width = me.opt.mq.obj.width(); 649 if ( layout_prev !== me.opt.mq.width ) { 650 me.layout_change(); 651 } 652 } ); 653 654 me.opt.window.on( 'scroll touchmove', function ( ev ) { 655 me.opt.scroll = me.opt.window.scrollTop(); 656 me.scroll_event( ev ); 657 } ); 658 659 me.id( 'site_anchor' ).click( function () { 660 var scrollspeed = me.opt.smoothscroll ? 400 : 1; 661 me.opt.body_scroll.animate( { scrollTop: 0 }, scrollspeed ); 662 } ); 663 664 me.opt.header.find( '.gallery-fullscreen' ).on( 'click', function () { 665 me.opt.site.toggleClass( 'fullscreen' ); 666 } ); 667 668 if ( me.opt.hash !== '' ) { 669 me.opt.window.on( 'load', function () { 670 setTimeout( function () { 671 me.smooth_scroll( { 672 'hash': me.opt.hash.replace(/^#+/,''), 673 'banner_height': window['scrolledBannerHeight'] || false 674 } ); 675 }, 300 ); 676 } ); 677 } 678 else if( me.opt.site.data('autoscroll') ){ 679 var scrollto = $( me.opt.site.data('autoscroll') ); 680 if( scrollto.length && me.opt.scroll == 0 ) { 681 me.opt.window.on( 'load', function () { 682 setTimeout( function () { 683 me.smooth_scroll( { 684 'scrollto': scrollto.eq( 0 ), 685 'banner_height': window['scrolledBannerHeight'] || false 686 } ); 687 }, 300 ); 688 } ); 689 } 690 } 691 }; 692 693 me.custom_events = $.noop; 694 695 me.menu_click = function ( ev ) { 696 ev.stopPropagation(); 697 var item, 698 is_single, 699 pos, 700 overlay_css, 701 overlay, 702 link_container = $( this ); 703 704 /* do not try to invert the state of the menu if the item is already opened */ 705 if ( ev.type === 'mouseenter' && link_container.hasClass( 'open' ) ) { 706 me.menu_fade_cancel(); 707 return; 708 } 709 item = link_container.find( '.main-menu-item-name' ); 710 is_single = item.hasClass( 'single' ) || link_container.hasClass( 'single' ); 711 712 /* No sub-menu handling for the navigation layout C */ 713 if ( me.opt.variants.navigation === 'C' && me.opt.mq.width >= 960 ) { 714 ev.target = item.find( 'a' )[0]; 715 me.smooth_scroll( ev ); 716 } 717 718 /* Top level items without a submenu fire an event to close the other overlays and follow the current link */ 719 else if ( is_single ) { 720 me.opt.main_menu_items.removeClass( 'open' ); // close all 721 ev.target = item.find( 'a' )[0]; 722 me.smooth_scroll( ev ); 723 } 724 725 /* Handling items with submenu (not being located in the submenu) */ 726 else if ( !$( ev.target ).closest( '.sub-menu' ).length ) { 727 ev.preventDefault(); 728 overlay = link_container.find( '.sub-menu' ); 729 me.opt.main_menu_items.not( link_container ).removeClass( 'open' ); // close all others 730 731 if ( me.opt.mq.width < 960 && me.opt.main_menu_items.filter( '.open-mobile' ).length === 1 ) { 732 if ( link_container.hasClass( 'open-mobile' ) ) { 733 link_container.removeClass( 'open-mobile' ); 734 } 735 else { 736 me.opt.main_menu_items.removeClass( 'open-mobile' ); 737 link_container.toggleClass( 'open' ); 738 } 739 } 740 else { 741 link_container.toggleClass( 'open' ); 742 } 743 switch ( me.opt.variants.navigation ) { 744 case 'A': 745 pos = item.offset(); 746 overlay_css = {top: pos.top - link_container.offset().top }; 747 if ( overlay.width() + pos.left > me.opt.site.width() ) { 748 overlay_css.right = 0; 749 overlay.addClass( 'rtl' ); 750 } 751 overlay.css( overlay_css ) 752 .animate( {opacity: (link_container.hasClass( 'open' ) ? 1 : 0 ) }, 'fast' ); 753 break; 754 case 'B': 755 pos = link_container.offset(); 756 if ( overlay.width() + pos.left > me.opt.site.width() ) { 757 overlay.addClass( 'rtl' ); 758 } 759 break; 760 } 761 } 762 }; 763 764 me.smooth_scroll = function ( ev ) { 765 var scrollspeed = me.opt.smoothscroll ? ( parseInt( ev.speed, 10 ) || 400 ) : 1, 766 boundingrect, 767 target_hash, 768 link, 769 link_href, 770 target, 771 match, 772 offset_px, 773 banner_height = parseInt( ev['banner_height'], 10 ) || window['scrolledBannerHeight'] || me.opt.banner.outerHeight() || 0; 774 775 /* if the click event is fired by javascript on an anchor in the page */ 776 if ( ev.hash ) { 777 target_hash = me.id( ev.hash ); 778 if ( target_hash.length === 0 ) { 779 if( ev.hash.indexOf('cid-') == 0 ){ 780 target_hash = $('[data-cid="' + ev.hash.substr(4) + '"]') 781 } 782 else { 783 target_hash = $('[id="' + ev.hash + '"],[name="' + ev.hash + '"]') 784 } 785 } 786 if ( target_hash.length ) { 787 if ( me.opt.menu_open ) { 788 me.opt.menu_open = false;
789 me.opt.site.removeClass( 'open open-delay' ); 790 } 791 /* removing the hash from the url to prevent the browser from jumping on its own after the animation */ 792 document.location.hash = ''; 793 offset_px = Math.round( target_hash.offset().top - banner_height ); 794 me.opt.body_scroll.animate( { scrollTop: offset_px }, scrollspeed ); 795 } 796 return; 797 } 798 if( ev.scrollto && ev.scrollto.length > 0 ){ 799 if ( me.opt.menu_open ) { 800 me.opt.menu_open = false; 801 me.opt.site.removeClass( 'open open-delay' ); 802 } 803 offset_px = Math.round( ev.scrollto.eq(0).offset().top - banner_height ); 804 me.opt.body_scroll.animate( { scrollTop: offset_px }, scrollspeed ); 805 return; 806 } 807 link = ev.target ? $( ev.target ) : $( this ); 808 809 if ( !link.is( 'a' ) ) { 810 link = link.closest( 'a' ); 811 } 812 /* if the click event is fired on a link */ 813 if ( link.length === 1 ) { 814 815 link_href = link.attr( 'href' ); 816 /* links with an attached event or which open in a new window are not treated */ 817 if ( !link_href || link.attr( 'target' ) || link.attr( 'onclick' ) || link.hasClass( 'fancybox' ) ) { 818 return; 819 } 820 821 match = link_href.match( /^([^#]*)#+(.+)$/ ); 822 /* if the link has a page#anchor, comparing the current page with the requested page and try to softscroll if it's the same */ 823 if ( match && ( !match[1] || match[1] === document.location.pathname || ( document.location.pathname === '/' && match[1] === '/' + me.opt.lang + '/' ) ) ) { 824 target = me.id( match[2] ); 825 if ( target.length === 0 ) { 826 target = $('[id="' + match[2] + '"],[name="' + match[2] + '"]') 827 } 828 if ( target && target.filter(':visible').length > 0 ) { 829 ev.preventDefault(); 830 me.smooth_scroll_callback(ev,target); 831 offset_px = Math.round( target.eq( 0 ).offset().top - banner_height ); 832 if ( me.opt.banner.css('position')=='fixed' ){ 833 boundingrect = me.opt.banner.get( 0 ).getBoundingClientRect(); 834 if ( boundingrect && boundingrect.top ) { 835 offset_px -= boundingrect.top; 836 } 837 } 838 me.opt.body_scroll.animate( { scrollTop: offset_px }, scrollspeed ); 839 document.activeElement.blur(); 840 } 841 } 842 } 843 }; 844 845 me.smooth_scroll_callback = function(){ 846 if ( me.opt.headc_chk && me.opt.headc_chk.is(':checked') ) { 847 me.opt.headc_chk.prop('checked', false); 848 } 849 else if ( me.opt.menu_open ) { 850 me.opt.menu_open = false; 851 me.opt.site.removeClass( 'open open-delay' ); 852 } 853 }; 854 855 me.scroll_event = function () { 856 me.opt.site.toggleClass( 'scrolled', me.opt.scroll_breakpoint() ); 857 if ((me.opt.already_scrolled == false) && (me.opt.scroll_breakpoint() == true)) { 858 me.opt.noscript_afterload.each(function() { 859 var i = $(this) 860 me.opt.head.append(i.html()); 861 i.remove(); 862 }); 863 me.opt.already_scrolled = true; 864 } 865 }; 866 867 me.flex = function ( container, layout, build, options ) { 868 var params = { 869 w: 0, 870 h: 0, 871 quality: -1, // jpeg quality, -1 = standard 872 max_w: 2048, 873 resp_img_bg: false, // define css background-image 874 resp_img_src: false, // change img src 875 container: container, 876 layout: layout, 877 build: build, 878 options: ( typeof options !== 'object' ) ? {} : options, 879 default_options: { 880 selector: '.slides > .slide', 881 controlNav: false, 882 directionNav: true, 883 slideshow: true, 884 slideshowSpeed: 5000, 885 animationSpeed: 400, 886 animationLoop: false, 887 keyboard: false, 888 prevText: "‹", 889 nextText: "›" 890 }, 891 flex_build: function () { 892 params.container.flexslider( params.options ); 893 } 894 }, 895 slides, existing_img, img; 896 897 if ( params.layout ) { 898 params.container.data( 'layout', params.layout ); 899 } 900 else if ( params.container.data( 'layout' ) ) { 901 params.layout = params.container.data( 'layout' ); 902 } 903 904 if ( typeof me.opt.flex_layouts[ params.layout ] === 'function' ) { 905 ( ( me.opt.flex_layouts[ params.layout ] ).bind( params ) )(); 906 if ( params.options.selector ) { 907 params.options.selector = params.options.selector.replace( '>', '>' ); 908 } 909 } 910 else { 911 params.w = Math.min( params.max_w, me.opt.mq.width ); 912 params.h = params.w / ( me.opt.gal_std_ratio > 0 ? me.opt.gal_std_ratio : ( 16 / 9 ) ); 913 } 914 915 params.options = $.extend( params.default_options, params.options ); 916 917 if ( !params.container.data( 'slides' ) ) { 918 slides = params.container.find( params.options.selector ); 919 if ( slides.length === 0 ) { 920 return; 921 } 922 params.container.data( 'slides', slides ); 923 } 924 925 if ( params.resp_img_bg || params.resp_img_src ) { 926 params.w = Math.round( params.w ); 927 params.h = Math.round( params.h ); 928 929 params.container.data( 'slides' ).each( function ( i, el ) { 930 var slide = $( el ), 931 media_id, media_url, url; 932 933 media_id = slide.data( 'media' ); 934 media_url = slide.data( 'media-url' ); 935 936 if ( media_id || media_url ) { 937 938 if ( !slide.data( 'img' ) ) {
939 slide.data( 'img', slide.find( 'img' ) ); 940 } 941 url = media_id ? 942 me.opt.std_domain + '/(cms)/media/resize/size=' + params.w + 'x' + params.h + ',scale=crop/' + media_id : 943 media_url + '/' + params.w + 'x' + params.h + 's'; 944 if ( params.resp_img_bg ) { 945 slide.css( 'background-image', "url('" + url + "')" ); 946 } 947 if ( params.resp_img_src ) { 948 if ( slide.data( 'img' ).length ) { 949 slide.data( 'img' ).attr( {'src': url, 'width': params.w, 'height': params.h } ); 950 } 951 else { 952 existing_img = slide.find( 'img' ); 953 if ( existing_img.length > 0 ) { 954 slide.data( 'img', existing_img.eq( 0 ) ); 955 } 956 else { 957 img = $( '<img src="' + url + '" width="' + params.w + '" height="' + params.h + '" />' ); 958 slide.append( img ).data( 'img', img ); 959 } 960 } 961 } 962 } 963 } ); 964 } 965 966 if ( params.build ) { 967 if ( params.resp_img_bg || params.resp_img_src ) { 968 me.opt.gals.push( params.container ); 969 } 970 if ( params.container.data( 'slides' ).length > 1 ) { 971 if ( params.resp_img_bg || params.resp_img_src ) { 972 params.container.data( 'slides' ).eq( 0 ).data( 'img' ).load( params.flex_build ); 973 } 974 else { 975 params.flex_build(); 976 } 977 } 978 else { 979 params.container.data( 'slides' ).show(); 980 } 981 } 982 }; 983 984 me.layout_change = function () { 985 $( me.opt.gals ).map( function ( i, el ) { 986 me.flex( el ); 987 } ); 988 }; 989 990 me.map_generate = function ( container, coordinates, options ) { 991 var form = container.closest('.grp-mem' ).find('form'); 992 var config = form.data('config'); 993 if( typeof config != 'object' ){ 994 config = {} 995 } 996 var autobuild = config.Autobuild; 997 998 if( config.Markers && config.Markers.length ){ 999 coordinates = []; 1000 $( config.Markers ).map( function( i, el ){ 1001 coordinates.push( [ parseFloat( el.Latitude ), parseFloat( el.Longitude ), el.Name, el.Url ] ); 1002 if( el.MediaID > 0 ){ 1003 me.opt.gmaps_markers[i] = { 1004 marker_1x: me.opt.std_domain + '/(cms)/media/resize/size=0x100/' + el.MediaID, 1005 marker_2x: me.opt.std_domain + '/(cms)/media/resize/size=0x200/' + el.MediaID 1006 } 1007 } 1008 } ); 1009 } 1010 else { 1011 if( !$.isArray( coordinates ) ){ 1012 console.warn( 'Map Module: invalid coordinates', coordinates ); 1013 return; 1014 } 1015 if( !$.isArray( coordinates[0] ) ){ 1016 coordinates = [ coordinates ]; 1017 } 1018 } 1019 1020 if ( options === undefined ) { 1021 options = {}; 1022 } 1023 1024 if ( options.zoom ) { 1025 options.zoom = parseFloat( options.zoom ); 1026 } 1027 1028 if ( options.resize ) { 1029 options.resize = Math.max( 1, parseFloat( options.resize ) ); 1030 } 1031 1032 me.gmapsinit = function () { 1033 var mapOptions, 1034 currentMarker, currentPos, 1035 center_lat, center_long, 1036 boundaries, 1037 markers = [], 1038 searchBox, 1039 container_h = container.height(), 1040 $input = $( '.nst15-map-input', form ), 1041 $submit = $( '.nst15-map-submit', form ), 1042 $saddr = $( 'input[name="saddr"]', form ), 1043 $daddr = $( 'input[name="daddr"]', form ); 1044 1045 if ( options.resize && !autobuild ) { 1046 container.height( container_h * options.resize ).addClass( 'gmaps' ); 1047 me.opt.body_scroll.animate( { scrollTop: me.opt.scroll + ( ( options.resize - 1 ) * container_h ) } ); 1048 } 1049 else { 1050 container.height( container_h ); 1051 } 1052 1053 container.addClass( 'gmaps' ); 1054 if( config.UseCustomCenter && $.isArray( config.CustomCenter ) ){ 1055 center_lat = config.CustomCenter[0]; 1056 center_long = config.CustomCenter[1]; 1057 } 1058 else { 1059 currentPos = [ coordinates[0][0], coordinates[0][1] ]; 1060 center_lat = currentPos[0]; 1061 center_long = currentPos[1]; 1062 1063 if( !config.UseCustomCenter && coordinates.length > 1 ){ 1064 boundaries = { 1065 minLat: currentPos[0], 1066 maxLat: currentPos[0], 1067 minLong: currentPos[1], 1068 maxLong: currentPos[1] 1069 }; 1070 $( coordinates ).map( function ( i, markerPos ) { 1071 boundaries.minLat = Math.min( boundaries.minLat, markerPos[0] ); 1072 boundaries.maxLat = Math.max( boundaries.maxLat, markerPos[0] ); 1073 boundaries.minLong = Math.min( boundaries.minLong, markerPos[1] );
1074 boundaries.maxLong = Math.max( boundaries.maxLong, markerPos[1] ); 1075 } ); 1076 center_lat = ( boundaries.minLat + boundaries.maxLat ) / 2; 1077 center_long = ( boundaries.minLong + boundaries.maxLong ) / 2; 1078 } 1079 } 1080 1081 mapOptions = $.extend( { 1082 zoom: 12, 1083 center: new google.maps.LatLng( center_lat, center_long ), 1084 gestureHandling: 'cooperative' 1085 }, options ); 1086 1087 if( me.opt['gmaps_styles'] !== undefined ){ 1088 mapOptions.styles = me.opt['gmaps_styles']; 1089 } 1090 1091 me.opt.gmap = new google.maps.Map( container[0], mapOptions ); 1092 form.on( 'submit', function ( ev ) { 1093 ev.preventDefault(); 1094 window.open( form.attr( 'action' ) + '?' + $.param( $( 'input[type="hidden"]', form ) ) ); 1095 } ); 1096 1097 $( coordinates ).map( function ( i, markerPos ) { 1098 var marker_pos = new google.maps.LatLng( markerPos[0], markerPos[1] ); 1099 var marker_img = document.createElement( 'img' ); 1100 var marker_scale = 1; 1101 var marker_srcs = me.opt.gmaps_markers[i] || me.opt.gmaps_markers[0]; 1102 var marker_src = marker_srcs.marker_1x; 1103 1104 if ( window.devicePixelRatio > 1 ) { 1105 marker_scale = 0.5; 1106 marker_src = marker_srcs.marker_2x; 1107 } 1108 1109 $( marker_img ).on( 'load', function () { 1110 var map_icon = { 1111 url: this.src, 1112 scaledSize: new google.maps.Size( 1113 parseInt( this.width * marker_scale ), 1114 parseInt( this.height * marker_scale ) 1115 ) 1116 }; 1117 1118 var marker_options = { 1119 position: marker_pos, 1120 map: me.opt.gmap, 1121 icon: map_icon 1122 }; 1123 1124 try{ 1125 if( config.Markers[i].Name.length > 0 ){ 1126 marker_options.title = config.Markers[i].Name; 1127 } 1128 } 1129 catch(e){} 1130 1131 var marker = new google.maps.Marker( marker_options ); 1132 1133 markers[i] = marker; 1134 1135 marker.addListener( 'click', function(){ 1136 currentMarker = marker; 1137 currentPos = [markerPos[0], markerPos[1]]; 1138 me.opt.gmap.panTo( marker.getPosition() ); 1139 $daddr.val( currentPos.join( ',' ) ); 1140 if( markerPos[3] ){ 1141 window.open( markerPos[3], '_blank' ); 1142 } 1143 else { 1144 $input.focus(); 1145 } 1146 } ); 1147 1148 if( !currentMarker ){ 1149 currentMarker = marker; 1150 $daddr.val( currentPos.join( ',' ) ); 1151 } 1152 } ); 1153 1154 marker_img.src = marker_src; 1155 } ); 1156 1157 me.opt.gmap.controls[google.maps.ControlPosition.TOP_LEFT].push( $input.get( 0 ) ); 1158 me.opt.gmap.controls[google.maps.ControlPosition.TOP_LEFT].push( $submit.get( 0 ) ); 1159 searchBox = new google.maps.places.SearchBox( $input.get( 0 ) ); 1160 1161 var rendererOptions = { 1162 map: me.opt.gmap, 1163 suppressMarkers: true 1164 }; 1165 var directionsService = new google.maps.DirectionsService; 1166 var directionsDisplay = new google.maps.DirectionsRenderer(rendererOptions); 1167 1168 google.maps.event.addListener( searchBox, 'places_changed', function () { 1169 var places = searchBox.getPlaces(); 1170 1171 if ( places.length === 0 ) { 1172 return; 1173 } 1174 $input.val( places[0].formatted_address ); 1175 $saddr.val( places[0].geometry.location.lat() + ',' + places[0].geometry.location.lng() ); 1176 $submit.addClass( 'visible' ); 1177 1178 if (directionsDisplay != null) { 1179 directionsDisplay.setMap(null); 1180 directionsDisplay = new google.maps.DirectionsRenderer(rendererOptions); 1181 } 1182 1183 directionsDisplay.setMap( me.opt.gmap ); 1184 directionsService.route({ 1185 origin: places[0].geometry.location, 1186 destination: currentMarker.position, 1187 travelMode: google.maps.TravelMode.DRIVING 1188 }, function(response, status) { 1189 if (status === google.maps.DirectionsStatus.OK) { 1190 directionsDisplay.setDirections(response); 1191 } else { 1192 console.error('Directions request failed due to ' + status); 1193 } 1194 }); 1195 } ); 1196 }; 1197 1198 if ( window.google !== undefined && window.google.maps !== undefined ) { 1199 me.gmapsinit(); 1200 } 1201 else { 1202 var apikey = options['apikey'] ? '&key=' + options['apikey'] : ''; 1203 $.getScript( 1204 'https://maps.googleapis.com/maps/api/js?libraries=places&callback=nst2015.gmapsinit' + apikey 1205 ); 1206 } 1207 }; 1208 1209 me.gal_parallax = function ( container ) { 1210 if ( container && !container.data( 'parallax' ) ) { 1211 container.data( 'parallax', true ); 1212 container.data( 'slides', container.find( '.slide' ) ); 1213 me.opt.gal_parallax.push( container ); 1214 1215 if ( !me.opt.gal_parallax_listening ) { 1216 me.opt.gal_parallax_listening = true; 1217 me.opt.window_h = me.opt.window.height(); 1218 me.gal_parallax(); 1219 1220 me.opt.window 1221 .on( 'resize.nst_parallax orientationchange.nst_parallax', function () { 1222 me.opt.window_h = me.opt.window.height(); 1223 me.gal_parallax(); 1224 } )
1225 .on( 'scroll.nst_parallax touchmove.nst_parallax', function () { 1226 me.gal_parallax(); 1227 } ); 1228 } 1229 } 1230 else { 1231 $.map( me.opt.gal_parallax, function ( el ) { 1232 var scroll_pos, pos = el.get( 0 ).getBoundingClientRect(); 1233 if ( pos.height + pos.top > 0 && me.opt.window_h - pos.top > 0 ) { 1234 scroll_pos = 100 * ( pos.top + pos.height ) / ( me.opt.window_h + pos.height ); 1235 el.data( 'slides' ).css( {'background-position': '0 ' + scroll_pos + '%'} ); 1236 } 1237 } ); 1238 } 1239 }; 1240 1241 me.left_pad = function ( value, fill, return_length ) { 1242 fill = fill !== undefined ? fill.toString() : '0'; 1243 return_length = return_length !== undefined ? return_length : 2; 1244 while ( value.toString().length < return_length ) { 1245 value = fill + value.toString(); 1246 } 1247 return value; 1248 }; 1249 1250 me.date_convert = function ( data, format_in, format_out, day_offset, min_today ) { 1251 day_offset = typeof day_offset === 'number' ? day_offset : 0; 1252 min_today = !!min_today; 1253 var test, date_calc = false, 1254 today = new Date(); 1255 switch ( format_in ) { 1256 case 'dmy': 1257 case 'd.m.y': 1258 case 'dd.mm.yy': 1259 case 'dd.mm.yyyy': 1260 test = /^0?([1-2]?[0-9]|3[0-1])\.0?([1-9]|1[0-2])\.(19|20[\d]{2})$/.exec( data ); 1261 date_calc = test ? new Date( parseInt( test[3], 10 ), parseInt( test[2], 10 ) - 1, parseInt( test[1], 10 ) + day_offset ) : false; 1262 break; 1263 case 'd/m/y': 1264 case 'dd/mm/yy': 1265 case 'dd/mm/yyyy': 1266 test = /^0?([1-2]?[0-9]|3[0-1])\/0?([1-9]|1[0-2])\/(19|20[\d]{2})$/.exec( data ); 1267 date_calc = test ? new Date( parseInt( test[3], 10 ), parseInt( test[2], 10 ) - 1, parseInt( test[1], 10 ) + day_offset ) : false; 1268 break; 1269 case 'iso': 1270 case 'ymd': 1271 case 'yyyy-mm-dd': 1272 test = /^(19|20[\d]{2})\-0?([1-9]|1[0-2])\-0?([1-2]?[0-9]|3[0-1])$/.exec( data ); 1273 date_calc = test ? new Date( parseInt( test[1], 10 ), parseInt( test[2], 10 ) - 1, parseInt( test[3], 10 ) + day_offset ) : false; 1274 break; 1275 case 'Date': 1276 date_calc = data.getMonth !== undefined ? new Date( data.getFullYear(), data.getMonth(), data.getDate() + day_offset ) : false; 1277 break; 1278 default: 1279 date_calc = false; 1280 break; 1281 } 1282 if ( date_calc === false ) { 1283 return false; 1284 } 1285 date_calc = ( min_today && date_calc < today ) ? new Date() : date_calc; 1286 switch ( format_out ) { 1287 case 'Date': 1288 return date_calc; 1289 case 'array': 1290 return [ date_calc.getFullYear(), date_calc.getMonth(), date_calc.getDate() ]; 1291 case 'dmy': 1292 case 'd.m.y': 1293 case 'dd.mm.yy': 1294 case 'dd.mm.yyyy': 1295 return me.left_pad( date_calc.getDate() ) + '.' + me.left_pad( date_calc.getMonth() + 1 ) + '.' + date_calc.getFullYear(); 1296 case 'd/m/y': 1297 case 'dd/mm/yy': 1298 case 'dd/mm/yyyy': 1299 return me.left_pad( date_calc.getDate() ) + '/' + me.left_pad( date_calc.getMonth() + 1 ) + '/' + date_calc.getFullYear(); 1300 case 'iso': 1301 case 'ymd': 1302 case 'yyyy-mm-dd': 1303 return date_calc.getFullYear() + '-' + me.left_pad( date_calc.getMonth() + 1 ) + '-' + me.left_pad( date_calc.getDate() ); 1304 } 1305 return false; 1306 }; 1307 1308 me.cal_avail = function ( date ) { 1309 var avail_tf = window['calendar_avail_tf'] ||Â [], 1310 len = avail_tf.length, 1311 avail = true, 1312 i = 0; 1313 if ( len > 0 ) { 1314 avail = false; 1315 while ( !avail && i < len ) { 1316 avail = avail || ( date >= me.date_convert( avail_tf[i][0], 'ymd', 'Date' ) && date <= me.date_convert( avail_tf[i][1], 'ymd', 'Date' ) ); 1317 i++; 1318 } 1319 } 1320 return [ avail, '' ]; 1321 }; 1322 1323 me.nst_accessibility = function () { 1324 if (me.opt.urlSearchParameters && me.opt.urlSearchParameters.get('prefers-contrast')) { 1325 me.opt.html.addClass('prefers-contrast-' + me.opt.urlSearchParameters.get('prefers-contrast')); 1326 } 1327 }; 1328 1329 me.nst_website_help = function () { 1330 let fe_edit = sessionStorage && sessionStorage.getItem('fe_edit'); 1331 if (fe_edit) { 1332 ((d, s) => { 1333 s = d.createElement("script"); 1334 s.src = "/(cms)/module/static/default/content/libs/js/browser-check/static/browser-check.js"; 1335 d.body.append(s); 1336 })(document); 1337 } 1338 } 1339 1340 me.detectFancyboxVersion = function () { 1341 if( typeof window?.jQuery?.fn?.fancybox === 'function' ) { 1342 return parseInt( window.jQuery.fancybox.version.substr(0, 1), 10 ); 1343 } 1344 return null; 1345 } 1346 1347 me.fancyboxVersionConverter = function () { 1348 if (me.detectFancyboxVersion() === 3) { 1349 let elementsToConvert = document.querySelectorAll('[data-fancybox-group], [data-fancybox-type]'); 1350 1351 elementsToConvert.forEach(function (element) { 1352 const href = element.getAttribute('data-fancybox-href'); 1353 const group = element.getAttribute('data-fancybox-group'); 1354 const thumb = element.getAttribute('data-fancybox-thumb'); 1355 const title = element.getAttribute('data-fancybox-title'); 1356 const type = element.getAttribute('data-fancybox-type'); 1357 1358 // Add new data-attributes if old ones are present 1359 href && element.setAttribute('data-src', href); 1360 group && element.setAttribute('data-fancybox', group); 1361 thumb && element.setAttribute('data-thumb', thumb); 1362 title && element.setAttribute('data-caption', title); 1363 type && element.setAttribute('data-type', type); 1364 1365 // Removing old data-attributes 1366 element.removeAttribute('data-fancybox-href'); 1367 element.removeAttribute('data-fancybox-group'); 1368 element.removeAttribute('data-fancybox-thumb'); 1369 element.removeAttribute('data-fancybox-type'); 1370 element.removeAttribute('data-fancybox-title'); 1371 }); 1372 } 1373 }; 1374 1375 me.setup(); 1376 1377 if( window['nst_manual_init'] !== true ) {
vendor: 5,357 bytes, lines 1378-1384
1378 me.init(); 1379 } 1380}; 1381 1382/*! modernizr 3.6.0 (Custom Build) | MIT * 1383 * https://modernizr.com/download/?-cssgrid_cssgridlegacy-scrollsnappoints-touchevents-webp-setclasses !*/ 1384 !function(e,n,t){function o(e,n){return typeof e===n}function r(){var e,n,t,r,i,s,a;for(var l in _)if(_.hasOwnProperty(l)){if(e=[],n=_[l],n.name&&(e.push(n.name.toLowerCase()),n.options&&n.options.aliases&&n.options.aliases.length))for(t=0;t<n.options.aliases.length;t++)e.push(n.options.aliases[t].toLowerCase());for(r=o(n.fn,"function")?n.fn():n.fn,i=0;i<e.length;i++)s=e[i],a=s.split("."),1===a.length?Modernizr[a[0]]=r:(!Modernizr[a[0]]||Modernizr[a[0]]instanceof Boolean||(Modernizr[a[0]]=new Boolean(Modernizr[a[0]])),Modernizr[a[0]][a[1]]=r),w.push((r?"":"no-")+a.join("-"))}}function i(e){var n=C.className,t=Modernizr._config.classPrefix||"";if(T&&(n=n.baseVal),Modernizr._config.enableJSClass){var o=new RegExp("(^|\\s)"+t+"no-js(\\s|$)");n=n.replace(o,"$1"+t+"js$2")}Modernizr._config.enableClasses&&(n+=" "+t+e.join(" "+t),T?C.className.baseVal=n:C.className=n)}function s(e,n){if("object"==typeof e)for(var t in e)B(e,t)&&s(t,e[t]);else{e=e.toLowerCase();var o=e.split("."),r=Modernizr[o[0]];if(2==o.length&&(r=r[o[1]]),"undefined"!=typeof r)return Modernizr;n="function"==typeof n?n():n,1==o.length?Modernizr[o[0]]=n:(!Modernizr[o[0]]||Modernizr[o[0]]instanceof Boolean||(Modernizr[o[0]]=new Boolean(Modernizr[o[0]])),Modernizr[o[0]][o[1]]=n),i([(n&&0!=n?"":"no-")+o.join("-")]),Modernizr._trigger(e,n)}return Modernizr}function a(){return"function"!=typeof n.createElement?n.createElement(arguments[0]):T?n.createElementNS.call(n,"http://www.w3.org/2000/svg",arguments[0]):n.createElement.apply(n,arguments)}function l(){var e=n.body;return e||(e=a(T?"svg":"body"),e.fake=!0),e}function u(e,t,o,r){var i,s,u,A,f="modernizr",c=a("div"),d=l();if(parseInt(o,10))for(;o--;)u=a("div"),u.id=r?r[o]:f+(o+1),c.appendChild(u);return i=a("style"),i.type="text/css",i.id="s"+f,(d.fake?d:c).appendChild(i),d.appendChild(c),i.styleSheet?i.styleSheet.cssText=e:i.appendChild(n.createTextNode(e)),c.id=f,d.fake&&(d.style.background="",d.style.overflow="hidden",A=C.style.overflow,C.style.overflow="hidden",C.appendChild(d)),s=t(c,e),d.fake?(d.parentNode.removeChild(d),C.style.overflow=A,C.offsetHeight):c.parentNode.removeChild(c),!!s}function A(e,n){return!!~(""+e).indexOf(n)}function f(e){return e.replace(/([a-z])-([a-z])/g,function(e,n,t){return n+t.toUpperCase()}).replace(/^-/,"")}function c(e,n){return function(){return e.apply(n,arguments)}}function d(e,n,t){var r;for(var i in e)if(e[i]in n)return t===!1?e[i]:(r=n[e[i]],o(r,"function")?c(r,t||n):r);return!1}function p(e){return e.replace(/([A-Z])/g,function(e,n){return"-"+n.toLowerCase()}).replace(/^ms-/,"-ms-")}function m(n,t,o){var r;if("getComputedStyle"in e){r=getComputedStyle.call(e,n,t);var i=e.console;if(null!==r)o&&(r=r.getPropertyValue(o));else if(i){var s=i.error?"error":"log";i[s].call(i,"getComputedStyle returning null, its possible modernizr test results are inaccurate")}}else r=!t&&n.currentStyle&&n.currentStyle[o];return r}function g(n,o){var r=n.length;if("CSS"in e&&"supports"in e.CSS){for(;r--;)if(e.CSS.supports(p(n[r]),o))return!0;return!1}if("CSSSupportsRule"in e){for(var i=[];r--;)i.push("("+p(n[r])+":"+o+")");return i=i.join(" or "),u("@supports ("+i+") { #modernizr { position: absolute; } }",function(e){return"absolute"==m(e,null,"position")})}return t}function h(e,n,r,i){function s(){u&&(delete R.style,delete R.modElem)}if(i=o(i,"undefined")?!1:i,!o(r,"undefined")){var l=g(e,r);if(!o(l,"undefined"))return l}for(var u,c,d,p,m,h=["modernizr","tspan","samp"];!R.style&&h.length;)u=!0,R.modElem=a(h.shift()),R.style=R.modElem.style;for(d=e.length,c=0;d>c;c++)if(p=e[c],m=R.style[p],A(p,"-")&&(p=f(p)),R.style[p]!==t){if(i||o(r,"undefined"))return s(),"pfx"==n?p:!0;try{R.style[p]=r}catch(v){}if(R.style[p]!=m)return s(),"pfx"==n?p:!0}return s(),!1}function v(e,n,t,r,i){var s=e.charAt(0).toUpperCase()+e.slice(1),a=(e+" "+E.join(s+" ")+s).split(" ");return o(n,"string")||o(n,"undefined")?h(a,n,r,i):(a=(e+" "+P.join(s+" ")+s).split(" "),d(a,n,t))}function y(e,n,o){return v(e,t,t,n,o)}var w=[],_=[],b={_version:"3.6.0",_config:{classPrefix:"",enableClasses:!0,enableJSClass:!0,usePrefixes:!0},_q:[],on:function(e,n){var t=this;setTimeout(function(){n(t[e])},0)},addTest:function(e,n,t){_.push({name:e,fn:n,options:t})},addAsyncTest:function(e){_.push({name:null,fn:e})}},Modernizr=function(){};Modernizr.prototype=b,Modernizr=new Modernizr;var C=n.documentElement,S=b._config.usePrefixes?" -webkit- -moz- -o- -ms- ".split(" "):["",""];b._prefixes=S;var B,T="svg"===C.nodeName.toLowerCase();!function(){var e={}.hasOwnProperty;B=o(e,"undefined")||o(e.call,"undefined")?function(e,n){return n in e&&o(e.constructor.prototype[n],"undefined")}:function(n,t){return e.call(n,t)}}(),b._l={},b.on=function(e,n){this._l[e]||(this._l[e]=[]),this._l[e].push(n),Modernizr.hasOwnProperty(e)&&setTimeout(function(){Modernizr._trigger(e,Modernizr[e])},0)},b._trigger=function(e,n){if(this._l[e]){var t=this._l[e];setTimeout(function(){var e,o;for(e=0;e<t.length;e++)(o=t[e])(n)},0),delete this._l[e]}},Modernizr._q.push(function(){b.addTest=s}),Modernizr.addAsyncTest(function(){function e(e,n,t){function o(n){var o=n&&"load"===n.type?1==r.width:!1,i="webp"===e;s(e,i&&o?new Boolean(o):o),t&&t(n)}
1384var r=new Image;r.onerror=o,r.onload=o,r.src=n}var n=[{uri:"data:image/webp;base64,UklGRiQAAABXRUJQVlA4IBgAAAAwAQCdASoBAAEAAwA0JaQAA3AA/vuUAAA=",name:"webp"},{uri:"data:image/webp;base64,UklGRkoAAABXRUJQVlA4WAoAAAAQAAAAAAAAAAAAQUxQSAwAAAABBxAR/Q9ERP8DAABWUDggGAAAADABAJ0BKgEAAQADADQlpAADcAD++/1QAA==",name:"webp.alpha"},{uri:"data:image/webp;base64,UklGRlIAAABXRUJQVlA4WAoAAAASAAAAAAAAAAAAQU5JTQYAAAD/////AABBTk1GJgAAAAAAAAAAAAAAAAAAAGQAAABWUDhMDQAAAC8AAAAQBxAREYiI/gcA",name:"webp.animation"},{uri:"data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA=",name:"webp.lossless"}],t=n.shift();e(t.name,t.uri,function(t){if(t&&"load"===t.type)for(var o=0;o<n.length;o++)e(n[o].name,n[o].uri)})});var x=b.testStyles=u;Modernizr.addTest("touchevents",function(){var t;if("ontouchstart"in e||e.DocumentTouch&&n instanceof DocumentTouch)t=!0;else{var o=["@media (",S.join("touch-enabled),("),"heartz",")","{#modernizr{top:9px;position:absolute}}"].join("");x(o,function(e){t=9===e.offsetTop})}return t});var Q="Moz O ms Webkit",E=b._config.usePrefixes?Q.split(" "):[];b._cssomPrefixes=E;var P=b._config.usePrefixes?Q.toLowerCase().split(" "):[];b._domPrefixes=P;var U={elem:a("modernizr")};Modernizr._q.push(function(){delete U.elem});var R={style:U.elem.style};Modernizr._q.unshift(function(){delete R.style}),b.testAllProps=v,b.testAllProps=y,Modernizr.addTest("cssgridlegacy",y("grid-columns","10px",!0)),Modernizr.addTest("cssgrid",y("grid-template-rows","none",!0)),Modernizr.addTest("scrollsnappoints",y("scrollSnapType")),r(),i(w),delete b.addTest,delete b.addAsyncTest;for(var k=0;k<Modernizr._q.length;k++)Modernizr._q[k]();e.Modernizr=Modernizr}(window,document); 1385 1386jQuery( responsive($) );
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.