diff --git a/adminer/create.inc.php b/adminer/create.inc.php index 0f8bbb9f..03e023ca 100644 --- a/adminer/create.inc.php +++ b/adminer/create.inc.php @@ -190,8 +190,8 @@ edit_fields($row["fields"], $collations, "TABLE", $foreign_keys, $comments); " . lang('Comment') . "" - . script("qsl('input').onclick = function () { columnShow(this.checked, 6); toggle('Comment'); if (this.checked) this.form['Comment'].focus(); };") - . ' ' + . script("qsl('input').onclick = partial(editingCommentsClick, true);") + . ' ' : '') ; ?>

@@ -225,3 +225,4 @@ foreach ($row["partition_names"] as $key => $val) { ?> + diff --git a/adminer/static/editing.js b/adminer/static/editing.js index 694dd76e..bba8f888 100644 --- a/adminer/static/editing.js +++ b/adminer/static/editing.js @@ -409,6 +409,19 @@ function partitionNameChange() { this.oninput = function () {}; } +/** Show or hide comment fields +* @param [boolean] whether to focus Comment if checked +* @this HTMLInputElement +*/ +function editingCommentsClick(focus) { + var comment = this.form['Comment']; + columnShow(this.checked, 6); + alterClass(comment, 'hidden', !this.checked); + if (focus && this.checked) { + comment.focus(); + } +} + /** Uncheck 'all' checkbox