1
0
Fork 0
mirror of https://github.com/lidarr/Lidarr synced 2024-12-29 02:55:38 +00:00
Lidarr/NzbDrone.Web/Scripts/AutoComplete.js

48 lines
1.4 KiB
JavaScript
Raw Normal View History

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