You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
841 B

/**
* Modals
* @param {type} $
* @param {type} window
* @param {type} document
* @param {type} name
* @returns {undefined}
*/
(function($, window, document, name) {
var CLASS_MODAL = $.className('modal');
var handle = function(event, target) {
if (target.tagName === 'A' && target.hash) {
var modal = document.getElementById(target.hash.replace('#', ''));
if (modal && modal.classList.contains(CLASS_MODAL)) {
return modal;
}
}
return false;
};
$.registerTarget({
name: name,
index: 50,
handle: handle,
target: false,
isReset: false,
isContinue: true
});
window.addEventListener('tap', function(event) {
if ($.targets.modal) {
event.detail.gesture.preventDefault(); //fixed hashchange
$.targets.modal.classList.toggle($.className('active'));
}
});
})(mui, window, document, 'modal');