]> git.joonet.de Git - adminer.git/commitdiff
JS: Use let/const for globals
authorJakub Vrana <jakub@vrana.cz>
Thu, 20 Mar 2025 07:58:20 +0000 (08:58 +0100)
committerJakub Vrana <jakub@vrana.cz>
Thu, 20 Mar 2025 07:59:07 +0000 (08:59 +0100)
adminer/include/adminer.inc.php
adminer/include/design.inc.php
adminer/include/functions.inc.php
adminer/schema.inc.php
adminer/static/editing.js
plugins/tables-filter.php

index e813164eed4c661f2150db533e896b1029eacb72..8e796e60f793cf3092a1901fc7344842b2c2ce2e 100644 (file)
@@ -484,7 +484,7 @@ class Adminer {
                echo "<input type='submit' value='" . lang('Select') . "'>";
                echo " <span id='noindex' title='" . lang('Full table scan') . "'></span>";
                echo "<script" . nonce() . ">\n";
-               echo "var indexColumns = ";
+               echo "const indexColumns = ";
                $columns = array();
                foreach ($indexes as $index) {
                        $current_key = reset($index["columns"]);
index 5e23ff45563a79530a8c9afe28091edae84f8f30..9d67fde3b32c184e1fb7b680838586e2245fc6f2 100644 (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
                . "});
 document.body.className = document.body.className.replace(/ nojs/, ' js');
-var offlineMessage = '" . js_escape(lang('You are offline.')) . "';
-var thousandsSeparator = '" . js_escape(lang(',')) . "';")
+const offlineMessage = '" . js_escape(lang('You are offline.')) . "';
+const thousandsSeparator = '" . js_escape(lang(',')) . "';")
        ;
        echo "<div id='help' class='jush-" . JUSH . " jsonly hidden'></div>\n";
        echo script("mixin(qs('#help'), {onmouseover: function () { helpOpen = 1; }, onmouseout: helpMouseout});");
index 62f37ef0513ab45c0ddb241bbe72d282476e1967..13923016ea59c26936a2ad8e2b4d5bb286ac9dc4 100644 (file)
@@ -974,7 +974,7 @@ function slow_query($query) {
        $connection2 = null;
        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
-               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();
        flush();
index d3c74848c3fdfc43a95f8f303085ef610aaa2226..34eb7bb193954dad352914d41f03533eb0f6bc8c 100644 (file)
@@ -53,8 +53,8 @@ foreach (table_status('', true) as $table => $table_status) {
 <div id="schema" style="height: <?php echo $top; ?>em;">
 <script<?php echo nonce(); ?>>
 qs('#schema').onselectstart = function () { return false; };
-var tablePos = {<?php echo implode(",", $table_pos_js) . "\n"; ?>};
-var em = qs('#schema').offsetHeight / <?php echo $top; ?>;
+const tablePos = {<?php echo implode(",", $table_pos_js) . "\n"; ?>};
+const em = qs('#schema').offsetHeight / <?php echo $top; ?>;
 document.onmousemove = schemaMousemove;
 document.onmouseup = partialArg(schemaMouseup, '<?php echo js_escape(DB); ?>');
 </script>
index e368bc86c61e11ab2e2555a6bc9af519e2a30a0f..99aa345f8a9030edf8cf4842efc1076ffed08800 100644 (file)
@@ -396,7 +396,7 @@ function editingMoveRow(up){
        return false;
 }
 
-var lastType = '';
+let lastType = '';
 
 /** Clear length and hide collation or unsigned
 * @this HTMLSelectElement
index 92e041128e73ff2382e2f99fd4bd233cc74b5040..97334602a9df766200450efa9143c61f4e153457 100644 (file)
@@ -10,8 +10,8 @@ class AdminerTablesFilter {
        function tablesPrint($tables) {
                ?>
 <script<?php echo Adminer\nonce(); ?>>
-var tablesFilterTimeout = null;
-var tablesFilterValue = '';
+let tablesFilterTimeout = null;
+let tablesFilterValue = '';
 
 function tablesFilter() {
        const value = qs('#filter-field').value.toLowerCase();