2020-05-13 20:22:42 +02:00
|
|
|
export class MessageUI {
|
|
|
|
|
|
|
|
static warningMessage(text: string){
|
|
|
|
this.removeMessage();
|
2020-06-09 23:13:26 +02:00
|
|
|
const body = document.getElementById("body");
|
2020-06-03 11:55:31 +02:00
|
|
|
body?.insertAdjacentHTML('afterbegin', `
|
2020-05-13 20:22:42 +02:00
|
|
|
<div id="message-reconnect" class="message-info warning">
|
|
|
|
${text}
|
|
|
|
</div>
|
|
|
|
`);
|
|
|
|
}
|
|
|
|
|
2020-06-03 11:55:31 +02:00
|
|
|
static removeMessage(id : string|null = null) {
|
2020-05-13 20:22:42 +02:00
|
|
|
if(!id){
|
2020-06-09 23:13:26 +02:00
|
|
|
const messages = document.getElementsByClassName("message-info");
|
2020-05-13 20:22:42 +02:00
|
|
|
for (let i = 0; i < messages.length; i++){
|
2020-06-03 11:55:31 +02:00
|
|
|
messages.item(i)?.remove();
|
2020-05-13 20:22:42 +02:00
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
2020-06-09 23:13:26 +02:00
|
|
|
const previousElement = document.getElementById(id);
|
2020-05-13 20:22:42 +02:00
|
|
|
if (!previousElement) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
previousElement.remove();
|
|
|
|
}
|
2020-06-03 11:55:31 +02:00
|
|
|
}
|