mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-01 21:49: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
|
||||
|
|
|
|||
2
vendors/bootstrap/js/bootstrap.native.min.js
vendored
2
vendors/bootstrap/js/bootstrap.native.min.js
vendored
|
|
@ -4,4 +4,4 @@
|
|||
* Licensed under MIT (https://github.com/thednp/bootstrap.native/blob/master/LICENSE)
|
||||
*/
|
||||
|
||||
window.BSN=(()=>{"use strict";const e=document,t=e.body,s=e=>e.focus?e.focus():e.setActive();return{Dropdown:function(t){let o,n=[];const a=this,i=t.parentNode,r=e=>{const t=e.target,s=t.href||t.parentNode&&t.parentNode.href;s&&"#"===s.slice(-1)&&e.preventDefault()},d=()=>{let s=t.open?"addEventListener":"removeEventListener";e[s]("click",c,!1),e[s]("keydown",h,!1),e[s]("keyup",u,!1),e[s]("focus",c,!1)},c=e=>{let s=e.target,n=o.contains(s),i=s&&(s.getAttribute("data-toggle")||s.parentNode&&s.parentNode.getAttribute("data-toggle"));"focus"===e.type&&(s===t||n)||i&&n||(a.hide(),r(e))},l=e=>{a.show(),r(e)},h=e=>("ArrowUp"===e.code||"ArrowDown"===e.code)&&e.preventDefault(),u=i=>{let r=e.activeElement,d=r===t,c=o.contains(r),l=r.parentNode===o||r.parentNode.parentNode===o,h=n.indexOf(r);l&&(h=d?0:"ArrowUp"===i.code?h>1?h-1:0:"ArrowDown"===i.code&&h<n.length-1?h+1:h,n[h]&&s(n[h])),(n.length&&l||!n.length&&(c||d)||!c)&&t.open&&"Escape"===i.code&&a.toggle()};a.show=(()=>{o=i.querySelector(".dropdown-menu"),n=[],Array.from(o.children).forEach(e=>{e.children.length&&"A"===e.children[0].tagName&&n.push(e.children[0]),"A"===e.tagName&&n.push(e)}),!("tabindex"in o)&&o.setAttribute("tabindex","0"),o.classList.add("show"),i.classList.add("show"),t.setAttribute("aria-expanded",!0),t.open=!0,t.removeEventListener("click",l,!1),setTimeout(()=>{s(o.getElementsByTagName("INPUT")[0]||t),d()},1)}),a.hide=(()=>{o.classList.remove("show"),i.classList.remove("show"),t.setAttribute("aria-expanded",!1),t.open=!1,d(),s(t),setTimeout(()=>t.Dropdown&&t.addEventListener("click",l,!1),1)}),a.toggle=(()=>i.classList.contains("show")&&t.open?a.hide():a.show()),t.addEventListener("click",l,!1),t.open=!1,t.Dropdown=a},Modal:function(o){let n=!1;const a=o.classList,i=(e,t)=>{let s=parseFloat(getComputedStyle(e).transitionDuration),o=s=>{t&&t(s),t=0,e.removeEventListener("transitionend",o)};isFinite(s)&&s?e.addEventListener("transitionend",o):setTimeout(()=>{t&&t(),t=0},17)},r=()=>{!e.getElementsByClassName("modal show")[0]&&t.classList.add("modal-open"),a.add("show"),o.setAttribute("aria-hidden",!1),a.contains("fade")?i(o,d):d()},d=()=>{s(o),n=!1},c=()=>{t.classList.remove("modal-open"),n=!1};this.show=(()=>{a.contains("show")&&n||(n=!0,e.getElementsByClassName("modal show")[0]?r():setTimeout(r,0))}),this.hide=(()=>{a.contains("show")&&(n=!0,a.remove("show"),o.setAttribute("aria-hidden",!0),a.contains("fade")?i(o,c):c())}),o.Modal=this},Tab:class{constructor(e){this.element=e,e.Tab=this,e.addEventListener("click",e=>{e.preventDefault(),this.show()})}show(){const t=this.element,s=t.closest("li");if(!s.classList.contains("active")){const o=t.closest("ul").querySelector(".active a");o.closest("li").classList.remove("active"),e.querySelector(o.getAttribute("href")).classList.remove("active"),s.classList.add("active"),e.querySelector(t.getAttribute("href")).classList.add("active")}}}}})();
|
||||
window.BSN=(()=>{"use strict";const e=document,t=e=>e.focus?e.focus():e.setActive();return{Dropdown:function(s){let o,n=[];const r=this,a=s.parentNode,i=e=>{const t=e.target,s=t.href||t.parentNode&&t.parentNode.href;s&&"#"===s.slice(-1)&&e.preventDefault()},c=()=>{let t=s.open?"addEventListener":"removeEventListener";e[t]("click",d,!1),e[t]("keydown",h,!1),e[t]("keyup",p,!1),e[t]("focus",d,!1)},d=e=>{let t=e.target,n=o.contains(t),a=t&&(t.getAttribute("data-toggle")||t.parentNode&&t.parentNode.getAttribute("data-toggle"));"focus"===e.type&&(t===s||n)||a&&n||(r.hide(),i(e))},l=e=>{r.show(),i(e)},h=e=>("ArrowUp"===e.code||"ArrowDown"===e.code)&&e.preventDefault(),p=a=>{let i=e.activeElement,c=i===s,d=o.contains(i),l=i.parentNode===o||i.parentNode.parentNode===o,h=n.indexOf(i);l&&(h=c?0:"ArrowUp"===a.code?h>1?h-1:0:"ArrowDown"===a.code&&h<n.length-1?h+1:h,n[h]&&t(n[h])),(n.length&&l||!n.length&&(d||c)||!d)&&s.open&&"Escape"===a.code&&r.toggle()};r.show=(()=>{o=a.querySelector(".dropdown-menu"),n=[],Array.from(o.children).forEach(e=>{e.children.length&&"A"===e.children[0].tagName&&n.push(e.children[0]),"A"===e.tagName&&n.push(e)}),!("tabindex"in o)&&o.setAttribute("tabindex","0"),o.classList.add("show"),a.classList.add("show"),s.setAttribute("aria-expanded",!0),s.open=!0,s.removeEventListener("click",l,!1),setTimeout(()=>{t(o.getElementsByTagName("INPUT")[0]||s),c()},1)}),r.hide=(()=>{o.classList.remove("show"),a.classList.remove("show"),s.setAttribute("aria-expanded",!1),s.open=!1,c(),t(s),setTimeout(()=>s.Dropdown&&s.addEventListener("click",l,!1),1)}),r.toggle=(()=>a.classList.contains("show")&&s.open?r.hide():r.show()),s.addEventListener("click",l,!1),s.open=!1,s.Dropdown=r},Tab:class{constructor(e){this.element=e,e.Tab=this,e.addEventListener("click",e=>{e.preventDefault(),this.show()})}show(){const t=this.element,s=t.closest("li");if(!s.classList.contains("active")){const o=t.closest("ul").querySelector(".active a");o.closest("li").classList.remove("active"),e.querySelector(o.getAttribute("href")).classList.remove("active"),s.classList.add("active"),e.querySelector(t.getAttribute("href")).classList.add("active")}}}}})();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue