mirror of
https://github.com/2ec0b4/kaamelott-soundboard.git
synced 2025-12-08 15:43:24 +00:00
(petosorus-random_button) Active / désactive le bouton
This commit is contained in:
@@ -1,2 +1,2 @@
|
||||
<button id="random" class="btn">Aléatoire</button>
|
||||
<button id="reset" class="btn hidden">Réinitialiser</button>
|
||||
<button id="reset" class="btn" disabled>Réinitialiser</button>
|
||||
|
||||
@@ -17,15 +17,25 @@ define("views/random", function(require) {
|
||||
"click @ui.resetButton": "reset"
|
||||
},
|
||||
initialize: function() {
|
||||
var that = this;
|
||||
this.channel = Radio.channel("Sounds");
|
||||
this.channel.on("sounds:filter", function (value) {
|
||||
if (value == "") {
|
||||
return;
|
||||
}
|
||||
that.enableButton();
|
||||
});
|
||||
},
|
||||
random: function() {
|
||||
this.$el.find(this.ui.resetButton).removeClass('hidden');
|
||||
this.enableButton();
|
||||
this.channel.trigger("sounds:random");
|
||||
},
|
||||
reset: function() {
|
||||
this.$el.find(this.ui.resetButton).addClass('hidden');
|
||||
this.$el.find(this.ui.resetButton).attr('disabled', 'disabled');
|
||||
this.channel.trigger("sounds:reset");
|
||||
},
|
||||
enableButton: function() {
|
||||
this.$el.find(this.ui.resetButton).removeAttr('disabled');
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user