2013-06-22 06:24:24 +00:00
|
|
|
|
'use strict';
|
2013-04-11 01:24:34 +00:00
|
|
|
|
|
|
|
|
|
define(['app'], function () {
|
2013-02-14 02:28:56 +00:00
|
|
|
|
|
2013-02-15 23:38:53 +00:00
|
|
|
|
$.fn.autoComplete = function (resource) {
|
2013-02-14 02:28:56 +00:00
|
|
|
|
$(this).typeahead({
|
2013-03-29 23:28:58 +00:00
|
|
|
|
source : function (filter, callback) {
|
2013-02-14 02:28:56 +00:00
|
|
|
|
$.ajax({
|
2013-03-29 23:28:58 +00:00
|
|
|
|
url : NzbDrone.Constants.ApiRoot + resource,
|
2013-06-22 06:24:24 +00:00
|
|
|
|
dataType: 'json',
|
|
|
|
|
type : 'GET',
|
2013-03-29 23:28:58 +00:00
|
|
|
|
data : { query: filter },
|
|
|
|
|
success : function (data) {
|
2013-02-15 23:38:53 +00:00
|
|
|
|
callback(data);
|
2013-02-14 02:28:56 +00:00
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
},
|
2013-05-20 20:30:23 +00:00
|
|
|
|
minLength: 3,
|
|
|
|
|
items :20
|
2013-02-14 02:28:56 +00:00
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
});
|