From 1548c6e5d3d09622fe0fa30fb0fa681def8ad5fd Mon Sep 17 00:00:00 2001 From: gravel Date: Sat, 6 Jan 2024 14:07:19 +0000 Subject: [PATCH] Fix copy staff ID button --- output/main.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/output/main.js b/output/main.js index 8251eabe..ad64a471 100644 --- a/output/main.js +++ b/output/main.js @@ -327,14 +327,15 @@ function addQRModalHandlers() { document.querySelector('#details-modal-copy-staff-id')?.addEventListener( 'click', function () { - /** - * @type {string[]} - */ - const staff = this.getAttribute(ATTRIBUTES.ROW.STAFF_DATA).split(","); - if (staff.length == 0) { + const staffList = this.getAttribute(ATTRIBUTES.ROW.STAFF_DATA); + if (staffList == "") { alert("No public moderators available for this Community."); return; } + /** + * @type {string[]} + */ + const staff = staffList.split(","); const staffId = staff[~~(staff.length * Math.random())]; copyToClipboard(`@${staffId}`, STAFF_ID_PASTE); }