mirror of
https://github.com/PavelDoGreat/WebGL-Fluid-Simulation.git
synced 2025-10-04 18:01:40 +02:00
add promo popup for mobile users
This commit is contained in:
29
script.js
29
script.js
@@ -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();
|
||||
|
||||
|
Reference in New Issue
Block a user