From 2efdd8a35c77e76332fee235e6b2669c66bfdfed Mon Sep 17 00:00:00 2001 From: Seth Date: Wed, 12 Nov 2014 09:07:57 +0000 Subject: [PATCH] Issue #16 hide khz/kbps/position/time by default show khz/kbps/position/time only when status set to play --- winamp.css | 4 ++++ winamp.js | 41 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+) diff --git a/winamp.css b/winamp.css index 2a67d1a6..6d681a57 100755 --- a/winamp.css +++ b/winamp.css @@ -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; diff --git a/winamp.js b/winamp.js index 49ef95f2..41df9819 100755 --- a/winamp.js +++ b/winamp.js @@ -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);