mirror of
https://github.com/danbee/mpd-client
synced 2025-03-04 08:39:09 +00:00
31 lines
616 B
JavaScript
31 lines
616 B
JavaScript
var Transport = can.Control.extend({
|
|
|
|
init: function(element, options) {
|
|
this.status = options.status;
|
|
element.html(
|
|
can.view(
|
|
'views/transport.ejs', { status: this.status },
|
|
{ formatLength: timeHelpers.formatLength }
|
|
)
|
|
);
|
|
},
|
|
|
|
updateStatus: function(status) {
|
|
this.status.attr(status);
|
|
},
|
|
|
|
sendCommand: function(command) {
|
|
can.ajax({
|
|
url: '/api/control/' + command,
|
|
type: 'PUT'
|
|
});
|
|
},
|
|
|
|
'button click': function(element, event) {
|
|
var command = $(element).data('command');
|
|
this.sendCommand(command);
|
|
$(element).blur();
|
|
}
|
|
|
|
});
|