From ddcd0fa5b77835ba0fed3ffed6b55ff5559151f9 Mon Sep 17 00:00:00 2001 From: Matteo Nastasi Date: Sat, 18 Apr 2020 14:07:58 +0200 Subject: [PATCH] use class instead of id to hide tables --- TODO.txt | 4 ++++ web/index.php | 31 ++++++++++++++++++++----------- web/prefs.js | 19 +++++-------------- 3 files changed, 29 insertions(+), 25 deletions(-) diff --git a/TODO.txt b/TODO.txt index 266c4ff..9e88cb7 100644 --- a/TODO.txt +++ b/TODO.txt @@ -3,6 +3,10 @@ BUGS | ------+ + - manage client answer (ping) on closing ws + - manage 'close' prefs when change visibilty + + - /cont and /rules just during 'bidding' phase DONE - Not sequence of 3 same chars DONE . check server side with test diff --git a/web/index.php b/web/index.php index 0ed96ea..76644d7 100644 --- a/web/index.php +++ b/web/index.php @@ -524,24 +524,33 @@ function index_main(&$brisk, $transp_type, $header, &$header_out, $remote_addr_f if ($ACTION == "room") { $tables .= '
'; $tables .= ''; + + $direct = ($user->is_auth() && !$user->is_appr()); for ($ii = 0 ; $ii < TABLES_N ; $ii++) { - if ($user->is_auth() && !$user->is_appr()) + if ($direct) $i = $ii; else $i = TABLES_N - $ii - 1; if ($ii % 4 == 0) { - $tables .= ''; - } - if (TRUE || !($user->flags & USER_FLAG_ISOLAUTH) || $i < TABLES_APPR_N) { - $tables .= ''."\n"; + if ($direct) { + $noauth_class = ($i + 3 < TABLES_APPR_N ? "" : "noauth"); + } + else { + $noauth_class = ($i < TABLES_APPR_N ? "" : "noauth"); + } + $tables .= sprintf('', $noauth_class); } + + $noauth_class = ($i < TABLES_APPR_N ? "" : "noauth"); + $tables .= sprintf(''."\n"; + if ($ii % 4 == 3) { $tables .= ''; } diff --git a/web/prefs.js b/web/prefs.js index e880506..83f3d31 100644 --- a/web/prefs.js +++ b/web/prefs.js @@ -64,13 +64,9 @@ function prefs_apply(prefs_new, is_update, is_volat) } if (relo || !is_update) { - for (i = g_tables_appr_n ; i < g_tables_n ; i++) { - if (i % 4 == 0) { - $('tr_noauth'+i).style.display = (prefs_new.listen == l_list_isol ? 'none' : ''); - } + $('tr.noauth').style.display = (prefs_new.listen == l_list_isol ? 'none' : ''); + $('td.noauth').style.display = (prefs_new.listen == l_list_isol ? 'none' : ''); - $('td_noauth'+i).style.display = (prefs_new.listen == l_list_isol ? 'none' : ''); - } if (prefs_new.listen == l_list_isol) { tra.hide_noauth(); } @@ -205,14 +201,9 @@ function list_set(what, is_update, info) if (relo || !is_update) { - for (i = g_tables_appr_n ; i < g_tables_n ; i++) { - - if (i % 4 == 0) { - $('tr_noauth'+i).style.display = (what == 'isolation' ? 'none' : ''); - } - - $('td_noauth'+i).style.display = (what == 'isolation' ? 'none' : ''); - } + $('tr.noauth').style.display = (what == 'isolation' ? 'none' : ''); + $('td.noauth').style.display = (what == 'isolation' ? 'none' : ''); + if (what == 'isolation') { tra.hide_noauth(); } -- 2.17.1
'; - - $tables .= '
'.$mlang_room['tit_tabl'][$G_lang].$i.'
'; - $tables .= sprintf('
', $i); - $tables .= sprintf('
', $i); - $tables .= '
'; - $tables .= '
', $noauth_class); + + $tables .= '
'.$mlang_room['tit_tabl'][$G_lang].$i.'
'; + $tables .= sprintf('
', $i); + $tables .= sprintf('
', $i); + $tables .= '
'; + $tables .= '