aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--view/js/autocomplete.js15
-rw-r--r--view/js/mod_connections.js2
-rw-r--r--view/js/mod_mail.js2
-rw-r--r--view/js/mod_photos.js2
-rw-r--r--view/js/mod_poke.js2
-rw-r--r--view/js/mod_sources.js2
6 files changed, 18 insertions, 7 deletions
diff --git a/view/js/autocomplete.js b/view/js/autocomplete.js
index 26d3f6211..afdf9c230 100644
--- a/view/js/autocomplete.js
+++ b/view/js/autocomplete.js
@@ -43,6 +43,10 @@ function basic_replace(item) {
return '$1'+item.name+' ';
}
+function submit_form(e) {
+ $(e).parents('form').submit();
+}
+
/**
* jQuery plugin 'editor_autocomplete'
*/
@@ -86,14 +90,18 @@ function basic_replace(item) {
template: contact_format,
}
this.attr('autocomplete','off');
- this.textcomplete([contacts],{className:'acpopup'});
+ var a = this.textcomplete([contacts],{className:'acpopup'});
+
+ a.on('textComplete:select', function(e,value,strategy) { submit_form(this); });
+
};
})( jQuery );
(function( $ ){
- $.fn.contact_autocomplete = function(backend_url, typ, onselect) {
+ $.fn.contact_autocomplete = function(backend_url, typ, autosubmit, onselect) {
if(typeof typ === 'undefined') typ = '';
+ if(typeof autosubmit === 'undefined') autosubmit = false;
// Autocomplete contacts
contacts = {
@@ -107,6 +115,9 @@ function basic_replace(item) {
this.attr('autocomplete','off');
var a = this.textcomplete([contacts],{className:'acpopup'});
+ if(autosubmit)
+ a.on('textComplete:select', function(e,value,strategy) { submit_form(this); });
+
if(typeof onselect !== 'undefined')
a.on('textComplete:select',function(e,value,strategy) { onselect(value); });
};
diff --git a/view/js/mod_connections.js b/view/js/mod_connections.js
index 6393630b3..f29d96729 100644
--- a/view/js/mod_connections.js
+++ b/view/js/mod_connections.js
@@ -1,5 +1,5 @@
$(document).ready(function() {
- $("#contacts-search").contact_autocomplete(baseurl + '/acl', 'a');
+ $("#contacts-search").contact_autocomplete(baseurl + '/acl', 'a', true);
});
$("#contacts-search").keyup(function(event){
diff --git a/view/js/mod_mail.js b/view/js/mod_mail.js
index 2cbc924f4..16e06e6f5 100644
--- a/view/js/mod_mail.js
+++ b/view/js/mod_mail.js
@@ -1,5 +1,5 @@
$(document).ready(function() {
- $("#recip").contact_autocomplete(baseurl + '/acl', '', function(data) {
+ $("#recip").contact_autocomplete(baseurl + '/acl', '', false, function(data) {
$("#recip-complete").val(data.xid);
});
diff --git a/view/js/mod_photos.js b/view/js/mod_photos.js
index 676f5e8ef..5f19e5f7f 100644
--- a/view/js/mod_photos.js
+++ b/view/js/mod_photos.js
@@ -3,7 +3,7 @@ var ispublic = aStr['everybody'];
$(document).ready(function() {
$(document).ready(function() {
- $("#photo-edit-newtag").contact_autocomplete(baseurl + '/acl', 'p', function(data) {
+ $("#photo-edit-newtag").contact_autocomplete(baseurl + '/acl', 'p', false, function(data) {
$("#photo-edit-newtag").val('@' + data.name.replace(' ','_'); // Is the underscore replacement still needed?
});
});
diff --git a/view/js/mod_poke.js b/view/js/mod_poke.js
index 3c07fcef7..58e50588f 100644
--- a/view/js/mod_poke.js
+++ b/view/js/mod_poke.js
@@ -1,5 +1,5 @@
$(document).ready(function() {
- $("#poke-recip").contact_autocomplete(baseurl + '/acl', 'a', function(data) {
+ $("#poke-recip").contact_autocomplete(baseurl + '/acl', 'a', false, function(data) {
$("#poke-recip-complete").val(data.id);
});
});
diff --git a/view/js/mod_sources.js b/view/js/mod_sources.js
index add8ac15e..1bbf89765 100644
--- a/view/js/mod_sources.js
+++ b/view/js/mod_sources.js
@@ -1,6 +1,6 @@
$(document).ready(function() {
$(document).ready(function() {
- $("#id_name").contact_autocomplete(baseurl + '/acl', 'a', function(data) {
+ $("#id_name").contact_autocomplete(baseurl + '/acl', 'a', false, function(data) {
$("#id_abook").val(data.id);
});
});