Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions src/html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,22 @@ <h5 class="modal-title" id="accountModalTitle"></h5>
</div>
</div>
</div>
<!--
the disconnection toast sh!t
by guest4242 :-)
-->
<div class="toast-container position-fixed bottom-0 end-0 p-3">
<div id="disconnectionToast" class="toast" role="alert" aria-live="assertive" aria-atomic="true">
<div class="toast-header">
<strong class="me-auto"><span id="siteNameText"></span></strong>
<small>just now</small>
</div>
<div class="toast-body">
<!-- You have been disconnected from the server. -->
<span id="disconnecti18n_thing"></span>
</div>
</div>
</div>
<script type="module" src="../ts/main.ts" type="application/javascript"></script>
</body>
</html>
3 changes: 2 additions & 1 deletion src/ts/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@ export class I18n {
accountSettingsButton: I18nStringKey.kAccountModal_AccountSettings,
accountLogoutButton: I18nStringKey.kGeneric_Logout,
languageDropdownText: I18nStringKey.kSiteButtons_Languages,
disconnecti18n_thing: I18nStringKey.kError_UnexpectedDisconnection,

welcomeModalHeader: I18nStringKey.kWelcomeModal_Header,
welcomeModalBody: I18nStringKey.kWelcomeModal_Body,
Expand Down Expand Up @@ -467,4 +468,4 @@ export class I18n {
}
}

export let TheI18n = new I18n();
export let TheI18n = new I18n();
10 changes: 9 additions & 1 deletion src/ts/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,15 @@ async function openVM(vm: VM): Promise<void> {
VM!.on('login', (rank: Rank, perms: Permissions) => onLogin(rank, perms));

VM!.on('close', () => {
if (!expectedClose) alert(TheI18n.GetString(I18nStringKey.kError_UnexpectedDisconnection));
if (!expectedClose) {
/*
* better disconnection thing
* by guest4242 :-)
*/
const someToast = document.getElementById('disconnectionToast') // yummy toast
const disconnectionToastControl = bootstrap.Toast.getOrCreateInstance(someToast)
disconnectionToastControl.show();
}
closeVM();
});

Expand Down