mirror of
https://github.com/vrana/adminer.git
synced 2025-08-29 17:19:52 +02:00
Use the fact that we handle oninput in whisper()
This commit is contained in:
@@ -11,7 +11,34 @@ function helpMouseover() {
|
||||
function helpMouseout() {
|
||||
}
|
||||
|
||||
function whisperClick(event, field) {
|
||||
/** Display typeahead
|
||||
* @param string
|
||||
* @this HTMLInputElement
|
||||
*/
|
||||
function whisper(url) {
|
||||
var field = this;
|
||||
field.orig = field.value;
|
||||
field.previousSibling.value = field.value; // accept number, reject string
|
||||
return ajax(url + encodeURIComponent(field.value), function (xmlhttp) {
|
||||
if (xmlhttp.status && field.orig == field.value) { // ignore old responses
|
||||
field.nextSibling.innerHTML = xmlhttp.responseText;
|
||||
field.nextSibling.style.display = '';
|
||||
var a = field.nextSibling.firstChild;
|
||||
if (a && a.firstChild.data == field.value) {
|
||||
field.previousSibling.value = decodeURIComponent(a.href.replace(/.*=/, ''));
|
||||
a.className = 'active';
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/** Select typeahead value
|
||||
* @param MouseEvent
|
||||
* @return boolean false for success
|
||||
* @this HTMLDivElement
|
||||
*/
|
||||
function whisperClick(event) {
|
||||
var field = this.previousSibling;
|
||||
var el = getTarget(event);
|
||||
if (isTag(el, 'a') && !(event.button || event.shiftKey || event.altKey || isCtrl(event))) {
|
||||
field.value = el.firstChild.data;
|
||||
@@ -21,25 +48,6 @@ function whisperClick(event, field) {
|
||||
}
|
||||
}
|
||||
|
||||
function whisper(url) {
|
||||
var field = this;
|
||||
if (field.orig != field.value) { // ignore arrows, Shift, ...
|
||||
field.orig = field.value;
|
||||
field.previousSibling.value = field.value; // accept number, reject string
|
||||
return ajax(url + encodeURIComponent(field.value), function (xmlhttp) {
|
||||
if (xmlhttp.status && field.orig == field.value) { // ignore old responses
|
||||
field.nextSibling.innerHTML = xmlhttp.responseText;
|
||||
field.nextSibling.style.display = '';
|
||||
var a = field.nextSibling.firstChild;
|
||||
if (a && a.firstChild.data == field.value) {
|
||||
field.previousSibling.value = decodeURIComponent(a.href.replace(/.*=/, ''));
|
||||
a.className = 'active';
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/** Add new attachment field
|
||||
* @this HTMLInputElement
|
||||
*/
|
||||
|
Reference in New Issue
Block a user