update components

This commit is contained in:
Luke Pulverenti 2016-02-01 12:02:17 -05:00
parent 2a72f0256e
commit 048ba20590
26 changed files with 1377 additions and 136 deletions

View file

@ -29,7 +29,7 @@
window.removeEventListener('popstate', onHashChange);
if (!self.closedByBack) {
if (!self.closedByBack && isHistoryEnabled(dlg)) {
var state = history.state || {};
if (state.dialogId == hash) {
history.back();
@ -60,9 +60,15 @@
removeScrollLockOnClose = true;
}
historyManager.pushState({ dialogId: hash }, "Dialog", hash);
if (isHistoryEnabled(dlg)) {
historyManager.pushState({ dialogId: hash }, "Dialog", hash);
window.addEventListener('popstate', onHashChange);
window.addEventListener('popstate', onHashChange);
}
}
function isHistoryEnabled(dlg) {
return dlg.getAttribute('data-history') == 'true';
}
function open(dlg) {
@ -76,7 +82,11 @@
function close(dlg) {
if (dlg.opened) {
history.back();
if (isHistoryEnabled(dlg)) {
history.back();
} else {
dlg.close();
}
}
}
@ -111,6 +121,10 @@
dlg.setAttribute('data-lockscroll', 'true');
}
if (options.enableHistory !== false) {
dlg.setAttribute('data-history', 'true');
}
// without this safari will scroll the background instead of the dialog contents
// but not needed here since this is already on top of an existing dialog
// but skip it in IE because it's causing the entire browser to hang