Make mod_poke use textcomplete
This commit is contained in:
parent
34ecbcceea
commit
0cf016b0b0
@ -40,7 +40,7 @@ function editor_replace(item) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function basic_replace(item) {
|
function basic_replace(item) {
|
||||||
return '$1$2'+item.nick;
|
return '$1'+item.name+' ';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -78,8 +78,8 @@ function basic_replace(item) {
|
|||||||
|
|
||||||
// Autocomplete contacts
|
// Autocomplete contacts
|
||||||
contacts = {
|
contacts = {
|
||||||
match: /(^)(@)([^\n]+)$/,
|
match: /(^@)([^\n]+)$/,
|
||||||
index: 3,
|
index: 2,
|
||||||
search: function(term, callback) { contact_search(term, callback, backend_url, 'x',[]); },
|
search: function(term, callback) { contact_search(term, callback, backend_url, 'x',[]); },
|
||||||
replace: basic_replace,
|
replace: basic_replace,
|
||||||
template: contact_format,
|
template: contact_format,
|
||||||
@ -87,3 +87,23 @@ function basic_replace(item) {
|
|||||||
this.textcomplete([contacts],{className:'acpopup'});
|
this.textcomplete([contacts],{className:'acpopup'});
|
||||||
};
|
};
|
||||||
})( jQuery );
|
})( jQuery );
|
||||||
|
|
||||||
|
(function( $ ){
|
||||||
|
$.fn.contact_autocomplete = function(backend_url, onselect) {
|
||||||
|
|
||||||
|
// Autocomplete contacts
|
||||||
|
contacts = {
|
||||||
|
match: /(^)([^\n]+)$/,
|
||||||
|
index: 2,
|
||||||
|
search: function(term, callback) { contact_search(term, callback, backend_url, '',[]); },
|
||||||
|
replace: basic_replace,
|
||||||
|
template: contact_format,
|
||||||
|
}
|
||||||
|
|
||||||
|
var a = this.textcomplete([contacts],{className:'acpopup'});
|
||||||
|
|
||||||
|
if(typeof onselect !== 'undefined')
|
||||||
|
a.on('textComplete:select',function(e,value,strategy) { onselect(value); });
|
||||||
|
};
|
||||||
|
})( jQuery );
|
||||||
|
|
||||||
|
@ -1,14 +1,5 @@
|
|||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
var a;
|
$("#poke-recip").contact_autocomplete(baseurl + '/acl', function(data) {
|
||||||
a = $("#poke-recip").autocomplete({
|
$("#poke-recip-complete").val(data.id);
|
||||||
serviceUrl: baseurl + '/acl',
|
|
||||||
minChars: 2,
|
|
||||||
width: 250,
|
|
||||||
id: 'poke-recip-ac',
|
|
||||||
onSelect: function(value,data) {
|
|
||||||
$("#poke-recip-complete").val(data);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
a.setOptions({ params: { type: 'a' }});
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user