|
|
|
@ -16,7 +16,8 @@
|
|
|
|
|
// Import magic numbers and data
|
|
|
|
|
import {
|
|
|
|
|
dom, COLUMN, COLUMN_LITERAL, COMPARISON, ATTRIBUTES,
|
|
|
|
|
columnAscendingByDefault, columnIsSortable, COLUMN_TRANSFORMATION, element, JOIN_URL_PASTE
|
|
|
|
|
columnAscendingByDefault, columnIsSortable, COLUMN_TRANSFORMATION,
|
|
|
|
|
element, JOIN_URL_PASTE, communityQRCodeURL
|
|
|
|
|
} from './js/constants.js';
|
|
|
|
|
|
|
|
|
|
// Hidden communities for transparency.
|
|
|
|
@ -104,7 +105,7 @@ function displayQRModal(communityID) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
dom.details_modal_qr_code().src = `qr-codes/${communityID}.png`;
|
|
|
|
|
dom.details_modal_qr_code().src = communityQRCodeURL(communityID);
|
|
|
|
|
|
|
|
|
|
modal.showModal();
|
|
|
|
|
}
|
|
|
|
@ -117,7 +118,7 @@ function addQRModalHandlers() {
|
|
|
|
|
const rows = dom.tbl_communities_content_rows();
|
|
|
|
|
if (!rows) throw new Error("Rows not found");
|
|
|
|
|
for (const row of rows) {
|
|
|
|
|
const communityID = row.getAttribute('data-identifier');
|
|
|
|
|
const communityID = row.getAttribute(ATTRIBUTES.ROW.IDENTIFIER);
|
|
|
|
|
row.querySelector('.td_qr_code').addEventListener(
|
|
|
|
|
'click',
|
|
|
|
|
() => displayQRModal(communityID)
|
|
|
|
@ -150,7 +151,7 @@ function addQRModalHandlers() {
|
|
|
|
|
/**
|
|
|
|
|
* @type {string[]}
|
|
|
|
|
*/
|
|
|
|
|
const staff = JSON.parse(this.getAttribute('data-staff'));
|
|
|
|
|
const staff = JSON.parse(this.getAttribute(ATTRIBUTES.ROW.STAFF_DATA));
|
|
|
|
|
if (staff.length == 0) {
|
|
|
|
|
alert("No public moderators available for this Community.");
|
|
|
|
|
return;
|
|
|
|
@ -159,7 +160,7 @@ function addQRModalHandlers() {
|
|
|
|
|
copyToClipboard(`@${staffId}`, 'Copied staff ID to clipboard.');
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (const anchor of dom.qr_code_buttons()) {
|
|
|
|
|
// Disable QR code links
|
|
|
|
|
anchor.setAttribute("href", "#");
|
|
|
|
@ -241,8 +242,8 @@ function setLastChecked(last_checked) {
|
|
|
|
|
function addServerIconInteractions() {
|
|
|
|
|
const rows = dom.tbl_communities_content_rows();
|
|
|
|
|
for (const row of rows) {
|
|
|
|
|
const hostname = row.getAttribute('data-hostname');
|
|
|
|
|
const publicKey = row.getAttribute('data-pubkey');
|
|
|
|
|
const hostname = row.getAttribute(ATTRIBUTES.ROW.HOSTNAME);
|
|
|
|
|
const publicKey = row.getAttribute(ATTRIBUTES.ROW.PUBLIC_KEY);
|
|
|
|
|
const serverIcon = row.querySelector('.td_server_icon');
|
|
|
|
|
serverIcon.addEventListener('click', () => {
|
|
|
|
|
alert(`Host: ${hostname}\n\nPublic key:\n${publicKey}`);
|
|
|
|
|