TeaWeb/js/main.ts

40 lines
1.4 KiB
TypeScript

/// <reference path="chat.ts" />
/// <reference path="client.ts" />
/// <reference path="Identity.ts" />
/// <reference path="utils/modal.ts" />
/// <reference path="ui/modal/ModalConnect.ts" />
/// <reference path="codec/CodecWrapper.ts" />
/// <reference path="settings.ts" />
let globalClient: TSClient;
let chat: ChatBox;
let forumIdentity: TeaForumIdentity;
function invokeMain() {
AudioController.initializeAudioController();
if(!TSIdentityHelper.setup()) { console.error("Could not setup the TeamSpeak identity parser!"); return; }
globalClient = new TSClient();
/** Setup the XF forum identity **/
if(globalClient.settings.static("forum_user_data")) {
forumIdentity = new TeaForumIdentity(globalClient.settings.static("forum_user_data"), globalClient.settings.static("forum_user_sign"));
}
chat = new ChatBox($("#chat"));
globalClient.setup();
//globalClient.startConnection("localhost:19974"); //TODO remove only for testing
//Modals.spawnConnectModal();
//Modals.spawnSettingsModal();
window.addEventListener("beforeunload", function (event) {
if(globalClient.serverConnection && globalClient.serverConnection.connected)
event.returnValue = "Are you really sure?<br>You're still connected!";
//event.preventDefault();
});
//console.log("XF: " + globalClient.settings.static("forum_user_data"));
//console.log("XF: " + globalClient.settings.static("forum_user_sign"));
}