36 lines
1.5 KiB
TypeScript
36 lines
1.5 KiB
TypeScript
import util from "./util"
|
|
import {AdapterState, AdapterData} from "./adapter";
|
|
import {Message, Attachment, Author} from "./message"
|
|
import {Settings} from "./settings"
|
|
import { TabBarElement } from "./tabbar-element"
|
|
import { MessageElement } from "./message-element"
|
|
import { SettingsElement } from "./settings-element"
|
|
import { AdapterElement } from "./adapter-element"
|
|
import { ThreadSummaryElement } from "./thread-summary-element"
|
|
import { ProfileElement } from "./profile-element"
|
|
import {DatagramSocket} from "./websocket"
|
|
|
|
function main() {
|
|
const saveData = localStorage.getItem("underbbs_settings");
|
|
Settings._instance = saveData ? <Settings>JSON.parse(saveData) : new Settings();
|
|
|
|
customElements.define("underbbs-tabbar", TabBarElement);
|
|
customElements.define("underbbs-message", MessageElement);
|
|
customElements.define("underbbs-settings", SettingsElement);
|
|
customElements.define("underbbs-adapter", AdapterElement);
|
|
customElements.define("underbbs-thread-summary", ThreadSummaryElement);
|
|
customElements.define("underbbs-profile", ProfileElement);
|
|
|
|
util._("closeErr", util.closeErr);
|
|
let settingsParent = util.$("settings_parent");
|
|
if (settingsParent) {
|
|
settingsParent.innerHTML = `<underbbs-settings data-adapters='${Settings._instance.adapters.map(a=>a.nickname).join(",")}'></underbbs-settings>`
|
|
}
|
|
|
|
let profileParent = util.$("profile_parent");
|
|
if (profileParent) {
|
|
profileParent.innerHTML = "<underbbs-profile data-adapter='honk' data-target='https://cafe.nilfm.cc/u/nilix'></underbbs-profile>"
|
|
}
|
|
}
|
|
|
|
main();
|