mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-03-12 18:31:23 +00:00
Improved auto-completion in webmail module
Monotone-Parent: 72263a3947a24816b683ce7865dc0f738b476aee Monotone-Revision: 28e932f280315e68f641452599d35da2b2a167d3 Monotone-Author: flachapelle@inverse.ca Monotone-Date: 2009-02-19T22:22:34 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
@@ -362,14 +362,9 @@ function onContactKeydown(event) {
|
||||
this.confirmedValue = null;
|
||||
MailEditor.selectedIndex = -1;
|
||||
MailEditor.currentField = this;
|
||||
if (this.value.length > 1) {
|
||||
if (MailEditor.delayedSearch) window.clearTimeout(MailEditor.delayedSearch);
|
||||
MailEditor.delayedSearch = window.setTimeout("performSearch()", MailEditor.delay);
|
||||
}
|
||||
else if (this.value.length <= 1) {
|
||||
if (document.currentPopupMenu)
|
||||
hideMenu(document.currentPopupMenu);
|
||||
}
|
||||
if (MailEditor.delayedSearch)
|
||||
window.clearTimeout(MailEditor.delayedSearch);
|
||||
MailEditor.delayedSearch = window.setTimeout("performSearch()", MailEditor.delay);
|
||||
}
|
||||
else if (event.keyCode == Event.KEY_RETURN) {
|
||||
preventDefault(event);
|
||||
@@ -402,6 +397,12 @@ function onContactKeydown(event) {
|
||||
}
|
||||
}
|
||||
|
||||
function onContactBlur(event) {
|
||||
if (MailEditor.delayedSearch)
|
||||
window.clearTimeout(MailEditor.delayedSearch);
|
||||
MailEditor.currentField = null;
|
||||
}
|
||||
|
||||
function performSearch() {
|
||||
// Perform address completion
|
||||
if (MailEditor.currentField) {
|
||||
@@ -410,12 +411,16 @@ function performSearch() {
|
||||
document.contactLookupAjaxRequest.aborted = true;
|
||||
document.contactLookupAjaxRequest.abort();
|
||||
}
|
||||
if (MailEditor.currentField.value.trim().length > 1) {
|
||||
if (MailEditor.currentField.value.trim().length > 2) {
|
||||
var urlstr = (UserFolderURL + "Contacts/allContactSearch?search="
|
||||
+ encodeURIComponent(MailEditor.currentField.value));
|
||||
document.contactLookupAjaxRequest =
|
||||
triggerAjaxRequest(urlstr, performSearchCallback, MailEditor.currentField);
|
||||
}
|
||||
else {
|
||||
if (document.currentPopupMenu)
|
||||
hideMenu(document.currentPopupMenu);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -521,6 +526,7 @@ function initTabIndex(addressList, subjectField, msgArea) {
|
||||
input.writeAttribute("tabindex", i++);
|
||||
input.writeAttribute("autocomplete", "off");
|
||||
input.observe("keydown", onContactKeydown); // bind listener for address completion
|
||||
input.observe("blur", onContactBlur);
|
||||
}
|
||||
});
|
||||
subjectField.writeAttribute("tabindex", i++);
|
||||
|
||||
Reference in New Issue
Block a user