aboutsummaryrefslogtreecommitdiffstats
path: root/view/js
diff options
context:
space:
mode:
authorMario Vavti <mario@mariovavti.com>2018-05-13 23:09:30 +0200
committerMario Vavti <mario@mariovavti.com>2018-05-13 23:09:30 +0200
commit7ed32a764cc0ffe8335affec37f28f63d9fd52c5 (patch)
treee51e360d51c9c22ba22f9f4902cd4cf44026882f /view/js
parent4f69bcfc38290db87c97645e311fda7a48e1468e (diff)
downloadvolse-hubzilla-7ed32a764cc0ffe8335affec37f28f63d9fd52c5.tar.gz
volse-hubzilla-7ed32a764cc0ffe8335affec37f28f63d9fd52c5.tar.bz2
volse-hubzilla-7ed32a764cc0ffe8335affec37f28f63d9fd52c5.zip
consolidate recent autocomplete changes
Diffstat (limited to 'view/js')
-rw-r--r--view/js/autocomplete.js32
-rw-r--r--view/js/mod_connections.js11
2 files changed, 14 insertions, 29 deletions
diff --git a/view/js/autocomplete.js b/view/js/autocomplete.js
index b61af23f8..e5a551344 100644
--- a/view/js/autocomplete.js
+++ b/view/js/autocomplete.js
@@ -82,11 +82,6 @@ function trim_replace(item) {
return '$1'+item.name;
}
-
-function submit_form(e) {
- $(e).parents('form').submit();
-}
-
function getWord(text, caretPos) {
var index = text.indexOf(caretPos);
var postText = text.substring(caretPos, caretPos+13);
@@ -264,14 +259,17 @@ function string2bb(element) {
this.attr('autocomplete', 'off');
+ var textcomplete;
var Textarea = Textcomplete.editors.Textarea;
+
$(this).each(function() {
var editor = new Textarea(this);
- var textcomplete = new Textcomplete(editor);
+ textcomplete = new Textcomplete(editor);
textcomplete.register([contacts,forums,tags], {className:'acpopup', maxCount:100, zIndex: 1020, appendTo:'nav'});
});
- this.on('select', function(e, value, strategy) { submit_form(this); });
+ textcomplete.on('selected', function() { this.editor.el.form.submit(); });
+
};
})( jQuery );
@@ -296,19 +294,20 @@ function string2bb(element) {
this.attr('autocomplete','off');
+ var textcomplete;
var Textarea = Textcomplete.editors.Textarea;
+
$(this).each(function() {
var editor = new Textarea(this);
- var textcomplete = new Textcomplete(editor);
+ textcomplete = new Textcomplete(editor);
textcomplete.register([contacts], {className:'acpopup', zIndex:1020});
- textcomplete.on('select', function() { aItem = textcomplete.dropdown.getActiveItem(); });
});
if(autosubmit)
- this.on('select', function() { submit_form(this); });
+ textcomplete.on('selected', function() { this.editor.el.form.submit(); });
if(typeof onselect !== 'undefined')
- this.on('select', function() { onselect(aItem.searchResult.data); });
+ textcomplete.on('select', function() { var item = this.dropdown.getActiveItem(); onselect(item.searchResult.data); });
};
})( jQuery );
@@ -334,21 +333,20 @@ function string2bb(element) {
this.attr('autocomplete','off');
- var aItem;
+ var textcomplete;
var Textarea = Textcomplete.editors.Textarea;
$(this).each(function() {
var editor = new Textarea(this);
- var textcomplete = new Textcomplete(editor);
+ textcomplete = new Textcomplete(editor);
textcomplete.register([names], {className:'acpopup', zIndex:1020});
- textcomplete.on('select', function() { aItem = textcomplete.dropdown.getActiveItem(); });
});
if(autosubmit)
- this.on('select', function() { submit_form(this); });
+ textcomplete.on('selected', function() { this.editor.el.form.submit(); });
if(typeof onselect !== 'undefined')
- this.on('select', function() { onselect(aItem.searchResult.data); });
+ textcomplete.on('select', function() { var item = this.dropdown.getActiveItem(); onselect(item.searchResult.data); });
};
})( jQuery );
@@ -425,8 +423,6 @@ function string2bb(element) {
textcomplete.register([bbco], {className:'acpopup', zIndex:1020});
});
- this.on('select', function(e, value, strategy) { value; });
-
this.keypress(function(e){
if (e.keyCode == 13) {
var x = listNewLineAutocomplete(this.id);
diff --git a/view/js/mod_connections.js b/view/js/mod_connections.js
index 68add4eed..db18e078d 100644
--- a/view/js/mod_connections.js
+++ b/view/js/mod_connections.js
@@ -3,14 +3,3 @@ $(document).ready(function() {
$(".autotime").timeago();
});
-$("#contacts-search").keyup(function(event){
- if(event.keyCode == 13){
- $("#contacts-search").click();
- }
-});
-$(".autocomplete-w1 .selected").keyup(function(event){
- if(event.keyCode == 13){
- $("#contacts-search").click();
- }
-});
-