From ac5bf3732e0f70fb7a6742808f83c7d61def1fd2 Mon Sep 17 00:00:00 2001 From: mdPlusPlus Date: Tue, 3 Jan 2023 22:55:44 +0100 Subject: [PATCH] Add filtering for bad communities --- get_online_session_communities.php | 6 +++--- output/script.js | 30 ++++++++++++++++++++++++++++++ output/styles.css | 2 ++ 3 files changed, 35 insertions(+), 3 deletions(-) diff --git a/get_online_session_communities.php b/get_online_session_communities.php index b93ec17a..3b652d15 100644 --- a/get_online_session_communities.php +++ b/get_online_session_communities.php @@ -582,14 +582,14 @@ } } - // test if active_users is valid $active_users = $content["active_users"]; + // test if active_users is valid /*if($active_users == -1) { $active_users = "N/A"; // this breaks sortTable() }*/ $line = - " " . PHP_EOL . + " " . PHP_EOL . " " . $id . "" . PHP_EOL . " " . $content["name"] . "" . PHP_EOL . " " . $content["description"] . "" . PHP_EOL . @@ -650,7 +650,7 @@ " " . PHP_EOL . " " . $title . "" . PHP_EOL . " " . PHP_EOL . - " " . PHP_EOL; + " " . PHP_EOL; $post = " " . PHP_EOL . "" . PHP_EOL; diff --git a/output/script.js b/output/script.js index 6a575517..30339902 100644 --- a/output/script.js +++ b/output/script.js @@ -1,3 +1,33 @@ +function onLoad(timestamp) { + setLastChecked(timestamp); + hideBadCommunities(); + sortTable(1); // 1 == Name +} + +function hideBadCommunities() { + const testCommunityIDs = [ + "2e9345+c7fb", // TestRoom + "762ba9+c7fb", // TesterRoom + "b4d829+c7fb", // Test + "e5853a+c7fb", // testtest + "test+118d", // Testing 1, 2, 3 + "test+13f6", // Testing room + "test+fe93" // 测试(Test) + ]; + + const badCommunityIDs = [ + "60fa60+c7fb" // "N-word" Community + ]; + + testCommunityIDs.forEach(hideElementByID); + badCommunityIDs.forEach(hideElementByID); +} + +function hideElementByID(id) { + element = document.getElementById(id); + element.style.display = "none"; +} + function copyToClipboard(text) { navigator.clipboard.writeText(text); } diff --git a/output/styles.css b/output/styles.css index 986ef931..2532ba03 100644 --- a/output/styles.css +++ b/output/styles.css @@ -2,6 +2,8 @@ #tbl_communities { width:100%; } +th { background-color: lightgray; } + #th_identifier { width:9%; } .td_identifier { font-family: monospace; } #th_name { width:13%; }