aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorredmatrix <redmatrix@redmatrix.me>2015-10-02 18:12:09 -0700
committerredmatrix <redmatrix@redmatrix.me>2015-10-02 18:12:09 -0700
commit7abad2ff997fc33ab0799c39787249c0e03c1092 (patch)
treee0aaee33d31c39e374086ac85bf0320c63aae3ff
parentd337cc6618889d031c920985fc3e05ed1b1e5f89 (diff)
downloadvolse-hubzilla-7abad2ff997fc33ab0799c39787249c0e03c1092.tar.gz
volse-hubzilla-7abad2ff997fc33ab0799c39787249c0e03c1092.tar.bz2
volse-hubzilla-7abad2ff997fc33ab0799c39787249c0e03c1092.zip
get rid of the unnecessary blank space after mail recipient completion
-rw-r--r--view/js/autocomplete.js34
-rw-r--r--view/js/mod_mail.js2
-rw-r--r--view/js/mod_poke.js2
3 files changed, 36 insertions, 2 deletions
diff --git a/view/js/autocomplete.js b/view/js/autocomplete.js
index e077dc88d..0af27c61b 100644
--- a/view/js/autocomplete.js
+++ b/view/js/autocomplete.js
@@ -88,6 +88,14 @@ function basic_replace(item) {
return '$1'+item.name+' ';
}
+function trim_replace(item) {
+ if(typeof item.replace !== 'undefined')
+ return '$1'+item.replace;
+
+ return '$1'+item.name;
+}
+
+
function submit_form(e) {
$(e).parents('form').submit();
}
@@ -162,4 +170,30 @@ function submit_form(e) {
if(typeof onselect !== 'undefined')
a.on('textComplete:select', function(e, value, strategy) { onselect(value); });
};
+})( jQuery );
+
+
+(function( $ ) {
+ $.fn.name_autocomplete = function(backend_url, typ, autosubmit, onselect) {
+ if(typeof typ === 'undefined') typ = '';
+ if(typeof autosubmit === 'undefined') autosubmit = false;
+
+ // Autocomplete contacts
+ names = {
+ match: /(^)([^\n]+)$/,
+ index: 2,
+ search: function(term, callback) { contact_search(term, callback, backend_url, typ,[], spinelement=false); },
+ replace: trim_replace,
+ template: contact_format,
+ };
+
+ this.attr('autocomplete','off');
+ var a = this.textcomplete([names], {className:'acpopup', zIndex:1020});
+
+ 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); });
+ };
})( jQuery ); \ No newline at end of file
diff --git a/view/js/mod_mail.js b/view/js/mod_mail.js
index 704d0a460..36b22138f 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', '', false, function(data) {
+ $("#recip").name_autocomplete(baseurl + '/acl', '', false, function(data) {
$("#recip-complete").val(data.xid);
});
});
diff --git a/view/js/mod_poke.js b/view/js/mod_poke.js
index 58e50588f..221cbbb31 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', false, function(data) {
+ $("#poke-recip").name_autocomplete(baseurl + '/acl', 'a', false, function(data) {
$("#poke-recip-complete").val(data.id);
});
});