Add language flags

pull/7/head
mdPlusPlus 2 years ago
parent 0aa8a5ef9a
commit 64836fa7d9

@ -3,6 +3,7 @@
// require other php files
require "helper_functions.php";
require "language_flags.php";
// some global stuff
@ -526,6 +527,7 @@
* Token + shortened pubkey | Name | Description | Users | View Links(?) | Join URL
*/
function get_table_html($room_assignments_arr) {
global $languages;
$shortened_pubkey_length = 4; // shorten pubkey to this length to make room token unique
// contains the info for each line of the table
$ordered_table_elements = array();
@ -548,6 +550,7 @@
$info_array = array(
"name" => $room_array["name"],
"language" => $languages[$identifier],
"description" => $room_array["description"],
"active_users" => $room_array["active_users"],
"join_link" => $join_link
@ -591,6 +594,7 @@
$line =
" <tr id=\"" . $id . "\">" . PHP_EOL .
" <td class=\"td_identifier\">" . $id . "</td>" . PHP_EOL .
" <td>" . $content["language"] . "</td>" . PHP_EOL .
" <td>" . $content["name"] . "</td>" . PHP_EOL .
" <td>" . $content["description"] . "</td>" . PHP_EOL .
" <td class=\"td_users\">" . $active_users . "</td>" . PHP_EOL .
@ -608,11 +612,12 @@
"<table id=\"tbl_communities\">" . PHP_EOL .
" <tr>" . PHP_EOL .
" <th onclick=\"sortTable(0)\" id=\"th_identifier\">Identifier</th>" . PHP_EOL .
" <th onclick=\"sortTable(1)\" id=\"th_name\">Name</th>" . PHP_EOL .
" <th onclick=\"sortTable(2)\" id=\"th_description\">Description</th>" . PHP_EOL .
" <th onclick=\"sortTable(3)\" id=\"th_users\">Users</th>" . PHP_EOL .
" <th onclick=\"sortTable(4)\" id=\"th_preview\">Preview</th>" . PHP_EOL .
" <th onclick=\"sortTable(5)\" id=\"th_join_url\">Join URL</th>" . PHP_EOL .
" <th onclick=\"sortTable(1)\" id=\"th_language\">L</th>" . PHP_EOL .
" <th onclick=\"sortTable(2)\" id=\"th_name\">Name</th>" . PHP_EOL .
" <th onclick=\"sortTable(3)\" id=\"th_description\">Description</th>" . PHP_EOL .
" <th onclick=\"sortTable(4)\" id=\"th_users\">Users</th>" . PHP_EOL .
" <th onclick=\"sortTable(5)\" id=\"th_preview\">Preview</th>" . PHP_EOL .
" <th onclick=\"sortTable(6)\" id=\"th_join_url\">Join URL</th>" . PHP_EOL .
" </tr>" . PHP_EOL;
// suffix

@ -0,0 +1,98 @@
<?php
// http://sog.caliban.org/
$languages_118d = array(
"android+118d" => "",
"brasil+118d" => "🇵🇹",
"deutsch+118d" => "🇩🇪",
"espanol+118d" => "🇪🇸",
"francais+118d" => "🇫🇷",
"gaming+118d" => "",
"health+118d" => "",
"im+118d" => "🇬🇧",
"italiano+118d" => "🇮🇹",
"linux+118d" => "",
"modernsurvival+118d" => "",
"music+118d" => "",
"nl+118d" => "🇳🇱",
"persian+118d" => "🇮🇷",
"portugues+118d" => "🇵🇹",
"privacy+118d" => "",
"russian+118d" => "🇷🇺",
"snops+118d" => "🇬🇧",
"sogops+118d" => "🇬🇧",
"travel+118d" => "",
"unix+118d" => ""
);
// http://45.77.102.159/
$languages_132d = array(
"kat67world+132d" => "",
"origin+132d" => "🇨🇳",
"scammer+132d" => ""
);
// http://173.249.51.184/
$languages_2812 = array(
"fi+2812" => "🇫🇮",
"main+2812" => "",
"scandinavia+2812" => ""
);
// http://95.217.236.112/
$languages_8e2e = array(
"CrazyGamers+8e2e" => "",
"fishing+8e2e" => "",
"ohjelmointisuomi+8e2e" => "🇫🇮",
"pk+8e2e" => "🇫🇮",
"SuomenTori+8e2e" => "🇫🇮",
"suomentoriv2+8e2e" => "🇫🇮",
"tori+8e2e" => ""
);
// https://open.getsession.org/
$languages_a03c = array(
"crypto+a03c" => "🇬🇧",
"lokinet+a03c" => "🇬🇧",
"oxen+a03c" => "🇬🇧",
"session-farsi+a03c" => "🇮🇷",
"session-updates+a03c" => "🇬🇧",
"session+a03c" => "🇬🇧"
);
// http://185.130.45.173/
$languages_b79f = array(
"cryptography+b79f" => "",
"philosophy+b79f" => "",
"trading+b79f" => "",
"uncensored+b79f" => "",
"webdev+b79f" => "🇬🇧"
);
// http://open.session.codes/
$languages_c7fb = array(
"4c2ba1+c7fb" => "🇪🇸",
"6e7b5f+c7fb" => "",
"90ca71+c7fb" => "🇷🇺",
"a80d69+c7fb" => "",
"d8dc40+c7fb" => "🇪🇸",
"edb497+c7fb" => "🇨🇳",
"sc+c7fb" => ""
);
// http://95.179.250.131/
$languages_e5e0 = array(
"generalchat+e5e0" => "",
"nsfw+e5e0" => "",
"public+e5e0" => "🇬🇧"
);
$languages = array_merge(
$languages_118d,
$languages_132d,
$languages_8e2e,
$languages_a03c,
$languages_b79f,
$languages_c7fb,
$languages_e5e0
);
?>

@ -1,7 +1,7 @@
function onLoad(timestamp) {
setLastChecked(timestamp);
hideBadCommunities();
sortTable(1); // 1 == Name
sortTable(2); // 2 == Name
}
function hideBadCommunities() {
@ -62,8 +62,8 @@ function sortTable(n) {
y = rows[i + 1].getElementsByTagName("TD")[n];
// Check if the two rows should switch place, based on the direction, asc or desc:
if (dir == "asc") {
// If columns is users (3), sort numerically
if ( n == 3 ) {
// If columns is users (4), sort numerically
if ( n == 4 ) {
if (Number(x.innerHTML) > Number(y.innerHTML)) {
shouldSwitch = true;
break;
@ -75,8 +75,8 @@ function sortTable(n) {
}
}
else if (dir == "desc") {
if ( n == 3 ) {
// If columns is users (3), sort numerically
if ( n == 4 ) {
// If columns is users (4), sort numerically
if (Number(x.innerHTML) < Number(y.innerHTML)) {
shouldSwitch = true;
break;

@ -5,6 +5,7 @@
#th_identifier { width:9%; }
.td_identifier { font-family: monospace; }
#th_name { width:13%; }
#th_language { width:16px }
#th_description { }
#th_users { }
.td_users { text-align: right; }

Loading…
Cancel
Save