add promo popup for mobile users

This commit is contained in:
Pavel Dobryakov
2020-03-31 15:26:08 +03:00
parent ab1ca45f88
commit 93cad8a40b
6 changed files with 145 additions and 6 deletions

View File

@@ -24,6 +24,35 @@ SOFTWARE.
'use strict';
// Promo code
const promoPopup = document.getElementsByClassName('promo')[0];
const promoPopupClose = document.getElementsByClassName('promo-close')[0];
if (isMobile()) {
setTimeout(() => {
promoPopup.style.display = 'table';
}, 20000);
}
promoPopupClose.addEventListener('click', e => {
promoPopup.style.display = 'none';
});
const appleLink = document.getElementById('apple_link');
appleLink.addEventListener('click', e => {
ga('send', 'event', 'link promo', 'app');
window.open('https://apps.apple.com/us/app/fluid-simulation/id1443124993');
});
const googleLink = document.getElementById('google_link');
googleLink.addEventListener('click', e => {
ga('send', 'event', 'link promo', 'app');
window.open('https://play.google.com/store/apps/details?id=games.paveldogreat.fluidsimfree');
});
// Simulation code
const canvas = document.getElementsByTagName('canvas')[0];
resizeCanvas();