diff --git a/Entities/Floorplan_Decorations/View.fs b/Entities/Floorplan_Decorations/View.fs index a08b594..16ede38 100644 --- a/Entities/Floorplan_Decorations/View.fs +++ b/Entities/Floorplan_Decorations/View.fs @@ -13,10 +13,10 @@ let decoratorItem (imageName, imageUrl) = let decoratorRow decoratorItems = div [_class "decoratorRow"] [yield! decoratorItems] let decorator (decorationRows: XmlNode[]) = - div [_id "decorator"] [ + div [_id "decorator"; _class "modal"] [ div [_id "decoratorHeader"] [ h2 [] [lang "choose_decoration"] - a [_class "posButton hideDecorator"] [str "×"] + a [_class "posButton hideModals"] [str "×"] ] div [_id "decoratorContent"] [ yield! decorationRows diff --git a/typescript/dredgepos.core.ts b/typescript/dredgepos.core.ts index 561be3a..6bf3796 100644 --- a/typescript/dredgepos.core.ts +++ b/typescript/dredgepos.core.ts @@ -23,9 +23,7 @@ const lang = (key: string, replacements?: string[] | string) => { } /** Check if a variable is defined */ -const defined = (variable: any) => { - return typeof variable !== 'undefined' -} +const defined = (variable: any) => typeof variable !== 'undefined' /** Call an Ajax function asynchronously */ const ajax = (endpoint: string, data: any, method = 'POST', successFunction: Function, errorFunction: Function, beforeFunction: any) => { @@ -69,18 +67,17 @@ const ajaxSync = (endpoint: string, data?: any, method = 'POST') => { /* Redirect to a specific URL */ const redirect = (url: string): void => location.assign(url) -const resize = () => { - $('#pageContainer').height(window.innerHeight + "px"); -} +const resize = () => $('#pageContainer').height(window.innerHeight + "px"); const setupCore = (languageVars: Record) => { Application.languageVars = languageVars - const doc = $(document) - doc.on('click', '#alertNo, #alertOk', hideAlerts) - doc.on('click', '.toggle', toggle) + $(document) + .on('click', '#alertNo, #alertOk', hideAlerts) + .on('click', '.toggle', toggle) + .on('click', '.hideModals', hideModals) + window.addEventListener('resize', resize) resize() - setElementVisibilityByMode() } @@ -117,6 +114,7 @@ const confirmation = (message: string, data: any, title = 'Confirm', submitFunct const hideAlerts = () => $('#alert').hide() +const hideModals = () => $('.modal').hide() const turnOnMode = (mode: PosMode) => { Application.mode.push(mode)