Move hideAllModals() from hotkeys to utilities
This commit is contained in:
parent
d665f861a2
commit
cf796a1043
|
@ -1,10 +1,10 @@
|
|||
import { confirmEditWord, submitWordForm } from "./wordManagement";
|
||||
import { showSection, getIsDetailsPanelDisplayed, hideDetailsPanel } from "./displayToggles";
|
||||
import { showSection, hideDetailsPanel } from "./displayToggles";
|
||||
import { renderInfoModal, renderMaximizedTextbox } from "./render";
|
||||
import { showSearchModal, clearSearchText } from "./search";
|
||||
import { saveAndCloseSettingsModal, openSettingsModal, saveSettings } from "./settings";
|
||||
import { saveAndCloseEditModal, openEditModal } from "./dictionaryManagement";
|
||||
import { addMessage } from "./utilities";
|
||||
import { addMessage, hideAllModals } from "./utilities";
|
||||
|
||||
export function enableHotKeys() {
|
||||
document.addEventListener('keydown', hotKeyActions);
|
||||
|
@ -59,14 +59,6 @@ export function hotKeyActions(event) {
|
|||
}
|
||||
}
|
||||
|
||||
function hideAllModals() {
|
||||
const permanentModals = ['#searchModal', '#settingsModal', '#editModal'];
|
||||
const hideModals = document.querySelectorAll(permanentModals.join(',')),
|
||||
removeModals = document.querySelectorAll('.modal:not(' + permanentModals.join('):not(') + ')');
|
||||
Array.from(hideModals).forEach(modal => modal.style.display = 'none');
|
||||
Array.from(removeModals).forEach(modal => modal.parentElement.removeChild(modal));
|
||||
}
|
||||
|
||||
function toggleDetailsDisplay() {
|
||||
const activeTab = document.querySelector('#detailsSection nav li.active');
|
||||
console.log(activeTab);
|
||||
|
|
|
@ -152,6 +152,14 @@ export function addMessage(messageText, time = 5000, extraClass = false) {
|
|||
setTimeout(closeMessage, time);
|
||||
}
|
||||
|
||||
export function hideAllModals() {
|
||||
const permanentModals = ['#searchModal', '#settingsModal', '#editModal'];
|
||||
const hideModals = document.querySelectorAll(permanentModals.join(',')),
|
||||
removeModals = document.querySelectorAll('.modal:not(' + permanentModals.join('):not(') + ')');
|
||||
Array.from(hideModals).forEach(modal => modal.style.display = 'none');
|
||||
Array.from(removeModals).forEach(modal => modal.parentElement.removeChild(modal));
|
||||
}
|
||||
|
||||
export function hasToken() {
|
||||
return getCookie('token') !== '';
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue