{"version":3,"sources":["20231019RepairService_functions.js"],"names":["scroll","window","requestAnimationFrame","showOnScroll","document","querySelectorAll","forEach","el","getBoundingClientRect","top","innerHeight","classList","add","getYouTubeSource","src","$","attr","console","log","close_video_modal","removeClass","on","e","preventDefault","addClass","event","keyup","keyCode","addEventListener","location","href","includes","origin","getElementById","scrollIntoView","behavior"],"mappings":"AAuDA,IAAMA,OAASC,OAAOC,sBAEtB,SAASC,eACOC,SAASC,iBAAiB,iBAElCC,QAAQ,SAACC,GACMA,EAAGC,wBAAwBC,IAC7BR,OAAOS,YAAc,IAGpCH,EAAGI,UAAUC,IAAI,mBAIrBZ,OAAOG,cA+FT,SAASU,mBACP,IAOIC,EAAM,2BAPDC,EAAE,2BAA2BC,KAAK,mBAG5B,qCAMfC,QAAQC,IAAIJ,GAEZC,EAAE,YAAYC,KAAK,MAAOF,GAW5B,SAASK,oBACPJ,EAAE,QAAQK,YAAY,6BACtBL,EAAE,YAAYC,KAAK,MAAO,IArH5Bb,eA2GAY,EAAE,2BACCM,GAAG,QAAS,SAASC,GACpBA,EAAEC,iBACFV,mBAEAE,EAAE,QAAQS,SAAS,+BAQvBT,EAAE,QAAQM,GAAG,QAAS,4CAA6C,SAASI,GAC1EN,sBAGFJ,EAAE,QAAQW,MAAM,SAASJ,GACN,IAAbA,EAAEK,SACJR,sBAKJlB,OAAO2B,iBAAiB,OAAQ,WAC1B3B,OAAO4B,SAASC,KAAKC,SAAS9B,OAAO4B,SAASG,OAAS,+BACzDnB,mBACAE,EAAE,QAAQS,SAAS,6BAEHpB,SAAS6B,eAAe,UAChCC,eAAe,CAAEC,SAAU","file":"20231019RepairService_functions.min.js","sourcesContent":["// TOUCH OR NO-TOUCH, THAT IS THE QUESTION!\r\n// SCROLL-TO ANIMATION FOR ANCHOR LINKS\r\n// FADE-IN-UP ELEMENTS ON SCROLL\r\n// SLIDER (SWIPER JS)\r\n// SLIDER (SLICK JS)\r\n// PRODUCT PICKER\r\n// NEWSLETTER PICKER\r\n\r\n\r\n\r\n//\r\n// =TOUCH OR NO-TOUCH, THAT IS THE QUESTION!\r\n// --------------------------------------------------\r\n\r\n// function isTouchDevice() {\r\n//   return true == (\"ontouchstart\" in window || window.DocumentTouch && document instanceof DocumentTouch);\r\n// }\r\n// if (isTouchDevice() === true) {\r\n//   $(\"body\").toggleClass(\"touch\");\r\n// } else {\r\n//   $(\"body\").toggleClass(\"no-touch\");\r\n// }\r\n\r\n\r\n//\r\n// =SCROLL-TO ANIMATION FOR ANCHOR LINKS\r\n// --------------------------------------------------\r\n\r\n// $('.msdw-page-scroll').click(function() {\r\n//   if (location.pathname.replace(/^\\//,'') == this.pathname.replace(/^\\//,'') && location.hostname == this.hostname) {\r\n//     var target = $(this.hash);\r\n//     target = target.length ? target : $('[name=' + this.hash.slice(1) +']');\r\n//     if (target.length) {\r\n//       var offsetValue = 0;\r\n//       if ( window.innerWidth <= 767 ) {\r\n//         offsetValue;\r\n//         // console.log(offsetValue);\r\n//       } else {\r\n//         offsetValue = 59;\r\n//         // console.log(offsetValue);\r\n//       }\r\n\r\n//       $('html,body').animate({\r\n//         scrollTop: target.offset().top - offsetValue\r\n//       }, 900);\r\n//       return false;\r\n//     }\r\n//   }\r\n// });\r\n\r\n\r\n//\r\n// =FADE-IN-UP ELEMENTS ON SCROLL\r\n// --------------------------------------------------\r\n\r\nconst scroll = window.requestAnimationFrame;\r\n\r\nfunction showOnScroll() {\r\n  const elems = document.querySelectorAll('.msdw-animate');\r\n\r\n  elems.forEach((el) => {\r\n    const elPosition = el.getBoundingClientRect().top\r\n    const elScreen = window.innerHeight / .9\r\n\r\n    if (elPosition < elScreen) {\r\n      el.classList.add('msdw-animated')\r\n    }\r\n  });\r\n\r\n  scroll(showOnScroll);\r\n}\r\n\r\nshowOnScroll();\r\n\r\n\r\n//\r\n// =SLIDER (SWIPER JS)\r\n// --------------------------------------------------\r\n\r\n// var swiper = new Swiper('.swiper-container', {\r\n//   slidesPerView: 1,\r\n//   loop: true,\r\n//   navigation: {\r\n//     nextEl: '.swiper-button-next',\r\n//     prevEl: '.swiper-button-prev',\r\n//   },\r\n// });\r\n\r\n\r\n//\r\n// =SLIDER (SLICK JS)\r\n// --------------------------------------------------\r\n\r\n// $('.msdw-slider-jacket').slick({\r\n//   slidesToShow: 1,\r\n//   slidesToScroll: 1,\r\n//   swipe: false,\r\n//   arrows: false,\r\n//   swipeToSlide: true,   // in case, 2 or more slides at a time\r\n//   autoplay: true,       // if autoplay...\r\n//   accessibility: false  // use this to avoid page jumping bug\r\n// });\r\n\r\n// $('.slick-prev').click(function() {\r\n//   $('.msdw-slider-jacket').slick('slickPrev');\r\n// });\r\n//\r\n// $('.slick-next').click(function() {\r\n//   $('.msdw-slider-jacket').slick('slickNext');\r\n// });\r\n\r\n// UNSLICK\r\n// If needed, here's a fix for window resizing\r\n// $(window).on('orientationchange resize', function() {\r\n//   $('.msdw-slider-jacket').slick('resize');\r\n// });\r\n\r\n\r\n//\r\n// =PRODUCT PICKER\r\n// --------------------------------------------------\r\n\r\n// $(\".product-detail-picker\").click(function(e){\r\n//   e.preventDefault();\r\n//   var productIdNumber = $(this).attr('data-product-id');\r\n//   window.jwsdwMediator.publish('openPicker', 'productDetailPicker', {'productId': productIdNumber});\r\n// });\r\n\r\n\r\n//\r\n// =NEWSLETTER PICKER\r\n// --------------------------------------------------\r\n\r\n// var campaignId = 'familyAndFriends',\r\n//     pickerTag = document.getElementById(\"openPicker\"),\r\n//     newsletterConfig = {},\r\n//     baseUrl = jwsdwSettings.baseUrl;\r\n\r\n// $.ajax({\r\n//   type: 'GET',\r\n//   url: baseUrl + '/Newsletter-getNewsletterConfig',\r\n//   data: {\r\n//     campaignId: campaignId\r\n//   },\r\n//   success: function(response) {\r\n//     newsletterConfig = response\r\n//   },\r\n//   error: function(response) {\r\n//     jwsdwApi.popup.showHttpError(response.status)\r\n//   }\r\n// });\r\n\r\n// pickerTag.addEventListener(\"click\", function(){\r\n//   window.jwsdwMediator.publish('openPicker', 'newsletterSignupPicker', {\r\n//     \"campaign\": newsletterConfig.id,\r\n//     \"introduction\": newsletterConfig.introduction,\r\n//     \"disclaimerOne\": newsletterConfig.disclaimerOne,\r\n//     \"disclaimerTwo\": newsletterConfig.disclaimerTwo\r\n//   });\r\n// });\r\n\r\n//\r\n// =YT VIDEO MODAL\r\n// --------------------------------------------------\r\nfunction getYouTubeSource() {\r\n  var id = $(\".js-trigger-video-modal\").attr('data-youtube-id');\r\n\r\n  // var enablejsapi = '?enablejsapi=1';\r\n  var autoplay = '?autoplay=1';\r\n  var related_no = '&rel=0';\r\n  var captions = '&cc_load_policy=1';\r\n  // var src = '//www.youtube.com/embed/'+id+enablejsapi+autoplay+related_no;\r\n  var src = '//www.youtube.com/embed/'+id+autoplay+related_no+captions;\r\n  \r\n  console.log(src);\r\n\r\n  $(\"#youtube\").attr('src', src);\r\n}\r\n\r\n$(\".js-trigger-video-modal\")\r\n  .on(\"click\", function(e){\r\n    e.preventDefault();\r\n    getYouTubeSource();\r\n\r\n    $(\"body\").addClass(\"show-video-modal noscroll\");\r\n  });\r\n\r\nfunction close_video_modal() {\r\n  $(\"body\").removeClass(\"show-video-modal noscroll\");\r\n  $(\"#youtube\").attr('src', '');\r\n}\r\n\r\n$('body').on('click', '.close-video-modal, .video-modal .overlay', function(event) {\r\n  close_video_modal();\r\n});\r\n\r\n$('body').keyup(function(e) {\r\n  if (e.keyCode == 27) {\r\n    close_video_modal();\r\n  }\r\n});\r\n\r\n\r\nwindow.addEventListener('load', function () {\r\n  if (window.location.href.includes(window.location.origin + \"/reparaturservice/\" + \"#repair\")) {\r\n    getYouTubeSource();\r\n    $(\"body\").addClass(\"show-video-modal noscroll\");\r\n\r\n    const element = document.getElementById(\"repair\");\r\n    element.scrollIntoView({ behavior: 'smooth' });\r\n  }\r\n});\r\n"]}