1
0
mirror of https://github.com/2ec0b4/kaamelott-soundboard.git synced 2025-12-08 23:53:24 +00:00

WIP - Filtre les sons

This commit is contained in:
Antoine
2016-04-12 15:34:55 +02:00
parent bde2b12632
commit 2bc2196562
7 changed files with 47 additions and 37 deletions

View File

@@ -11,13 +11,13 @@ define(
var Sounds = Backbone.Collection.extend({
model: Sound,
url: 'sounds/sounds.json',
search : function(search){
filterByTitle: function(search){
if( search == "" ) {
return this;
}
var pattern = new RegExp('^'+search, 'gi');
return _(this.filter(function(data) {
return new Sounds(this.filter(function(data) {
return pattern.test(data.get('title'));
}));
}