consolidate recent autocomplete changes
This commit is contained in:
parent
4f69bcfc38
commit
7ed32a764c
@ -82,11 +82,6 @@ function trim_replace(item) {
|
|||||||
return '$1'+item.name;
|
return '$1'+item.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function submit_form(e) {
|
|
||||||
$(e).parents('form').submit();
|
|
||||||
}
|
|
||||||
|
|
||||||
function getWord(text, caretPos) {
|
function getWord(text, caretPos) {
|
||||||
var index = text.indexOf(caretPos);
|
var index = text.indexOf(caretPos);
|
||||||
var postText = text.substring(caretPos, caretPos+13);
|
var postText = text.substring(caretPos, caretPos+13);
|
||||||
@ -264,14 +259,17 @@ function string2bb(element) {
|
|||||||
|
|
||||||
this.attr('autocomplete', 'off');
|
this.attr('autocomplete', 'off');
|
||||||
|
|
||||||
|
var textcomplete;
|
||||||
var Textarea = Textcomplete.editors.Textarea;
|
var Textarea = Textcomplete.editors.Textarea;
|
||||||
|
|
||||||
$(this).each(function() {
|
$(this).each(function() {
|
||||||
var editor = new Textarea(this);
|
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'});
|
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 );
|
})( jQuery );
|
||||||
|
|
||||||
@ -296,19 +294,20 @@ function string2bb(element) {
|
|||||||
|
|
||||||
this.attr('autocomplete','off');
|
this.attr('autocomplete','off');
|
||||||
|
|
||||||
|
var textcomplete;
|
||||||
var Textarea = Textcomplete.editors.Textarea;
|
var Textarea = Textcomplete.editors.Textarea;
|
||||||
|
|
||||||
$(this).each(function() {
|
$(this).each(function() {
|
||||||
var editor = new Textarea(this);
|
var editor = new Textarea(this);
|
||||||
var textcomplete = new Textcomplete(editor);
|
textcomplete = new Textcomplete(editor);
|
||||||
textcomplete.register([contacts], {className:'acpopup', zIndex:1020});
|
textcomplete.register([contacts], {className:'acpopup', zIndex:1020});
|
||||||
textcomplete.on('select', function() { aItem = textcomplete.dropdown.getActiveItem(); });
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if(autosubmit)
|
if(autosubmit)
|
||||||
this.on('select', function() { submit_form(this); });
|
textcomplete.on('selected', function() { this.editor.el.form.submit(); });
|
||||||
|
|
||||||
if(typeof onselect !== 'undefined')
|
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 );
|
})( jQuery );
|
||||||
|
|
||||||
@ -334,21 +333,20 @@ function string2bb(element) {
|
|||||||
|
|
||||||
this.attr('autocomplete','off');
|
this.attr('autocomplete','off');
|
||||||
|
|
||||||
var aItem;
|
var textcomplete;
|
||||||
var Textarea = Textcomplete.editors.Textarea;
|
var Textarea = Textcomplete.editors.Textarea;
|
||||||
|
|
||||||
$(this).each(function() {
|
$(this).each(function() {
|
||||||
var editor = new Textarea(this);
|
var editor = new Textarea(this);
|
||||||
var textcomplete = new Textcomplete(editor);
|
textcomplete = new Textcomplete(editor);
|
||||||
textcomplete.register([names], {className:'acpopup', zIndex:1020});
|
textcomplete.register([names], {className:'acpopup', zIndex:1020});
|
||||||
textcomplete.on('select', function() { aItem = textcomplete.dropdown.getActiveItem(); });
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if(autosubmit)
|
if(autosubmit)
|
||||||
this.on('select', function() { submit_form(this); });
|
textcomplete.on('selected', function() { this.editor.el.form.submit(); });
|
||||||
|
|
||||||
if(typeof onselect !== 'undefined')
|
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 );
|
})( jQuery );
|
||||||
@ -425,8 +423,6 @@ function string2bb(element) {
|
|||||||
textcomplete.register([bbco], {className:'acpopup', zIndex:1020});
|
textcomplete.register([bbco], {className:'acpopup', zIndex:1020});
|
||||||
});
|
});
|
||||||
|
|
||||||
this.on('select', function(e, value, strategy) { value; });
|
|
||||||
|
|
||||||
this.keypress(function(e){
|
this.keypress(function(e){
|
||||||
if (e.keyCode == 13) {
|
if (e.keyCode == 13) {
|
||||||
var x = listNewLineAutocomplete(this.id);
|
var x = listNewLineAutocomplete(this.id);
|
||||||
|
@ -3,14 +3,3 @@ $(document).ready(function() {
|
|||||||
$(".autotime").timeago();
|
$(".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();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<div class="generic-content-wrapper">
|
<div class="generic-content-wrapper">
|
||||||
<div class="section-title-wrapper clearfix">
|
<div class="section-title-wrapper clearfix">
|
||||||
<div class="dropdown pull-right">
|
<div class="dropdown pull-right">
|
||||||
<button type="button" class="btn btn-primary btn-sm" onclick="openClose('contacts-search-form'); $('#contacts-search').focus()">
|
<button type="button" class="btn btn-primary btn-sm" onclick="openClose('contacts-search-form'); $('#contacts-search').focus();">
|
||||||
<i class="fa fa-search"></i> {{$label}}
|
<i class="fa fa-search"></i> {{$label}}
|
||||||
</button>
|
</button>
|
||||||
<button type="button" class="btn btn-outline-secondary btn-sm dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" title="{{$sort}}">
|
<button type="button" class="btn btn-outline-secondary btn-sm dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" title="{{$sort}}">
|
||||||
@ -16,11 +16,11 @@
|
|||||||
{{if $finding}}<h2>{{$finding}}</h2>{{else}}<h2>{{$header}}{{if $total}} ({{$total}}){{/if}}</h2>{{/if}}
|
{{if $finding}}<h2>{{$finding}}</h2>{{else}}<h2>{{$header}}{{if $total}} ({{$total}}){{/if}}</h2>{{/if}}
|
||||||
</div>
|
</div>
|
||||||
<div id="contacts-search-form" class="section-content-tools-wrapper">
|
<div id="contacts-search-form" class="section-content-tools-wrapper">
|
||||||
<form action="{{$cmd}}" method="get" >
|
<form action="{{$cmd}}" method="get" id="mimimi" name="contacts-search-form">
|
||||||
<div class="input-group form-group">
|
<div class="input-group form-group">
|
||||||
<input type="text" name="search" id="contacts-search" class="form-control" onfocus="this.select();" value="{{$search}}" placeholder="{{$desc}}" />
|
<input type="text" name="search" id="contacts-search" class="form-control" onfocus="this.select();" value="{{$search}}" placeholder="{{$desc}}" />
|
||||||
<div class="input-group-append">
|
<div class="input-group-append">
|
||||||
<button id="contacts-search-submit" class="btn btn-outline-secondary" type="submit" name="submit" value="{{$submit}}"><i class="fa fa-fw fa-search"></i></button>
|
<button id="contacts-search-submit" class="btn btn-outline-secondary" type="submit"><i class="fa fa-fw fa-search"></i></button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
Reference in New Issue
Block a user