From e4235d21e553ed7fbec632ff1365fbd4de8d1d66 Mon Sep 17 00:00:00 2001 From: Peter Knut Date: Wed, 30 Oct 2024 20:35:14 +0100 Subject: [PATCH] Clean up JS code --- adminer/create.inc.php | 2 +- adminer/database.inc.php | 2 +- adminer/db.inc.php | 2 +- adminer/dump.inc.php | 6 +-- adminer/include/adminer.inc.php | 12 ++--- adminer/include/editing.inc.php | 2 +- adminer/include/functions.inc.php | 2 +- adminer/schema.inc.php | 12 ++--- adminer/scheme.inc.php | 2 +- adminer/select.inc.php | 4 +- adminer/sql.inc.php | 2 +- adminer/static/editing.js | 52 ++++++++++++---------- adminer/static/functions.js | 73 ++++++++++++------------------- adminer/trigger.inc.php | 2 +- adminer/user.inc.php | 2 +- editor/db.inc.php | 6 +-- editor/include/adminer.inc.php | 6 +-- editor/static/editing.js | 2 +- plugins/tinymce.php | 2 +- 19 files changed, 90 insertions(+), 103 deletions(-) diff --git a/adminer/create.inc.php b/adminer/create.inc.php index 6574e83d..04f37bff 100644 --- a/adminer/create.inc.php +++ b/adminer/create.inc.php @@ -182,7 +182,7 @@ foreach ($engines as $engine) {

: " autocapitalize="off"> - + " . optionlist(array("" => "(" . lang('engine') . ")") + $engines, $row["Engine"]) . "" . help_script_command("value", true) : ""); ?> "(" . lang('collation') . ")") + $collations, $row["Collation"]) : ""); ?> diff --git a/adminer/database.inc.php b/adminer/database.inc.php index bc5e4dbf..6d9e6876 100644 --- a/adminer/database.inc.php +++ b/adminer/database.inc.php @@ -66,7 +66,7 @@ echo ($_POST["add_x"] || strpos($name, "\n") 'mariadb' => "supported-character-sets-and-collations/", 'mssql' => "ms187963.aspx", )) : ""); -echo script("focus(qs('#name'));"); +echo script("focus(gid('name'));"); ?> homepage()) { echo "\n"; echo script("mixin(qsl('table'), {onclick: tableClick, ondblclick: partialArg(tableClick, true)});"); echo ''; - echo '"; - echo "\n"; $views = ""; @@ -208,7 +208,7 @@ if (DB != "") { } else { echo "\n"; $databases = $adminer->databases(); if ($databases) { diff --git a/adminer/include/adminer.inc.php b/adminer/include/adminer.inc.php index a0002660..011ed46a 100644 --- a/adminer/include/adminer.inc.php +++ b/adminer/include/adminer.inc.php @@ -129,7 +129,7 @@ class Adminer { echo "
' . script("qs('#check-all').onclick = partial(formCheck, /^(tables|views)\[/);", ""); + echo '' . script("gid('check-all').onclick = partial(formCheck, /^(tables|views)\[/);", ""); echo '' . lang('Table'); echo '' . lang('Engine') . doc_link(array('sql' => 'storage-engines.html')); echo '' . lang('Collation') . doc_link(array('sql' => 'charset-charsets.html', 'mariadb' => 'supported-character-sets-and-collations/')); diff --git a/adminer/dump.inc.php b/adminer/dump.inc.php index eaf5a462..a9512e0f 100644 --- a/adminer/dump.inc.php +++ b/adminer/dump.inc.php @@ -182,8 +182,8 @@ $prefixes = array(); if (DB != "") { $checked = ($TABLE != "" ? "" : " checked"); echo "
" . script("qs('#check-tables').onclick = partial(formCheck, /^tables\\[/);", ""); - echo "" . script("qs('#check-data').onclick = partial(formCheck, /^data\\[/);", ""); + echo "" . script("gid('check-tables').onclick = partial(formCheck, /^tables\\[/);", ""); + echo "" . script("gid('check-data').onclick = partial(formCheck, /^data\\[/);", ""); echo "
"; echo ""; - echo script("qs('#check-databases').onclick = partial(formCheck, /^databases\\[/);", ""); + echo script("gid('check-databases').onclick = partial(formCheck, /^databases\\[/);", ""); echo "
\n"; echo $this->loginFormField('driver', '
' . lang('System') . '', html_select("auth[driver]", $drivers, DRIVER, "loginDriver(this);") . "\n"); echo $this->loginFormField('server', '
' . lang('Server') . '', '' . "\n"); - echo $this->loginFormField('username', '
' . lang('Username') . '', '' . script("focus(qs('#username')); qs('#username').form['auth[driver]'].onchange();")); + echo $this->loginFormField('username', '
' . lang('Username') . '', '' . script("focus(gid('username')); gid('username').form['auth[driver]'].onchange();")); echo $this->loginFormField('password', '
' . lang('Password') . '', '' . "\n"); echo $this->loginFormField('db', '
' . lang('Database') . '', '' . "\n"); echo "
\n"; @@ -557,7 +557,7 @@ class Adminer { json_row($key); } echo ";\n"; - echo "selectFieldChange.call(qs('#form')['select']);\n"; + echo "selectFieldChange.call(gid('form')['select']);\n"; echo "\n"; echo "\n"; } @@ -1073,7 +1073,7 @@ class Adminer { } } if ($output) { - echo "

\n" . script("mixin(qs('#logins'), {onmouseover: menuOver, onmouseout: menuOut});"); + echo "\n" . script("mixin(gid('logins'), {onmouseover: menuOver, onmouseout: menuOut});"); } } else { $tables = array(); @@ -1156,7 +1156,7 @@ bodyLoad('" . optionlist(["" => lang('Database')] + $databases, DB) . "" - . script("mixin(qs('#database-select'), {onmousedown: dbMouseDown, onchange: dbChange});"); + . script("mixin(gid('database-select'), {onmousedown: dbMouseDown, onchange: dbChange});"); } else { echo "\n"; } @@ -1164,7 +1164,7 @@ bodyLoad('select_db(DB)) { echo "
" - . script("mixin(qs('#scheme-select'), {onmousedown: dbMouseDown, onchange: dbChange});"); + . script("mixin(gid('scheme-select'), {onmousedown: dbMouseDown, onchange: dbChange});"); if ($_GET["ns"] != "") { set_schema($_GET["ns"]); @@ -1200,7 +1200,7 @@ bodyLoad('" . script("mixin(qs('#tables'), {onmouseover: menuOver, onmouseout: menuOut});"); + echo "