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