// @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt Expat
/**
- * @brief Friendica people autocomplete
+ * Friendica people autocomplete
*
* require jQuery, jquery.textcomplete
*
match: /(^|\s)(\#)([^ \n]{2,})$/,
index: 3,
search: function(term, callback) {
- $.getJSON(baseurl + '/hashtag/' + '?f=&t=' + term)
+ $.getJSON(baseurl + '/hashtag/' + '?t=' + term)
.done(function(data) {
callback($.map(data, function(entry) {
// .toLowerCase() enables case-insensitive search
tags = {
match: /(^|\s)(\#)([^ \n]{2,})$/,
index: 3,
- search: function(term, callback) { $.getJSON(baseurl + '/hashtag/' + '?f=&t=' + term).done(function(data) { callback($.map(data, function(entry) { return entry.text.indexOf(term) === 0 ? entry : null; })); }); },
+ search: function(term, callback) { $.getJSON(baseurl + '/hashtag/' + '?t=' + term).done(function(data) { callback($.map(data, function(entry) { return entry.text.indexOf(term) === 0 ? entry : null; })); }); },
replace: function(item) { return "$1$2" + item.text; },
template: tag_format
};
};
})( 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); },
+ replace: trim_replace,
+ template: contact_format,
+ };
+
+ this.attr('autocomplete','off');
+ var a = this.textcomplete([names], {className:'acpopup', zIndex:10000});
+
+ 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 );
+
(function( $ ) {
$.fn.bbco_autocomplete = function(type) {