mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-09-17 17:14:18 +02:00
Bootstrap 3
New: Updated UI New: Mobile browser support Fixed: /favicon.ico will return the favicon now
This commit is contained in:
@@ -2,24 +2,40 @@
|
||||
define(
|
||||
[
|
||||
'jquery',
|
||||
'underscore',
|
||||
'typeahead'
|
||||
], function ($) {
|
||||
], function ($, _) {
|
||||
|
||||
$.fn.autoComplete = function (resource) {
|
||||
$(this).typeahead({
|
||||
source : function (filter, callback) {
|
||||
$.ajax({
|
||||
url : window.NzbDrone.ApiRoot + resource,
|
||||
dataType: 'json',
|
||||
type : 'GET',
|
||||
data : { query: filter },
|
||||
success : function (data) {
|
||||
callback(data);
|
||||
}
|
||||
});
|
||||
hint : true,
|
||||
highlight : true,
|
||||
minLength : 3,
|
||||
items : 20
|
||||
},
|
||||
minLength: 3,
|
||||
items : 20
|
||||
{
|
||||
name: resource.replace('/'),
|
||||
displayKey: '',
|
||||
source : function (filter, callback) {
|
||||
$.ajax({
|
||||
url : window.NzbDrone.ApiRoot + resource,
|
||||
dataType: 'json',
|
||||
type : 'GET',
|
||||
data : { query: filter },
|
||||
success : function (data) {
|
||||
|
||||
var matches = [];
|
||||
|
||||
$.each(data, function(i, d) {
|
||||
if (d.startsWith(filter)) {
|
||||
matches.push({ value: d });
|
||||
}
|
||||
});
|
||||
|
||||
callback(matches);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
});
|
||||
|
Reference in New Issue
Block a user