volume, stop
This commit is contained in:
@@ -9,13 +9,16 @@ var Radio = function() {
|
||||
|
||||
var channels;
|
||||
var $navigation;
|
||||
var $controlPanel;
|
||||
|
||||
return {
|
||||
init: function(channels_) {
|
||||
channels = channels_;
|
||||
$navigation = $('#navigation');
|
||||
$controlPanel = $('#controls');
|
||||
|
||||
initTiles();
|
||||
initClickOfControls();
|
||||
console.log('Radio initialized with ' + channels.length + ' channels');
|
||||
}
|
||||
};
|
||||
@@ -81,5 +84,33 @@ var Radio = function() {
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/* private */
|
||||
function initClickOfControls() {
|
||||
$controlPanel.find('a').click(function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
var stream = $(this).attr('href');
|
||||
console.log('Action: ' + stream);
|
||||
|
||||
$.ajax({
|
||||
url: stream,
|
||||
context: document.body,
|
||||
statusCode: {
|
||||
200: function() {
|
||||
console.log('ok');
|
||||
},
|
||||
404: function() {
|
||||
console.log('Resource not found');
|
||||
},
|
||||
500: function() {
|
||||
console.log('Something went wrong');
|
||||
}
|
||||
}
|
||||
}).done(function() {
|
||||
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
}();
|
||||
|
||||
Reference in New Issue
Block a user