import Swiper from 'swiper/swiper-bundle'; import { ScratchCard, SCRATCH_TYPE } from 'scratchcard-js' require('./bootstrap'); require('@fancyapps/fancybox'); // cookie notice import { LdcwebCn } from "./ldcweb-cn.js"; window.LdcwebCn = LdcwebCn; $(document).ready(function () { // BOUTON HAUT DE PAGE $(window).on('scroll', function () { if ($(window).scrollTop()) { $('.pageup').addClass('see') } else { $('.pageup').removeClass('see') } }) $('.toggle-menu').click(function () { $(this).toggleClass('active'); $('nav').toggleClass('active'); $('body').toggleClass('mobile-nav-active'); }) $('ul li a').click(function () { const body = document.querySelector('body'); if (body.classList.contains('mobile-nav-active')) { $('.toggle-menu').toggleClass('active'); $('nav').toggleClass('active'); $('body').toggleClass('mobile-nav-active'); } }) // $('.close-menu').click(function(){ // $('nav').removeClass('active') // $('li').siblings().removeClass('active') // }) var mySwiper = new Swiper('.swiper-container', { // Optional parameters direction: 'horizontal', loop: true, autoplay: { delay: 8000, }, pagination: { el: '.gift-bloc .swiper-pagination', type: 'bullets', clickable: true, }, }) //wheel spin /*WHEEL SPIN FUNCTION*/ $('#spin').click(function(){ //add 1 every click clicks ++; /*multiply the degree by number of clicks generate random number between 1 - 85, then add to the new degree*/ var newDegree = degree*clicks; var extraDegree = Math.floor(Math.random() * (85 - 1 + 1)) + 1; var totalDegree = newDegree+extraDegree; // totalDegree = 1710; //vert => BR // totalDegree = 1620; //bleu => happy // totalDegree = 1530; //bleu foncé => BR //1440 //jaune => loisir totalDegree = thisWinAngle+extraDegree; /*let's make the spin btn to tilt every time the edge of the section hits the indicator*/ $('#wheel .sec').each(function(){ var t = $(this); // var noY = 0; $('#inner-wheel').css({ 'transform' : 'rotate(' + totalDegree + 'deg)' }); setTimeout(function () { $(".congratulate .main--bloc").css('display', 'block'); $(".register .main--bloc").css('display', 'block'); $(".sc__wrapper").hide(); }, 6000); }); }); const scContainer = document.getElementById('js--sc--container') if (scContainer != null) { const scInfos = document.querySelector('.sc__infos'); const sc = new ScratchCard('#js--sc--container', { scratchType: SCRATCH_TYPE.LINE, containerWidth: scContainer.offsetWidth, containerHeight: scContainer.offsetHeight, imageForwardSrc: '/front/assets/images/grattage.png', imageBackgroundSrc: '', htmlBackground: '', clearZoneRadius: 50, nPoints: 30, pointSize: 8, callback: function () { // alert('Now the window will reload !') // window.location.reload() $(".congratulate .main--bloc").css('display', 'block'); $(".register .main--bloc").css('display', 'block'); $(".sc__wrapper").hide(); } }) // Init sc.init().then(() => { // sc.canvas.addEventListener('scratch.move', () => { // let percent = sc.getPercent().toFixed(0); // scInfos.innerHTML = percent + '%'; // console.log(percent) // }) }).catch((error) => { // image not loaded alert(error.message); }); } function CompteARebours() { // DECLARATION var date_actuelle = new Date(); // On déclare la date d'aujourd'hui // Ici c'est du sale ! var date = __TEASEREND.split(' ')[0].split('-') var annee = date[0]; var mois = date[1]; var jour = date[2]; var date_ouverture = new Date(annee, mois - 1, jour, 0, 0, 0); // On déclare la date, attention mois -1 var tps_restant = date_ouverture.getTime() - date_actuelle.getTime(); // Temps restant en millisecondes // CONVERSIONS var s_restantes = tps_restant / 1000; // On convertit en secondes var i_restantes = s_restantes / 60; var H_restantes = i_restantes / 60; var d_restants = H_restantes / 24; var hours = H_restantes % 24; var min = Math.floor((hours % 1) * 60); hours = Math.floor(hours); d_restants = Math.floor(d_restants); // Jours restants if (d_restants < 10) { d_restants = '0' + d_restants; } if (hours < 10) { hours = '0' + hours; } if (min < 10) { min = '0' + min; } // AFFICHAGE $(".compteur .jours span").html(d_restants); $(".compteur .heures span").html(hours); $(".compteur .minutes span").html(min); } if (typeof __TEASEREND !== 'undefined') { CompteARebours(); } })