1
0
mirror of https://github.com/Radarr/Radarr.git synced 2026-04-23 22:25:14 -04:00

rjs -> webpack

This commit is contained in:
Keivan Beigi
2015-02-02 17:18:45 -08:00
parent 344f3d66ef
commit 428a1439e5
399 changed files with 11591 additions and 16139 deletions
+34 -42
View File
@@ -1,44 +1,36 @@
'use strict';
define(
[
'underscore',
'jquery',
'vent',
'backbone',
'Series/SeriesCollection',
'typeahead'
], function (_, $, vent, Backbone, SeriesCollection) {
var _ = require('underscore');
var $ = require('jquery');
var vent = require('../vent');
var Backbone = require('backbone');
var SeriesCollection = require('../Series/SeriesCollection');
require('typeahead');
vent.on(vent.Hotkeys.NavbarSearch, function () {
$('.x-series-search').focus();
});
$.fn.bindSearch = function () {
$(this).typeahead({
hint: true,
highlight: true,
minLength: 1
},
{
name: 'series',
displayKey: 'title',
source: substringMatcher()
});
$(this).on('typeahead:selected typeahead:autocompleted', function (e, series) {
this.blur();
$(this).val('');
Backbone.history.navigate('/series/{0}'.format(series.titleSlug), { trigger: true });
});
};
var substringMatcher = function() {
return function findMatches(q, cb) {
var matches = _.select(SeriesCollection.toJSON(), function (series) {
return series.title.toLowerCase().indexOf(q.toLowerCase()) > -1;
});
cb(matches);
};
};
module.exports = (function(){
vent.on(vent.Hotkeys.NavbarSearch, function(){
$('.x-series-search').focus();
});
$.fn.bindSearch = function(){
$(this).typeahead({
hint : true,
highlight : true,
minLength : 1
}, {
name : 'series',
displayKey : 'title',
source : substringMatcher()
});
$(this).on('typeahead:selected typeahead:autocompleted', function(e, series){
this.blur();
$(this).val('');
Backbone.history.navigate('/series/{0}'.format(series.titleSlug), {trigger : true});
});
};
var substringMatcher = function(){
return function findMatches (q, cb){
var matches = _.select(SeriesCollection.toJSON(), function(series){
return series.title.toLowerCase().indexOf(q.toLowerCase()) > -1;
});
cb(matches);
};
};
}).call(this);