mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-31 21:19:21 +03:00
Remove bootstrap Modal feature for improved transition effects (in future might use <dialog>)
This commit is contained in:
parent
0309879d6b
commit
7135cc38fe
82 changed files with 1767 additions and 3990 deletions
46
vendors/bootstrap/js/bootstrap.native.js
vendored
46
vendors/bootstrap/js/bootstrap.native.js
vendored
|
|
@ -8,7 +8,6 @@ window.BSN = (() => {
|
|||
'use strict';
|
||||
|
||||
const doc = document,
|
||||
body = doc.body,
|
||||
setFocus = element => element.focus ? element.focus() : element.setActive();
|
||||
|
||||
return {
|
||||
|
|
@ -98,51 +97,6 @@ window.BSN = (() => {
|
|||
element.Dropdown = self;
|
||||
},
|
||||
|
||||
Modal: function(modal) {
|
||||
let isAnimating = false;
|
||||
const mcl = modal.classList,
|
||||
emulateTransitionEnd = (element,handler) => {
|
||||
let transitionEndEvent = 'transitionend',
|
||||
duration = parseFloat(getComputedStyle(element).transitionDuration),
|
||||
transitionEndWrapper = e => {
|
||||
handler && handler(e), handler = 0;
|
||||
element.removeEventListener( transitionEndEvent, transitionEndWrapper);
|
||||
};
|
||||
(isFinite(duration) && duration)
|
||||
? element.addEventListener( transitionEndEvent, transitionEndWrapper )
|
||||
: setTimeout(() => { handler && handler(), handler = 0; }, 17);
|
||||
},
|
||||
beforeShow = () => {
|
||||
!doc.getElementsByClassName('modal show')[0] && body.classList.add('modal-open');
|
||||
mcl.add('show');
|
||||
modal.setAttribute('aria-hidden', false);
|
||||
mcl.contains('fade') ? emulateTransitionEnd(modal, triggerShow) : triggerShow();
|
||||
},
|
||||
triggerShow = () => {
|
||||
setFocus(modal);
|
||||
isAnimating = false;
|
||||
},
|
||||
triggerHide = () => {
|
||||
body.classList.remove('modal-open');
|
||||
isAnimating = false;
|
||||
};
|
||||
this.show = () => {
|
||||
if (!mcl.contains('show') || !isAnimating) {
|
||||
isAnimating = true;
|
||||
doc.getElementsByClassName('modal show')[0] ? beforeShow() : setTimeout( beforeShow, 0 );
|
||||
}
|
||||
};
|
||||
this.hide = () => {
|
||||
if (mcl.contains('show') ) {
|
||||
isAnimating = true;
|
||||
mcl.remove('show');
|
||||
modal.setAttribute('aria-hidden', true);
|
||||
mcl.contains('fade') ? emulateTransitionEnd(modal, triggerHide) : triggerHide();
|
||||
}
|
||||
};
|
||||
modal.Modal = this;
|
||||
},
|
||||
|
||||
Tab: class {
|
||||
constructor(element) {
|
||||
this.element = element
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue