From f3017de02e9b93b6987d34a8e4aba338703cc7d5 Mon Sep 17 00:00:00 2001 From: mdPlusPlus Date: Sun, 8 Jan 2023 01:12:14 +0100 Subject: [PATCH] Make site accessible without JavaScript --- html_generator.php | 5 +++-- output/script.js | 12 ++++++++++++ output/styles.css | 5 ++++- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/html_generator.php b/html_generator.php index 85eb0361..ee8a5b93 100644 --- a/html_generator.php +++ b/html_generator.php @@ -54,9 +54,10 @@ " " . $content["description"] . "" . PHP_EOL . " " . $content["active_users"] . "" . PHP_EOL . " " . $content["preview_link"] . "" . PHP_EOL . - " " . substr($content["join_link"], 0, 32) . "..." . PHP_EOL . + /*" " . substr($content["join_link"], 0, 32) . "..." . PHP_EOL . " " . PHP_EOL . - " " . PHP_EOL . + " " . PHP_EOL .*/ + " " . $content["join_link"] . "" . PHP_EOL . " " . PHP_EOL; $table_lines[] = $line; } diff --git a/output/script.js b/output/script.js index 2a7f3f85..4e545b09 100644 --- a/output/script.js +++ b/output/script.js @@ -2,6 +2,18 @@ function onLoad(timestamp) { setLastChecked(timestamp); hideBadCommunities(); sortTable(2); // 2 == Name + createJoinLinkButtons(); +} + +function createJoinLinkButtons() { + elements = document.getElementsByClassName("td_join_url"); + Array.from(elements).forEach((td_element) => { + a_href = td_element.getElementsByTagName('a')[0]; // get first (only) element + join_link = a_href.getAttribute("href"); // get link + button_content = join_link.substring(0, 30) + "..."; + + td_element.innerHTML = button_content; + }); } function hideBadCommunities() { diff --git a/output/styles.css b/output/styles.css index abb03722..3775b361 100644 --- a/output/styles.css +++ b/output/styles.css @@ -11,7 +11,10 @@ .td_users { text-align: right; } #th_preview { width:19%; } #th_join_url { width:17%; } -.td_join_url { font-family: monospace; } +.td_join_url { + font-family: monospace; + white-space: nowrap; +} .copy_button { }