2021-07-02 14:35:28 +02:00
|
|
|
import { coWebsiteManager } from "../WebRtc/CoWebsiteManager";
|
2021-09-13 14:48:19 +02:00
|
|
|
import { playersStore } from "../Stores/PlayersStore";
|
|
|
|
import { chatMessagesStore } from "../Stores/ChatStore";
|
|
|
|
import type { ChatEvent } from "./Events/ChatEvent";
|
2021-03-25 17:12:53 +01:00
|
|
|
|
|
|
|
class ScriptUtils {
|
2021-07-02 14:35:28 +02:00
|
|
|
public openTab(url: string) {
|
2021-03-28 16:36:02 +02:00
|
|
|
window.open(url);
|
|
|
|
}
|
2021-03-25 17:12:53 +01:00
|
|
|
|
2021-07-02 14:35:28 +02:00
|
|
|
public goToPage(url: string) {
|
|
|
|
window.location.href = url;
|
2021-03-28 16:36:02 +02:00
|
|
|
}
|
2021-03-25 17:12:53 +01:00
|
|
|
|
2021-06-28 18:00:48 +02:00
|
|
|
public openCoWebsite(url: string, base: string, api: boolean, policy: string) {
|
2021-07-02 14:35:28 +02:00
|
|
|
coWebsiteManager.loadCoWebsite(url, base, api, policy);
|
2021-03-28 16:36:02 +02:00
|
|
|
}
|
2021-03-25 17:12:53 +01:00
|
|
|
|
2021-07-02 14:35:28 +02:00
|
|
|
public closeCoWebSite() {
|
2021-03-28 16:36:02 +02:00
|
|
|
coWebsiteManager.closeCoWebsite();
|
|
|
|
}
|
2021-09-13 14:48:19 +02:00
|
|
|
|
|
|
|
public sendAnonymousChat(chatEvent: ChatEvent) {
|
|
|
|
const userId = playersStore.addFacticePlayer(chatEvent.author);
|
|
|
|
chatMessagesStore.addExternalMessage(userId, chatEvent.message);
|
|
|
|
}
|
2021-03-25 17:12:53 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
export const scriptUtils = new ScriptUtils();
|