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 | |
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')
-rw-r--r-- | view/js/autocomplete.js | 21 | ||||
-rw-r--r-- | view/js/main.js | 2 | ||||
-rw-r--r-- | view/js/mod_poke.js | 6 | ||||
-rw-r--r-- | view/theme/redbasic/css/style.css | 7 | ||||
-rw-r--r-- | view/tpl/messages_widget.tpl | 47 |
5 files changed, 60 insertions, 23 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 ); diff --git a/view/js/main.js b/view/js/main.js index fdebb5faa..8b348b2c9 100644 --- a/view/js/main.js +++ b/view/js/main.js @@ -163,7 +163,7 @@ $(document).ready(function() { }); // @hilmar <-| - $(document).on('click', '.notification, .message', function(e) { + $(document).on('click focus', '.notification, .message', function(e) { let b64mid = this.dataset.b64mid; let notify_id = this.dataset.notify_id; let path = $(this)[0].pathname.split('/')[1]; diff --git a/view/js/mod_poke.js b/view/js/mod_poke.js index 221cbbb31..88fa9f7c2 100644 --- a/view/js/mod_poke.js +++ b/view/js/mod_poke.js @@ -1,5 +1,5 @@ -$(document).ready(function() { - $("#poke-recip").name_autocomplete(baseurl + '/acl', 'a', false, function(data) { +$(document).ready(function() { + $("#poke-recip").contact_autocomplete(baseurl + '/acl', 'a', false, function(data) { $("#poke-recip-complete").val(data.id); }); -}); +}); diff --git a/view/theme/redbasic/css/style.css b/view/theme/redbasic/css/style.css index 9548d73f5..bf7ea2a37 100644 --- a/view/theme/redbasic/css/style.css +++ b/view/theme/redbasic/css/style.css @@ -1111,7 +1111,7 @@ img.mail-conv-sender-photo { .wall-item-ago, .dropdown-sub-text { - color: #777; + color: var(--bs-tertiary-color); } .wall-item-content, @@ -1425,9 +1425,10 @@ blockquote { overflow: auto; } -.dropdown-item.active { +.dropdown-item.active, +.textcomplete-item.active { color: #fff; - background-color: #007bff; + background-color: var(--bs-tertiary-bg); } .navbar { diff --git a/view/tpl/messages_widget.tpl b/view/tpl/messages_widget.tpl index ee933b392..f71d8a223 100644 --- a/view/tpl/messages_widget.tpl +++ b/view/tpl/messages_widget.tpl @@ -39,7 +39,12 @@ {8} </a> </div> - <div id="dm-container" class="list-group list-group-flush" data-offset="10"> + <div id="messages-container" class="list-group list-group-flush" data-offset="10"> + <div id="messages-author-container" class="list-group-item notifications-textinput"> + <div class="text-muted notifications-textinput-filter"><i class="fa fa-fw fa-filter"></i></div> + <input id="messages-author" type="text" class="form-control form-control-sm" placeholder="{{$strings.filter}}"> + <div id="messages-author-input-clear" class="text-muted notifications-textinput-clear d-none"><i class="fa fa-times"></i></div> + </div> {{foreach $entries as $e}} <a href="{{$e.href}}" class="list-group-item list-group-item-action message" data-b64mid="{{$e.b64mid}}"> <div class="d-flex w-100 justify-content-between"> @@ -67,15 +72,42 @@ </div> </div> <script> - var messages_offset = {{$offset}}; - var get_messages_page_active = false; - var messages_type; + let messages_offset = {{$offset}}; + let get_messages_page_active = false; + let messages_type; + let author_hash; + let author_url; + let author; $(document).ready(function () { $('.messages-timeago').timeago(); if (bParam_mid) { $('.message[data-b64mid=\'' + bParam_mid + '\']').addClass('active'); } + + $("#messages-author").name_autocomplete(baseurl + '/acl', 'a', false, function(data) { + $('#messages-container .message').remove(); + $('#messages-author-container').addClass('active sticky-top'); + $('#messages-author-input-clear').removeClass('d-none'); + author_hash = data.xid; + author_url = data.url; + author = messages_type === 'notification' ? author_url : author_hash; + messages_offset = 0; + get_messages_page(); + }); + + $(document).on('click', '#messages-author-input-clear', function() { + $('#messages-author').val(''); + $('#messages-author-container').removeClass('active sticky-top'); + $('#messages-author-input-clear').addClass('d-none'); + $('#messages-container .message').remove(); + author = ''; + author_hash = ''; + author_url = ''; + messages_offset = 0; + get_messages_page(); + }); + }); $('#messages-widget').on('scroll', function() { @@ -90,7 +122,8 @@ $(this).addClass('active'); messages_offset = 0; messages_type = $(this).data('messages_type'); - $('#dm-container .message').remove(); + author = messages_type === 'notification' ? author_url : author_hash; + $('#messages-container .message').remove(); get_messages_page(); }); @@ -111,7 +144,8 @@ url: 'hq', data: { offset: messages_offset, - type: messages_type + type: messages_type, + author: author } }).done(function(obj) { get_messages_page_active = false; @@ -144,5 +178,6 @@ $('.messages-timeago').timeago(); }); + } </script> |