ZeroOmega/omega-target-chromium-extension/overlay/x-background.js

47 lines
1.2 KiB
JavaScript
Raw Normal View History

import zeroLocalStorage from "./localstorage-polyfill.js"
import ZeroLogFactory from './log.js'
import ZeroIndexedDBFactory from './indexedDB.js'
2024-02-29 09:14:04 -05:00
import "./js/background_preload.js"
2024-06-28 22:46:25 -04:00
import "./lib/idb-keyval.js"
import "./lib/moment-with-locales.js"
import "./lib/csso.js"
2024-02-29 09:14:04 -05:00
import "./js/log_error.js"
2024-06-28 22:46:25 -04:00
import "./log.js"
2024-02-29 09:14:04 -05:00
//import "./lib/FileSaver/FileSaver.min.js"
2024-06-28 22:46:25 -04:00
//import "./js/omega_debug.js"
2024-02-29 09:14:04 -05:00
import "./js/omega_pac.min.js"
import "./js/omega_target.min.js"
import "./js/omega_target_chromium_extension.min.js"
import "./img/icons/draw_omega.js"
import "./js/background.js" // zeroBackground
/**
* author: suziwen1@gmail.com
**/
const isFirefox = !!globalThis.localStorage
function detectPrivateMode(cb) {
var db,
on = cb.bind(null, true),
off = cb.bind(null, false)
if (isFirefox) {
db = indexedDB.open("zeroOmega-test"), db.onerror = on, db.onsuccess = off
} else {
off()
}
}
detectPrivateMode(function (isPrivateMode) {
if (isPrivateMode && isFirefox) {
// fake indexedDB
ZeroIndexedDBFactory()
}
ZeroLogFactory()
const zeroStorage = isFirefox ? localStorage : zeroLocalStorage
globalThis.zeroBackground(zeroStorage)
console.log('is private mode: ' + isPrivateMode)
})