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