update redirect page
This commit is contained in:
@ -9,6 +9,7 @@ export default class Dropdown extends window.AObject {
|
||||
if (window.dropdown == null) {
|
||||
this.initGlobalVar();
|
||||
}
|
||||
this.scrollTrack = false;
|
||||
}
|
||||
initGlobalVar() {
|
||||
var f = function (ev) {
|
||||
@ -42,7 +43,7 @@ export default class Dropdown extends window.AObject {
|
||||
if (window.isValidPointerClick(ev)) return;
|
||||
this.onClick.call(this, ev);
|
||||
}.bind(this);
|
||||
this.addSystemEvent(this.eventName, e, f, p);
|
||||
this.addSystemEvent(this.eventName, e, f, p, true);
|
||||
}
|
||||
document_onClick(e) {
|
||||
this.checkRelease(e);
|
||||
@ -51,8 +52,13 @@ export default class Dropdown extends window.AObject {
|
||||
if (this.isLock) {
|
||||
return;
|
||||
}
|
||||
if (this.scrollTrack) {
|
||||
e.stopImmediatePropagation();
|
||||
e.preventDefault();
|
||||
return;
|
||||
}
|
||||
var t1 = e.currentTarget;
|
||||
var p = t1.closest('[data-dropdown]');
|
||||
var p = t1.closest('[data-dropdown]');
|
||||
var p1 = e.target.closest(".noopen");
|
||||
if (window.dropdown.currentE != null && (e.target.closest(".item") != null || p1 == null)) {
|
||||
var tmp = window.dropdown.currentE.con;
|
||||
|
||||
@ -45,17 +45,17 @@ export default class AMenu extends window.AObject {
|
||||
this.initDropDown();
|
||||
this.initNav(this.navD);
|
||||
if (this.isMDiffD) {
|
||||
this.initNav(this.navM);
|
||||
this.initNav(this.navM, "M");
|
||||
}
|
||||
}
|
||||
|
||||
initNav(ele) {
|
||||
initNav(ele, type = "D") {
|
||||
let arr = ele.querySelectorAll(".nav-i.has-sub .nav-link, .nav-mainmenu > .nav-i:not(.has-sub) a");
|
||||
Array.from(arr).forEach(el => {
|
||||
var f = function (evt) {
|
||||
if (window.isValidPointerClick(evt)) return;
|
||||
|
||||
this.addEventClick.call(this, evt);
|
||||
this.addEventClick.call(this, evt, type);
|
||||
}.bind(this);
|
||||
el.addEventListener(this.eventName, f);
|
||||
var f1 = function (evt) {
|
||||
@ -124,8 +124,14 @@ export default class AMenu extends window.AObject {
|
||||
}
|
||||
}
|
||||
|
||||
addEventClick(e) {
|
||||
addEventClick(e, t) {
|
||||
window.app.initNavApp(e.currentTarget.getAttribute("href"), e.currentTarget.hasAttribute("isflexpage"));
|
||||
if (t == "M") {
|
||||
this.overlay.removeOverlay();
|
||||
this.listIco.forEach(el => {
|
||||
el.classList.remove("active");
|
||||
})
|
||||
}
|
||||
}
|
||||
closeExpandMenu() {
|
||||
Array.from(this.navM.querySelectorAll(".nav-i.has-sub")).forEach(el => {
|
||||
|
||||
@ -415,13 +415,13 @@ window.AObject = class {
|
||||
}
|
||||
|
||||
}
|
||||
addSystemEvent(eventName, element, callback, parent = null) {
|
||||
addSystemEvent(eventName, element, callback, parent = null, capture = false) {
|
||||
if (!this.systemEvents.has(element)) {
|
||||
this.systemEvents.set(element, new Map());
|
||||
}
|
||||
const eventMap = this.systemEvents.get(element);
|
||||
eventMap.set(eventName, { callback, parent });
|
||||
element.addEventListener(eventName, callback, false);
|
||||
element.addEventListener(eventName, callback, capture);
|
||||
if (parent) {
|
||||
if (!this.parentEventMap.has(parent)) {
|
||||
this.parentEventMap.set(parent, new Set());
|
||||
@ -622,7 +622,7 @@ class AApp extends window.AObject {
|
||||
} else {
|
||||
|
||||
var sOption = {
|
||||
damping: (window.getOS() == "Android") ? .1 : .04,
|
||||
damping: (window.getOS() == "Android") ? .08 : .04,
|
||||
thumbMinSize: 25,
|
||||
renderByPixel: true,
|
||||
alwaysShowTracks: true,
|
||||
@ -1007,36 +1007,43 @@ class CacheStorage {
|
||||
}
|
||||
|
||||
_initDB() {
|
||||
const req = indexedDB.open(`${this.prefix}_db`, 1);
|
||||
req.onupgradeneeded = (e) => {
|
||||
let store;
|
||||
if (!e.target.result.objectStoreNames.contains("cache")) {
|
||||
store = e.target.result.createObjectStore("cache", { keyPath: "key" });
|
||||
}
|
||||
if (!e.target.result.objectStoreNames.contains("fpCache")) {
|
||||
e.target.result.createObjectStore("fpCache", { keyPath: "key" });
|
||||
}
|
||||
try {
|
||||
store.add({ id: 1, value: "test data" });
|
||||
store.delete("1");
|
||||
} catch (e) {
|
||||
|
||||
const openDB = () => {
|
||||
console.log("Renew Database");
|
||||
const req = indexedDB.open(`${this.prefix}_db`, 1);
|
||||
req.onupgradeneeded = (e) => {
|
||||
const db = e.target.result;
|
||||
if (!db.objectStoreNames.contains("cache")) {
|
||||
db.createObjectStore("cache", { keyPath: "key" });
|
||||
}
|
||||
if (!db.objectStoreNames.contains("fpCache")) {
|
||||
db.createObjectStore("fpCache", { keyPath: "key" });
|
||||
}
|
||||
};
|
||||
req.onsuccess = () => {
|
||||
this.db = req.result;
|
||||
this.ready = true;
|
||||
this._flushQueue();
|
||||
};
|
||||
req.onerror = () => {
|
||||
console.warn("IndexedDB open failed, fallback to localStorage");
|
||||
this.db = null;
|
||||
this.useIndexedDB = false;
|
||||
}
|
||||
|
||||
this.ready = true;
|
||||
this._flushQueue();
|
||||
};
|
||||
};
|
||||
req.onsuccess = (event) => {
|
||||
this.db = req.result;
|
||||
this.ready = true;
|
||||
this._flushQueue();
|
||||
|
||||
|
||||
const del = indexedDB.deleteDatabase(`${this.prefix}_db`);
|
||||
del.onsuccess = () => openDB();
|
||||
del.onerror = () => {
|
||||
console.warn("deleteDatabase failed, continue opening fresh");
|
||||
openDB();
|
||||
};
|
||||
req.onerror = () => {
|
||||
console.warn("IndexedDB failed, fallback to localStorage");
|
||||
this.ready = true;
|
||||
this.db = null;
|
||||
this._flushQueue();
|
||||
del.onblocked = () => {
|
||||
console.warn("deleteDatabase blocked (tab khác đang giữ kết nối)");
|
||||
};
|
||||
|
||||
}
|
||||
_flushQueue() {
|
||||
while (this.queue.length) {
|
||||
|
||||
Reference in New Issue
Block a user