underbbs/frontend/ts/index.ts

46 lines
1.9 KiB
TypeScript
Raw Normal View History

import util from "./util"
import {AdapterState, AdapterData} from "./adapter";
import {Message, Attachment, Author} from "./message"
import {Settings} from "./settings"
import { MessageElement } from "./message-element"
import { SettingsElement } from "./settings-element"
import { ProfileElement } from "./profile-element"
import { AuthorMessagesElement } from "./author-messages-element"
import { TimelineElement } from "./timeline-element"
import {DatagramSocket} from "./websocket"
2024-04-22 00:02:44 +00:00
function main() {
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
customElements.define("underbbs-message", MessageElement);
customElements.define("underbbs-settings", SettingsElement);
customElements.define("underbbs-profile", ProfileElement);
customElements.define("underbbs-author-messages", AuthorMessagesElement);
customElements.define("underbbs-timeline", TimelineElement);
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(",")}' data-gateway=""></underbbs-settings>`
}
let profileParent = util.$("profile_parent");
if (profileParent) {
profileParent.innerHTML = "<underbbs-profile data-adapter='honk' data-target='https://cafe.nilfm.cc/u/nilix' data-gateway=''></underbbs-profile>"
2024-05-13 00:26:44 +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' data-gateway=''></underbbs-author-messages>";
}
let timelineParent = util.$("timeline_parent");
if (timelineParent) {
timelineParent.innerHTML = "<underbbs-timeline id='honkstream' data-adapter='honk' data-target='home' data-gateway=''></underbbs-timeline>";
}
2024-05-13 00:26:44 +00:00
}
2024-04-27 16:50:27 +00:00
main();