2019-03-27 02:20:54 +03:00
|
|
|
function showDialogue (dialogueName, trackEvent) {
|
|
|
|
if (typeof trackEvent === 'undefined') trackEvent = true;
|
2020-04-04 10:41:56 +03:00
|
|
|
|
|
|
|
dialogueOpen = true;
|
|
|
|
popUpContainer.style.display = 'block';
|
|
|
|
|
|
|
|
document.getElementById(dialogueName).style.display = 'block';
|
|
|
|
|
2019-03-27 02:20:54 +03:00
|
|
|
//track google event
|
|
|
|
if (trackEvent)
|
|
|
|
ga('send', 'event', 'Palette Editor Dialogue', dialogueName); /*global ga*/
|
|
|
|
}
|
|
|
|
|
|
|
|
function closeDialogue () {
|
2020-04-04 10:41:56 +03:00
|
|
|
popUpContainer.style.display = 'none';
|
|
|
|
|
|
|
|
var popups = popUpContainer.children;
|
|
|
|
for (var i = 0; i < popups.length; i++) {
|
|
|
|
popups[i].style.display = 'none';
|
|
|
|
}
|
|
|
|
|
|
|
|
dialogueOpen = false;
|
2019-03-27 02:20:54 +03:00
|
|
|
}
|
|
|
|
|
2020-04-04 10:41:56 +03:00
|
|
|
popUpContainer.addEventListener('click', function (e) {
|
|
|
|
if (e.target == popUpContainer)
|
|
|
|
closeDialogue();
|
2019-03-27 02:20:54 +03:00
|
|
|
});
|
|
|
|
|
|
|
|
//add click handlers for all cancel buttons
|
|
|
|
var cancelButtons = popUpContainer.getElementsByClassName('close-button');
|
|
|
|
for (var i = 0; i < cancelButtons.length; i++) {
|
2020-04-04 10:41:56 +03:00
|
|
|
cancelButtons[i].addEventListener('click', function () {
|
|
|
|
closeDialogue();
|
|
|
|
});
|
|
|
|
}
|