mirror of
https://github.com/vrana/adminer.git
synced 2025-08-16 03:24:01 +02:00
Ctrl+Up and Down in edit and in-place edit
This commit is contained in:
@@ -240,33 +240,6 @@ function editingLengthBlur(edit) {
|
||||
edit.style.display = 'none';
|
||||
}
|
||||
|
||||
/** Find node position
|
||||
* @param Node
|
||||
* @return number
|
||||
*/
|
||||
function nodePosition(el) {
|
||||
var pos = 0;
|
||||
while (el = el.previousSibling) {
|
||||
pos++;
|
||||
}
|
||||
return pos;
|
||||
}
|
||||
|
||||
/** Change focus by Ctrl+Up or Down
|
||||
* @param KeyboardEvent
|
||||
* @return boolean
|
||||
*/
|
||||
function editingKeydown(event) {
|
||||
var target = event.target || event.srcElement;
|
||||
if ((event.keyCode == 40 || event.keyCode == 38) && event.ctrlKey && !event.altKey && !event.metaKey) { // shiftKey allowed
|
||||
if ((el = target.parentNode.parentNode[(event.keyCode == 40 ? 'nextSibling' : 'previousSibling')]) && (el = el.childNodes[nodePosition(target.parentNode)]) && (el = el.childNodes[nodePosition(target)])) {
|
||||
el.focus();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/** Show or hide selected table column
|
||||
* @param boolean
|
||||
* @param number
|
||||
|
@@ -107,6 +107,18 @@ function setHtml(id, html) {
|
||||
}
|
||||
}
|
||||
|
||||
/** Find node position
|
||||
* @param Node
|
||||
* @return number
|
||||
*/
|
||||
function nodePosition(el) {
|
||||
var pos = 0;
|
||||
while (el = el.previousSibling) {
|
||||
pos++;
|
||||
}
|
||||
return pos;
|
||||
}
|
||||
|
||||
/** Go to the specified page
|
||||
* @param string
|
||||
* @param string
|
||||
@@ -177,6 +189,25 @@ function textareaKeypress(target, event, tab, button) {
|
||||
|
||||
|
||||
|
||||
/** Change focus by Ctrl+Up or Ctrl+Down
|
||||
* @param KeyboardEvent
|
||||
* @return boolean
|
||||
*/
|
||||
function editingKeydown(event) {
|
||||
if ((event.keyCode == 40 || event.keyCode == 38) && event.ctrlKey && !event.altKey && !event.metaKey) { // shiftKey allowed
|
||||
var target = event.target || event.srcElement;
|
||||
var sibling = (event.keyCode == 40 ? 'nextSibling' : 'previousSibling');
|
||||
var el = target.parentNode.parentNode[sibling];
|
||||
if (el && (/^tr$/i.test(el.tagName) || (el = el[sibling])) && /^tr$/i.test(el.tagName) && (el = el.childNodes[nodePosition(target.parentNode)]) && (el = el.childNodes[nodePosition(target)])) {
|
||||
el.focus();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/** Create AJAX request
|
||||
* @param string
|
||||
* @param function (text)
|
||||
|
Reference in New Issue
Block a user