|
|
@ -9,6 +9,14 @@ |
|
|
|
!(function () { |
|
|
|
!(function () { |
|
|
|
'use strict'; |
|
|
|
'use strict'; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var eventModalOpen = new CustomEvent('modalOpen', { |
|
|
|
|
|
|
|
bubbles: true, |
|
|
|
|
|
|
|
cancelable: true |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
var eventModalClose = new CustomEvent('modalClose', { |
|
|
|
|
|
|
|
bubbles: true, |
|
|
|
|
|
|
|
cancelable: true |
|
|
|
|
|
|
|
}); |
|
|
|
var findModals = function (target) { |
|
|
|
var findModals = function (target) { |
|
|
|
var i; |
|
|
|
var i; |
|
|
|
var modals = document.querySelectorAll('a'); |
|
|
|
var modals = document.querySelectorAll('a'); |
|
|
@ -31,11 +39,14 @@ |
|
|
|
|
|
|
|
|
|
|
|
window.addEventListener('touchend', function (event) { |
|
|
|
window.addEventListener('touchend', function (event) { |
|
|
|
var modal = getModal(event); |
|
|
|
var modal = getModal(event); |
|
|
|
if (modal) { |
|
|
|
|
|
|
|
if (modal && modal.classList.contains('modal')) { |
|
|
|
if (modal && modal.classList.contains('modal')) { |
|
|
|
|
|
|
|
var eventToDispatch = eventModalOpen; |
|
|
|
|
|
|
|
if (modal.classList.contains('active')) { |
|
|
|
|
|
|
|
eventToDispatch = eventModalClose; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
modal.dispatchEvent(eventToDispatch); |
|
|
|
modal.classList.toggle('active'); |
|
|
|
modal.classList.toggle('active'); |
|
|
|
} |
|
|
|
} |
|
|
|
event.preventDefault(); // prevents rewriting url (apps can still use hash values in url)
|
|
|
|
event.preventDefault(); // prevents rewriting url (apps can still use hash values in url)
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
}()); |
|
|
|
}()); |
|
|
|