1 2(function($) { 3 4 5 /*** Document ready ***/ 6 7 if (!function_exists('headerPlaceholderHeight')) { 8 STOM.headerPlaceholderHeight = function() { 9 if (!$('#page').hasClass('header-sticky')) return; 10 11 var solution = 2; 12 13 $('#masthead').imagesLoaded(function() { 14 $('.header-placeholder').height($('#masthead').height()); 15 $('#page').addClass('header-sticky-active'); 16 }); 17 18 19 var stickyHeaderScrollTimer; 20 $(window).on('load scroll resize orientationchange', function(e) { 21 if (stickyHeaderScrollTimer) return; 22 23 stickyHeaderScrollTimer = window.setTimeout(function() { 24 window.clearTimeout(stickyHeaderScrollTimer); 25 stickyHeaderScrollTimer = undefined; 26 27 if (window.scrollY > 50) { 28 $('#page').addClass('scrolled'); 29 } else { 30 $('#page').removeClass('scrolled'); 31 32 /* Resize at top of page */ 33 if (solution == 1) { 34 var delay = parseFloat($('#masthead').css('transition-duration')) * 1000 + 50; 35 window.setTimeout(function() { 36 if (!$('#page').hasClass('scrolled')) 37 $('.header-placeholder').height($('#masthead').height()); 38 }, delay); 39 } 40 /* END Resize at top of page */ 41 } 42 }, 50); 43 }); 44 45 /* Resize at screen size change */ 46 if (solution == 2) { 47 var stickyHeaderResizeTimer; 48 $(window).on('load resize orientationchange', function() { 49 if (stickyHeaderResizeTimer) { 50 window.clearTimeout(stickyHeaderResizeTimer); 51 stickyHeaderResizeTimer = null; 52 } 53 54 stickyHeaderResizeTimer = window.setTimeout(function() { 55 var delay = parseFloat($('#masthead').css('transition-duration')) * 1000 + 50; 56 57 $('#page').addClass('header-sticky-resize').removeClass('header-sticky-active'); 58 $('.header-placeholder').height(''); 59 60 $('.header-placeholder').height($('#masthead').height()); 61 $('#page').addClass('header-sticky-active'); 62 63 window.setTimeout(function() { 64 $('#page').removeClass('header-sticky-resize'); 65 }, delay); 66 }, 50); 67 }); 68 } 69 /* END Resize at screen size change */ 70 } 71 STOM.headerPlaceholderHeight(); 72 } 73 74 75 if (!function_exists('centerLogoInNav')) { 76 STOM.centerLogoInNav = function() { 77 if (!$('#masthead').hasClass('style-header-5')) return; 78 79 $(window).on('load resize', function() { 80 window.setTimeout(function() { 81 stomHandleMenuItemAligners(); 82 }, 100); 83 84 $('.logo-center-aligner').css('opacity', '1'); 85 }); 86 87 $(document).ready(stomHandleMenuItemAligners); 88 function stomHandleMenuItemAligners() { 89 if (!$('.logo-center-aligner:visible').length) return true; 90 91 $('.logo-center-aligner + .logo-center-aligner').css('margin-left', ''); 92 $('.logo-center-aligner').width(''); 93 94 var menuItemWrapWidth = 0; 95 $('.logo-center-aligner').each(function() { 96 if (this.getBoundingClientRect().width > menuItemWrapWidth) 97 menuItemWrapWidth = this.getBoundingClientRect().width; 98 }); 99 100 $('.logo-center-aligner').width(menuItemWrapWidth + 1); 101 $('.logo-center-aligner + .logo-center-aligner').css('margin-left', $('#logo img').width() + (40 * 2)); 102 103 $('.logo-center-aligner').css('opacity', '1'); 104 } 105 } 106 STOM.centerLogoInNav(); 107 } 108 109 110 if (!function_exists('pageSliderHandler')) { 111 STOM.pageSliderHandler = function() { 112 if (!$('.page-slider-section').length) return; 113 114 115 var sliderSlickOptions = { 116 adaptiveHeight: true, 117 autoplay: true, 118 autoplaySpeed: 7500, 119 arrows: false, 120 speed: 1000, 121 infinite: true, 122 prevArrow: '<button type="button" class="slick-prev">'+stomFaIcons.slick.buttonPrev+'</button>', 123 nextArrow: '<button type="button" class="slick-next">'+stomFaIcons.slick.buttonNext+'</button>', 124 lazyLoad: 'progressive', 125 draggable: false, 126 }; 127 128 129 $('.page-slider-section').each(function() { 130 $('.slides', this).on('init', function() { 131 var $currentSlide = $('.slick-current', this); 132 133 if ($currentSlide.hasClass('slide-video')) { 134 var thisVideo = $currentSlide.find('video').get(0); 135 136 if (thisVideo && thisVideo.paused) { 137 thisVideo.currentTime = 0; 138 thisVideo.play(); 139 } 140 } 141 }); 142 143 144 $('.slides', this).slick(sliderSlickOptions); 145 146 147 $('.slides', this).on('beforeChange', function(event, slick, currentSlide, nextSlide) { 148 var $currentSlide = $('[data-slick-index='+currentSlide+']'); 149 if ($currentSlide.hasClass('slide-video')) { 150 var oldVideo = $currentSlide.find('video').get(0); 151 152 if (oldVideo) { 153 window.setTimeout(function() { 154 if (!oldVideo.paused) { 155 oldVideo.pause(); 156 oldVideo.currentTime = 0; 157 } 158 }, sliderSlickOptions.speed); 159 } 160 } 161 162 163 var $nextSlide = $('[data-slick-index='+nextSlide+']'); 164 if ($nextSlide.hasClass('slide-video')) { 165 var newVideo = $nextSlide.find('video').get(0); 166 167 if (newVideo && newVideo.paused) { 168 newVideo.currentTime = 0; 169 newVideo.play(); 170 } 171 } 172 }); 173 }); 174 } 175 STOM.pageSliderHandler(); 176 } 177 178
179 if (!function_exists('headerHeightCSSVariable')) { 180 STOM.headerHeightCSSVariable = function() { 181 var headerHeightResizeTimer; 182 183 $('#masthead').imagesLoaded(function() { 184 document.querySelector(':root').style.setProperty('--stom-header-height', $('#masthead').height() + 'px'); 185 }); 186 187 $(window).on('load resize orientationchange', function() { 188 if (headerHeightResizeTimer) { 189 window.clearTimeout(headerHeightResizeTimer); 190 headerHeightResizeTimer = null; 191 } 192 193 headerHeightResizeTimer = window.setTimeout(function() { 194 document.querySelector(':root').style.setProperty('--stom-header-height', $('#masthead').height() + 'px'); 195 }, 50); 196 }); 197 198 document.querySelector(':root').style.setProperty('--stom-header-height', $('#masthead').height() + 'px'); 199 } 200 STOM.headerHeightCSSVariable(); 201 } 202 203 204 if (!function_exists('youtubeIframeSlideHandler')) { 205 STOM.youtubeIframeSlideHandler = function() { 206 if (!$('.slider-inner .service-aligner #youtube-embed').length) return; 207 208 209 var tag = document.createElement('script'); 210 tag.src = "https://www.youtube.com/iframe_api"; 211 212 var firstScriptTag = document.getElementsByTagName('script')[0]; 213 firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); 214 215 216 var YTPlayer; 217 window.onYouTubeIframeAPIReady = function() { 218 YTPlayer = new YT.Player('youtube-embed', { 219 events: { 220 'onReady': onPlayerReady, 221 'onStateChange': onPlayerStateChange 222 } 223 }); 224 } 225 226 227 function onPlayerReady(event) { 228 if (event.target.getPlayerState() != YT.PlayerState.PLAYING) 229 YTPlayer.playVideo(); 230 } 231 232 233 function onPlayerStateChange(event) { 234 if (event.data != YT.PlayerState.PLAYING) 235 YTPlayer.playVideo(); 236 } 237 } 238 STOM.youtubeIframeSlideHandler(); 239 } 240 241 242 if (!function_exists('vimeoIframeSlideHandler')) { 243 STOM.vimeoIframeSlideHandler = function() { 244 if (!$('.slider-inner .service-aligner #vimeo-embed').length) return; 245 246 247 var tag = document.createElement('script'); 248 tag.src = "https://player.vimeo.com/api/player.js"; 249 250 var firstScriptTag = document.getElementsByTagName('script')[0]; 251 firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); 252 253 254 var vimeoTimer = window.setInterval(vimeoEmbedApi, 250); 255 function vimeoEmbedApi() { 256 if (typeof Vimeo !== 'undefined') { 257 var iframe = document.querySelector('#vimeo-embed'); 258 var player = new Vimeo.Player(iframe); 259 260 function onVimeoSuccess() { 261 if (typeof playInterval !== undefined) { 262 window.clearInterval(playInterval); 263 playInterval = null; 264 } 265 } 266 267 var playInterval = window.setInterval(function() { 268 player.play().then(onVimeoSuccess); 269 }, 500); 270 271 window.clearInterval(vimeoTimer); 272 vimeoTimer = null; 273 } 274 } 275 } 276 STOM.vimeoIframeSlideHandler(); 277 } 278 279 280 if (!function_exists('tabsShortcodeHandler')) { 281 STOM.tabsShortcodeHandler = function() { 282 if (!$('.stom-tabs').length) return; 283 284 $('.stom-tabs .tabs-header li a').on('click', function(e) { 285 e.preventDefault(); 286 287 var $this = $(this), 288 id = $this.parent('li').attr('data-id'), 289 $content = $('.tabs-wrapper .tabs-content[data-id='+ id +']'); 290 291 $('.stom-tabs .tabs-header li.active').removeClass('active'); 292 $this.parent('li').addClass('active'); 293 294 $('.tabs-wrapper .tabs-content').hide(); 295 296 $content.show(); 297 298 return false; 299 }); 300 } 301 STOM.tabsShortcodeHandler(); 302 } 303 304 305 /* ----------- MERE SHORTCODE ----------- */ 306 if (!function_exists('mereShortcodeHandler')) { 307 STOM.mereShortcodeHandler = function() { 308 if (!$(".mere-tekst-wrapper").length) return; 309 310 $(".mere-tekst-wrapper button").on('click', function() { 311 if ($(".mere-tekst", $(this).parent()).css("display") == "none") { 312 $("button.fold-ud", $(this).parent()).hide(); 313 $("button.fold-ind", $(this).parent()).show(); 314 $(".mere-tekst", $(this).parent()).slideToggle("slow"); 315 } else { 316 $("button.fold-ud", $(this).parent()).show(); 317 $("button.fold-ind", $(this).parent()).hide(); 318 $(".mere-tekst", $(this).parent()).slideUp("slow"); 319 $('.fold-ud', $(this).parent()).slideDown("slow"); 320 } 321 }); 322 } 323 STOM.mereShortcodeHandler(); 324 } 325 326 327 if (!function_exists('openHoursFoldHandler')) { 328 STOM.openHoursFoldHandler = function() { 329 if (!$('#openhours-fold-out').length) return; 330 331 $('#openhours-fold-out').on('click', function(e){
332 e.preventDefault(); 333 334 if(!$('.header-aabningstider').hasClass('active')) { 335 $('.header-aabningstider').addClass('active'); 336 $('.header-aabningstider .full-openhours').slideToggle(800); 337 } else { 338 $('.header-aabningstider').removeClass('active'); 339 $('.header-aabningstider .full-openhours').slideUp(800); 340 } 341 }); 342 } 343 STOM.openHoursFoldHandler(); 344 } 345 346 347 348 /*** GravityForms handling (AJAX, empty labels, etc.) ***/ 349 if (!function_exists('numberThreeGravityFormsHandler')) { 350 STOM.numberThreeGravityFormsHandler = function() { 351 var formHeights = [], 352 scrollOffset = 100; 353 354 $(document).bind('gform_post_render', function(e, form_id) { 355 var $form = $('#gform_' + form_id); 356 357 /* Gemmer hver formular's højde relateret til dens ID */ 358 formHeights[form_id] = $form.height(); 359 }); 360 361 $(document).bind('gform_confirmation_loaded', function(e, form_id) { 362 $('html, body').stop(); 363 364 $('#gform_confirmation_wrapper_' + form_id).height(formHeights[form_id] + 'px'); 365 366 if ($('#gform_confirmation_wrapper_' + form_id).offset().top < $(document).scrollTop() + scrollOffset) { 367 $('html, body').animate({ 368 scrollTop: $('#gform_confirmation_wrapper_' + form_id).offset().top - 150 369 }, 1000); 370 } 371 }); 372 373 374 375 $(window).on('load', function() { 376 if ($('body').hasClass('stom-gform-legacy')) return; 377 if (!$('.gform_wrapper').length) return; 378 379 380 gform.addFilter('gform_spinner_target_elem', function($targetElem, formId) { 381 $targetElem = $('#stom_spinner_wrapper .stom-anchor'); 382 383 return $targetElem; 384 }); 385 386 387 $('body').on('mouseenter', '.gfield.gfield_error .gfield_validation_message', function() { 388 $(this).fadeOut(300); 389 }); 390 391 $('body').on('focus', '.gfield.gfield_error *', function() { 392 $(this).parents('.gfield').first().find('.gfield_validation_message').fadeOut(300); 393 }); 394 395 $('body').on('click', '.gform_validation_errors', function() { 396 var $this = $(this); 397 $this.css('transform', 'translateY(100%)'); 398 399 window.setTimeout(function() { 400 $this.hide(); 401 }, parseFloat($this.css('transition-duration')) * 100 + 500); 402 }); 403 }); 404 } 405 STOM.numberThreeGravityFormsHandler(); 406 } 407 408 409 /* Legacy Gravity Forms < 2.5 */ 410 if (!function_exists('legacyGravityFormsHandler')) { 411 STOM.legacyGravityFormsHandler = function() { 412 if (!$('.gform_wrapper').length) return; 413 414 var errorTimer = '', 415 formHeights = [], 416 scrollOffset = 100; 417 418 419 /* Når formen er loaded & re-loaded */ 420 $(document).bind('gform_post_render', function(e, form_id) { 421 var $form = $('#gform_' + form_id); 422 423 424 /* IE placeholder submit fix*/ 425 $('.gfield').each(function() { 426 if ($('input, textarea', this).text() == $('input, textarea', this).attr('placeholder')) 427 $('input, textarea', this).val(''); 428 }); 429 430 431 /* Skjuler tomme <labels> og flytter required til placeholder */ 432 $('.gfield', $form).each(function() { 433 var isRequired = $(this).hasClass('gfield_contains_required') == true ? 'required' : ''; 434 435 $('.gfield_label', this).each(function() { 436 var childNodes = $(this)[0].childNodes.length; 437 438 if (isRequired && childNodes == 1 && $('.gfield_required', this).length) { 439 $input = $(this).parent().find('.ginput_container').children('[placeholder]'); 440 $input.attr('placeholder', $input.attr('placeholder') + ' *'); 441 442 $(this).remove(); 443 } 444 445 else if ($(this).html() == '') 446 $(this).remove(); 447 }); 448 }); 449 450 451 function cookieBoxCheck() { 452 if ($('#cookie_box').is(':visible')) { 453 $('.validation_error').css('bottom', $('#cookie_box').outerHeight()); 454 } 455 } 456 457 $(window).on('resize orientationchange', cookieBoxCheck); 458 459 460 /* Håndtering af fejlbesked(er) */ 461 if ($('.validation_error').length > 0) { 462 $('.validation_error').hide(); 463 464 $('.validation_error', $form).css('bottom', ''); 465 $('.validation_error', $form).slideDown('slow'); 466 467 cookieBoxCheck(); 468 469 470 $('li.gfield_error', $form).each(function() { 471 $('.ginput_container', this).append($('.validation_message', this)); 472 });
473 474 475 if (errorTimer) clearTimeout(errorTimer); 476 477 errorTimer = setTimeout(function() { 478 $('.validation_error').slideUp('slow'); 479 }, 7500); 480 481 482 if ($('#gform_' + form_id + ' .gfield_error').first().offset().top < $(document).scrollTop() + scrollOffset) { 483 $('html, body').animate({ 484 scrollTop: $('#gform_' + form_id + ' .gfield_error').first().offset().top - scrollOffset 485 }, 1000); 486 } 487 } 488 489 490 /* AJAX spinner */ 491 $form.append('\ 492 <div id="spinner-anchor"></div>\ 493 <div id="spinner-overlay">\ 494 <span class="spinner-element">\ 495 <i class="fas fa-sync-alt fa-spin fa-3x fa-fw"></i>\ 496 </span>\ 497 </div>\ 498 '); 499 500 if (window.hasOwnProperty('gform')) { 501 gform.addFilter('gform_spinner_target_elem', function($targetElem, formId) { 502 return $('#gform_' + formId + ' #spinner-anchor'); 503 }); 504 } else { 505 console.error('Gravity Form med id: '+formId+' er ikke sat til at bruge AJAX - rediger formularens indstilling!'); 506 } 507 508 509 /* Gemmer hver formular's højde relateret til dens ID */ 510 formHeights[form_id] = $form.height(); 511 }); 512 513 514 /* Når formen har sendt korrekt */ 515 $(document).bind('gform_confirmation_loaded', function(e, form_id) { 516 $('html, body').stop(); 517 518 $('#gform_confirmation_wrapper_' + form_id).height(formHeights[form_id] + 'px'); 519 520 if ($('#gform_confirmation_wrapper_' + form_id).offset().top < $(document).scrollTop() + scrollOffset) { 521 $('html, body').animate({ 522 scrollTop: $('#gform_confirmation_wrapper_' + form_id).offset().top - 150 523 }, 1000); 524 } 525 }); 526 527 528 /* Skjuler fejlbesked i bunden af siden */ 529 $('body').on('click', '.validation_error', function() { 530 $(this).slideUp('slow'); 531 532 if (errorTimer) clearTimeout(errorTimer); 533 }); 534 535 536 /* Fjerner fejl-beskeder ved :focus */ 537 $('body').on('focus', 'li.gfield_error *', function(e) { 538 e.stopPropagation(); 539 540 var $error = $(this).parents('li.gfield_error').find('.validation_message'); 541 542 if ($error.length) { 543 $error.fadeOut('slow', function() { 544 $error.remove(); 545 }); 546 } 547 }); 548 549 /* Skjuler fejlbeskeder ved :hover */ 550 $('body').on('mouseenter', 'li.gfield_error .validation_message', function() { 551 $(this).fadeOut('slow', function() { 552 $(this).remove(); 553 }); 554 }); 555 } 556 } 557 558 if (!function_exists('gravityFormsHandler')) { 559 STOM.gravityFormsHandler = function() { 560 STOM.legacyGravityFormsHandler(); 561 } 562 } 563 564 565 /*** STOM tæt_grid shortcode height calculator ***/ 566 if (!function_exists('closeGridShortcodeHandler')) { 567 STOM.closeGridShortcodeHandler = function() { 568 if (!$('.close-grid-wrapper').length) return; 569 570 function resizeGrid() { 571 $('.close-grid-wrapper').each(function() { 572 var height = $('.close-grid:first-of-type', this).width(); 573 574 $('.close-grid', this).height(height); 575 }); 576 } 577 578 $(window).on('resize orientationchange', resizeGrid); 579 resizeGrid(); 580 } 581 STOM.closeGridShortcodeHandler(); 582 } 583 584 585 /*** STOM Maps Sections ***/ 586 if (!function_exists('mobileMapsHandler')) { 587 STOM.mobileMapsHandler = function() { 588 if ($('.section-map.maps-optimize').length && window.innerWidth > 767) { 589 $('.section-map.maps-optimize').each(function() { 590 var $map_section = $(this); 591 592 if ($map_section.hasClass('optimize-left')) { 593 $('.stom-cols-6.last', $map_section).css('min-height', $('.stom-cols-6:not(.last)', $map_section).height()); 594 } else { 595 $('.stom-cols-6:not(.last)', $map_section).css('min-height', $('.stom-cols-6.last', $map_section).height()); 596 } 597 }); 598 } 599 } 600 STOM.mobileMapsHandler(); 601 } 602 603 604 /* PhotoSwipe gallery handler */ 605 if (!function_exists('photoSwipeGalleryHandler')) { 606 STOM.photoSwipeGalleryHandler = function() { 607 if (!$('.gallery[id^=gallery-]').length) return; 608 609 $('.gallery.gallery-link-file[id^=gallery-]').each(function() { 610 var $items = $('figure.gallery-item', this), 611 $links = $('a', $items), 612 $images = $('img', $links), 613 pswpElement = $('.pswp')[0], 614 slides = [], 615 options = { 616 bgOpacity: .75 617 }; 618 619 for (i = 0; i < $links.length; i++) { 620 var caption = ''; 621 if ($($images[i]).closest('.gallery-icon').length && $($images[i]).closest('.gallery-icon').next('.wp-caption-text').length) 622 caption = $($images[i]).closest('.gallery-icon').next('.wp-caption-text').html(); 623 624 slides.push({ 625 src: $($links[i]).attr('href'), 626 w: $($images[i]).attr('data-stom-width'), 627 h: $($images[i]).attr('data-stom-height'), 628 title: caption 629 });
630 }; 631 632 $links.on('click', function(e) { 633 e.preventDefault(); 634 635 var index = $items.index($(this).parents('figure')); 636 options['index'] = index; 637 638 var gallery = new PhotoSwipe(pswpElement, PhotoSwipeUI_Default, slides, options); 639 gallery.init(); 640 }); 641 }); 642 } 643 STOM.photoSwipeGalleryHandler(); 644 } 645 646 647 /*** STOM anmeldelses-slider ***/ 648 if (!function_exists('anmeldelserSliderHandler')) { 649 STOM.anmeldelserSliderHandler = function() { 650 if (!$('.stom-anmeldelse-wrapper').length) return; 651 652 // Reset shortcode slick options 653 $('.stom-anmeldelse-wrapper').slick({ 654 dots: true, 655 infinite: true, 656 slidesToShow: 1, 657 autoplay: true, 658 autoplaySpeed: 5000, 659 adaptiveHeight: true, 660 prevArrow: '<button type="button" class="slick-prev">'+stomFaIcons.slick.buttonPrev+'</button>', 661 nextArrow: '<button type="button" class="slick-next">'+stomFaIcons.slick.buttonNext+'</button>', 662 lazyLoad: 'progressive', 663 speed: 175, 664 draggable: false, 665 }); 666 } 667 STOM.anmeldelserSliderHandler(); 668 } 669 670 671 if (!function_exists('slickSliderHandler')) { 672 STOM.slickSliderHandler = function() { 673 if (!$('.stom-simple-slider').length) return; 674 675 if (jQuery.fn.slick) { 676 $('.stom-simple-slider').slick({ 677 dots: true, 678 prevArrow: '<button type="button" class="slick-prev">'+stomFaIcons.slick.buttonPrev+'</button>', 679 nextArrow: '<button type="button" class="slick-next">'+stomFaIcons.slick.buttonNext+'</button>', 680 lazyLoad: 'progressive', 681 speed: 175, 682 draggable: false, 683 }); 684 } else { 685 pre('Slick Slider Could\'t Initialize'); 686 } 687 } 688 STOM.slickSliderHandler(); 689 } 690 691 692 if (!function_exists('calendarSliderHandler')) { 693 STOM.calendarSliderHandler = function() { 694 /*** STOM Kalender-slider ***/ 695 if (!$('.kalender-container').length) return; 696 697 // Reset shortcode slick options 698 $('.kalender-container').each(function() { 699 $(this).slick({ 700 slidesToShow: 4, 701 slidesToScroll: 1, 702 autoplay: true, 703 autoplaySpeed: 3500, 704 dots: false, 705 prevArrow: '<button type="button" class="slick-prev">'+stomFaIcons.slick.buttonPrev+'</button>', 706 nextArrow: '<button type="button" class="slick-next">'+stomFaIcons.slick.buttonNext+'</button>', 707 lazyLoad: 'progressive', 708 speed: 175, 709 draggable: false, 710 responsive: [ 711 { 712 breakpoint: 960, 713 settings: { 714 arrows: true, 715 centerMode: false, 716 slidesToShow: 3 717 } 718 }, 719 { 720 breakpoint: 768, 721 settings: { 722 arrows: true, 723 centerMode: false, 724 slidesToShow: 2 725 } 726 }, 727 { 728 breakpoint: 480, 729 settings: { 730 arrows: true, 731 centerMode: false, 732 slidesToShow: 1 733 } 734 } 735 ] 736 }); 737 }); 738 } 739 STOM.calendarSliderHandler(); 740 } 741 742 743 /*** Video Slider muted icon click handler ***/ 744 if (!function_exists('mutedVideoHandler')) { 745 STOM.mutedVideoHandler = function() { 746 if (!$('.section-wrap.video-bg').length) return; 747 748 $('.video-muted-icon').on('click', function() { 749 var $this = $(this), 750 $video = $this.next('video'); 751 752 $video.prop('muted', !$video.prop('muted')); 753 $this.toggleClass('unmuted'); 754 }); 755 } 756 STOM.mutedVideoHandler(); 757 } 758 759 760 761 /*** Sticky Mobile CTA push ***/ 762 if (!function_exists('stickyMobileCTA')) { 763 STOM.stickyMobileCTA = function() { 764 if (!$('#number-three-sticky-mobile-cta').length) return; 765 766 767 function updateStickyPlaceholderHeight() { 768 if ($('#number-three-sticky-mobile-cta').is(':visible')) { 769 $('#number-three-sticky-mobile-cta-placeholder').height($('#number-three-sticky-mobile-cta').height()); 770 } else { 771 $('#number-three-sticky-mobile-cta-placeholder').height(''); 772 } 773 } 774 775 updateStickyPlaceholderHeight(); 776 $(window).on('load resize', updateStickyPlaceholderHeight); 777 } 778 STOM.stickyMobileCTA(); 779 } 780 781 782 if (!function_exists('menuItemsHiddenHandling')) { 783 STOM.menuItemsHiddenHandling = function() { 784 $('.nav-menu a[data-stom-remove]').each(function() { 785 $(this).parent('.menu-item').remove(); 786 }); 787 } 788 STOM.menuItemsHiddenHandling(); 789 } 790 791 792 if (!function_exists('sliderSectionHandler')) { 793 STOM.sliderSectionHandler = function() { 794 if (!$('.stom-slider-sektion').length) return; 795 796 797 $('.stom-slider-sektion').each(function() { 798 if ($('.section-images img', this).length > 1) { 799 $('.section-images', this).slick({ 800 adaptiveHeight: true, 801 autoplay: true, 802 autoplaySpeed: 7500,
803 arrows: false, 804 speed: 1000, 805 infinite: true, 806 prevArrow: '<button type="button" class="slick-prev">'+stomFaIcons.slick.buttonPrev+'</button>', 807 nextArrow: '<button type="button" class="slick-next">'+stomFaIcons.slick.buttonNext+'</button>', 808 lazyLoad: 'progressive', 809 draggable: false, 810 }); 811 } 812 }); 813 } 814 STOM.sliderSectionHandler(); 815 } 816 817 818 /*** Devices Sidebar toggle-button ***/ 819 if (!function_exists('mobileSidebarHandler')) { 820 STOM.mobileSidebarHandler = function() { 821 if (!$('#secondary').length) return; 822 823 var $secondary = $('#secondary'), 824 sidebarButtonClicked = 'no', 825 dataOffset = $secondary.data('offset'); 826 827 828 function calcOpenPosition() { 829 var adminBarHeight = $('#wpadminbar').length ? $('#wpadminbar').outerHeight() : 0, 830 headerHeight = $('#masthead').outerHeight(), 831 buttonWidth = $('#page .open-button').outerWidth(), 832 offset = dataOffset; 833 834 $('#page .open-button').css('top', adminBarHeight + headerHeight + buttonWidth + offset + 'px'); 835 } 836 calcOpenPosition(); 837 838 839 function getScrollbarWidth() { 840 var outer = document.createElement("div"); 841 outer.style.visibility = "hidden"; 842 outer.style.width = "100px"; 843 outer.style.msOverflowStyle = "scrollbar"; 844 845 document.body.appendChild(outer); 846 847 var widthNoScroll = outer.offsetWidth; 848 // force scrollbars 849 outer.style.overflow = "scroll"; 850 851 // add innerdiv 852 var inner = document.createElement("div"); 853 inner.style.width = "100%"; 854 outer.appendChild(inner); 855 856 var widthWithScroll = inner.offsetWidth; 857 858 // remove divs 859 outer.parentNode.removeChild(outer); 860 861 return widthNoScroll - widthWithScroll; 862 } 863 864 865 function checkOverflow() { 866 if (sidebarButtonClicked == 'yes') { 867 if (window.innerWidth < 450 && $secondary.hasClass('active')) { 868 if (navigator.userAgent.match(/iPhone|iPad|iPod/i)) { 869 document.body.style.position = 'fixed'; 870 } 871 872 document.body.style.overflow = 'hidden'; 873 document.body.style.height = '100%'; 874 document.body.style.width = '100%'; 875 } 876 } else { 877 $('body').removeAttr('style'); 878 } 879 } 880 881 882 $(window).on('load resize orientationchange', function() { 883 if (window.innerWidth > 959 && sidebarButtonClicked == 'yes') 884 $('#page .devices-toggle').first().trigger('click'); 885 886 checkOverflow(); 887 calcOpenPosition(); 888 }); 889 890 891 $('#page .devices-toggle, .aside-overlay').on('click', function() { 892 $secondary.toggleClass('active'); 893 sidebarButtonClicked = sidebarButtonClicked == 'no' ? 'yes' : 'no'; 894 895 if (sidebarButtonClicked == 'yes') { 896 window.setTimeout(function() { 897 $('body').addClass('off-canvas'); 898 $('body').css('padding-right', getScrollbarWidth()); 899 checkOverflow(); 900 }, 100); 901 } else { 902 window.setTimeout(function() { 903 $('body').removeClass('off-canvas'); 904 $('body').css('padding-right', ''); 905 checkOverflow(); 906 }, 150); 907 } 908 }); 909 } 910 STOM.mobileSidebarHandler(); 911 } 912 913 /*** END Document ready ***/ 914 915 916 917 918 919 /*** Window load ***/ 920 $(window).on('load', function() { 921 922 if (!function_exists('calendarSortingHandler')) { 923 STOM.calendarSortingHandler = function() { 924 if (!$('#sorting-date').length) return; 925 926 $("#sorting-date").datepicker({ 927 altFormat: 'yymmdd', 928 dateFormat: 'dd-mm-yy', 929 altField: '#sorting-date-hidden' 930 }); 931 932 $("#sorting-date").on('keyup change', function() { 933 if ($("#sorting-date").val() == '') 934 $("#sorting-date-hidden").val(''); 935 }); 936 } 937 STOM.calendarSortingHandler(); 938 } 939 940 941 /*** STOM produktion <h1> checker ***/ 942 if (!function_exists('stomProductionH1Checker')) { 943 STOM.stomProductionH1Checker = function() { 944 if (!$('body.stom-admin').length || !$('body.stom-production').length) return; 945 946 947 window.setTimeout(function() { 948 var titleCount = $('h1').filter(function() { 949 return $(this).parents('.slick-cloned').length === 0; 950 }).length; 951 952 if (titleCount != 1) { 953 $('body').prepend('\ 954 <style>\ 955 .stom-production-error {\ 956 position: fixed;\ 957 top: 0;\ 958 right: 0;\ 959 left: 0;\ 960 padding: 50px;\ 961 font-size: 50px;\ 962 background-color: rgba(255, 0, 0, .8);\ 963 text-align: center;\ 964 font-weight: bold;\ 965 color: white;\ 966 border-bottom: 3px solid white;\ 967 cursor: pointer;\ 968 z-index: 99999;\ 969 }\ 970 </style>\ 971 '); 972 } 973 974 if (titleCount == 0) { 975 $('body').prepend('<div class="stom-production-error">DENNE SIDER MANGLER EN <h1></div>'); 976 } else if (titleCount > 1) { 977 $('body').prepend('<div class="stom-production-error">DU HAR <u>' + titleCount + '</u> <h1> TAGS PÅ DENNE SIDE</div>'); 978 979 $('h1').each(function() { 980 $(this).css({ 981 'color' : 'white', 982 'background-color': 'red', 983 'outline' : '10px solid red', 984 });
985 }); 986 } 987 }, 1500); 988 989 990 $('body').on('click', '.stom-production-error', function() { 991 $(this).slideUp(750); 992 }); 993 } 994 STOM.stomProductionH1Checker(); 995 } 996 997 998 999 if (!function_exists('stomInlinePopupHandler')) { 1000 STOM.stomInlinePopupHandler = function() { 1001 if (!$('.stom-inline-overlay-wrap').length) return; 1002 1003 1004 $('.stom-inline-overlay-wrap').each(function() { 1005 var $popup = $(this); 1006 1007 $(document).on('click', 'a[href="#'+$(this).attr('id')+'"]', function(e) { 1008 e.preventDefault(); 1009 1010 $popup.fadeIn(175); 1011 1012 $('body').addClass('inline-popup-open'); 1013 $('body').css('padding-right', getScrollbarWidth()); 1014 }); 1015 }); 1016 1017 1018 $(document).on('click', '.stom-inline-overlay-close', function() { 1019 $(this).parents('.stom-inline-overlay-wrap').first().fadeOut(175, function() { 1020 $('body').removeClass('inline-popup-open'); 1021 $('body').css('padding-right', ''); 1022 }); 1023 }); 1024 1025 $(document).on('click', '.stom-inline-overlay-wrap', function(e) { 1026 if (!$(e.target).is(this)) return; 1027 1028 1029 $(this).fadeOut(175, function() { 1030 $('body').removeClass('inline-popup-open'); 1031 $('body').css('padding-right', ''); 1032 }); 1033 }); 1034 1035 1036 function getScrollbarWidth() { 1037 var outer = document.createElement("div"); 1038 outer.style.visibility = "hidden"; 1039 outer.style.width = "100px"; 1040 outer.style.msOverflowStyle = "scrollbar"; 1041 1042 document.body.appendChild(outer); 1043 1044 var widthNoScroll = outer.offsetWidth; 1045 // force scrollbars 1046 outer.style.overflow = "scroll"; 1047 1048 // add innerdiv 1049 var inner = document.createElement("div"); 1050 inner.style.width = "100%"; 1051 outer.appendChild(inner); 1052 1053 var widthWithScroll = inner.offsetWidth; 1054 1055 // remove divs 1056 outer.parentNode.removeChild(outer); 1057 1058 return widthNoScroll - widthWithScroll; 1059 } 1060 } 1061 STOM.stomInlinePopupHandler(); 1062 } 1063 1064 1065 }); 1066 /*** END Window load ***/ 1067 1068 1069})(jQuery); 1070
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.