mirror of
https://github.com/danbee/mpd-client
synced 2025-03-04 08:39:09 +00:00
Make play/pause button dynamic.
This commit is contained in:
parent
99c057f1ee
commit
280455ca4e
@ -2,7 +2,7 @@ var Transport = can.Control.extend({
|
|||||||
|
|
||||||
init: function(element, options) {
|
init: function(element, options) {
|
||||||
this.status = options.status;
|
this.status = options.status;
|
||||||
element.html(can.view('views/transport.ejs'));
|
element.html(can.view('views/transport.ejs', { status: this.status }));
|
||||||
},
|
},
|
||||||
|
|
||||||
updateStatus: function(status) {
|
updateStatus: function(status) {
|
||||||
@ -23,6 +23,7 @@ var Transport = can.Control.extend({
|
|||||||
'button click': function(element, event) {
|
'button click': function(element, event) {
|
||||||
var command = $(element).data('command');
|
var command = $(element).data('command');
|
||||||
this.sendCommand(command);
|
this.sendCommand(command);
|
||||||
|
$(element).blur();
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
@ -1,7 +1,10 @@
|
|||||||
<div id="controls">
|
<nav>
|
||||||
<button data-command="previous">previous</button>
|
<button data-command="previous">previous</button>
|
||||||
<button data-command="play">play</button>
|
<% if (status.attr('state') == 'play') { %>
|
||||||
<button data-command="pause">pause</button>
|
<button data-command="pause">pause</button>
|
||||||
|
<% } else { %>
|
||||||
|
<button data-command="play">play</button>
|
||||||
|
<% } %>
|
||||||
<button data-command="stop">stop</button>
|
<button data-command="stop">stop</button>
|
||||||
<button data-command="next">next</button>
|
<button data-command="next">next</button>
|
||||||
</div>
|
</nav>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user