hide khz/kbps/position/time by default
show khz/kbps/position/time only when status set to play
This commit is contained in:
Seth 2014-11-12 09:07:57 +00:00
parent 90d1e862f8
commit 2efdd8a35c
2 changed files with 45 additions and 0 deletions

View file

@ -133,6 +133,7 @@ a:focus { outline: none; }
.status #play-pause.pause { background-position: -9px 0; }
.status #play-pause.stop { background-position: -18px 0; }
.status #time {
display:none;
position: absolute;
left: 48px;
left: 40px;
@ -201,6 +202,7 @@ a:focus { outline: none; }
.setting-balance #balance-message { display: block; }
.media-info #kbps {
display: none;
position: absolute;
left: 111px;
top: 43px;
@ -210,6 +212,7 @@ a:focus { outline: none; }
}
.media-info #khz {
display: none;
position: absolute;
left: 156px;
top: 43px;
@ -347,6 +350,7 @@ a:focus { outline: none; }
}
#position {
display: none;
position: absolute;
left: 16px;
top: 72px;

View file

@ -101,6 +101,8 @@ function Winamp () {
'repeat': document.getElementById('repeat'),
'shuffle': document.getElementById('shuffle'),
'volume': document.getElementById('volume'),
'kbps': document.getElementById('kbps'),
'khz': document.getElementById('khz'),
'balance': document.getElementById('balance'),
'playPause': document.getElementById('play-pause'),
'workIndicator': document.getElementById('work-indicator'),
@ -182,6 +184,10 @@ function Winamp () {
});
this.media.addEventListener('ended', function() {
self.hideKbps();
self.hideKHz();
self.hidePosition();
self.hideTime();
self.setStatus('stop');
});
@ -212,6 +218,10 @@ function Winamp () {
}
this.nodes.play.onclick = function() {
self.showKbps();
self.showKHz();
self.showPosition();
self.showTime();
self.media.play();
self.setStatus('play');
}
@ -222,6 +232,11 @@ function Winamp () {
this.nodes.stop.onclick = function() {
self.media.stop();
self.setStatus('stop');
self.setStatus('stop');
self.hideKbps();
self.hideKHz();
self.hidePosition();
self.hideTime();
}
this.nodes.next.onclick = function() {
// Implement this when we support playlists
@ -273,6 +288,32 @@ function Winamp () {
toggleShuffle();
}
/* Functions */
this.showKHz = function(){
this.nodes.khz.style.display='block';
};
this.showKbps = function(){
this.nodes.kbps.style.display='block';
};
this.showPosition = function(){
this.nodes.position.style.display='block';
};
this.showTime = function(){
this.nodes.time.style.display='block';
};
this.hideKHz = function(){
this.nodes.khz.style.display='';
};
this.hideKbps = function(){
this.nodes.kbps.style.display='';
};
this.hidePosition = function(){
this.nodes.position.style.display='';
};
this.hideTime = function(){
this.nodes.time.style.display='';
};
this.setStatus = function(className) {
self.nodes.playPause.removeAttribute("class");
self.nodes.playPause.classList.add(className);