mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-22 22:14:44 -04:00
Moved source code under src folder - massive change
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
'use strict';
|
||||
define(
|
||||
[
|
||||
'app',
|
||||
'Series/SeriesCollection'
|
||||
], function (App, SeriesCollection) {
|
||||
$(document).on('keydown', function (e){
|
||||
if ($(e.target).is('input')) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (e.keyCode === 84) {
|
||||
$('.x-series-search').focus();
|
||||
e.preventDefault();
|
||||
}
|
||||
});
|
||||
|
||||
$.fn.bindSearch = function () {
|
||||
$(this).typeahead({
|
||||
source : function () {
|
||||
return SeriesCollection.pluck('title');
|
||||
},
|
||||
|
||||
sorter: function (items) {
|
||||
return items.sort();
|
||||
},
|
||||
|
||||
updater: function (item) {
|
||||
var series = SeriesCollection.findWhere({ title: item });
|
||||
|
||||
this.$element.blur();
|
||||
App.Router.navigate('/series/{0}'.format(series.get('titleSlug')), { trigger: true });
|
||||
}
|
||||
});
|
||||
};
|
||||
});
|
||||
Reference in New Issue
Block a user