1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-14 06:52:36 +01:00
Radarr/NzbDrone.Web/Scripts/AutoComplete.js

48 lines
1.4 KiB
JavaScript
Raw Normal View History

2011-07-28 00:59:48 +02:00
jQuery(document).ready(function () {
$.ajaxSetup({
cache: false
});
2011-06-30 08:15:06 +02:00
2011-07-28 00:59:48 +02:00
$('.folderLookup').livequery(function () {
bindFolderAutoComplete(".folderLookup");
});
$('.seriesLookup').livequery(function () {
bindSeriesAutoComplete(".seriesLookup");
});
2011-06-30 08:15:06 +02:00
2011-07-28 00:59:48 +02:00
});
function bindFolderAutoComplete(selector) {
$(selector).each(function (index, element) {
YUI().use("autocomplete", "autocomplete-highlighters", 'autocomplete-filters', function (Y) {
Y.one('body').addClass('yui3-skin-sam');
Y.one(element).plug(Y.Plugin.AutoComplete, {
resultHighlighter: 'startsWith',
resultFilters: 'phraseMatch',
source: '/Directory/GetDirectories/?q={query}'
});
2011-06-30 08:15:06 +02:00
});
2011-07-28 00:59:48 +02:00
});
2011-06-30 08:15:06 +02:00
2011-07-28 00:59:48 +02:00
}
function bindSeriesAutoComplete(selector) {
$(selector).each(function (index, element) {
YUI().use("autocomplete", "autocomplete-highlighters", 'autocomplete-filters', function (Y) {
Y.one('body').addClass('yui3-skin-sam');
Y.one(element).plug(Y.Plugin.AutoComplete, {
resultHighlighter: 'startsWith',
resultFilters: 'phraseMatch',
resultTextLocator: 'Value',
minQueryLength: 3,
queryDelay: 500,
source: '/AddSeries/LookupSeries/?q={query}'
});
});
});
2011-06-30 08:15:06 +02:00
}