Skip to content

Commit ca8a74e

Browse files
BixilonBios-Marcel
authored andcommitted
lobby list: use event listener over js string
This fixes the CSP errors when there were lobbies in the lobby list. See #381 and #382
1 parent 5d6c569 commit ca8a74e

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

internal/frontend/index.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,6 @@ const language_to_flag = (language) => {
9292
}
9393
};
9494

95-
const remove_icon_loading_class = (img) => {
96-
img.classList.remove("lobby-list-icon-loading");
97-
};
98-
9995
const set_lobbies = (lobbies, visible) => {
10096
const new_lobby_nodes = lobbies.map((lobby) => {
10197
const lobby_list_item = document.createElement("div");
@@ -154,8 +150,9 @@ const set_lobbies = (lobbies, visible) => {
154150
const image = document.createElement("img");
155151
image.className = "lobby-list-item-icon lobby-list-icon-loading";
156152
image.setAttribute("loading", "lazy");
157-
image.setAttribute("onLoad",
158-
"remove_icon_loading_class(this)");
153+
image.addEventListener("load", function() {
154+
image.classList.remove("lobby-list-icon-loading");
155+
});
159156
image.setAttribute("src", icon);
160157

161158
const span = document.createElement("span");

0 commit comments

Comments
 (0)