Remove inline styles

This commit is contained in:
Florine W. Dekker 2021-04-24 18:11:56 +02:00
parent d17af82b2a
commit f9d5bd4411
Signed by: FWDekker
GPG Key ID: B1B567AF58D6EE0F
3 changed files with 13 additions and 9 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "interlanguage-checker", "name": "interlanguage-checker",
"version": "1.11.0", "version": "1.11.1",
"description": "Check the consistency of MediaWiki interlanguage links in a simple overview.", "description": "Check the consistency of MediaWiki interlanguage links in a simple overview.",
"author": "Felix W. Dekker", "author": "Felix W. Dekker",
"browser": "dist/bundle.js", "browser": "dist/bundle.js",

View File

@ -22,13 +22,13 @@
<noscript> <noscript>
<img src="https://stats.fwdekker.com/count?p=/tools/interlanguage-checker/" alt="Counting pixel" /> <img src="https://stats.fwdekker.com/count?p=/tools/interlanguage-checker/" alt="Counting pixel" />
<p style="color: red; font-weight: bold;"> <p>
This website does not function if JavaScript is disabled. This website does not function if JavaScript is disabled.
Please check the <a href="https://www.enable-javascript.com/"> Please check the <a href="https://www.enable-javascript.com/">
instructions on how to enable JavaScript in your web browser</a>. instructions on how to enable JavaScript in your web browser</a>.
</p> </p>
</noscript> </noscript>
<main style="display: none;"> <main class="hidden">
<div id="nav"></div> <div id="nav"></div>
<div id="contents"> <div id="contents">
<div id="header"></div> <div id="header"></div>

View File

@ -105,7 +105,7 @@ export class MessageHandler {
*/ */
constructor(parent, id) { constructor(parent, id) {
this._mainDiv = document.createElement("div"); this._mainDiv = document.createElement("div");
this._mainDiv.style.display = "none"; this._mainDiv.classList.add("hidden");
this._mainDiv.classList.add("messageInner"); this._mainDiv.classList.add("messageInner");
parent.appendChild(this._mainDiv); parent.appendChild(this._mainDiv);
@ -179,8 +179,7 @@ export class MessageHandler {
if (level === this._currentLevel) return; if (level === this._currentLevel) return;
this._currentLevel = level; this._currentLevel = level;
this._mainDiv.style.display = null; this._mainDiv.classList.remove("hidden", "success", "warning", "error");
this._mainDiv.classList.remove("success", "warning", "error");
switch (level) { switch (level) {
case "complete": case "complete":
@ -202,7 +201,7 @@ export class MessageHandler {
this._toggleLoadingIcon(false); this._toggleLoadingIcon(false);
break; break;
default: default:
this._mainDiv.style.display = "none"; this._mainDiv.classList.remove("hidden");
return this; // No further handling necessary return this; // No further handling necessary
} }
} }
@ -215,8 +214,13 @@ export class MessageHandler {
* @private * @private
*/ */
_toggleLoadingIcon(state) { _toggleLoadingIcon(state) {
this._loadingIcon.style.display = state ? null : "none"; if (state) {
this._spacing.style.display = state ? null : "none"; this._loadingIcon.classList.remove("hidden");
this._spacing.classList.remove("hidden");
} else {
this._loadingIcon.classList.add("hidden");
this._spacing.classList.add("hidden");
}
return this; return this;
} }