1
0
mirror of https://github.com/vrana/adminer.git synced 2025-08-18 12:21:24 +02:00

Autocomplete for big foreign keys

This commit is contained in:
Jakub Vrana
2011-05-04 15:53:26 +02:00
parent daf85306a5
commit 6b4ee48ae8
7 changed files with 62 additions and 8 deletions

View File

@@ -5,3 +5,31 @@ function bodyLoad(version) {
onpopstate(history);
}
}
function whisperClick(event, field) {
var el = event.target || event.srcElement;
if (/^a$/i.test(el.tagName) && !(event.button || event.ctrlKey || event.shiftKey || event.altKey || event.metaKey)) {
field.value = el.firstChild.data;
field.previousSibling.value = decodeURIComponent(el.href.replace(/.*=/, ''));
field.nextSibling.style.display = 'none';
eventStop(event);
return false;
}
}
function whisper(url, field) {
if (field.orig != field.value) {
field.orig = field.value;
return ajax(url + encodeURIComponent(field.value), function (xmlhttp) {
if (xmlhttp.status && field.orig == field.value) {
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.style.fontWeight = 'bold';
}
}
});
}
}