From a8051aa8a3dee4b716ff0cc70702169caa35869d Mon Sep 17 00:00:00 2001 From: gravel Date: Wed, 17 May 2023 15:50:54 +0000 Subject: [PATCH] QR code preloading --- output/main.js | 11 +++++++++++ sites/+components/qr_modals.php | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/output/main.js b/output/main.js index 4b48f61..6eaf9fb 100644 --- a/output/main.js +++ b/output/main.js @@ -69,6 +69,7 @@ function onLoad() { markSortableColumns(); addQRModalHandlers(); addServerIconInteractions(); + preloadQRCodes(); } function displayQRModal(communityID) { @@ -170,6 +171,16 @@ function addQRModalHandlers() { } +function preloadQRCodes() { + const rows = dom.tbl_communities_content_rows(); + const identifiers = rows.map( + rowElement => rowElement.getAttribute(ATTRIBUTES.ROW.IDENTIFIER) + ); + for (const identifier of identifiers) { + (new Image()).src = communityQRCodeURL(identifier); + } +} + function createJoinLinkButtons() { const join_URLs = dom.join_urls(); Array.from(join_URLs).forEach((td_url) => { diff --git a/sites/+components/qr_modals.php b/sites/+components/qr_modals.php index 4184fab..b88ae6b 100644 --- a/sites/+components/qr_modals.php +++ b/sites/+components/qr_modals.php @@ -55,7 +55,7 @@