Hotfix Copy button generation

dev
gravel 2 years ago
parent 1d48e1e5fb
commit 490d25c895
Signed by: gravel
GPG Key ID: C0538F3C906B308F

@ -51,11 +51,11 @@ const filteredCommunities = {
// This can be achieved with `text-overflow: ellipsis` instead
// and generated entirely server-side.
const transformJoinURL = (join_link) => {
return element.button({
textContent: "Copy",
className: "copy_button",
onclick: () => copyToClipboard(join_link)
});
return element.button({
textContent: "Copy",
className: "copy_button",
onclick: () => copyToClipboard(join_link)
});
}
function onLoad(timestamp) {
@ -77,8 +77,8 @@ function hideQRModal(communityID) {
function createJoinLinkButtons() {
const join_URLs = dom.join_urls();
Array.from(join_URLs).forEach((td_url) => {
const a_href = td_url.querySelector('a'); // get first (only) <a> element
const join_link = a_href.getAttribute("href"); // get link
// Data attributes are more idiomatic and harder to change by accident in the DOM.
const join_link = td_url.getAttribute('data-url');
td_url.append(transformJoinURL(join_link)); // add interactive content
});
}
@ -101,7 +101,7 @@ function hideBadCommunities() {
* Removes an element by its ID and returns the number of elements removed.
*/
function hideElementByID(id) {
const element = document.getElementById(id);
const element = document.getElementById(id);
element?.remove();
return element ? 1 : 0;
}
@ -289,3 +289,4 @@ Object.assign(window, {
onLoad, sortTable, displayQRModal,
hideQRModal, copyToClipboard
});

@ -61,7 +61,7 @@
>
</td>
<td class="td_join_url">
<div class="join_url_container">
<div class="join_url_container" data-url="<?=$room->join_link?>">
<a class="join_url show-from-w5" title="<?=$room->join_link?>"
><?=truncate($room->join_link, 32)?></a>
<a class="noscript" href="<?=$room->join_link?>"

Loading…
Cancel
Save