Merge branch 'dev'

This commit is contained in:
zotlabs 2020-02-19 11:01:07 -08:00
commit ddce711da0
3 changed files with 49 additions and 1 deletions

View file

@ -332,6 +332,7 @@ class Acl extends Controller {
"photo" => $g['photo'],
"name" => $g['name'],
"nick" => $g['address'],
'link' => (($g['address']) ? $g['address'] : $g['url'])
];
}
}

View file

@ -75,6 +75,15 @@ function basic_replace(item) {
return '$1'+item.name+' ';
}
function link_replace(item) {
if(typeof item.replace !== 'undefined')
return '$1'+item.replace;
return '$1'+item.link+' ';
}
function trim_replace(item) {
if(typeof item.replace !== 'undefined')
return '$1'+item.replace;
@ -311,6 +320,44 @@ function string2bb(element) {
};
})( jQuery );
(function( $ ) {
$.fn.discover_autocomplete = function(backend_url, typ, autosubmit, onselect) {
if(! this.length)
return;
if(typeof typ === 'undefined') typ = 'x';
if(typeof autosubmit === 'undefined') autosubmit = false;
// Autocomplete contacts
contacts = {
match: /(^)([^\n]{2,})$/,
index: 2,
cache: true,
search: function(term, callback) { contact_search(term, callback, backend_url, typ,[], spinelement=false); },
replace: link_replace,
template: contact_format,
};
this.attr('autocomplete','off');
var textcomplete;
var Textarea = Textcomplete.editors.Textarea;
$(this).each(function() {
var editor = new Textarea(this);
textcomplete = new Textcomplete(editor);
textcomplete.register([contacts], {className:'acpopup', zIndex:1020});
});
if(autosubmit)
textcomplete.on('selected', function() { this.editor.el.form.submit(); });
if(typeof onselect !== 'undefined')
textcomplete.on('select', function() { var item = this.dropdown.getActiveItem(); onselect(item.searchResult.data); });
};
})( jQuery );
(function( $ ) {
$.fn.name_autocomplete = function(backend_url, typ, autosubmit, onselect) {

View file

@ -1,6 +1,6 @@
$(document).ready(function() {
$("#contacts-search").contact_autocomplete(baseurl + '/acl', 'a', true);
$("#follow_input").contact_autocomplete(baseurl + '/acl', 'x', true);
$("#follow_input").discover_autocomplete(baseurl + '/acl', 'x', true);
$(".autotime").timeago();
});