1
0
mirror of https://github.com/vrana/adminer.git synced 2025-08-10 00:28:34 +02:00

JS: Use let/const for globals

This commit is contained in:
Jakub Vrana
2025-03-20 08:58:20 +01:00
parent 101229043e
commit 62c18efbd5
6 changed files with 9 additions and 9 deletions

View File

@@ -484,7 +484,7 @@ class Adminer {
echo "<input type='submit' value='" . lang('Select') . "'>"; echo "<input type='submit' value='" . lang('Select') . "'>";
echo " <span id='noindex' title='" . lang('Full table scan') . "'></span>"; echo " <span id='noindex' title='" . lang('Full table scan') . "'></span>";
echo "<script" . nonce() . ">\n"; echo "<script" . nonce() . ">\n";
echo "var indexColumns = "; echo "const indexColumns = ";
$columns = array(); $columns = array();
foreach ($indexes as $index) { foreach ($indexes as $index) {
$current_key = reset($index["columns"]); $current_key = reset($index["columns"]);

View File

@@ -72,8 +72,8 @@ fQIDAQAB
. (isset($_COOKIE["adminer_version"]) ? "" : ", onload: partial(verifyVersion, '$VERSION', '" . js_escape(ME) . "', '" . get_token() . "')") // $token may be empty in auth.inc.php . (isset($_COOKIE["adminer_version"]) ? "" : ", onload: partial(verifyVersion, '$VERSION', '" . js_escape(ME) . "', '" . get_token() . "')") // $token may be empty in auth.inc.php
. "}); . "});
document.body.className = document.body.className.replace(/ nojs/, ' js'); document.body.className = document.body.className.replace(/ nojs/, ' js');
var offlineMessage = '" . js_escape(lang('You are offline.')) . "'; const offlineMessage = '" . js_escape(lang('You are offline.')) . "';
var thousandsSeparator = '" . js_escape(lang(',')) . "';") const thousandsSeparator = '" . js_escape(lang(',')) . "';")
; ;
echo "<div id='help' class='jush-" . JUSH . " jsonly hidden'></div>\n"; echo "<div id='help' class='jush-" . JUSH . " jsonly hidden'></div>\n";
echo script("mixin(qs('#help'), {onmouseover: function () { helpOpen = 1; }, onmouseout: helpMouseout});"); echo script("mixin(qs('#help'), {onmouseover: function () { helpOpen = 1; }, onmouseout: helpMouseout});");

View File

@@ -974,7 +974,7 @@ function slow_query($query) {
$connection2 = null; $connection2 = null;
if (!$slow_query && support("kill") && is_object($connection2 = connect($adminer->credentials())) && ($db == "" || $connection2->select_db($db))) { if (!$slow_query && support("kill") && is_object($connection2 = connect($adminer->credentials())) && ($db == "" || $connection2->select_db($db))) {
$kill = $connection2->result(connection_id()); // MySQL and MySQLi can use thread_id but it's not in PDO_MySQL $kill = $connection2->result(connection_id()); // MySQL and MySQLi can use thread_id but it's not in PDO_MySQL
echo script("var timeout = setTimeout(function () { ajax('" . js_escape(ME) . "script=kill', function () {}, 'kill=$kill&token=$token'); }, 1000 * $timeout);"); echo script("const timeout = setTimeout(function () { ajax('" . js_escape(ME) . "script=kill', function () {}, 'kill=$kill&token=$token'); }, 1000 * $timeout);");
} }
ob_flush(); ob_flush();
flush(); flush();

View File

@@ -53,8 +53,8 @@ foreach (table_status('', true) as $table => $table_status) {
<div id="schema" style="height: <?php echo $top; ?>em;"> <div id="schema" style="height: <?php echo $top; ?>em;">
<script<?php echo nonce(); ?>> <script<?php echo nonce(); ?>>
qs('#schema').onselectstart = function () { return false; }; qs('#schema').onselectstart = function () { return false; };
var tablePos = {<?php echo implode(",", $table_pos_js) . "\n"; ?>}; const tablePos = {<?php echo implode(",", $table_pos_js) . "\n"; ?>};
var em = qs('#schema').offsetHeight / <?php echo $top; ?>; const em = qs('#schema').offsetHeight / <?php echo $top; ?>;
document.onmousemove = schemaMousemove; document.onmousemove = schemaMousemove;
document.onmouseup = partialArg(schemaMouseup, '<?php echo js_escape(DB); ?>'); document.onmouseup = partialArg(schemaMouseup, '<?php echo js_escape(DB); ?>');
</script> </script>

View File

@@ -396,7 +396,7 @@ function editingMoveRow(up){
return false; return false;
} }
var lastType = ''; let lastType = '';
/** Clear length and hide collation or unsigned /** Clear length and hide collation or unsigned
* @this HTMLSelectElement * @this HTMLSelectElement

View File

@@ -10,8 +10,8 @@ class AdminerTablesFilter {
function tablesPrint($tables) { function tablesPrint($tables) {
?> ?>
<script<?php echo Adminer\nonce(); ?>> <script<?php echo Adminer\nonce(); ?>>
var tablesFilterTimeout = null; let tablesFilterTimeout = null;
var tablesFilterValue = ''; let tablesFilterValue = '';
function tablesFilter() { function tablesFilter() {
const value = qs('#filter-field').value.toLowerCase(); const value = qs('#filter-field').value.toLowerCase();