Removed some unneeded code

master
WolverinDEV 2021-04-25 11:37:37 +02:00
parent 4b6ff14fb2
commit b54c564151
8 changed files with 32 additions and 91 deletions

View File

@ -44,7 +44,7 @@ export function loadScript(url: SourcePath) : Promise<void> {
}
scriptTag.src = config.baseUrl + url;
document.getElementById("scripts").appendChild(scriptTag);
document.body.appendChild(scriptTag);
resourceRequest.markExecuting();
});
}

View File

@ -45,7 +45,7 @@ export function loadStyle(path: SourcePath) : Promise<void> {
resolve();
};
document.getElementById("style").appendChild(linkTag);
document.head.appendChild(linkTag);
resourceRequest.markExecuting();
});
}

View File

@ -156,6 +156,11 @@ export async function execute(customLoadingAnimations: boolean) {
return;
}
/* Cleanup <noscript> elements */
for(const element of document.getElementsByTagName("noscript")) {
element.remove();
}
const timestampBegin = Date.now();
let begin: number = 0;

View File

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

View File

@ -12,7 +12,7 @@
<% /* TODO: Put in an appropriate image <meta name="og:image" content="https://www.whatsapp.com/img/whatsapp-promo.png"> */ %>
<% /* Using an absolute path here since the manifest.json works only with such. */ %>
<link rel="manifest" href="/manifest.json">
<% /* <link rel="manifest" href="/manifest.json"> */ %>
<% if(buildTarget === "client") { %>
<title>TeaClient</title>
@ -20,7 +20,7 @@
<% } else { %>
<title>TeaSpeak-Web</title>
<meta name='og:title' content='TeaSpeak-Web'>
<link rel='shortcut icon' href='img/favicon/teacup.png' type='image/x-icon' id="favicon">
<link rel='shortcut icon' href='<%= require("./images/favicon_teacup.png") %>' type='image/x-icon' id="favicon">
<% /* <link rel="apple-touch-icon" sizes="194x194" href="/apple-touch-icon.png" type="image/png"> */ %>
<% } %>
@ -53,7 +53,7 @@
<div id="overlay-no-js">
<div class="container">
<div class="img">
<%= require("./images/script.svg") %>
<%= require("!!svg-inline-loader!./images/script.svg") %>
</div>
<h1>Please enable JavaScript</h1>
<h3>TeaSpeak web could not run without it!</h3>
@ -62,10 +62,6 @@
</div>
</noscript>
<!-- loader setup -->
<div id="style"></div>
<div id="scripts"></div>
<!-- Loading screen -->
<div class="loader" id="loader-overlay">
<div class="container">

View File

@ -82,32 +82,6 @@
</div>
</div>
</script>
<script class="jsrender-template" id="tmpl_modal_yesno" type="text/html">
<div class="modal fade" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-header">
<div class="container-icon">
<img src="img/favicon/teacup.png">
</div>
<node key="modal_header"></node>
<div class="container-close">
<div class="button-modal-close icon_em client-close_button"></div>
</div>
</div>
<div class="modal-body modal-body-yesno">
<node key="question"></node>
<div class="buttons">
<button type="button" class="btn btn-danger button-no">{{>text_no}}</button>
<button type="button" class="btn btn-raised btn-success button-yes">{{>text_yes}}
</button>
</div>
</div>
</div>
</div>
</div>
</script>
</div>
<!-- Template for the settings -->
@ -2277,59 +2251,5 @@
</div>
</div>
</script>
<script class="jsrender-template" id="tmpl_channel_info" type="text/html">
<div> <!-- Important for the renderer -->
<div class="row">
<div class="column channel-type">
<a class="title">{{tr "Channel Type" /}}</a>
<div class="value">error: channel type</div>
</div>
<div class="column chat-mode">
<a class="title">{{tr "Chat mode" /}}</a>
<div class="value">error: chat mode</div>
</div>
<div class="column current-clients">
<a class="title">{{tr "Current clients" /}}</a>
<div class="value">error: current clients</div>
</div>
</div>
<div class="row">
<div class="column audio-codec">
<a class="title">{{tr "Audio Codec" /}}</a>
<div class="value">error: audio codec</div>
</div>
<div class="column audio-encrypted">
<a class="title">{{tr "Audio encrypted" /}}</a>
<div class="value">error: audio encrypted</div>
</div>
<div class="column flag-password">
<a class="title">{{tr "Password protected" /}}</a>
<div class="value">error: password protected</div>
</div>
</div>
<div class="row topic"> <!-- only visible if set! -->
<div class="column">
<a class="title">{{tr "Topic" /}}</a>
<div class="value">error: channel topic</div>
</div>
</div>
<div class="container-description"> <!-- only visible if set -->
<a class="title">
{{tr "Description" /}}
<div class="button-copy">
<div class="icon client-copy"></div>
</div>
</a>
<div class="value">
error: channel description
</div>
<div class="no-value">{{tr "Channel has no description" /}}</div>
</div>
<div class="container-buttons">
<button class="btn btn-success button-update">{{tr "Refresh" /}}</button>
</div>
</div>
</script>
</body>
</html>

View File

@ -339,7 +339,7 @@ export function set_icon_size(size: string) {
document.head.append(iconStyleSize);
}
iconStyleSize.innerText = ("\n" +
iconStyleSize.innerHTML = ("\n" +
".chat-emoji {\n" +
" height: " + size + "!important;\n" +
" width: " + size + "!important;\n" +

View File

@ -19,10 +19,21 @@ interface FaviconEvents {
}
let iconImage: HTMLImageElement;
let defaultFaviconUrl: string;
async function initializeFaviconRenderer() {
const events = new Registry<FaviconEvents>();
initializeFaviconController(events);
{
const favicon = document.head.getElementsByTagName("link");
for(const element of favicon) {
if(element.rel === "shortcut icon") {
defaultFaviconUrl = element.href;
break;
}
}
}
iconImage = new Image();
iconImage.src = kClientSpriteUrl;
@ -93,7 +104,16 @@ function initializeFaviconController(events: Registry<FaviconEvents>) {
events.on("query_icon", () => sendFavicon());
}
const DefaultFaviconRenderer = () => <link key={"normal"} rel={"shortcut icon"} href={"img/favicon/teacup.png"} type={"image/x-icon"} />;
const DefaultFaviconRenderer = () => {
if(!defaultFaviconUrl) {
return null;
}
return (
<link key={"normal"} rel={"shortcut icon"} href={defaultFaviconUrl} type={"image/x-icon"} />
);
};
const ClientIconFaviconRenderer = (props: { icon: ClientIcon }) => {
const url = clientIconToDataUrl(props.icon);
if(!url) {