estreui 1.2.3 → 1.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.html +8 -1
- package/package.json +13 -5
- package/scripts/alienese.js +282 -275
- package/scripts/boot.js +107 -67
- package/scripts/doctre.js +330 -6
- package/scripts/estreU0EEOZ.js +25 -4
- package/scripts/estreUi-core.js +555 -0
- package/scripts/estreUi-dialog.js +511 -0
- package/scripts/estreUi-handles.js +7243 -0
- package/scripts/estreUi-interaction.js +1374 -0
- package/scripts/estreUi-main.js +1667 -0
- package/scripts/estreUi-notation.js +596 -0
- package/scripts/estreUi-pageManager.js +625 -0
- package/scripts/estreUi-pageModel.js +4317 -0
- package/scripts/modernism.js +44 -3
- package/serviceWorker.js +10 -3
- package/scripts/estreUi.js +0 -16337
|
@@ -0,0 +1,1667 @@
|
|
|
1
|
+
/*
|
|
2
|
+
EstreUI rimwork — estreStruct, estreUi singleton, DOM init
|
|
3
|
+
Part of the split from estreUi.js (roadmap #002 phase 2).
|
|
4
|
+
|
|
5
|
+
This file is loaded as a plain <script> tag and shares the global scope
|
|
6
|
+
with the other estreUi-*.js files. Load order matters: see index.html.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
// MODULE: Main -- estreStruct, estreUi singleton, DOM initialization
|
|
10
|
+
// ======================================================================
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
const estreStruct = {
|
|
15
|
+
structureSuffix: ".json",
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const estreUi = {
|
|
19
|
+
|
|
20
|
+
//constant
|
|
21
|
+
overlaySections: {},
|
|
22
|
+
overlaySectionList: [],
|
|
23
|
+
|
|
24
|
+
blindSections: {},
|
|
25
|
+
blindSectionList: [],
|
|
26
|
+
|
|
27
|
+
mainSections: {},
|
|
28
|
+
mainSectionList: [],
|
|
29
|
+
|
|
30
|
+
menuSections: {},
|
|
31
|
+
menuSectionList: [],
|
|
32
|
+
get menuArea() { return this.menuSections["menuArea"]; },
|
|
33
|
+
|
|
34
|
+
headerSections: {},
|
|
35
|
+
headerSectionList: [],
|
|
36
|
+
get appbar() { return this.headerSections["appbar"]; },
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
//static property
|
|
40
|
+
overlayCurrentOnTop: null,
|
|
41
|
+
blindedCurrentOnTop: null,
|
|
42
|
+
mainCurrentOnTop: null,
|
|
43
|
+
menuCurrentOnTop: null,
|
|
44
|
+
headerCurrentOnTop: null,
|
|
45
|
+
|
|
46
|
+
//static getter
|
|
47
|
+
get currentTopComponent() {
|
|
48
|
+
return this.blindedCurrentOnTop ?? (this.isOpenMainMenu ? this.menuCurrentOnTop : null) ?? this.mainCurrentOnTop;
|
|
49
|
+
},
|
|
50
|
+
get currentTopPage() {
|
|
51
|
+
return this.currentTopComponent?.currentTop?.currentTop;
|
|
52
|
+
},
|
|
53
|
+
get currentTopPid() {
|
|
54
|
+
return EstreUiPage.from(this.currentTopPage)?.pid;
|
|
55
|
+
},
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
get showingOverlayTopArticle() {
|
|
59
|
+
const currentTopArticle = this.overlayCurrentOnTop?.currentTop?.currentTop;
|
|
60
|
+
if (currentTopArticle != null && currentTopArticle.isShowing) return currentTopArticle;
|
|
61
|
+
},
|
|
62
|
+
|
|
63
|
+
get showingBlindedTopArticle() {
|
|
64
|
+
const currentTopArticle = this.blindedCurrentOnTop?.currentTop?.currentTop;
|
|
65
|
+
if (currentTopArticle != null && currentTopArticle.isShowing) return currentTopArticle;
|
|
66
|
+
},
|
|
67
|
+
|
|
68
|
+
get showingMenuTopArticle() {
|
|
69
|
+
if (this.isOpenMainMenu) {
|
|
70
|
+
const currentTopArticle = this.menuCurrentOnTop?.currentTop?.currentTop;
|
|
71
|
+
if (currentTopArticle != null && currentTopArticle.isShowing) return currentTopArticle;
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
|
|
75
|
+
get showingMainTopArticle() {
|
|
76
|
+
const currentTopArticle = this.mainCurrentOnTop?.currentTop?.currentTop;
|
|
77
|
+
if (currentTopArticle != null && currentTopArticle.isShowing) return currentTopArticle;
|
|
78
|
+
},
|
|
79
|
+
|
|
80
|
+
get showingTopArticle() {
|
|
81
|
+
return this.showingOverlayTopArticle ?? this.showingBlindedTopArticle ?? this.showingMenuTopArticle ?? this.showingMainTopArticle;
|
|
82
|
+
},
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
//elements
|
|
86
|
+
$fixedBottom: null,
|
|
87
|
+
$tabsbar: null,
|
|
88
|
+
$rootbar: null,
|
|
89
|
+
$rootTabs: null,
|
|
90
|
+
|
|
91
|
+
$overlayArea: null,
|
|
92
|
+
get $overlaySections() { return this.$overlayArea.find(c.c + se); },
|
|
93
|
+
|
|
94
|
+
$blindArea: null,
|
|
95
|
+
get $blindSections() { return this.$blindArea.find(c.c + se); },
|
|
96
|
+
|
|
97
|
+
$mainArea: null,
|
|
98
|
+
get $mainSections() { return this.$mainArea.find(c.c + se); },
|
|
99
|
+
|
|
100
|
+
$mainMenu: null,
|
|
101
|
+
get $menuSections() { return this.$mainMenu.find(c.c + se); },
|
|
102
|
+
$menuArea: null,
|
|
103
|
+
$grabArea: null,
|
|
104
|
+
|
|
105
|
+
$fixedTop: null,
|
|
106
|
+
get $headerSections() { return this.$fixedTop.find(c.c + se); },
|
|
107
|
+
$appbar: null,
|
|
108
|
+
$homeBtn: null,
|
|
109
|
+
$mainMenuBtn: null,
|
|
110
|
+
$mainMenuBtnLottie: null,
|
|
111
|
+
|
|
112
|
+
$more: null,
|
|
113
|
+
$sessionManager: null,
|
|
114
|
+
$sessionGroupHolder: null,
|
|
115
|
+
$fixedPages: null,
|
|
116
|
+
$fixedPageList: null,
|
|
117
|
+
$openedPages: null,
|
|
118
|
+
$openedPageList: null,
|
|
119
|
+
|
|
120
|
+
$handlePrototypes: null,
|
|
121
|
+
|
|
122
|
+
//handles
|
|
123
|
+
menuSwipeHandler: null,
|
|
124
|
+
|
|
125
|
+
//properties
|
|
126
|
+
euiState: "exit",
|
|
127
|
+
initialHistoryOffset: null,
|
|
128
|
+
isBackwardFlow: false,
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
prevRootTabIds: new Set(),
|
|
132
|
+
get latestRootTabId() { return [...this.prevRootTabIds].pop(); },
|
|
133
|
+
get prevRootTabId() {
|
|
134
|
+
const rootTabIds = this.mainSections.ways;
|
|
135
|
+
let latestRootTabId = null;
|
|
136
|
+
while (latestRootTabId = this.latestRootTabId) {
|
|
137
|
+
this.prevRootTabIds.delete(latestRootTabId);
|
|
138
|
+
if (rootTabIds.includes(latestRootTabId)) return latestRootTabId;
|
|
139
|
+
}
|
|
140
|
+
return null;
|
|
141
|
+
},
|
|
142
|
+
set prevRootTabId(id) {
|
|
143
|
+
if (id == null) return;
|
|
144
|
+
if (this.prevRootTabIds.has(id)) this.prevRootTabIds.delete(id);
|
|
145
|
+
this.prevRootTabIds.add(id);
|
|
146
|
+
},
|
|
147
|
+
|
|
148
|
+
prevBlindedIds: new Set(),
|
|
149
|
+
get latestBlindedId() { return [...this.prevBlindedIds].pop(); },
|
|
150
|
+
get prevBlindedId() {
|
|
151
|
+
const blindedIds = this.blindSections.ways;
|
|
152
|
+
let latestBlindedId = null;
|
|
153
|
+
while (latestBlindedId = this.latestBlindedId) {
|
|
154
|
+
this.prevBlindedIds.delete(latestBlindedId);
|
|
155
|
+
if (blindedIds.includes(latestBlindedId)) return latestBlindedId;
|
|
156
|
+
}
|
|
157
|
+
return null;
|
|
158
|
+
},
|
|
159
|
+
set prevBlindedId(id) {
|
|
160
|
+
if (id == null) return;
|
|
161
|
+
if (this.prevBlindedIds.has(id)) this.prevBlindedIds.delete(id);
|
|
162
|
+
this.prevBlindedIds.add(id);
|
|
163
|
+
},
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
//getter and setter
|
|
167
|
+
get isOpenMainMenu() { return this.$mainMenu.attr(eds.opened) == t1; },
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
//links (object redirection)
|
|
172
|
+
get unifiedCalendar() { return this.mainSections.calendar.containers.root.articles.main.handles[uis.unifiedCalendar][0]; },
|
|
173
|
+
get stockCalendar() { return this.unifiedCalendar.calendar; },
|
|
174
|
+
get stockScheduler() { return this.unifiedCalendar.scheduler; },
|
|
175
|
+
|
|
176
|
+
//inits
|
|
177
|
+
init(setOnReady = true) {
|
|
178
|
+
EstreHandle.commit();
|
|
179
|
+
EstreUiPage.commit();
|
|
180
|
+
scheduleDataSet.commit();
|
|
181
|
+
|
|
182
|
+
this.$blindArea = $("main#instantDoc");
|
|
183
|
+
|
|
184
|
+
this.$mainArea = $("main#staticDoc");
|
|
185
|
+
|
|
186
|
+
this.$overlayArea = $("nav#managedOverlay");
|
|
187
|
+
|
|
188
|
+
this.$mainMenu = $("nav#mainMenu");
|
|
189
|
+
|
|
190
|
+
this.$fixedTop = $("header#fixedTop");
|
|
191
|
+
|
|
192
|
+
this.$fixedBottom = $("#fixedBottom");
|
|
193
|
+
|
|
194
|
+
this.$handlePrototypes = $("section#handlePrototypes");
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
// events
|
|
198
|
+
this.setReload();
|
|
199
|
+
this.setBackNavigation();
|
|
200
|
+
this.setMenuSwipeHandler();
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
const onLoadedFixedBottom = async _ => {
|
|
204
|
+
this.$tabsbar = this.$fixedBottom.find(".tabsbar");
|
|
205
|
+
this.$rootbar = this.$fixedBottom.find("nav#rootbar");
|
|
206
|
+
this.initRootbar();
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
const onLoadedFixedTop = subTerm => {
|
|
210
|
+
this.$appbar = this.$fixedTop.find("section#appbar");
|
|
211
|
+
this.$homeBtn = this.$appbar.find("button#home");
|
|
212
|
+
this.$mainMenuBtn = this.$appbar.find("button#mainMenuBtn");
|
|
213
|
+
this.$mainMenuBtnLottie = this.$mainMenuBtn.find(uis.dotlottiePlayer);
|
|
214
|
+
|
|
215
|
+
this.$mainMenuBtn.click(this.mainMenuBtnOnClick);
|
|
216
|
+
return this.initHeaderBars(subTerm);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
const onLoadedStaticDoc = subTerm => {
|
|
220
|
+
return this.initStaticContents(subTerm);
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
const onLoadedInstantDoc = subTerm => {
|
|
224
|
+
return this.initInstantContents(subTerm);
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
const onLoadedManagedOverlay = subTerm => {
|
|
228
|
+
return this.initOverlayContents(subTerm);
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
const onLoadedMainMenu = subTerm => {
|
|
232
|
+
this.$menuArea = this.$mainMenu.find("section#menuArea");
|
|
233
|
+
this.$grabArea = this.$mainMenu.find("section#grabArea");
|
|
234
|
+
|
|
235
|
+
this.$grabArea.click(this.mainMenuGrabAreaOnclick);
|
|
236
|
+
return this.initStaticMenus(subTerm);
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+
const loadExported = url => fetch(url).then(response => {
|
|
241
|
+
if (!response.ok) throw new Error('Network response was not ok');
|
|
242
|
+
return response.text();
|
|
243
|
+
});
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
let loadExportedFixedBottom;
|
|
247
|
+
loadExportedFixedBottom = (_, attempt = 0) => loadExported("fixedBottom.html").then(htmlContent => {
|
|
248
|
+
this.$fixedBottom.prepend(htmlContent);
|
|
249
|
+
return onLoadedFixedBottom();
|
|
250
|
+
}).catch(error => {
|
|
251
|
+
const delay = Math.min(1000 * Math.pow(2, attempt), 30000);
|
|
252
|
+
console.error("There has been a problem with your fetch operation for fixedBottom: ", error);
|
|
253
|
+
console.log(`Retrying to load fixedBottom in ${delay}ms...`);
|
|
254
|
+
return postPromise(resolve => setTimeout(resolve, delay))
|
|
255
|
+
.then(() => loadExportedFixedBottom(_, attempt + 1));
|
|
256
|
+
});
|
|
257
|
+
|
|
258
|
+
let loadExportedFixedTop;
|
|
259
|
+
loadExportedFixedTop = (subTerm, attempt = 0) => loadExported("fixedTop.html").then(htmlContent => {
|
|
260
|
+
this.$fixedTop.prepend(htmlContent);
|
|
261
|
+
return onLoadedFixedTop(subTerm);
|
|
262
|
+
}).catch(error => {
|
|
263
|
+
const delay = Math.min(1000 * Math.pow(2, attempt), 30000);
|
|
264
|
+
console.error("There has been a problem with your fetch operation for fixedTop: ", error);
|
|
265
|
+
console.log(`Retrying to load fixedTop in ${delay}ms...`);
|
|
266
|
+
return postPromise(resolve => setTimeout(resolve, delay))
|
|
267
|
+
.then(() => loadExportedFixedTop(subTerm, attempt + 1));
|
|
268
|
+
});
|
|
269
|
+
|
|
270
|
+
let loadExportedStaticDoc;
|
|
271
|
+
loadExportedStaticDoc = (subTerm, attempt = 0) => loadExported("staticDoc.html").then(htmlContent => {
|
|
272
|
+
this.$mainArea.prepend(htmlContent);
|
|
273
|
+
return onLoadedStaticDoc(subTerm);
|
|
274
|
+
}).catch(error => {
|
|
275
|
+
const delay = Math.min(1000 * Math.pow(2, attempt), 30000);
|
|
276
|
+
console.error("There has been a problem with your fetch operation for staticDoc: ", error);
|
|
277
|
+
console.log(`Retrying to load staticDoc in ${delay}ms...`);
|
|
278
|
+
return postPromise(resolve => setTimeout(resolve, delay))
|
|
279
|
+
.then(() => loadExportedStaticDoc(subTerm, attempt + 1));
|
|
280
|
+
});
|
|
281
|
+
|
|
282
|
+
let loadExportedInstantDoc;
|
|
283
|
+
loadExportedInstantDoc = (subTerm, attempt = 0) => loadExported("instantDoc.html").then(htmlContent => {
|
|
284
|
+
this.$blindArea.prepend(htmlContent);
|
|
285
|
+
return onLoadedInstantDoc(subTerm);
|
|
286
|
+
}).catch(error => {
|
|
287
|
+
const delay = Math.min(1000 * Math.pow(2, attempt), 30000);
|
|
288
|
+
console.error("There has been a problem with your fetch operation for instantDoc: ", error);
|
|
289
|
+
console.log(`Retrying to load instantDoc in ${delay}ms...`);
|
|
290
|
+
return postPromise(resolve => setTimeout(resolve, delay))
|
|
291
|
+
.then(() => loadExportedInstantDoc(subTerm, attempt + 1));
|
|
292
|
+
});
|
|
293
|
+
|
|
294
|
+
let loadExportedManagedOverlay;
|
|
295
|
+
loadExportedManagedOverlay = (subTerm, attempt = 0) => loadExported("managedOverlay.html").then(htmlContent => {
|
|
296
|
+
this.$overlayArea.prepend(htmlContent);
|
|
297
|
+
return onLoadedManagedOverlay(subTerm);
|
|
298
|
+
}).catch(error => {
|
|
299
|
+
const delay = Math.min(1000 * Math.pow(2, attempt), 30000);
|
|
300
|
+
console.error("There has been a problem with your fetch operation for managedOverlay: ", error);
|
|
301
|
+
console.log(`Retrying to load managedOverlay in ${delay}ms...`);
|
|
302
|
+
return postPromise(resolve => setTimeout(resolve, delay))
|
|
303
|
+
.then(() => loadExportedManagedOverlay(subTerm, attempt + 1));
|
|
304
|
+
});
|
|
305
|
+
|
|
306
|
+
let loadExportedMainMenu;
|
|
307
|
+
loadExportedMainMenu = (subTerm, attempt = 0) => loadExported("mainMenu.html").then(htmlContent => {
|
|
308
|
+
this.$mainMenu.prepend(htmlContent);
|
|
309
|
+
return onLoadedMainMenu(subTerm);
|
|
310
|
+
}).catch(error => {
|
|
311
|
+
const delay = Math.min(1000 * Math.pow(2, attempt), 30000);
|
|
312
|
+
console.error("There has been a problem with your fetch operation for mainMenu: ", error);
|
|
313
|
+
console.log(`Retrying to load mainMenu in ${delay}ms...`);
|
|
314
|
+
return postPromise(resolve => setTimeout(resolve, delay))
|
|
315
|
+
.then(() => loadExportedMainMenu(subTerm, attempt + 1));
|
|
316
|
+
});
|
|
317
|
+
|
|
318
|
+
let loadExportedStockHandlePrototypes;
|
|
319
|
+
loadExportedStockHandlePrototypes = (_, attempt = 0) => loadExported("stockHandlePrototypes.html").then(htmlContent => {
|
|
320
|
+
this.$handlePrototypes.prepend(htmlContent);
|
|
321
|
+
return true;
|
|
322
|
+
}).catch(error => {
|
|
323
|
+
const delay = Math.min(1000 * Math.pow(2, attempt), 30000);
|
|
324
|
+
console.error("There has been a problem with your fetch operation for stockHandlePrototypes: ", error);
|
|
325
|
+
console.log(`Retrying to load stockHandlePrototypes in ${delay}ms...`);
|
|
326
|
+
return postPromise(resolve => setTimeout(resolve, delay))
|
|
327
|
+
.then(() => loadExportedStockHandlePrototypes(_, attempt + 1));
|
|
328
|
+
});
|
|
329
|
+
|
|
330
|
+
let loadExportedCustomHandlePrototypes;
|
|
331
|
+
loadExportedCustomHandlePrototypes = (_, attempt = 0) => loadExported("customHandlePrototypes.html").then(htmlContent => {
|
|
332
|
+
this.$handlePrototypes.append(htmlContent);
|
|
333
|
+
return true;
|
|
334
|
+
}).catch(error => {
|
|
335
|
+
const delay = Math.min(1000 * Math.pow(2, attempt), 30000);
|
|
336
|
+
console.error("There has been a problem with your fetch operation for customHandlePrototypes: ", error);
|
|
337
|
+
console.log(`Retrying to load customHandlePrototypes in ${delay}ms...`);
|
|
338
|
+
return postPromise(resolve => setTimeout(resolve, delay))
|
|
339
|
+
.then(() => loadExportedCustomHandlePrototypes(_, attempt + 1));
|
|
340
|
+
});
|
|
341
|
+
|
|
342
|
+
|
|
343
|
+
//common element initializing
|
|
344
|
+
const term = 1;//isIPhone ? 1000 : 1;
|
|
345
|
+
const subTerm = 0;//isIPhone ? 200 : 0;
|
|
346
|
+
const delayer = (delay = term) => postPromise(resolve => setTimeout(resolve, delay));
|
|
347
|
+
return postAsyncQueue(async _ => {
|
|
348
|
+
// await delayer();
|
|
349
|
+
const handlePrototypesLoader = [];
|
|
350
|
+
if (this.$handlePrototypes.attr(eds.exported) == t1) {
|
|
351
|
+
handlePrototypesLoader.push(loadExportedStockHandlePrototypes());
|
|
352
|
+
handlePrototypesLoader.push(loadExportedCustomHandlePrototypes());
|
|
353
|
+
}
|
|
354
|
+
await Promise.all(handlePrototypesLoader);
|
|
355
|
+
|
|
356
|
+
pageManager.init();
|
|
357
|
+
|
|
358
|
+
const topBottomLoader = [
|
|
359
|
+
this.$fixedBottom.attr(eds.exported) == t1 ? loadExportedFixedBottom() : onLoadedFixedBottom(),
|
|
360
|
+
this.$fixedTop.attr(eds.exported) == t1 ? loadExportedFixedTop(subTerm) : onLoadedFixedTop(subTerm),
|
|
361
|
+
];
|
|
362
|
+
|
|
363
|
+
const mainLoader = [
|
|
364
|
+
this.$overlayArea.attr(eds.exported) == t1 ? loadExportedManagedOverlay(subTerm) : onLoadedManagedOverlay(subTerm),
|
|
365
|
+
postAsyncQueue(async _ => {
|
|
366
|
+
await Promise.all(topBottomLoader);
|
|
367
|
+
return await (this.$mainArea.attr(eds.exported) == t1 ? loadExportedStaticDoc(subTerm) : onLoadedStaticDoc(subTerm));
|
|
368
|
+
}),
|
|
369
|
+
this.$blindArea.attr(eds.exported) == t1 ? loadExportedInstantDoc(subTerm) : onLoadedInstantDoc(subTerm),
|
|
370
|
+
];
|
|
371
|
+
|
|
372
|
+
await Promise.all(mainLoader);
|
|
373
|
+
|
|
374
|
+
await (this.$mainMenu.attr(eds.exported) == t1 ? loadExportedMainMenu(subTerm) : onLoadedMainMenu(subTerm));
|
|
375
|
+
|
|
376
|
+
this.initSessionManager();
|
|
377
|
+
|
|
378
|
+
|
|
379
|
+
// $("#splashRoot").css("z-index", null);
|
|
380
|
+
|
|
381
|
+
window.addEventListener("focus", (e) => {
|
|
382
|
+
// note("onFocus");
|
|
383
|
+
this.onFocus();
|
|
384
|
+
});
|
|
385
|
+
window.addEventListener("blur", (e) => {
|
|
386
|
+
// note("onBlur");
|
|
387
|
+
this.onBlur();
|
|
388
|
+
});
|
|
389
|
+
|
|
390
|
+
if (setOnReady) this.checkOnReady();
|
|
391
|
+
});
|
|
392
|
+
},
|
|
393
|
+
|
|
394
|
+
setReload() {
|
|
395
|
+
const inst = this;
|
|
396
|
+
$(window).on("keydown", function (e) {
|
|
397
|
+
if ((e.which || e.keyCode) == 116) {
|
|
398
|
+
if (!e.ctrlKey) {
|
|
399
|
+
e.preventDefault();
|
|
400
|
+
inst.onReload();
|
|
401
|
+
return false;
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
});
|
|
405
|
+
},
|
|
406
|
+
|
|
407
|
+
setBackNavigation() {
|
|
408
|
+
const inst = this;
|
|
409
|
+
window.addEventListener("popstate", async function (e) {
|
|
410
|
+
const state = e.state;
|
|
411
|
+
|
|
412
|
+
if (state?.offset != null && state?.offset <= history.length) {
|
|
413
|
+
inst.isBackwardFlow = true;
|
|
414
|
+
|
|
415
|
+
if (await inst.onBack()) {
|
|
416
|
+
// note("[" + history.length + "] poped - " + history.state?.euiState + " / [" + history.state?.offset + "] " + history.state?.currentTopPid);
|
|
417
|
+
|
|
418
|
+
} else {
|
|
419
|
+
if (history.length < inst.initialHistoryOffset + 1 || state?.euiState == "initializing") {
|
|
420
|
+
note(EsLocale.get("exitApplicationWhenPressBackAgain"));
|
|
421
|
+
// inst.pushCurrentState(inst.currentTopPage, state);
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
inst.isBackwardFlow = false;
|
|
426
|
+
}
|
|
427
|
+
}, false);
|
|
428
|
+
|
|
429
|
+
// window.addEventListener("pageshow", async function (e) {
|
|
430
|
+
// if (await inst.onBack()) {
|
|
431
|
+
// e.preventDefault();
|
|
432
|
+
// note("prevented");
|
|
433
|
+
// return false;
|
|
434
|
+
// }
|
|
435
|
+
// });
|
|
436
|
+
|
|
437
|
+
// $(window).on("beforeunload", async function(e) {
|
|
438
|
+
// if (await inst.onBack()) {
|
|
439
|
+
// e.preventDefault();
|
|
440
|
+
// e.returnValue = "";
|
|
441
|
+
// return false;
|
|
442
|
+
// } else {
|
|
443
|
+
// alert(e.type);
|
|
444
|
+
// }
|
|
445
|
+
// });
|
|
446
|
+
},
|
|
447
|
+
|
|
448
|
+
pushCurrentState(pageHandle = this.currentTopPage, currentState = history.state) {
|
|
449
|
+
if (this.isBackwardFlow) return false;
|
|
450
|
+
let currentTopPid = currentState?.currentTopPid;
|
|
451
|
+
|
|
452
|
+
if (pageHandle != null && currentTopPid == null) {
|
|
453
|
+
const sectionBound = pageHandle.sectionBound;
|
|
454
|
+
if (sectionBound != "main" && sectionBound != "blind" && sectionBound != "menu") return false;
|
|
455
|
+
|
|
456
|
+
currentTopPid = pageHandle != null ? EstreUiPage.from(pageHandle)?.pid : null;
|
|
457
|
+
}
|
|
458
|
+
// if (currentTopPid == null) currentTopPid = this.currentTopPid;
|
|
459
|
+
if (currentTopPid == null) return false;
|
|
460
|
+
|
|
461
|
+
const euiState = currentState?.euiState ?? this.euiState;
|
|
462
|
+
const offset = currentState?.offset ?? history.length;
|
|
463
|
+
history.pushState({ euiState, currentTopPid, offset }, null);
|
|
464
|
+
// note("[" + history.length + "] pushed - " + euiState + " / [" + offset + "] " + currentTopPid);
|
|
465
|
+
|
|
466
|
+
return true;
|
|
467
|
+
},
|
|
468
|
+
|
|
469
|
+
replaceCurrentState(pageHandle = this.currentTopPage) {
|
|
470
|
+
if (pageHandle != null) {
|
|
471
|
+
const sectionBound = pageHandle.sectionBound;
|
|
472
|
+
if (sectionBound != "main" && sectionBound != "blind" && sectionBound != "menu") return false;
|
|
473
|
+
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
let currentTopPid = pageHandle != null ? EstreUiPage.from(pageHandle)?.pid : null;
|
|
477
|
+
// if (currentTopPid == null) currentTopPid = this.currentTopPid;
|
|
478
|
+
|
|
479
|
+
if (currentTopPid != null) {
|
|
480
|
+
if (currentTopPid == history.state?.currentTopPid) return false;
|
|
481
|
+
|
|
482
|
+
if (history.state != null) this.pushCurrentState();
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
const euiState = this.euiState;
|
|
486
|
+
const offset = history.length;
|
|
487
|
+
history.replaceState({ euiState, currentTopPid, offset }, null);
|
|
488
|
+
// note("[" + history.length + "] replaced - " + euiState + " / [" + offset + "] " + currentTopPid);
|
|
489
|
+
|
|
490
|
+
return true;
|
|
491
|
+
},
|
|
492
|
+
|
|
493
|
+
|
|
494
|
+
//mainMenu
|
|
495
|
+
setMenuSwipeHandler() {
|
|
496
|
+
if (this.$mainMenu.length > 0) {
|
|
497
|
+
this.releaseMenuSwipeHandler();
|
|
498
|
+
const ui = this;
|
|
499
|
+
this.menuSwipeHandler = new EstreSwipeHandler(this.$mainMenu).unuseY().setOnUp(function(grabX, grabY, handled, canceled, directed) {
|
|
500
|
+
if (window.isVerbosely) console.log("grabX: " + grabX + ", grabY: " + grabY + ", lastX: " + this.lastX + ", startX: " + this.startX);
|
|
501
|
+
if (handled) {
|
|
502
|
+
const isOpen = ui.$mainMenu.hasClass("right") ? grabX < 0 : grabX > 0;
|
|
503
|
+
setTimeout(_ => {
|
|
504
|
+
if (isOpen) ui.openMainMenu();
|
|
505
|
+
else ui.closeMainMenu();
|
|
506
|
+
}, 0);
|
|
507
|
+
}
|
|
508
|
+
});
|
|
509
|
+
}
|
|
510
|
+
},
|
|
511
|
+
|
|
512
|
+
releaseMenuSwipeHandler() {
|
|
513
|
+
if (this.menuSwipeHandler != null) this.menuSwipeHandler.release();
|
|
514
|
+
},
|
|
515
|
+
|
|
516
|
+
mainMenuBtnOnClick(e) {
|
|
517
|
+
estreUi.toggleMainMenuButton();
|
|
518
|
+
},
|
|
519
|
+
|
|
520
|
+
mainMenuGrabAreaOnclick(e) {
|
|
521
|
+
estreUi.closeMainMenu();
|
|
522
|
+
},
|
|
523
|
+
|
|
524
|
+
toggleMainMenuButton() {
|
|
525
|
+
if (this.isOpenMainMenu) return this.closeMainMenu();
|
|
526
|
+
else return this.openMainMenu();
|
|
527
|
+
},
|
|
528
|
+
|
|
529
|
+
openMainMenu() {
|
|
530
|
+
if (!this.isOpenMainMenu) {
|
|
531
|
+
this.$mainMenu.attr(eds.opened, t1);
|
|
532
|
+
const $top = this.$menuSections.filter(asv(eds.onTop, t1));
|
|
533
|
+
const menuCurrentTop = $top[$top.length - 1]?.pageHandle;//?.focus();
|
|
534
|
+
if (menuCurrentTop != null) {
|
|
535
|
+
this.menuCurrentOnTop = menuCurrentTop;
|
|
536
|
+
menuCurrentTop.show();
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
const lottie = this.getMainMenuLottie();
|
|
540
|
+
if (lottie != null) {
|
|
541
|
+
lottie.pause();
|
|
542
|
+
lottie.setDirection(1);
|
|
543
|
+
lottie.setSegment(0, 30);
|
|
544
|
+
lottie.goToAndPlay(0, true);
|
|
545
|
+
}
|
|
546
|
+
return true;
|
|
547
|
+
} else return false;
|
|
548
|
+
},
|
|
549
|
+
|
|
550
|
+
closeMainMenu() {
|
|
551
|
+
if (this.isOpenMainMenu) {
|
|
552
|
+
this.$mainMenu.attr(eds.opened, "");
|
|
553
|
+
// const $top = this.$menuSections.filter(asv(eds.onTop, t1));
|
|
554
|
+
// $top[$top.length - 1]?.pageHandle?.blur();
|
|
555
|
+
this.menuCurrentOnTop?.onHide();
|
|
556
|
+
|
|
557
|
+
const lottie = this.getMainMenuLottie();
|
|
558
|
+
if (lottie != null) {
|
|
559
|
+
lottie.pause();
|
|
560
|
+
lottie.setDirection(-1);
|
|
561
|
+
lottie.goToAndPlay(30, true);
|
|
562
|
+
}
|
|
563
|
+
return true;
|
|
564
|
+
} else return false;
|
|
565
|
+
},
|
|
566
|
+
|
|
567
|
+
getMainMenuLottie() {
|
|
568
|
+
return this.$mainMenuBtnLottie[0]?.getLottie?.();
|
|
569
|
+
},
|
|
570
|
+
|
|
571
|
+
|
|
572
|
+
//rootbar
|
|
573
|
+
initRootbar() {
|
|
574
|
+
this.$rootTabs = this.$tabsbar.find(c.c + btn);
|
|
575
|
+
this.$rootTabs.attr(eds.active, "");
|
|
576
|
+
|
|
577
|
+
var topId = null;
|
|
578
|
+
const topSection = this.$mainSections.filter(asv(eds.onTop, t1));
|
|
579
|
+
if (topSection.length > 0) topId = topSection.attr("id");
|
|
580
|
+
|
|
581
|
+
if (topId != null) {
|
|
582
|
+
this.$rootTabs.filter(aiv(eds.tabId, topId)).attr(eds.active, t1);
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
this.$rootTabs.filter(ax(eds.tabId)).click(this.rootTabOnClick);
|
|
586
|
+
|
|
587
|
+
|
|
588
|
+
// * Currently not using
|
|
589
|
+
// fetch("./structure/rootmenu" + estreStruct.structureSuffix)
|
|
590
|
+
// .then((response) => {
|
|
591
|
+
// if (response.ok) return response.json();
|
|
592
|
+
// throw Error("[" + response.status + "]" + response.url);
|
|
593
|
+
// })
|
|
594
|
+
// .then((data) => estreUi.renderRootBar(data))
|
|
595
|
+
// .catch((error) => console.log("fetch error: " + error));
|
|
596
|
+
},
|
|
597
|
+
|
|
598
|
+
// === Currently not using
|
|
599
|
+
renderRootBar(esd) {
|
|
600
|
+
this.$rootTabs.empty();
|
|
601
|
+
this.$mainArea.empty();
|
|
602
|
+
var topId = null;
|
|
603
|
+
for (var item of esd.menu) {
|
|
604
|
+
this.$rootTabs.append(this.buildRootTabItem(item));
|
|
605
|
+
this.$mainArea.append(this.buildMainSection(item));
|
|
606
|
+
if (item.type == "static" && item.home) topId = item.id;
|
|
607
|
+
}
|
|
608
|
+
this.$rootTabs = this.$rootbar.find(c.c + btn);
|
|
609
|
+
|
|
610
|
+
if (topId != null) {
|
|
611
|
+
this.$rootTabs.filter(aiv(eds.tabId, topId)).attr(eds.active, t1);
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
this.$rootTabs.filter(ax(eds.tabId)).click(this.rootTabOnClick);
|
|
615
|
+
},
|
|
616
|
+
|
|
617
|
+
buildRootTabItem(esm) {
|
|
618
|
+
const element = doc.ce(btn);
|
|
619
|
+
element.setAttribute(m.cls, "tp_tiled_btn");
|
|
620
|
+
element.setAttribute("title", esm.desc);
|
|
621
|
+
element.setAttribute(eds.tabId, esm.id);
|
|
622
|
+
element.innerHTML = esm.title;
|
|
623
|
+
return element;
|
|
624
|
+
},
|
|
625
|
+
|
|
626
|
+
buildMainSection(esm) {
|
|
627
|
+
const element = doc.ce(se);
|
|
628
|
+
element.setAttribute(m.cls, "vfv_scroll");
|
|
629
|
+
element.setAttribute("id", esm.id);
|
|
630
|
+
this.fetchContent(esm, element);
|
|
631
|
+
return element;
|
|
632
|
+
},
|
|
633
|
+
|
|
634
|
+
fetchContent(esm, target) {
|
|
635
|
+
return fetch("." + esm.direct + estreStruct.structureSuffix)
|
|
636
|
+
.then((response) => {
|
|
637
|
+
if (response.ok) return response.json();
|
|
638
|
+
throw Error("[" + response.status + "]" + response.url);
|
|
639
|
+
})
|
|
640
|
+
.then((data) => {
|
|
641
|
+
const parts = this.renderContentArea(data);
|
|
642
|
+
for (var part of parts) target.append(part);
|
|
643
|
+
})
|
|
644
|
+
.catch((error) => {
|
|
645
|
+
if (window.isLogging) console.error("fetch error: " + error);
|
|
646
|
+
});
|
|
647
|
+
},
|
|
648
|
+
|
|
649
|
+
renderContentArea(ecm) {
|
|
650
|
+
const set = [];
|
|
651
|
+
const article = doc.ce(ar);
|
|
652
|
+
if (ecm.content.display == "constraint") article.setAttribute(m.cls, "constraint");
|
|
653
|
+
set.push(article);
|
|
654
|
+
for (var handle of handles) {
|
|
655
|
+
const handler = doc.ce(div);
|
|
656
|
+
handler.setAttribute(m.cls, "handle_set " + handle.attach);
|
|
657
|
+
set.push(handler);
|
|
658
|
+
}
|
|
659
|
+
return set;
|
|
660
|
+
},
|
|
661
|
+
// ===========================
|
|
662
|
+
|
|
663
|
+
showExactAppbar(component, container, article) {
|
|
664
|
+
const appbar = this.appbar;
|
|
665
|
+
if (appbar == null) return;
|
|
666
|
+
const currentExactComponent = this.isOpenMainMenu ? this.menuCurrentOnTop : this.mainCurrentOnTop;
|
|
667
|
+
if (component == null) component = currentExactComponent;
|
|
668
|
+
if (component == null) return;
|
|
669
|
+
if (container != null && component != currentExactComponent) return null;
|
|
670
|
+
const currentExactContainer = currentExactComponent.currentOnTop;
|
|
671
|
+
if (article != null && container != currentExactContainer) return null;
|
|
672
|
+
|
|
673
|
+
const isHomeComponent = component.isHome;
|
|
674
|
+
const topContainer = component.currentTop;
|
|
675
|
+
const isRootContainer = topContainer != null ? topContainer?.isRoot ?? false : true;
|
|
676
|
+
const isSingleContainer = component.isSingleContainer;
|
|
677
|
+
const isRootOrSingle = isRootContainer || isSingleContainer;
|
|
678
|
+
|
|
679
|
+
const topArticle = topContainer?.currentTop;
|
|
680
|
+
const isMainArticle = topArticle != null ? topArticle?.isMain ?? false : true;
|
|
681
|
+
const isSingleArticle = container?.isSingleArticle ?? topContainer?.isSingleArticle ?? true;
|
|
682
|
+
const isMainOrSingle = isMainArticle || isSingleArticle;
|
|
683
|
+
|
|
684
|
+
let success = false;
|
|
685
|
+
if (!success && topArticle != null) success = appbar.showContainer("article_" + topArticle.id);
|
|
686
|
+
if (!success && topContainer != null) success = appbar.showContainer("container_" + topContainer.id);
|
|
687
|
+
if (!success && isRootContainer) success = appbar.showContainer(component.id);
|
|
688
|
+
if (!success && isHomeComponent && isRootOrSingle && isMainOrSingle) success = appbar.showContainer("home");
|
|
689
|
+
if (!success && isMainArticle) success = appbar.showContainer("main");
|
|
690
|
+
if (!success && isRootContainer) success = appbar.showContainer("root");
|
|
691
|
+
if (!success && (!isHomeComponent || !isRootContainer)) success = appbar.showContainer("sub");
|
|
692
|
+
estreUi.releaseAppbarPageTitle();
|
|
693
|
+
estreUi.releaseAppbarLeftToolSet();
|
|
694
|
+
estreUi.releaseAppbarRightToolSet();
|
|
695
|
+
|
|
696
|
+
return success;
|
|
697
|
+
},
|
|
698
|
+
|
|
699
|
+
setAppbarPageTitle(text) {
|
|
700
|
+
this.appbar?.handler?.setPageTitle(text);
|
|
701
|
+
},
|
|
702
|
+
|
|
703
|
+
releaseAppbarPageTitle() {
|
|
704
|
+
this.setAppbarPageTitle(this.isOpenMainMenu ? this.menuCurrentOnTop?.title ?? "" : this.mainCurrentOnTop?.title ?? "");
|
|
705
|
+
},
|
|
706
|
+
|
|
707
|
+
setAppbarLeftToolSet(frostOrCold, matchReplacer, dataName = "frozen") {
|
|
708
|
+
if (typeFunction(frostOrCold)) return frostOrCold(feed => this.appbar?.handler?.setAppbarLeftToolSet(feed, matchReplacer, dataName));
|
|
709
|
+
else return $(this.appbar?.handler?.setAppbarLeftToolSet(frostOrCold, matchReplacer, dataName));
|
|
710
|
+
},
|
|
711
|
+
|
|
712
|
+
releaseAppbarLeftToolSet() {
|
|
713
|
+
const appbarFeed = this.isOpenMainMenu ? this.menuCurrentOnTop?.appbarLeftFeed : this.mainCurrentOnTop?.appbarLeftFeed;
|
|
714
|
+
return this.setAppbarLeftToolSet(appbarFeed);
|
|
715
|
+
},
|
|
716
|
+
|
|
717
|
+
setAppbarRightToolSet(frostOrCold, matchReplacer, dataName = "frozen") {
|
|
718
|
+
if (typeFunction(frostOrCold)) return frostOrCold(feed => this.appbar?.handler?.setAppbarRightToolSet(feed, matchReplacer, dataName));
|
|
719
|
+
else return $(this.appbar?.handler?.setAppbarRightToolSet(frostOrCold, matchReplacer, dataName));
|
|
720
|
+
},
|
|
721
|
+
|
|
722
|
+
releaseAppbarRightToolSet() {
|
|
723
|
+
const appbarFeed = this.isOpenMainMenu ? this.menuCurrentOnTop?.appbarRightFeed : this.mainCurrentOnTop?.appbarRightFeed;
|
|
724
|
+
return this.setAppbarRightToolSet(appbarFeed);
|
|
725
|
+
},
|
|
726
|
+
|
|
727
|
+
rootTabOnClick(e) {
|
|
728
|
+
const target = this.tagName == BTN ? this : (e.target.tagName == BTN ? e.target : e.target.parentElement);
|
|
729
|
+
estreUi.switchRootTab(target);
|
|
730
|
+
},
|
|
731
|
+
|
|
732
|
+
switchRootTab($target, intent) {
|
|
733
|
+
switch (typeof $target) {
|
|
734
|
+
case "number":
|
|
735
|
+
if ($target < this.$rootTabs.length) return this.switchRootTab(this.$rootTabs[$target], intent);
|
|
736
|
+
break;
|
|
737
|
+
|
|
738
|
+
case "string":
|
|
739
|
+
const targets = this.$rootTabs.filter(aiv(eds.tabId, $target));
|
|
740
|
+
if ($target.length < 1) $target = this.$fixedPageList.find(btn + aiv(eds.contained, "root") + aiv(eds.containerId, id));
|
|
741
|
+
if (targets.length > 0) return this.switchRootTab(targets[0], intent);
|
|
742
|
+
break;
|
|
743
|
+
|
|
744
|
+
case "object":
|
|
745
|
+
if ($target instanceof jQuery) ;//do nothing
|
|
746
|
+
else $target = $($target);
|
|
747
|
+
|
|
748
|
+
const id = $target.attr(eds.tabId);
|
|
749
|
+
const $targetSection = this.$mainSections.filter(eid + id);
|
|
750
|
+
const isModal = $targetSection.hasClass("modal");
|
|
751
|
+
|
|
752
|
+
var unhandled = false;
|
|
753
|
+
if (isModal) {
|
|
754
|
+
if ($targetSection[0]?.pageHandle?.isOnTop) {
|
|
755
|
+
return this.closeModalTab(id, $targetSection);
|
|
756
|
+
} else return this.openModalTab(id, $targetSection, intent);
|
|
757
|
+
}
|
|
758
|
+
|
|
759
|
+
//단일 탭 사용 기준 구현
|
|
760
|
+
const $elseSections = this.$mainSections.filter(asv(eds.onTop, t1) + nti(id));
|
|
761
|
+
if ($elseSections.length > 0) {
|
|
762
|
+
for (var section of $elseSections) section.pageHandle?.hide();
|
|
763
|
+
|
|
764
|
+
const currentTopHandle = this.mainCurrentOnTop;
|
|
765
|
+
const currentTopHandleId = currentTopHandle?.id;
|
|
766
|
+
if (id != currentTopHandleId && currentTopHandleId != this.latestRootTabId) {
|
|
767
|
+
this.prevRootTabId = currentTopHandleId;
|
|
768
|
+
|
|
769
|
+
// if (estreUi.euiState == "onReady" && currentTopHandle != null) {
|
|
770
|
+
// estreUi.pushCurrentState(currentTopHandle);
|
|
771
|
+
// }
|
|
772
|
+
}
|
|
773
|
+
}
|
|
774
|
+
this.$rootTabs.filter(aiv(eds.active, t1) + naiv(eds.tabId, id)).attr(eds.active, "");
|
|
775
|
+
|
|
776
|
+
const targetComponent = this.mainSections[id];
|
|
777
|
+
if (targetComponent.isOnTop) {
|
|
778
|
+
unhandled = true;
|
|
779
|
+
|
|
780
|
+
//현재 선택된 탭을 다시 선택했을 때
|
|
781
|
+
targetComponent.back();
|
|
782
|
+
// history.back();
|
|
783
|
+
} else {
|
|
784
|
+
targetComponent.pushIntent(intent);
|
|
785
|
+
targetComponent.show(false);
|
|
786
|
+
this.mainCurrentOnTop = targetComponent;
|
|
787
|
+
|
|
788
|
+
this.showExactAppbar(targetComponent);
|
|
789
|
+
}
|
|
790
|
+
|
|
791
|
+
this.$rootTabs.blur();
|
|
792
|
+
|
|
793
|
+
if ($target.attr(eds.active) == t1) {
|
|
794
|
+
//do nothing //추후 방향에 따라 섹션 새로고침 등 구현
|
|
795
|
+
} else {
|
|
796
|
+
$target.attr(eds.active, t1);
|
|
797
|
+
}
|
|
798
|
+
|
|
799
|
+
return !unhandled;
|
|
800
|
+
//break;
|
|
801
|
+
}
|
|
802
|
+
},
|
|
803
|
+
|
|
804
|
+
switchRootTabPrev() {
|
|
805
|
+
const prev = this.prevRootTabId;
|
|
806
|
+
if (prev != null) {
|
|
807
|
+
const processed = this.switchRootTab(prev);
|
|
808
|
+
return processed;
|
|
809
|
+
} else return false;
|
|
810
|
+
},
|
|
811
|
+
|
|
812
|
+
openInstantBlinded(id, intent, instanceOrigin) {
|
|
813
|
+
const page = pageManager.getComponent(id);
|
|
814
|
+
if (page == null) return null;
|
|
815
|
+
if (page.statement == "static") return null;
|
|
816
|
+
this.$blindArea.append(page.live);
|
|
817
|
+
const $section = this.$blindSections.filter(eid + id);
|
|
818
|
+
if ($section == null || $section.length < 1) return null;
|
|
819
|
+
const component = this.initInstantContent($section[$section.length - 1], intent, instanceOrigin);
|
|
820
|
+
if (component.isOnTop) component.show(false);
|
|
821
|
+
return component;
|
|
822
|
+
},
|
|
823
|
+
|
|
824
|
+
showInstantBlinded(id, intent, instanceOrigin) {
|
|
825
|
+
let $targetSection = this.$blindSections.filter(eid + id + (instanceOrigin?.let(it => aiv(eds.instanceOrigin, it)) ?? ""));
|
|
826
|
+
|
|
827
|
+
if ($targetSection.length < 1) {
|
|
828
|
+
if (instanceOrigin != null) return false;
|
|
829
|
+
$targetSection = this.$blindSections.filter(eid + id);
|
|
830
|
+
if ($targetSection.length < 1) return false;
|
|
831
|
+
$targetSection = $($targetSection[$targetSection.length - 1]);
|
|
832
|
+
}
|
|
833
|
+
|
|
834
|
+
const isModal = $targetSection.hasClass("modal");
|
|
835
|
+
|
|
836
|
+
var unhandled = false;
|
|
837
|
+
if (isModal) {
|
|
838
|
+
const onTop = $targetSection.attr(eds.onTop);
|
|
839
|
+
if (onTop == t1 || onTop == "1*") {
|
|
840
|
+
//do nothing
|
|
841
|
+
} else return this.openModalSection(id, this.$blindSections, $targetSection, intent);
|
|
842
|
+
}
|
|
843
|
+
|
|
844
|
+
const $elseSections = this.$blindSections.filter(asv(eds.onTop, t1) + nti(id));
|
|
845
|
+
if ($elseSections.length > 0) {
|
|
846
|
+
for (var section of $elseSections) section.pageHandle?.hide(false);
|
|
847
|
+
|
|
848
|
+
const currentTopHandle = this.blindedCurrentOnTop;
|
|
849
|
+
const currentTopHandleId = currentTopHandle?.id;
|
|
850
|
+
if (id != currentTopHandleId && currentTopHandleId != this.latestBlindedId) {
|
|
851
|
+
this.prevBlindedId = currentTopHandleId;
|
|
852
|
+
|
|
853
|
+
// if (estreUi.euiState == "onReady" && currentTopHandle != null) {
|
|
854
|
+
// estreUi.pushCurrentState(currentTopHandle);
|
|
855
|
+
// }
|
|
856
|
+
}
|
|
857
|
+
}
|
|
858
|
+
|
|
859
|
+
let targetComponent = this.blindSections[id + (instanceOrigin?.let(it => "^" + it) ?? "")];
|
|
860
|
+
if (targetComponent == null) {
|
|
861
|
+
if (instanceOrigin != null) return false;
|
|
862
|
+
const componentIds = this.blindSections.ways.filter(it => it.startsWith(id + "^"));
|
|
863
|
+
if (componentIds.length < 1) return false;
|
|
864
|
+
targetComponent = this.blindSections[componentIds[componentIds.length - 1]];
|
|
865
|
+
}
|
|
866
|
+
targetComponent.pushIntent(intent);
|
|
867
|
+
if (targetComponent.isOnTop) {
|
|
868
|
+
unhandled = true;
|
|
869
|
+
} else {
|
|
870
|
+
targetComponent.show(false);
|
|
871
|
+
this.blindedCurrentOnTop = targetComponent;
|
|
872
|
+
}
|
|
873
|
+
|
|
874
|
+
return !unhandled;
|
|
875
|
+
},
|
|
876
|
+
|
|
877
|
+
async closeInstantBlinded(id, instanceOrigin, isTermination) {
|
|
878
|
+
let component = this.blindSections[id + (instanceOrigin?.let(it => "^" + it) ?? "")];
|
|
879
|
+
if (component == null) {
|
|
880
|
+
if (instanceOrigin != null) return null;
|
|
881
|
+
const componentIds = this.blindSections.ways.filter(it => it.startsWith(id + "^"));
|
|
882
|
+
if (componentIds.length < 1) return null;
|
|
883
|
+
component = this.blindSections[componentIds[componentIds.length - 1]];
|
|
884
|
+
}
|
|
885
|
+
const $targetSection = component.$host;
|
|
886
|
+
const isModal = $targetSection.hasClass("modal");
|
|
887
|
+
|
|
888
|
+
if (isModal) {
|
|
889
|
+
if (component.isOnTop) {
|
|
890
|
+
const closed = await this.closeModalSection(id, this.$blindSections, $targetSection);
|
|
891
|
+
if (!component.isStatic) await this.releaseInstantContent(component);
|
|
892
|
+
return closed;
|
|
893
|
+
} else return null;
|
|
894
|
+
} else {
|
|
895
|
+
if (!component.$host.hasClass("home")) {
|
|
896
|
+
isTermination ??= !component.isStatic;
|
|
897
|
+
const closed = await component.close(false, isTermination);
|
|
898
|
+
setTimeout(async _ => {
|
|
899
|
+
const $components = this.$blindSections.filter(naiv(m.id, id));
|
|
900
|
+
if ($components.length > 0) {
|
|
901
|
+
const prevComponent = this.prevBlindedId?.let(it => this.blindSections[it]);
|
|
902
|
+
if (prevComponent != null) await prevComponent.show();
|
|
903
|
+
else await $components[$components.length - 1]?.pageHandle?.show();
|
|
904
|
+
}
|
|
905
|
+
}, 0);
|
|
906
|
+
if (isTermination) await this.releaseInstantContent(component);
|
|
907
|
+
return closed;
|
|
908
|
+
} else return false;
|
|
909
|
+
}
|
|
910
|
+
},
|
|
911
|
+
|
|
912
|
+
openMenuArea(id, intent, instanceOrigin) {
|
|
913
|
+
const page = pageManager.getComponent(id);
|
|
914
|
+
if (page == null) return null;
|
|
915
|
+
if (page.statement == "static") return null;
|
|
916
|
+
this.$mainMenu.append(page.live);
|
|
917
|
+
const $section = this.$menuSections.filter(eid + id);
|
|
918
|
+
if ($section == null || $section.length < 1) return null;
|
|
919
|
+
const component = this.initStaticMenu($section[$section.length - 1], intent, instanceOrigin);
|
|
920
|
+
if (component.isOnTop) component.show(false);
|
|
921
|
+
return component;
|
|
922
|
+
},
|
|
923
|
+
|
|
924
|
+
showMenuArea(id, intent, instanceOrigin) {
|
|
925
|
+
let $targetSection = this.$menuSections.filter(eid + id + (instanceOrigin?.let(it => aiv(eds.instanceOrigin, it)) ?? ""));
|
|
926
|
+
|
|
927
|
+
if ($targetSection.length < 1) {
|
|
928
|
+
if (instanceOrigin != null) return false;
|
|
929
|
+
$targetSection = this.$menuSections.filter(eid + id);
|
|
930
|
+
if ($targetSection.length < 1) return false;
|
|
931
|
+
$targetSection = $($targetSection[$targetSection.length - 1]);
|
|
932
|
+
}
|
|
933
|
+
|
|
934
|
+
const isModal = $targetSection.hasClass("modal");
|
|
935
|
+
|
|
936
|
+
var unhandled = false;
|
|
937
|
+
if (isModal) {
|
|
938
|
+
const onTop = $targetSection.attr(eds.onTop);
|
|
939
|
+
if (onTop == t1 || onTop == "1*") {
|
|
940
|
+
//do nothing
|
|
941
|
+
} else return this.openModalSection(id, this.$menuSections, $targetSection, intent);
|
|
942
|
+
}
|
|
943
|
+
|
|
944
|
+
const $elseSections = this.$menuSections.filter(asv(eds.onTop, t1) + nti(id));
|
|
945
|
+
if ($elseSections.length > 0) {
|
|
946
|
+
for (var section of $elseSections) section.pageHandle?.hide(false);
|
|
947
|
+
}
|
|
948
|
+
|
|
949
|
+
let targetComponent = this.menuSections[id + (instanceOrigin?.let(it => "^" + it) ?? "")];
|
|
950
|
+
if (targetComponent == null) {
|
|
951
|
+
if (instanceOrigin != null) return false;
|
|
952
|
+
const componentIds = this.menuSections.ways.filter(it => it.startsWith(id + "^"));
|
|
953
|
+
if (componentIds.length < 1) return false;
|
|
954
|
+
targetComponent = this.menuSections[componentIds[componentIds.length - 1]];
|
|
955
|
+
}
|
|
956
|
+
targetComponent.pushIntent(intent);
|
|
957
|
+
if (targetComponent.isOnTop) {
|
|
958
|
+
unhandled = true;
|
|
959
|
+
} else {
|
|
960
|
+
targetComponent.show(false);
|
|
961
|
+
this.menuCurrentOnTop = targetComponent;
|
|
962
|
+
|
|
963
|
+
this.showExactAppbar(targetComponent);
|
|
964
|
+
}
|
|
965
|
+
|
|
966
|
+
return !unhandled;
|
|
967
|
+
},
|
|
968
|
+
|
|
969
|
+
async closeMenuArea(id, instanceOrigin, isTermination) {
|
|
970
|
+
let component = this.menuSections[id + (instanceOrigin?.let(it => "^" + it) ?? "")];
|
|
971
|
+
if (component == null) {
|
|
972
|
+
if (instanceOrigin != null) return null;
|
|
973
|
+
const componentIds = this.menuSections.ways.filter(it => it.startsWith(id + "^"));
|
|
974
|
+
if (componentIds.length < 1) return null;
|
|
975
|
+
component = this.menuSections[componentIds[componentIds.length - 1]];
|
|
976
|
+
}
|
|
977
|
+
const $targetSection = component.$host;
|
|
978
|
+
const isModal = $targetSection.hasClass("modal");
|
|
979
|
+
|
|
980
|
+
if (isModal) {
|
|
981
|
+
if (component.isOnTop) {
|
|
982
|
+
const closed = await this.closeModalSection(id, this.$menuSections, $targetSection);
|
|
983
|
+
if (!component.isStatic) await this.releaseInstantContent(component);
|
|
984
|
+
return closed;
|
|
985
|
+
} else return null;
|
|
986
|
+
} else {
|
|
987
|
+
isTermination ??= !component.isStatic;
|
|
988
|
+
const closed = await component.close(false, isTermination);
|
|
989
|
+
if (isTermination) await this.releaseInstantContent(component);
|
|
990
|
+
return closed;
|
|
991
|
+
}
|
|
992
|
+
},
|
|
993
|
+
|
|
994
|
+
openHeaderBar(id, intent, instanceOrigin) {
|
|
995
|
+
const page = pageManager.getComponent(id);
|
|
996
|
+
if (page == null) return null;
|
|
997
|
+
if (page.statement == "static") return null;
|
|
998
|
+
this.$headerArea.append(page.live);
|
|
999
|
+
const $section = this.$headerSections.filter(eid + id);
|
|
1000
|
+
if ($section == null || $section.length < 1) return null;
|
|
1001
|
+
const component = this.initHeaderBar($section[$section.length - 1], intent, instanceOrigin);
|
|
1002
|
+
// if (component.isOnTop) component.show(false);
|
|
1003
|
+
return component;
|
|
1004
|
+
},
|
|
1005
|
+
|
|
1006
|
+
showHeaderBar(id, intent, instanceOrigin) {
|
|
1007
|
+
let $targetSection = this.$headerSections.filter(eid + id + (instanceOrigin?.let(it => aiv(eds.instanceOrigin, it)) ?? ""));
|
|
1008
|
+
|
|
1009
|
+
if ($targetSection.length < 1) {
|
|
1010
|
+
if (instanceOrigin != null) return false;
|
|
1011
|
+
$targetSection = this.$headerSections.filter(eid + id);
|
|
1012
|
+
if ($targetSection.length < 1) return false;
|
|
1013
|
+
$targetSection = $($targetSection[$targetSection.length - 1]);
|
|
1014
|
+
}
|
|
1015
|
+
|
|
1016
|
+
const isModal = $targetSection.hasClass("modal");
|
|
1017
|
+
|
|
1018
|
+
var unhandled = false;
|
|
1019
|
+
if (isModal) {
|
|
1020
|
+
const onTop = $targetSection.attr(eds.onTop);
|
|
1021
|
+
if (onTop == t1 || onTop == "1*") {
|
|
1022
|
+
//do nothing
|
|
1023
|
+
} else return this.openModalSection(id, this.$headerSections, $targetSection, intent);
|
|
1024
|
+
}
|
|
1025
|
+
|
|
1026
|
+
const $elseSections = this.$headerSections.filter(asv(eds.onTop, t1) + nti(id));
|
|
1027
|
+
if ($elseSections.length > 0) {
|
|
1028
|
+
for (var section of $elseSections) section.pageHandle?.hide(false);
|
|
1029
|
+
}
|
|
1030
|
+
|
|
1031
|
+
let targetComponent = this.headerSections[id + (instanceOrigin?.let(it => "^" + it) ?? "")];
|
|
1032
|
+
if (targetComponent == null) {
|
|
1033
|
+
if (instanceOrigin != null) return false;
|
|
1034
|
+
const componentIds = this.headerSections.ways.filter(it => it.startsWith(id + "^"));
|
|
1035
|
+
if (componentIds.length < 1) return false;
|
|
1036
|
+
targetComponent = this.headerSections[componentIds[componentIds.length - 1]];
|
|
1037
|
+
}
|
|
1038
|
+
targetComponent.pushIntent(intent);
|
|
1039
|
+
if (targetComponent.isOnTop) {
|
|
1040
|
+
unhandled = true;
|
|
1041
|
+
} else {
|
|
1042
|
+
targetComponent.show(false);
|
|
1043
|
+
this.headerCurrentOnTop = targetComponent;
|
|
1044
|
+
}
|
|
1045
|
+
|
|
1046
|
+
return !unhandled;
|
|
1047
|
+
},
|
|
1048
|
+
|
|
1049
|
+
async closeHeaderBar(id, instanceOrigin, isTermination) {
|
|
1050
|
+
let component = this.headerSections[id + (instanceOrigin?.let(it => "^" + it) ?? "")];
|
|
1051
|
+
if (component == null) {
|
|
1052
|
+
if (instanceOrigin != null) return null;
|
|
1053
|
+
const componentIds = this.headerSections.ways.filter(it => it.startsWith(id + "^"));
|
|
1054
|
+
if (componentIds.length < 1) return null;
|
|
1055
|
+
component = this.headerSections[componentIds[componentIds.length - 1]];
|
|
1056
|
+
}
|
|
1057
|
+
const $targetSection = component.$host;
|
|
1058
|
+
const isModal = $targetSection.hasClass("modal");
|
|
1059
|
+
|
|
1060
|
+
if (isModal) {
|
|
1061
|
+
if (component.isOnTop) {
|
|
1062
|
+
const closed = await this.closeModalSection(id, this.$headerSections, $targetSection);
|
|
1063
|
+
if (!component.isStatic) await this.releaseInstantContent(component);
|
|
1064
|
+
return closed;
|
|
1065
|
+
} else return null;
|
|
1066
|
+
} else {
|
|
1067
|
+
isTermination ??= !component.isStatic;
|
|
1068
|
+
const closed = await component.close(false, isTermination);
|
|
1069
|
+
if (isTermination) await this.releaseInstantContent(component);
|
|
1070
|
+
return closed;
|
|
1071
|
+
}
|
|
1072
|
+
},
|
|
1073
|
+
|
|
1074
|
+
openManagedOverlay(id, intent, instanceOrigin) {
|
|
1075
|
+
const page = pageManager.getComponent(id, "overlay");
|
|
1076
|
+
if (page == null) return null;
|
|
1077
|
+
if (page.statement == "static") return null;
|
|
1078
|
+
this.$overlayArea.append(page.live);
|
|
1079
|
+
const $section = this.$overlaySections.filter(eid + id);
|
|
1080
|
+
if ($section == null || $section.length < 1) return null;
|
|
1081
|
+
const component = this.initOverlayContent($section[$section.length - 1], intent, instanceOrigin);
|
|
1082
|
+
// if (component.isOnTop) component.show(false);
|
|
1083
|
+
return component;
|
|
1084
|
+
},
|
|
1085
|
+
|
|
1086
|
+
showManagedOverlay(id, intent, instanceOrigin) {
|
|
1087
|
+
let $targetSection = this.$overlaySections.filter(eid + id + (instanceOrigin?.let(it => aiv(eds.instanceOrigin, it)) ?? ""));
|
|
1088
|
+
|
|
1089
|
+
if ($targetSection.length < 1) {
|
|
1090
|
+
if (instanceOrigin != null) return false;
|
|
1091
|
+
$targetSection = this.$overlaySections.filter(eid + id);
|
|
1092
|
+
if ($targetSection.length < 1) return false;
|
|
1093
|
+
$targetSection = $($targetSection[$targetSection.length - 1]);
|
|
1094
|
+
}
|
|
1095
|
+
|
|
1096
|
+
const isModal = $targetSection.hasClass("modal");
|
|
1097
|
+
|
|
1098
|
+
var unhandled = false;
|
|
1099
|
+
if (isModal) {
|
|
1100
|
+
const onTop = $targetSection.attr(eds.onTop);
|
|
1101
|
+
if (onTop == t1 || onTop == "1*") {
|
|
1102
|
+
//do nothing
|
|
1103
|
+
} else return this.openModalSection(id, this.$overlaySections, $targetSection, intent);
|
|
1104
|
+
}
|
|
1105
|
+
|
|
1106
|
+
const $elseSections = this.$overlaySections.filter(asv(eds.onTop, t1) + nti(id));
|
|
1107
|
+
if ($elseSections.length > 0) {
|
|
1108
|
+
for (var section of $elseSections) section.pageHandle?.hide(false);
|
|
1109
|
+
}
|
|
1110
|
+
|
|
1111
|
+
let targetComponent = this.overlaySections[id + (instanceOrigin?.let(it => "^" + it) ?? "")];
|
|
1112
|
+
if (targetComponent == null) {
|
|
1113
|
+
if (instanceOrigin != null) return false;
|
|
1114
|
+
const componentIds = this.overlaySections.ways.filter(it => it.startsWith(id + "^"));
|
|
1115
|
+
if (componentIds.length < 1) return false;
|
|
1116
|
+
targetComponent = this.overlaySections[componentIds[componentIds.length - 1]];
|
|
1117
|
+
}
|
|
1118
|
+
targetComponent.pushIntent(intent);
|
|
1119
|
+
if (targetComponent.isOnTop) {
|
|
1120
|
+
unhandled = true;
|
|
1121
|
+
} else {
|
|
1122
|
+
targetComponent.show(false);
|
|
1123
|
+
this.overlayCurrentOnTop = targetComponent;
|
|
1124
|
+
}
|
|
1125
|
+
|
|
1126
|
+
return !unhandled;
|
|
1127
|
+
},
|
|
1128
|
+
|
|
1129
|
+
async closeManagedOverlay(id, instanceOrigin, isTermination) {
|
|
1130
|
+
let component = this.overlaySections[id + (instanceOrigin?.let(it => "^" + it) ?? "")];
|
|
1131
|
+
if (component == null) {
|
|
1132
|
+
if (instanceOrigin != null) return null;
|
|
1133
|
+
const componentIds = this.overlaySections.ways.filter(it => it.startsWith(id + "^"));
|
|
1134
|
+
if (componentIds.length < 1) return null;
|
|
1135
|
+
component = this.overlaySections[componentIds[componentIds.length - 1]];
|
|
1136
|
+
}
|
|
1137
|
+
const $targetSection = component.$host;
|
|
1138
|
+
const isModal = $targetSection.hasClass("modal");
|
|
1139
|
+
|
|
1140
|
+
if (isModal) {
|
|
1141
|
+
if (component.isOnTop) {
|
|
1142
|
+
const closed = await this.closeModalSection(id, this.$overlaySections, $targetSection);
|
|
1143
|
+
if (!component.isStatic) await this.releaseInstantContent(component);
|
|
1144
|
+
return closed;
|
|
1145
|
+
} else return null;
|
|
1146
|
+
} else {
|
|
1147
|
+
isTermination ??= !component.isStatic;
|
|
1148
|
+
const closed = await component.close(false, isTermination);
|
|
1149
|
+
if (isTermination) await this.releaseInstantContent(component);
|
|
1150
|
+
return closed;
|
|
1151
|
+
}
|
|
1152
|
+
},
|
|
1153
|
+
|
|
1154
|
+
openModalTab(id, $targetSection, intent = null, $sectionSet = this.$mainSections) {
|
|
1155
|
+
var $target = this.$fixedBottom.find(btn + aiv(eds.tabId, id));
|
|
1156
|
+
if ($target.length < 1) $target = this.$sessionGroupHolder.find(btn + aiv(eds.contained, "root") + aiv(eds.containerId, id));
|
|
1157
|
+
|
|
1158
|
+
$target.attr(eds.active, t1);
|
|
1159
|
+
|
|
1160
|
+
return this.openModalSection(id, $sectionSet, $targetSection, intent);
|
|
1161
|
+
},
|
|
1162
|
+
|
|
1163
|
+
openModalSection(id, $sectionSet = this.$mainSections, $targetSection, intent = null) {
|
|
1164
|
+
var $target = this.$fixedBottom.find(btn + aiv(eds.tabId, id));
|
|
1165
|
+
if ($target.length < 1) $target = this.$sessionGroupHolder.find(btn + aiv(eds.contained, "root") + aiv(eds.containerId, id));
|
|
1166
|
+
|
|
1167
|
+
if ($targetSection == null) $targetSection = $sectionSet.filter(eid + id);
|
|
1168
|
+
|
|
1169
|
+
const isMainSection = $sectionSet == this.$mainSections;
|
|
1170
|
+
const isBlildSection = $sectionSet == this.$blindSections;
|
|
1171
|
+
const isMenuSection = $sectionSet == this.$menuSections;
|
|
1172
|
+
const isOverlaySection = $sectionSet == this.$overlaySections;
|
|
1173
|
+
const isHeaderSection = $sectionSet == this.$headerSections;
|
|
1174
|
+
const component = isMainSection ? this.mainSections[id] : (isBlildSection ? this.blindSections[id] : (isMenuSection ? this.menuSections[id] : (isOverlaySection ? this.overlaySections[id] : (isHeaderSection ? this.headerSections[id] : null))));
|
|
1175
|
+
|
|
1176
|
+
// if (isMainSection && this.mainCurrentOnTop != null) this.prevRootTabId = this.mainCurrentOnTop.id;
|
|
1177
|
+
|
|
1178
|
+
component?.pushIntent(intent);
|
|
1179
|
+
|
|
1180
|
+
$targetSection.off("click");
|
|
1181
|
+
$targetSection.click(function(e) {
|
|
1182
|
+
e.preventDefault();
|
|
1183
|
+
|
|
1184
|
+
estreUi.closeModalTab(this.id, $targetSection, $sectionSet);
|
|
1185
|
+
|
|
1186
|
+
return false;
|
|
1187
|
+
});
|
|
1188
|
+
const $container = $targetSection.find(c.c + div + uis.container);
|
|
1189
|
+
$container.off("click");
|
|
1190
|
+
$container.click(function(e) {
|
|
1191
|
+
e.preventDefault();
|
|
1192
|
+
|
|
1193
|
+
return false;
|
|
1194
|
+
});
|
|
1195
|
+
|
|
1196
|
+
return $targetSection[0]?.pageHandle?.show(false);
|
|
1197
|
+
},
|
|
1198
|
+
|
|
1199
|
+
closeModalTab(id, $targetSection, $sectionSet = this.$mainSections) {
|
|
1200
|
+
var $target = this.$fixedBottom.find(btn + aiv(eds.tabId, id));
|
|
1201
|
+
if ($target.length < 1) $target = this.$sessionGroupHolder.find(btn + aiv(eds.contained, "root") + aiv(eds.containerId, id));
|
|
1202
|
+
|
|
1203
|
+
$target.attr(eds.active, "");
|
|
1204
|
+
|
|
1205
|
+
return this.closeModalSection(id, $sectionSet, $targetSection);
|
|
1206
|
+
},
|
|
1207
|
+
|
|
1208
|
+
closeModalSection(id, $sectionSet = this.$mainSections, $targetSection) {
|
|
1209
|
+
if ($targetSection == null) $targetSection = $sectionSet.filter(eid + id);
|
|
1210
|
+
|
|
1211
|
+
// if ($sectionSet == this.$mainSections) this.prevRootTabId = $targetSection.attr("id");
|
|
1212
|
+
|
|
1213
|
+
$targetSection.off("click");
|
|
1214
|
+
$targetSection.find(c.c + div + uis.container).off("click");
|
|
1215
|
+
|
|
1216
|
+
return $targetSection[0]?.pageHandle?.close(false);
|
|
1217
|
+
},
|
|
1218
|
+
|
|
1219
|
+
async initOverlayContents(term = 0) {
|
|
1220
|
+
const $oss = this.$overlaySections;
|
|
1221
|
+
|
|
1222
|
+
const delayer = (delay = term) => postPromise(resolve => setTimeout(resolve, delay));
|
|
1223
|
+
for (var i=0; i<$oss.length; i++) {
|
|
1224
|
+
this.initOverlayContent($oss[i], null, u, true);
|
|
1225
|
+
await delayer();
|
|
1226
|
+
}
|
|
1227
|
+
|
|
1228
|
+
// let $top = this.$overlaySections.filter(asv(eds.onTop, t1));
|
|
1229
|
+
// if ($top.length < 1) $top = this.$overlaySections;
|
|
1230
|
+
// $top[$top.length - 1]?.pageHandle?.show(false);
|
|
1231
|
+
},
|
|
1232
|
+
|
|
1233
|
+
releaseOverlayContent(component) {
|
|
1234
|
+
if (component == null) return;
|
|
1235
|
+
const instanceId = component.instanceId;
|
|
1236
|
+
component.release(component.isStatic ? null : true);
|
|
1237
|
+
if (this.blindSections[instanceId] != null) delete this.overlaySections[instanceId];
|
|
1238
|
+
const index = this.overlaySectionList.indexOf(component);
|
|
1239
|
+
if (index > -1) this.overlaySectionList.splice(index, 1);
|
|
1240
|
+
},
|
|
1241
|
+
|
|
1242
|
+
initOverlayContent(bound, intent = null, instanceOrigin, init = false) {
|
|
1243
|
+
this.releaseOverlayContent(bound.pageHandle);
|
|
1244
|
+
const component = new EstreOverlayComponent(bound, instanceOrigin);
|
|
1245
|
+
if (!init || component.isStatic) {
|
|
1246
|
+
this.overlaySections[component.instanceId] = component;
|
|
1247
|
+
this.overlaySectionList.push(component);
|
|
1248
|
+
}
|
|
1249
|
+
component.init(intent);
|
|
1250
|
+
// if (component.isOnTop && component.isStatic) component.show(false);
|
|
1251
|
+
return component;
|
|
1252
|
+
},
|
|
1253
|
+
|
|
1254
|
+
async initInstantContents(term = 0) {
|
|
1255
|
+
const $bss = this.$blindSections;
|
|
1256
|
+
|
|
1257
|
+
const delayer = (delay = term) => postPromise(resolve => setTimeout(resolve, delay));
|
|
1258
|
+
for (var i=0; i<$bss.length; i++) {
|
|
1259
|
+
this.initInstantContent($bss[i], null, u, true);
|
|
1260
|
+
await delayer();
|
|
1261
|
+
}
|
|
1262
|
+
|
|
1263
|
+
const $top = this.$blindSections.filter(asv(eds.onTop, t1));
|
|
1264
|
+
// if ($top.length < 1) $top = this.$blindSections;
|
|
1265
|
+
if ($top.length > 0) {
|
|
1266
|
+
const targetComponent = $top[$top.length - 1].pageHandle;
|
|
1267
|
+
targetComponent?.show(false);
|
|
1268
|
+
this.blindedCurrentOnTop = targetComponent;
|
|
1269
|
+
}
|
|
1270
|
+
},
|
|
1271
|
+
|
|
1272
|
+
releaseInstantContent(component) {
|
|
1273
|
+
if (component == null) return;
|
|
1274
|
+
const instanceId = component.instanceId;
|
|
1275
|
+
component.release(component.isStatic ? null : true);
|
|
1276
|
+
if (this.blindSections[instanceId] != null) delete this.blindSections[instanceId];
|
|
1277
|
+
const index = this.blindSectionList.indexOf(component);
|
|
1278
|
+
if (index > -1) this.blindSectionList.splice(index, 1);
|
|
1279
|
+
},
|
|
1280
|
+
|
|
1281
|
+
initInstantContent(bound, intent = null, instanceOrigin, init = false) {
|
|
1282
|
+
this.releaseInstantContent(bound.pageHandle);
|
|
1283
|
+
const component = new EstreInstantComponent(bound, instanceOrigin);
|
|
1284
|
+
if (!init || component.isStatic) {
|
|
1285
|
+
this.blindSections[component.instanceId] = component;
|
|
1286
|
+
this.blindSectionList.push(component);
|
|
1287
|
+
}
|
|
1288
|
+
component.init(intent);
|
|
1289
|
+
// if (component.isOnTop && component.isStatic) component.show(false);
|
|
1290
|
+
return component;
|
|
1291
|
+
},
|
|
1292
|
+
|
|
1293
|
+
async initStaticContents(term = 0) {
|
|
1294
|
+
const $mss = this.$mainSections;
|
|
1295
|
+
|
|
1296
|
+
const delayer = (delay = term) => postPromise(resolve => setTimeout(resolve, delay));
|
|
1297
|
+
for (var i=0; i<$mss.length; i++) {
|
|
1298
|
+
this.initStaticContent($mss[i], null, u, true);
|
|
1299
|
+
await delayer();
|
|
1300
|
+
}
|
|
1301
|
+
|
|
1302
|
+
let $top = this.$mainSections.filter(asv(eds.onTop, t1));
|
|
1303
|
+
if ($top.length < 1) $top = this.$mainSections.filter(eid + "home");
|
|
1304
|
+
if ($top.length < 1) $top = this.$mainSections.filter(cls + "home");
|
|
1305
|
+
if ($top.length < 1) $top = this.$mainSections;
|
|
1306
|
+
if ($top.length > 0) {
|
|
1307
|
+
const targetComponent = $top[0].pageHandle;
|
|
1308
|
+
targetComponent?.show(false);
|
|
1309
|
+
this.mainCurrentOnTop = targetComponent;
|
|
1310
|
+
}
|
|
1311
|
+
},
|
|
1312
|
+
|
|
1313
|
+
releaseStaticContent(component) {
|
|
1314
|
+
if (component == null) return;
|
|
1315
|
+
const instanceId = component.instanceId;
|
|
1316
|
+
component.release(component.isStatic ? null : true);
|
|
1317
|
+
if (this.mainSections[instanceId] != null) delete this.mainSections[instanceId];
|
|
1318
|
+
const index = this.mainSectionList.indexOf(component);
|
|
1319
|
+
if (index > -1) this.mainSectionList.splice(index, 1);
|
|
1320
|
+
},
|
|
1321
|
+
|
|
1322
|
+
initStaticContent(bound, intent = null, instanceOrigin, init = false) {
|
|
1323
|
+
this.releaseStaticContent(bound.pageHandle);
|
|
1324
|
+
const component = new EstreComponent(bound, instanceOrigin);
|
|
1325
|
+
if (!init || component.isStatic) {
|
|
1326
|
+
this.mainSections[component.instanceId] = component;
|
|
1327
|
+
this.mainSectionList.push(component);
|
|
1328
|
+
}
|
|
1329
|
+
component.init(intent);
|
|
1330
|
+
// var $sections = this.$mainSections.filter(asv(eds.onTop, t1));
|
|
1331
|
+
// if ($sections.length < 1) $sections = this.$mainSections;
|
|
1332
|
+
// if (component.isOnTop && component.isStatic && (!init || bound == $sections[$sections.length - 1])) component.show(false);
|
|
1333
|
+
return component;
|
|
1334
|
+
},
|
|
1335
|
+
|
|
1336
|
+
async initStaticMenus(term = 0) {
|
|
1337
|
+
const $mss = this.$menuSections;
|
|
1338
|
+
|
|
1339
|
+
const delayer = (delay = term) => postPromise(resolve => setTimeout(resolve, delay));
|
|
1340
|
+
for (var i=0; i<$mss.length; i++) {
|
|
1341
|
+
this.initStaticMenu($mss[i], null, u, true);
|
|
1342
|
+
await delayer();
|
|
1343
|
+
}
|
|
1344
|
+
|
|
1345
|
+
let $top = this.$menuSections.filter(asv(eds.onTop, t1));
|
|
1346
|
+
if ($top.length < 1) $top = this.$menuSections.filter(eid + "menuArea");
|
|
1347
|
+
if ($top.length > 0) {
|
|
1348
|
+
const targetComponent = $top[$top.length - 1].pageHandle;
|
|
1349
|
+
targetComponent?.show(false);
|
|
1350
|
+
this.menuCurrentOnTop = targetComponent;
|
|
1351
|
+
}
|
|
1352
|
+
},
|
|
1353
|
+
|
|
1354
|
+
releaseStaticMenu(component) {
|
|
1355
|
+
if (component == null) return;
|
|
1356
|
+
const instanceId = component.instanceId;
|
|
1357
|
+
component.release(component.isStatic ? null : true);
|
|
1358
|
+
if (this.menuSections[instanceId] != null) delete this.menuSections[instanceId];
|
|
1359
|
+
const index = this.menuSectionList.indexOf(component);
|
|
1360
|
+
if (index > -1) this.menuSectionList.splice(index, 1);
|
|
1361
|
+
},
|
|
1362
|
+
|
|
1363
|
+
initStaticMenu(bound, intent = null, instanceOrigin, init = false) {
|
|
1364
|
+
this.releaseStaticMenu(bound.pageHandle);
|
|
1365
|
+
const component = new EstreMenuComponent(bound, instanceOrigin);
|
|
1366
|
+
if (!init || component.isStatic) {
|
|
1367
|
+
this.menuSections[component.instanceId] = component;
|
|
1368
|
+
this.menuSectionList.push(component);
|
|
1369
|
+
}
|
|
1370
|
+
component.init(intent);
|
|
1371
|
+
// if (component.isOnTop) component.show(false);
|
|
1372
|
+
return component;
|
|
1373
|
+
},
|
|
1374
|
+
|
|
1375
|
+
async initHeaderBars(term = 0) {
|
|
1376
|
+
const $hss = this.$headerSections;
|
|
1377
|
+
|
|
1378
|
+
const delayer = (delay = term) => postPromise(resolve => setTimeout(resolve, delay));
|
|
1379
|
+
for (var i=0; i<$hss.length; i++) {
|
|
1380
|
+
this.initHeaderBar($hss[i], null, u, true);
|
|
1381
|
+
await delayer();
|
|
1382
|
+
}
|
|
1383
|
+
|
|
1384
|
+
let $top = this.$headerSections.filter(asv(eds.onTop, t1));
|
|
1385
|
+
if ($top.length < 1) $top = this.$headerSections.filter(eid + "appbar");
|
|
1386
|
+
if ($top.length < 1) $top = this.$headerSections;
|
|
1387
|
+
if ($top.length > 0) {
|
|
1388
|
+
const targetComponent = $top[$top.length - 1].pageHandle;
|
|
1389
|
+
targetComponent?.show(false);
|
|
1390
|
+
this.headerCurrentOnTop = targetComponent;
|
|
1391
|
+
}
|
|
1392
|
+
},
|
|
1393
|
+
|
|
1394
|
+
releaseHeaderBar(component) {
|
|
1395
|
+
if (component == null) return;
|
|
1396
|
+
const instanceId = component.instanceId;
|
|
1397
|
+
component.release(component.isStatic ? null : true);
|
|
1398
|
+
if (this.headerSections[instanceId] != null) delete this.headerSections[instanceId];
|
|
1399
|
+
const index = this.headerSectionList.indexOf(component);
|
|
1400
|
+
if (index > -1) this.headerSectionList.splice(index, 1);
|
|
1401
|
+
},
|
|
1402
|
+
|
|
1403
|
+
initHeaderBar(bound, intent = null, instanceOrigin, init = false) {
|
|
1404
|
+
this.releaseHeaderBar(bound.pageHandle);
|
|
1405
|
+
const component = new EstreHeaderComponent(bound, instanceOrigin);
|
|
1406
|
+
if (!init || component.isStatic) {
|
|
1407
|
+
this.headerSections[component.instanceId] = component;
|
|
1408
|
+
this.headerSectionList.push(component);
|
|
1409
|
+
}
|
|
1410
|
+
component.init(intent);
|
|
1411
|
+
// if (component.isOnTop) component.show(false);
|
|
1412
|
+
return component;
|
|
1413
|
+
},
|
|
1414
|
+
|
|
1415
|
+
initSessionManager() {
|
|
1416
|
+
this.$more = this.$mainSections.filter("#more");
|
|
1417
|
+
this.$sessionManager = this.$more.find(".session_manager");
|
|
1418
|
+
this.$sessionGroupHolder = this.$more.find(".session_group_holder");
|
|
1419
|
+
this.$fixedPages = this.$sessionGroupHolder.find(c.c + ".fixed_pages");
|
|
1420
|
+
this.$fixedPageList = this.$fixedPages.find(".session_list");
|
|
1421
|
+
this.$openedPages = this.$sessionGroupHolder.find(c.c + ".opened_pages");
|
|
1422
|
+
this.$openedPageList = this.$openedPages.find(".session_list");
|
|
1423
|
+
|
|
1424
|
+
this.initSessionList(this.$fixedPageList);
|
|
1425
|
+
this.initSessionList(this.$openedPageList);
|
|
1426
|
+
},
|
|
1427
|
+
|
|
1428
|
+
initSessionList($listHolder) {
|
|
1429
|
+
const $list = $listHolder.find(uis.pageShortCut);
|
|
1430
|
+
for (var item of $list) {
|
|
1431
|
+
this.setEventSessionItem($(item));
|
|
1432
|
+
}
|
|
1433
|
+
},
|
|
1434
|
+
|
|
1435
|
+
setEventSessionItem($item) {
|
|
1436
|
+
if (!($item instanceof jQuery)) {
|
|
1437
|
+
this.setEventSessionItem($($item));
|
|
1438
|
+
return;
|
|
1439
|
+
}
|
|
1440
|
+
|
|
1441
|
+
const inst = this;
|
|
1442
|
+
$item.find(btn).click(function(e) {
|
|
1443
|
+
const $this = $(this);
|
|
1444
|
+
const $item = $this.closest(".page_short_cut");
|
|
1445
|
+
const contained = $item.attr(eds.contained);
|
|
1446
|
+
const containerType = $item.attr(eds.containerType);
|
|
1447
|
+
const containerId = $item.attr(eds.containerId);
|
|
1448
|
+
|
|
1449
|
+
switch(contained) {
|
|
1450
|
+
case "root":
|
|
1451
|
+
if (containerType == "root_tab_content") inst.switchRootTab(containerId);
|
|
1452
|
+
break;
|
|
1453
|
+
|
|
1454
|
+
default:
|
|
1455
|
+
if (containerType == "sub_page") {
|
|
1456
|
+
const section = inst.mainSections[contained];
|
|
1457
|
+
if (section.showContainer(containerId)) inst.switchRootTab(contained);
|
|
1458
|
+
}
|
|
1459
|
+
break;
|
|
1460
|
+
}
|
|
1461
|
+
});
|
|
1462
|
+
},
|
|
1463
|
+
|
|
1464
|
+
|
|
1465
|
+
focus(article) {
|
|
1466
|
+
const currentTopArticle = this.showingTopArticle;
|
|
1467
|
+
|
|
1468
|
+
if (article == null && currentTopArticle == null) {
|
|
1469
|
+
let $top = this.$mainSections.filter(eid + "home");
|
|
1470
|
+
if ($top.length < 1) this.$mainSections.filter(cls + "home");
|
|
1471
|
+
if ($top.length < 1) this.$mainSections.filter(asv(eds.onTop, t1));
|
|
1472
|
+
if ($top.length < 1) this.$mainSections;
|
|
1473
|
+
const top = $top[0]?.pageHandle;
|
|
1474
|
+
if (top != null) {
|
|
1475
|
+
this.mainCurrentOnTop = top;
|
|
1476
|
+
top.focus();
|
|
1477
|
+
}
|
|
1478
|
+
} else if (article == currentTopArticle) return article.container.component.focus();
|
|
1479
|
+
else if (article == null) return currentTopArticle.container.component.focus();
|
|
1480
|
+
},
|
|
1481
|
+
|
|
1482
|
+
reload() {
|
|
1483
|
+
return this.onReload();
|
|
1484
|
+
},
|
|
1485
|
+
|
|
1486
|
+
back() {
|
|
1487
|
+
return this.onBack();
|
|
1488
|
+
},
|
|
1489
|
+
|
|
1490
|
+
closeContainer() {
|
|
1491
|
+
return this.onCloseContainer();
|
|
1492
|
+
},
|
|
1493
|
+
|
|
1494
|
+
|
|
1495
|
+
async onReload() {
|
|
1496
|
+
return this.isOpenMainMenu ? await this.onReloadMenu() : false ||
|
|
1497
|
+
await this.onReloadBlinded() || await this.onReloadMain();
|
|
1498
|
+
},
|
|
1499
|
+
|
|
1500
|
+
async onBack() {
|
|
1501
|
+
return await this.onBackOverlay() || onBackWhile() ||
|
|
1502
|
+
this.isOpenMainMenu ? await this.onBackMenu() || await this.closeMainMenu() : false ||
|
|
1503
|
+
await this.onBackBlinded() || await this.onBackMain();
|
|
1504
|
+
},
|
|
1505
|
+
|
|
1506
|
+
async onCloseContainer() {
|
|
1507
|
+
return this.isOpenMainMenu ? await this.menuCurrentOnTop?.onCloseContainer() ?? false : false ||
|
|
1508
|
+
await this.mainCurrentOnTop?.onCloseContainer();
|
|
1509
|
+
},
|
|
1510
|
+
|
|
1511
|
+
|
|
1512
|
+
onReloadHeader() {
|
|
1513
|
+
const currentOnTop = this.headerCurrentOnTop;
|
|
1514
|
+
return currentOnTop?.onReload() ?? false;
|
|
1515
|
+
},
|
|
1516
|
+
|
|
1517
|
+
onReloadMenu() {
|
|
1518
|
+
const currentOnTop = this.menuCurrentOnTop;
|
|
1519
|
+
return currentOnTop?.onReload() ?? false;
|
|
1520
|
+
},
|
|
1521
|
+
|
|
1522
|
+
onReloadBlinded() {
|
|
1523
|
+
if (this.$blindSections.filter(asv(eds.onTop, t1)).length > 0) {
|
|
1524
|
+
return this.blindedCurrentOnTop?.onReload() ?? false;
|
|
1525
|
+
} else return false;
|
|
1526
|
+
},
|
|
1527
|
+
|
|
1528
|
+
onReloadMain() {
|
|
1529
|
+
const currentOnTop = this.mainCurrentOnTop;
|
|
1530
|
+
return currentOnTop?.onReload() ?? false;
|
|
1531
|
+
},
|
|
1532
|
+
|
|
1533
|
+
|
|
1534
|
+
onBackOverlay() {
|
|
1535
|
+
if (this.$overlaySections.filter(asv(eds.onTop, t1)).length > 0) {
|
|
1536
|
+
return this.overlayCurrentOnTop?.onBack() ?? false;
|
|
1537
|
+
} else return false;
|
|
1538
|
+
},
|
|
1539
|
+
|
|
1540
|
+
onBackMenu() {
|
|
1541
|
+
const currentOnTop = this.menuCurrentOnTop ?? this.menuArea;
|
|
1542
|
+
return currentOnTop?.onBack() ?? false;
|
|
1543
|
+
},
|
|
1544
|
+
|
|
1545
|
+
async onBackBlinded() {
|
|
1546
|
+
const currentOnTop = this.blindedCurrentOnTop;
|
|
1547
|
+
let processed = false;
|
|
1548
|
+
if (currentOnTop != null) processed = await currentOnTop.onBack();
|
|
1549
|
+
const prevBlindedId = this.prevBlindedId;
|
|
1550
|
+
if (!processed && prevBlindedId != null) {
|
|
1551
|
+
processed = await this.showInstantBlinded(prevBlindedId);
|
|
1552
|
+
}
|
|
1553
|
+
return processed;
|
|
1554
|
+
},
|
|
1555
|
+
|
|
1556
|
+
async onBackMain() {
|
|
1557
|
+
const currentOnTop = this.mainCurrentOnTop;
|
|
1558
|
+
let processed = false;
|
|
1559
|
+
if (currentOnTop != null) processed = await currentOnTop.onBack();
|
|
1560
|
+
if (!processed) {
|
|
1561
|
+
if (!currentOnTop.isHome) processed = await this.switchRootTabPrev();
|
|
1562
|
+
else if (currentOnTop.intent?.bringOnBack != n) {
|
|
1563
|
+
const bringOnBack = currentOnTop.intent?.bringOnBack;
|
|
1564
|
+
if (bringOnBack.pid != n && bringOnBack.hostType == currentOnTop.hostType) {
|
|
1565
|
+
processed = t;
|
|
1566
|
+
const pid = bringOnBack.pid;
|
|
1567
|
+
if (window.isDebug) console.log("Bringing on back to " + pid);
|
|
1568
|
+
delete currentOnTop.intent.bringOnBack;
|
|
1569
|
+
pageManager.bringPage(pid);
|
|
1570
|
+
}
|
|
1571
|
+
}
|
|
1572
|
+
}
|
|
1573
|
+
return processed;
|
|
1574
|
+
},
|
|
1575
|
+
|
|
1576
|
+
|
|
1577
|
+
async onFocus() {
|
|
1578
|
+
// <= to do implement
|
|
1579
|
+
// this.focus();
|
|
1580
|
+
},
|
|
1581
|
+
|
|
1582
|
+
async onBlur() {
|
|
1583
|
+
// <= to do implement
|
|
1584
|
+
},
|
|
1585
|
+
|
|
1586
|
+
|
|
1587
|
+
onReady() {
|
|
1588
|
+
this.initialHistoryOffset = history.length;
|
|
1589
|
+
// note("[" + history.length + "] initial - null / null");
|
|
1590
|
+
this.euiState = "initializing";
|
|
1591
|
+
this.replaceCurrentState(null);
|
|
1592
|
+
this.euiState = "onReady";
|
|
1593
|
+
this.replaceCurrentState();
|
|
1594
|
+
|
|
1595
|
+
this.focus();
|
|
1596
|
+
|
|
1597
|
+
this.setUiOnReady();
|
|
1598
|
+
},
|
|
1599
|
+
|
|
1600
|
+
|
|
1601
|
+
async checkOnReady(awaitAsyncTasks = t, transitionDelay = 500, linkTimeout = 8000, imageTimeout = 3000) {
|
|
1602
|
+
// lazy load of links
|
|
1603
|
+
const head = doc.h;
|
|
1604
|
+
const lazyLinks = head.querySelectorAll(m1 + aiv(lk, lz));
|
|
1605
|
+
for (const lazy of lazyLinks) {
|
|
1606
|
+
const link = doc.ce(lk);
|
|
1607
|
+
for (const attr of lazy.attributes) {
|
|
1608
|
+
if (attr.name == "link") continue;
|
|
1609
|
+
link.setAttribute(attr.name, attr.value);
|
|
1610
|
+
}
|
|
1611
|
+
lazy.after(link);
|
|
1612
|
+
lazy.remove();
|
|
1613
|
+
}
|
|
1614
|
+
|
|
1615
|
+
|
|
1616
|
+
const waiters = [];
|
|
1617
|
+
|
|
1618
|
+
waiters.push(EUX.setOnLinksFullyLoaded(_ => {
|
|
1619
|
+
if (isStandalone) {
|
|
1620
|
+
// is PWA
|
|
1621
|
+
|
|
1622
|
+
} else {
|
|
1623
|
+
// isn't PWA
|
|
1624
|
+
updateInsets({ type: "init"});
|
|
1625
|
+
// setTimeout(() => updateInsets(), 3000);
|
|
1626
|
+
window.addEventListener("load", updateInsets);
|
|
1627
|
+
window.addEventListener('resize', updateInsets);
|
|
1628
|
+
window.addEventListener('orientationchange', updateInsets);
|
|
1629
|
+
document.addEventListener('scrollend', updateInsets);
|
|
1630
|
+
}
|
|
1631
|
+
|
|
1632
|
+
setTimeout(() => $("main#splashRoot").css("z-index", null), 0);
|
|
1633
|
+
}, linkTimeout));
|
|
1634
|
+
|
|
1635
|
+
waiters.push(EUX.setOnImagesFullyLoaded(_ => {
|
|
1636
|
+
// do nothing
|
|
1637
|
+
}, imageTimeout));
|
|
1638
|
+
|
|
1639
|
+
|
|
1640
|
+
if (awaitAsyncTasks) waiters.push(postPromise(resolve => {
|
|
1641
|
+
const callback = _ => {
|
|
1642
|
+
EstreAsyncManager.removeOnFinishedCurrentWorks(callback);
|
|
1643
|
+
resolve();
|
|
1644
|
+
};
|
|
1645
|
+
|
|
1646
|
+
EstreAsyncManager.setOnFinishedCurrentWorks(callback);
|
|
1647
|
+
}));
|
|
1648
|
+
|
|
1649
|
+
|
|
1650
|
+
await Promise.all(waiters);
|
|
1651
|
+
|
|
1652
|
+
setTimeout(_ => this.onReady(), transitionDelay);
|
|
1653
|
+
},
|
|
1654
|
+
|
|
1655
|
+
setUiOnReady() {
|
|
1656
|
+
doc.$b.attr(eds.onReady, t0);
|
|
1657
|
+
setTimeout(_ => doc.$b.attr(eds.onReady, t1), cvt.t2ms($("main#splashRoot").css(a.trdr)));
|
|
1658
|
+
},
|
|
1659
|
+
|
|
1660
|
+
unsetUiOnReady() {
|
|
1661
|
+
doc.$b.attr(eds.onReady, t0);
|
|
1662
|
+
setTimeout(_ => doc.$b.attr(eds.onReady, ""), cvt.t2ms($("main#splashRoot").css(a.trdr)));
|
|
1663
|
+
},
|
|
1664
|
+
|
|
1665
|
+
eoo: eoo
|
|
1666
|
+
}
|
|
1667
|
+
|