diff --git a/output/index.css b/output/index.css index d54d0d8..bf2edaf 100644 --- a/output/index.css +++ b/output/index.css @@ -462,6 +462,19 @@ label[for=toggle-show-room-ids]::after { justify-content: center; } +#details-modal-community-icon[src=""] { + display: none; +} + +#details-modal-community-icon { + position: relative; + top: 0.15em; + width: 1em; + height: 1em; + margin-right: 0.1em; + border-radius: 100%; +} + #details-modal-start #details-modal-description { max-height: 50vh; overflow: auto; diff --git a/output/js/constants.js b/output/js/constants.js index b631b8e..00af865 100644 --- a/output/js/constants.js +++ b/output/js/constants.js @@ -20,7 +20,8 @@ export const dom = { hostname: row.getAttribute(ATTRIBUTES.ROW.HOSTNAME), public_key: row.getAttribute(ATTRIBUTES.ROW.PUBLIC_KEY), staff: row.getAttribute(ATTRIBUTES.ROW.STAFF_DATA), - tags: row.getAttribute(ATTRIBUTES.ROW.TAGS) + tags: row.getAttribute(ATTRIBUTES.ROW.TAGS), + icon: row.getAttribute(ATTRIBUTES.ROW.ROOM_ICON) }; }, meta_timestamp: () => document.querySelector('meta[name=timestamp]'), @@ -62,7 +63,8 @@ export const ATTRIBUTES = { IDENTIFIER: 'data-identifier', PUBLIC_KEY: 'data-pubkey', HOSTNAME: 'data-hostname', - STAFF_DATA: 'data-staff' + STAFF_DATA: 'data-staff', + ROOM_ICON: 'data-icon' }, SORTING: { ACTIVE: 'data-sort', diff --git a/output/main.js b/output/main.js index f123560..07f1b8c 100644 --- a/output/main.js +++ b/output/main.js @@ -76,7 +76,7 @@ function onLoad() { markSortableColumns(); addQRModalHandlers(); addServerIconInteractions(); - preloadQRCodes(); + preloadImages(); } const tagBody = ({text, type, description}) => element.span({ @@ -209,14 +209,23 @@ function addQRModalHandlers() { } -function preloadQRCodes() { +function preloadImages() { const rows = dom.tbl_communities_content_rows(); const identifiers = rows.map( rowElement => rowElement.getAttribute(ATTRIBUTES.ROW.IDENTIFIER) ); + const icons = rows.map( + rowElement => rowElement.getAttribute(ATTRIBUTES.ROW.ROOM_ICON) + ) for (const identifier of identifiers) { (new Image()).src = communityQRCodeURL(identifier); } + for (const icon of icons) { + if (!icon) { + continue; + } + (new Image()).src = icon; + } } function createJoinLinkButtons() { diff --git a/sites/+components/qr_modals.php b/sites/+components/qr_modals.php index ad6768c..dea4545 100644 --- a/sites/+components/qr_modals.php +++ b/sites/+components/qr_modals.php @@ -11,6 +11,11 @@