1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-14 11:23:42 +02:00
Sonarr/NzbDrone.Web/Scripts/AutoComplete.js

48 lines
1.4 KiB
JavaScript
Raw Normal View History

2011-07-28 01:59:48 +03:00
jQuery(document).ready(function () {
$.ajaxSetup({
cache: false
});
2011-06-30 09:15:06 +03:00
2011-07-28 01:59:48 +03:00
$('.folderLookup').livequery(function () {
bindFolderAutoComplete(".folderLookup");
});
$('.seriesLookup').livequery(function () {
bindSeriesAutoComplete(".seriesLookup");
});
2011-06-30 09:15:06 +03:00
2011-07-28 01:59:48 +03: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 09:15:06 +03:00
});
2011-07-28 01:59:48 +03:00
});
2011-06-30 09:15:06 +03:00
2011-07-28 01:59:48 +03: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 09:15:06 +03:00
}