mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-29 12:09:20 +03:00
Revamp aBootstrapDropdowns
This commit is contained in:
parent
8846c453b1
commit
31bb7267ec
4 changed files with 16 additions and 23 deletions
18
dev/bootstrap.js
vendored
18
dev/bootstrap.js
vendored
|
|
@ -1,5 +1,4 @@
|
|||
import { detectDropdownVisibility } from 'Common/Utils';
|
||||
import { $html, $htmlCL, data as GlobalsData, bMobileDevice } from 'Common/Globals';
|
||||
import { $html, $htmlCL, data as GlobalsData, bMobileDevice, dropdownVisibility } from 'Common/Globals';
|
||||
import * as Enums from 'Common/Enums';
|
||||
import * as Plugins from 'Common/Plugins';
|
||||
import { i18n } from 'Common/Translator';
|
||||
|
|
@ -30,12 +29,10 @@ export default (App) => {
|
|||
}
|
||||
}
|
||||
});
|
||||
addEventListener('unload', () => {
|
||||
GlobalsData.bUnload = true;
|
||||
});
|
||||
addEventListener('unload', () => GlobalsData.bUnload = true);
|
||||
|
||||
$htmlCL.add(bMobileDevice ? 'mobile' : 'no-mobile');
|
||||
$html.on('click.dropdown.data-api', detectDropdownVisibility);
|
||||
$html.on('click.dropdown.data-api', ()=>rl.Dropdowns.detectVisibility());
|
||||
|
||||
const rl = window.rl || {};
|
||||
|
||||
|
|
@ -51,6 +48,15 @@ export default (App) => {
|
|||
rl.EmailModel = EmailModel;
|
||||
rl.Enums = Enums;
|
||||
|
||||
rl.Dropdowns = [];
|
||||
rl.Dropdowns.registrate = function(element) {
|
||||
this.push(element);
|
||||
element.addEventListener('click', () => rl.Dropdowns.detectVisibility());
|
||||
};
|
||||
rl.Dropdowns.detectVisibility = (() =>
|
||||
dropdownVisibility(!!rl.Dropdowns.find(item => item.classList.contains('open')))
|
||||
).debounce(50);
|
||||
|
||||
window.rl = rl;
|
||||
|
||||
const start = () => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue