2024-07-16 19:43:35 +00:00
|
|
|
import util from "./util"
|
2024-07-01 03:51:25 +00:00
|
|
|
import {AdapterState, AdapterData} from "./adapter";
|
|
|
|
import {Message, Attachment, Author} from "./message"
|
2024-07-16 19:43:35 +00:00
|
|
|
import {Settings} from "./settings"
|
2024-07-01 03:51:25 +00:00
|
|
|
import { TabBarElement } from "./tabbar-element"
|
|
|
|
import { MessageElement } from "./message-element"
|
|
|
|
import { SettingsElement } from "./settings-element"
|
2024-07-05 01:27:29 +00:00
|
|
|
import { AdapterElement } from "./adapter-element"
|
|
|
|
import { ThreadSummaryElement } from "./thread-summary-element"
|
2024-12-01 21:08:02 +00:00
|
|
|
import { ProfileElement } from "./profile-element"
|
2024-12-02 00:35:49 +00:00
|
|
|
import { AuthorMessagesElement } from "./author-messages-element"
|
2024-12-01 21:08:02 +00:00
|
|
|
import {DatagramSocket} from "./websocket"
|
2024-04-22 00:02:44 +00:00
|
|
|
|
2024-07-01 03:51:25 +00:00
|
|
|
function main() {
|
2024-12-01 21:08:02 +00:00
|
|
|
const saveData = localStorage.getItem("underbbs_settings");
|
2024-07-16 20:11:46 +00:00
|
|
|
Settings._instance = saveData ? <Settings>JSON.parse(saveData) : new Settings();
|
2024-04-27 16:50:27 +00:00
|
|
|
|
2024-07-01 03:51:25 +00:00
|
|
|
customElements.define("underbbs-tabbar", TabBarElement);
|
|
|
|
customElements.define("underbbs-message", MessageElement);
|
|
|
|
customElements.define("underbbs-settings", SettingsElement);
|
2024-07-05 01:27:29 +00:00
|
|
|
customElements.define("underbbs-adapter", AdapterElement);
|
|
|
|
customElements.define("underbbs-thread-summary", ThreadSummaryElement);
|
2024-12-01 21:08:02 +00:00
|
|
|
customElements.define("underbbs-profile", ProfileElement);
|
2024-12-02 00:35:49 +00:00
|
|
|
customElements.define("underbbs-author-messages", AuthorMessagesElement);
|
2024-07-16 19:43:35 +00:00
|
|
|
|
|
|
|
util._("closeErr", util.closeErr);
|
2024-12-01 21:08:02 +00:00
|
|
|
let settingsParent = util.$("settings_parent");
|
|
|
|
if (settingsParent) {
|
|
|
|
settingsParent.innerHTML = `<underbbs-settings data-adapters='${Settings._instance.adapters.map(a=>a.nickname).join(",")}'></underbbs-settings>`
|
2024-07-01 03:51:25 +00:00
|
|
|
}
|
2024-12-01 21:08:02 +00:00
|
|
|
|
|
|
|
let profileParent = util.$("profile_parent");
|
|
|
|
if (profileParent) {
|
|
|
|
profileParent.innerHTML = "<underbbs-profile data-adapter='honk' data-target='https://cafe.nilfm.cc/u/nilix'></underbbs-profile>"
|
2024-05-13 00:26:44 +00:00
|
|
|
}
|
2024-12-02 00:35:49 +00:00
|
|
|
|
|
|
|
let honksParent = util.$("honks_parent");
|
|
|
|
if (honksParent) {
|
|
|
|
honksParent.innerHTML = "<underbbs-author-messages data-adapter='honk' data-target='https://cafe.nilfm.cc/u/nilix'></underbbs-author-messages>";
|
|
|
|
}
|
2024-05-13 00:26:44 +00:00
|
|
|
}
|
|
|
|
|
2024-04-27 16:50:27 +00:00
|
|
|
main();
|