<?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') . ")'>");
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";
($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++;
$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>';
},
onchange: editingTypeChange,
onmouseover: function (event) {
- helpMouseover.call(this, event, getTarget(event).value, 1);
+ helpMouseover.call(this, event, event.target.value, 1);
},
onmouseout: helpMouseout
});
* @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);
* @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);
* @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);
* @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)) {
*/
function helpMouseout(event) {
helpOpen = 0;
- helpIgnore = (this != getTarget(event));
+ helpIgnore = (this != event.target);
setTimeout(() => {
if (!helpOpen) {
helpClose();
* @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'))) {
}
}
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') {
* @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';
}
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>
*/
function bodyKeydown(event, button) {
eventStop(event);
- let target = getTarget(event);
+ let target = event.target;
if (target.jushTextarea) {
target = target.jushTextarea;
}
* @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(() => {
*/
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)])) {
}
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 {
*/
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;
}
*/
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(/.*=/, ''));