mirror of
https://github.com/2ec0b4/kaamelott-soundboard.git
synced 2025-12-09 16:05:35 +00:00
Proto bouton aléatoire
This commit is contained in:
@@ -28,6 +28,7 @@ define("views/sounds", function(require) {
|
||||
this.channel = Radio.channel("Sounds");
|
||||
this.channel.request("getSounds").then(this.initCollection.bind(this));
|
||||
this.channel.on("sounds:filter", this.filterCollection.bind(this));
|
||||
this.channel.on("sounds:random", this.randomSound.bind(this));
|
||||
},
|
||||
onBeforeRender: function() {
|
||||
var sound;
|
||||
@@ -57,6 +58,13 @@ define("views/sounds", function(require) {
|
||||
|
||||
Radio.channel("Sounds").trigger("sound:play", args.model.getSlug());
|
||||
},
|
||||
randomSound: function() {
|
||||
var index = Math.floor(Math.random() * Math.floor(this.collection.length));
|
||||
var sound = this.collection.models[index];
|
||||
|
||||
Radio.channel("Sounds").trigger("sound:play", sound.getSlug());
|
||||
// sound.play();
|
||||
},
|
||||
stopPlayingSound: function() {
|
||||
var playingSound = this.collection.findWhere({playing: true});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user