diff --git a/output/js/util.js b/output/js/util.js index 7cb8d0c..74626df 100644 --- a/output/js/util.js +++ b/output/js/util.js @@ -83,9 +83,17 @@ export const dom = { tbl_communities: () => document.getElementById("tbl_communities"), tbl_communities_content_rows: () => Array.from(dom.tbl_communities()?.rows)?.filter(row => !row.querySelector('th')), + /** + * @param {string} communityID + * @param {bool} matchIdPrefix + * @returns {HTMLRowElement | null} + */ community_row: (communityID, matchIdPrefix=false) => { const identifier = ATTRIBUTES.ROW.IDENTIFIER; + // Support matching shorter legacy IDs in links online const matches = matchIdPrefix ? '^=' : '='; + // Support matching room token, but only as a full match (plus symbol and hex code follows) + const id = communityID.includes('+') ? `${communityID}+` : communityID; return document.querySelector(`.room-row[${identifier}${matches}"${communityID}"]`); }, /**