You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
561 B
22 lines
561 B
var $ = require('jquery');
|
|
require('./AutoComplete');
|
|
|
|
$.fn.directoryAutoComplete = function() {
|
|
var query = 'path';
|
|
|
|
$(this).autoComplete({
|
|
resource : '/filesystem',
|
|
query : query,
|
|
filter : function(filter, response, callback) {
|
|
var matches = [];
|
|
|
|
$.each(response.directories, function(i, d) {
|
|
if (d[query] && d[query].startsWith(filter)) {
|
|
matches.push({ value : d[query] });
|
|
}
|
|
});
|
|
|
|
callback(matches);
|
|
}
|
|
});
|
|
}; |