diff options
author | Mario <mario@mariovavti.com> | 2023-02-09 01:52:48 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2023-02-09 01:52:48 +0000 |
commit | 09c9b47265b144c905a51434c40002d8aef526e5 (patch) | |
tree | ff006fb316e3aa49ab49a6ed067aac4aea152b63 /view/js/autocomplete.js | |
parent | ea2b653b9bd831e835e19d4f5f1e560cee2f200e (diff) | |
download | volse-hubzilla-09c9b47265b144c905a51434c40002d8aef526e5.tar.gz volse-hubzilla-09c9b47265b144c905a51434c40002d8aef526e5.tar.bz2 volse-hubzilla-09c9b47265b144c905a51434c40002d8aef526e5.zip |
fix more hubloc confusion, implement hq widget author filter and some autocomplete fixes
Diffstat (limited to 'view/js/autocomplete.js')
-rw-r--r-- | view/js/autocomplete.js | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/view/js/autocomplete.js b/view/js/autocomplete.js index d6893073d..e50a4f927 100644 --- a/view/js/autocomplete.js +++ b/view/js/autocomplete.js @@ -31,8 +31,6 @@ function contact_search(term, callback, backend_url, type, extra_channels, spine }, }).fail(function () {callback([]); }); // Callback must be invoked even if something went wrong. } -contact_search.cache = {}; - function contact_format(item) { // Show contact information if not explicitly told to show something else @@ -40,10 +38,10 @@ function contact_format(item) { var desc = ((item.label) ? item.nick + ' ' + item.label : item.nick); if(typeof desc === 'undefined') desc = ''; if(desc) desc = ' ('+desc+')'; - return "<div class='{0} dropdown-item dropdown-notification clearfix' title='{4}'><img class='menu-img-2' src='{1}' loading='lazy'><span class='font-weight-bold contactname'>{2}</span><span class='dropdown-sub-text'>{4}</span></div>".format(item.taggable, item.photo, item.name, desc, typeof(item.link) !== 'undefined' ? item.link : desc.replace('(','').replace(')','')); + return "<div class='{0} dropdown-item dropdown-notification clearfix' title='{4}'><img class='menu-img-2' src='{1}' loading='lazy'><span class='fw-bold contactname'>{2}</span><span class='dropdown-sub-text'>{4}</span></div>".format(item.taggable, item.photo, item.name, desc, typeof(item.link) !== 'undefined' ? item.link : desc.replace('(','').replace(')','')); } else - return "<div>" + item.text + "</div>"; + return ""; } function smiley_format(item) { @@ -247,7 +245,7 @@ function string2bb(element) { template: tag_format }; - this.attr('autocomplete', 'off'); + //this.attr('autocomplete', 'off'); var textcomplete; var Textarea = Textcomplete.editors.Textarea; @@ -296,6 +294,7 @@ function string2bb(element) { textcomplete = new Textcomplete(editor, { dropdown: { maxCount: 100 + } }); textcomplete.register([contacts]); @@ -305,7 +304,8 @@ function string2bb(element) { 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); }); + textcomplete.on('select', function() { var item = this.dropdown.getActiveItem(); onselect(item.searchResult.data);}); + }; })( jQuery ); @@ -331,11 +331,11 @@ function string2bb(element) { //this.attr('autocomplete','off'); - var textcomplete; - var Textarea = Textcomplete.editors.Textarea; + let textcomplete; + let Textarea = Textcomplete.editors.Textarea; $(this).each(function() { - var editor = new Textarea(this); + let editor = new Textarea(this); textcomplete = new Textcomplete(editor, { dropdown: { maxCount: 100 @@ -344,11 +344,12 @@ function string2bb(element) { textcomplete.register([names]); }); + 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); }); + textcomplete.on('select', function() { let item = this.dropdown.getActiveItem(); onselect(item.searchResult.data); }); }; })( jQuery ); |