]> git.joonet.de Git - adminer.git/commitdiff
JS: Unsupport event.srcElement
authorJakub Vrana <jakub@vrana.cz>
Fri, 21 Mar 2025 22:41:46 +0000 (23:41 +0100)
committerJakub Vrana <jakub@vrana.cz>
Fri, 21 Mar 2025 22:58:45 +0000 (23:58 +0100)
adminer/create.inc.php
adminer/include/adminer.inc.php
adminer/include/html.inc.php
adminer/static/editing.js
adminer/static/functions.js
editor/static/editing.js

index 9215d6f3e94085774c1d6a91f38525c5b6c920cd..953cd590cec768e9675440dc5895312a686d1680 100644 (file)
@@ -183,7 +183,7 @@ foreach ($engines as $engine) {
 <?php
 if (support("columns") || $TABLE == "") {
        echo lang('Table name') . ": <input name='name'" . ($TABLE == "" && !$_POST ? " autofocus" : "") . " data-maxlength='64' value='" . h($row["name"]) . "' autocapitalize='off'>\n";
-       echo ($engines ? html_select("Engine", array("" => "(" . lang('engine') . ")") + $engines, $row["Engine"]) . on_help("getTarget(event).value", 1) . script("qsl('select').onchange = helpClose;") . "\n" : "");
+       echo ($engines ? html_select("Engine", array("" => "(" . lang('engine') . ")") + $engines, $row["Engine"]) . on_help("event.target.value", 1) . script("qsl('select').onchange = helpClose;") . "\n" : "");
        if ($collations) {
                echo "<datalist id='collations'>" . optionlist($collations) . "</datalist>";
                echo (preg_match("~sqlite|mssql~", JUSH) ? "" : "<input list='collations' name='Collation' value='" . h($row["Collation"]) . "' placeholder='(" . lang('collation') . ")'>");
@@ -221,7 +221,7 @@ if (support("columns")) {
 if (support("partitioning")) {
        $partition_table = preg_match('~RANGE|LIST~', $row["partition_by"]);
        print_fieldset("partition", lang('Partition by'), $row["partition_by"]);
-       echo "<p>" . html_select("partition_by", array("" => "") + $partition_by, $row["partition_by"]) . on_help("getTarget(event).value.replace(/./, 'PARTITION BY \$&')", 1) . script("qsl('select').onchange = partitionByChange;");
+       echo "<p>" . html_select("partition_by", array("" => "") + $partition_by, $row["partition_by"]) . on_help("event.target.value.replace(/./, 'PARTITION BY \$&')", 1) . script("qsl('select').onchange = partitionByChange;");
        echo "(<input name='partition' value='" . h($row["partition"]) . "'>)\n";
        echo lang('Partitions') . ": <input type='number' name='partitions' class='size" . ($partition_table || !$row["partition_by"] ? " hidden" : "") . "' value='" . h($row["partitions"]) . "'>\n";
        echo "<table id='partition-table'" . ($partition_table ? "" : " class='hidden'") . ">\n";
index 8e796e60f793cf3092a1901fc7344842b2c2ce2e..9fcd06ed157015c2e4ad9e81f8ee2250a59b96df 100644 (file)
@@ -387,7 +387,7 @@ class Adminer {
                                ($key !== "" ? "selectFieldChange" : "selectAddRow")
                        );
                        echo "<div>" . ($driver->functions || $driver->grouping ? html_select("columns[$i][fun]", array(-1 => "") + array_filter(array(lang('Functions') => $driver->functions, lang('Aggregation') => $driver->grouping)), $val["fun"])
-                               . on_help("getTarget(event).value && getTarget(event).value.replace(/ |\$/, '(') + ')'", 1)
+                               . on_help("event.target.value && event.target.value.replace(/ |\$/, '(') + ')'", 1)
                                . script("qsl('select').onchange = function () { helpClose();" . ($key !== "" ? "" : " qsl('select, input', this.parentNode).onchange();") . " };", "")
                                . "($column)" : $column) . "</div>\n";
                        $i++;
index ec338e165a20558fcf99a657fa68228b40fc2fed..c3d19595345215cb30676f4295923e1f693df793 100644 (file)
@@ -280,7 +280,7 @@ function input($field, $value, $function, $autofocus = false) {
                $has_function = (in_array($function, $functions) || isset($functions[$function]));
                echo (count($functions) > 1
                        ? "<select name='function[$name]'$disabled>" . optionlist($functions, $function === null || $has_function ? $function : "") . "</select>"
-                               . on_help("getTarget(event).value.replace(/^SQL\$/, '')", 1)
+                               . on_help("event.target.value.replace(/^SQL\$/, '')", 1)
                                . script("qsl('select').onchange = functionChange;", "")
                        : h(reset($functions))
                ) . '<td>';
index 9f5d4f21fd65cff733941c10d78d6d83bda7db40..94dec1880c8a9a6d71388058c586ce35485ebff8 100644 (file)
@@ -237,7 +237,7 @@ function editFields() {
                        },
                        onchange: editingTypeChange,
                        onmouseover: function (event) {
-                               helpMouseover.call(this, event, getTarget(event).value, 1);
+                               helpMouseover.call(this, event, event.target.value, 1);
                        },
                        onmouseout: helpMouseout
                });
@@ -249,7 +249,7 @@ function editFields() {
 * @return boolean false to cancel action
 */
 function editingClick(event) {
-       let el = getTarget(event);
+       let el = event.target;
        if (!isTag(el, 'input')) {
                el = parentTag(el, 'label');
                el = el && qs('input', el);
@@ -282,7 +282,7 @@ function editingClick(event) {
 * @param InputEvent
 */
 function editingInput(event) {
-       const el = getTarget(event);
+       const el = event.target;
        if (/\[default]$/.test(el.name)) {
                 el.previousElementSibling.checked = true;
                 el.previousElementSibling.selectedIndex = Math.max(el.previousElementSibling.selectedIndex, 1);
@@ -546,7 +546,7 @@ function editingCommentsClick(el, focus) {
 * @this HTMLTableElement
 */
 function dumpClick(event) {
-       let el = parentTag(getTarget(event), 'label');
+       let el = parentTag(event.target, 'label');
        if (el) {
                el = qs('input', el);
                const match = /(.+)\[]$/.exec(el.name);
@@ -758,7 +758,7 @@ let helpOpen, helpIgnore; // when mouse outs <option> then it mouse overs border
 * @this HTMLElement
 */
 function helpMouseover(event, text, side) {
-       const target = getTarget(event);
+       const target = event.target;
        if (!text) {
                helpClose();
        } else if (window.jush && (!helpIgnore || this != target)) {
@@ -780,7 +780,7 @@ function helpMouseover(event, text, side) {
 */
 function helpMouseout(event) {
        helpOpen = 0;
-       helpIgnore = (this != getTarget(event));
+       helpIgnore = (this != event.target);
        setTimeout(() => {
                if (!helpOpen) {
                        helpClose();
index 34a57f6c93983b24dcc4927bb2e4df11a517cb82..4d9d627a8ef4a59683bca1a47c6beec4ef4bb8c3 100644 (file)
@@ -232,7 +232,7 @@ function formChecked(input, name) {
 * @param [boolean] force click
 */
 function tableClick(event, click) {
-       const td = parentTag(getTarget(event), 'td');
+       const td = parentTag(event.target, 'td');
        let text;
        if (td && (text = td.getAttribute('data-text'))) {
                if (selectClick.call(td, event, +text, td.getAttribute('data-warning'))) {
@@ -240,7 +240,7 @@ function tableClick(event, click) {
                }
        }
        click = (click || !window.getSelection || getSelection().isCollapsed);
-       let el = getTarget(event);
+       let el = event.target;
        while (!isTag(el, 'tr')) {
                if (isTag(el, 'table|a|input|textarea')) {
                        if (el.type != 'checkbox') {
@@ -345,7 +345,7 @@ function pageClick(href, page) {
 * @this HTMLElement
 */
 function menuOver(event) {
-       const a = getTarget(event);
+       const a = event.target;
        if (isTag(a, 'a|span') && a.offsetLeft + a.offsetWidth > a.parentNode.offsetWidth - 15) { // 15 - ellipsis
                this.style.overflow = 'visible';
        }
@@ -452,14 +452,6 @@ function isCtrl(event) {
        return (event.ctrlKey || event.metaKey) && !event.altKey; // shiftKey allowed
 }
 
-/** Return event target
-* @param Event
-* @return HTMLElement
-*/
-function getTarget(event) {
-       return event.target || event.srcElement;
-}
-
 
 
 /** Send form by Ctrl+Enter on <select> and <textarea>
@@ -469,7 +461,7 @@ function getTarget(event) {
 */
 function bodyKeydown(event, button) {
        eventStop(event);
-       let target = getTarget(event);
+       let target = event.target;
        if (target.jushTextarea) {
                target = target.jushTextarea;
        }
@@ -493,7 +485,7 @@ function bodyKeydown(event, button) {
 * @param MouseEvent
 */
 function bodyClick(event) {
-       const target = getTarget(event);
+       const target = event.target;
        if ((isCtrl(event) || event.shiftKey) && target.type == 'submit' && isTag(target, 'input')) {
                target.form.target = '_blank';
                setTimeout(() => {
@@ -511,7 +503,7 @@ function bodyClick(event) {
 */
 function editingKeydown(event) {
        if ((event.keyCode == 40 || event.keyCode == 38) && isCtrl(event)) { // 40 - Down, 38 - Up
-               const target = getTarget(event);
+               const target = event.target;
                const sibling = (event.keyCode == 40 ? 'nextSibling' : 'previousSibling');
                let el = target.parentNode.parentNode[sibling];
                if (el && (isTag(el, 'tr') || (el = el[sibling])) && isTag(el, 'tr') && (el = el.childNodes[nodePosition(target.parentNode)]) && (el = el.childNodes[nodePosition(target)])) {
@@ -618,7 +610,7 @@ function ajax(url, callback, data, message) {
                }
                request.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
                request.onreadystatechange = () => {
-                       if (request.readyState == 4) { // 4 - DONE
+                       if (request.readyState == 4) {
                                if (/^2/.test(request.status)) {
                                        callback(request);
                                } else {
@@ -690,7 +682,7 @@ function ajaxForm(form, message, button) {
 */
 function selectClick(event, text, warning) {
        const td = this;
-       const target = getTarget(event);
+       const target = event.target;
        if (!isCtrl(event) || isTag(td.firstChild, 'input|textarea') || isTag(target, 'a')) {
                return;
        }
index 0d153fde96349878e23c3459f25afadd24645b09..b03d816491c32230e83fce1f691a2ef2150a91df 100644 (file)
@@ -45,7 +45,7 @@ function whisper(url) {
 */
 function whisperClick(event) {
        const field = this.previousSibling;
-       const el = getTarget(event);
+       const el = event.target;
        if (isTag(el, 'a') && !(event.button || event.shiftKey || event.altKey || isCtrl(event))) {
                field.value = el.firstChild.data;
                field.previousSibling.value = decodeURIComponent(el.href.replace(/.*=/, ''));