mirror of
https://github.com/danbee/mpd-client
synced 2025-03-04 08:39:09 +00:00
38 lines
638 B
JavaScript
38 lines
638 B
JavaScript
can.Component.extend({
|
|
|
|
tag: 'mpd-library',
|
|
|
|
template: can.view('views/library.mustache'),
|
|
|
|
scope: {
|
|
currentPane: 0
|
|
},
|
|
|
|
events: {
|
|
show: function() {
|
|
$(this.element).addClass('show');
|
|
},
|
|
|
|
hide: function() {
|
|
$(this.element).removeClass('show');
|
|
},
|
|
|
|
'route': function(data) {
|
|
this.hide();
|
|
},
|
|
|
|
':type route': function(data) {
|
|
if (data.type == 'library') {
|
|
this.show();
|
|
if (data.pane > this.currentPane) {
|
|
this.addPane(data);
|
|
}
|
|
else if (data.pane < this.currentPane) {
|
|
this.removePane(data);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
});
|