From aa7f2ec3624e56513c42ded1631aa0cd1099dbaf Mon Sep 17 00:00:00 2001 From: Jordan Eldredge Date: Wed, 28 Jan 2015 21:08:39 -0800 Subject: [PATCH] Abstract position update --- js/main-window.js | 5 +++-- js/winamp.js | 5 ++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/js/main-window.js b/js/main-window.js index 3b68b9e0..7f09d091 100644 --- a/js/main-window.js +++ b/js/main-window.js @@ -213,9 +213,9 @@ MainWindow = { this.nodes.window.classList.add('closed'); }, - updatePosition: function(percent) { + updatePosition: function() { if(!this.nodes.window.classList.contains('setting-position')) { - this.nodes.position.value = percent; + this.nodes.position.value = this.winamp.getPercentComplete(); } }, @@ -234,6 +234,7 @@ MainWindow = { updateTime: function() { this.updateShadePositionClass(); + this.updatePosition(); var shadeMinusCharacter = ' '; if(this.nodes.time.classList.contains('countdown')) { diff --git a/js/winamp.js b/js/winamp.js index d98a3b00..4a110a23 100755 --- a/js/winamp.js +++ b/js/winamp.js @@ -41,7 +41,6 @@ Winamp = { this.windowManager.registerWindow(this.mainWindow); this.media.addEventListener('timeupdate', function() { - self.mainWindow.updatePosition(self.media.percentComplete()); window.dispatchEvent(self.events.timeUpdated); }); @@ -90,6 +89,10 @@ Winamp = { return this.media.timeElapsed(); }, + getPercentComplete: function() { + return this.media.percentComplete() + }, + getChannelCount: function() { return this.media.channels(); },