Hungary

Hungary

Norway

Norway

Sweden

Sweden

Rest of World

Asia

Rest of World

Rest of World

On your next visit to Vera & John, it will automatically redirect you to your chosen country. Click 'Continue' to proceed
`; notificationDialog.appendChild(dialogContent); document.body.appendChild(notificationDialog); notificationDialog.showModal(); // Close dialog when the "closeNotification" image is clicked const closeNotification = document.getElementById('closeNotification'); closeNotification.addEventListener('click', () => { // Remove the entire dialog from the DOM tree notificationDialog.remove(); }); // Add a click event listener to the document body document.body.addEventListener('click', (event) => { if (event.target === notificationDialog) { // Clicked outside the dialog, add the wobble animation class dialogContent.classList.add('wobble-animation'); // Remove the wobble animation class after the animation completes dialogContent.addEventListener( 'animationend', () => { dialogContent.classList.remove('wobble-animation'); }, { once: true } ); } }); const countryElements = document.querySelectorAll( '.notification-countries .country' ); /* Initialize selectedIndex To keep track of the currently selected country */ let selectedIndex = 0; // Loop and assign an event listeners for each .country elements countryElements.forEach((countryElement, index) => { countryElement.addEventListener('click', () => { /* When clicks any of the .country, it Remove the "active" class from all country elements countryElements (with 's) - Please refer to the const not the loop data */ countryElements.forEach((element) => { element.classList.remove('active'); }); /* Add the "active" class to the clicked country countryElement (without 's) - this is the loop data not the const */ countryElement.classList.add('active'); // Update the selectedCountryElement to the clicked element selectedCountryElement = countryElement; /* Get the text inside the

tag of the clicked element This will serve as data of what country is selected */ selectedCountry = countryElement.querySelector('p').textContent; // Update selectedIndex when a country is clicked selectedIndex = index; updateButtonContent(selectedCountry); }); }); /* Add a keydown event listener for arrow keys outside the forEach loop */ document.addEventListener('keydown', (event) => { if (event.key === 'ArrowUp') { //Prevent page scrolling event.preventDefault(); /* Calculates the index of the previous country Example: selectedIndex = 0 is already defined then we have countryElements = [Japan, Brazil, Finland, Sweden, Rest of world] therefore countryElements.length = 5 using this formula (selectedIndex - 1 + countryElements.length) % countryElements.length (0 - 1 + 5) % 5 0 - 1 = -1 -1 + 5 = 4 4 % 5 = 4 4 corresponds to 'Rest of world' Same logic applies below */ const prevIndex = (selectedIndex - 1 + countryElements.length) % countryElements.length; countryElements[prevIndex].click(); } else if (event.key === 'ArrowDown') { event.preventDefault(); // Prevent page scrolling const nextIndex = (selectedIndex + 1) % countryElements.length; countryElements[nextIndex].click(); } else if (event.key === 'Enter') { event.preventDefault(); // Prevent form submission, if any // if (selectedCountryElement) { // redirectToCountrySite(selectedCountry); // updateButtonContent(selectedCountry); // } proceedRegionButton.click(); } else if (event.key === 'Escape') { event.preventDefault(); } }); const proceedRegionButton = document.getElementById('proceedRegion'); const MeCheckbox = document.querySelector( '#Me input[type="checkbox"]' ); const notificationActionsContainer = document.querySelector( '.notification-actions' ); const MeContainer = document.querySelector('#Me'); MeCheckbox.addEventListener('click', () => { if (MeCheckbox.checked) { const disclaimerElement = document.createElement('div'); disclaimerElement.textContent = "On your next visit to verajohn.com, it will automatically redirect you to your chosen country. Click 'Continue' to proceed"; disclaimerElement.classList.add('disclaimer'); MeContainer.insertAdjacentElement( 'afterend', disclaimerElement ); } else { const disclaimerElement = document.querySelector( '.notification-actions .disclaimer' ); notificationActionsContainer.removeChild(disclaimerElement); } }); proceedRegionButton.addEventListener('click', () => { if (MeCheckbox.checked) { setCookie('SelectedCountry', selectedCountry, 14); // 7 days = 1 week, Change this to adjust the expiration } dataLayer.push({ event: 'button_continue_to', pop_up_button_country: selectedCountry, }); redirectToCountrySite(selectedCountry); updateButtonContent(selectedCountry); }); updateButtonContent(selectedCountry); } const selectedCountryCookie = getCookie('SelectedCountry'); if (selectedCountryCookie) { const selectedCountry = selectedCountryCookie; redirectToCountrySite(selectedCountry); } // Function to set a cookie with an expiration date function setCookie(cookieName, cookieValue, daysToExpire) { const expirationDate = new Date(); expirationDate.setTime( expirationDate.getTime() + daysToExpire * 24 * 60 * 60 * 1000 ); const expires = 'expires=' + expirationDate.toUTCString(); document.cookie = `${cookieName}=${cookieValue}; ${expires}; path=/`; } // Function to check for the existence of a cookie function getCookie(cookieName) { const name = cookieName + '='; const decodedCookie = decodeURIComponent(document.cookie); const cookieArray = decodedCookie.split(';'); for (let i = 0; i < cookieArray.length; i++) { let cookie = cookieArray[i]; while (cookie.charAt(0) === ' ') { cookie = cookie.substring(1); } if (cookie.indexOf(name) === 0) { return cookie.substring(name.length, cookie.length); } } return ''; } // Function to handle the redirection function redirectToCountrySite(selectedCountry) { switch (selectedCountry) { case 'Finland': window.location.href = 'https://play.verajohncasino.com/'; break; case 'Hungary': window.location.href = 'https://tinyurl.com/vjurl'; break; case 'Norway': window.location.href = 'https://play.verajohncasino.com/'; break; case 'Sweden': window.location.href = 'https://www.verajohn.se/sv'; break; case 'Asia': window.location.pathname = '/ja/'; break; case 'Rest of World': window.location.href = 'https://www.verajohncasino.com'; break; default: break; } } // Function to update the button text function updateButtonContent(country) { const proceedRegionButton = document.getElementById('proceedRegion'); proceedRegionButton.textContent = `Continue to ${country}`; } // const addDialog = document.getElementById('addBtn') // addDialog.addEventListener('click', () => { // createDialog() // }) });

Popular
See all
New Games
See all
Microgaming
See all
Exclusive
See all
Live casino
See all
Pachislots
See all
Most Played Slots
See all
Most Played Table Games
See all
Buy Feature Games
See all
VeraJohn Lucky Jackpots
See all
Daily Jackpots
See all
Jackpots
See all
Slingo
See all