mirror of
https://github.com/captbaritone/webamp.git
synced 2026-07-26 11:34:14 +00:00
Factor winamp.media out of main-window
This commit is contained in:
parent
2c5a3c9a12
commit
6d2cdccc61
2 changed files with 21 additions and 5 deletions
|
|
@ -107,15 +107,15 @@ MainWindow = {
|
|||
this.nodes.position.oninput = function() {
|
||||
var newPercentComplete = self.nodes.position.value;
|
||||
var newFractionComplete = newPercentComplete/100;
|
||||
var newElapsed = self._timeString(self.winamp.media.duration() * newFractionComplete);
|
||||
var duration = self._timeString(self.winamp.media.duration());
|
||||
var newElapsed = self._timeString(self.winamp.getDuration() * newFractionComplete);
|
||||
var duration = self._timeString(self.winamp.getDuration());
|
||||
var message = "Seek to: " + newElapsed + "/" + duration + " (" + newPercentComplete + "%)";
|
||||
self.textDisplay.setRegisterText('position', message);
|
||||
}
|
||||
|
||||
this.nodes.position.onchange = function() {
|
||||
if(self.winamp.getState() != 'stop'){
|
||||
self.winamp.media.seekToPercentComplete(this.value);
|
||||
self.winamp.seekToPercentComplete(this.value);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -227,10 +227,10 @@ MainWindow = {
|
|||
|
||||
var shadeMinusCharacter = ' ';
|
||||
if(this.nodes.time.classList.contains('countdown')) {
|
||||
digits = this.winamp._timeObject(this.winamp.media.timeRemaining());
|
||||
digits = this.winamp._timeObject(this.winamp.getTimeRemaining());
|
||||
var shadeMinusCharacter = '-';
|
||||
} else {
|
||||
digits = this.winamp._timeObject(this.winamp.media.timeElapsed());
|
||||
digits = this.winamp._timeObject(this.winamp.getTimeElapsed());
|
||||
}
|
||||
this.winamp.skin.font.displayCharacterInNode(shadeMinusCharacter, document.getElementById('shade-minus-sign'));
|
||||
|
||||
|
|
|
|||
16
js/winamp.js
16
js/winamp.js
|
|
@ -75,6 +75,22 @@ Winamp = {
|
|||
return this.state;
|
||||
},
|
||||
|
||||
getDuration: function() {
|
||||
return this.media.duration();
|
||||
},
|
||||
|
||||
getTimeRemaining: function() {
|
||||
return this.media.timeRemaining();
|
||||
},
|
||||
|
||||
getTimeElapsed: function() {
|
||||
return this.media.timeElapsed();
|
||||
},
|
||||
|
||||
seekToPercentComplete: function(percent) {
|
||||
this.media.seekToPercentComplete(percent);
|
||||
},
|
||||
|
||||
toggleTimeMode: function() {
|
||||
this.mainWindow.toggleTimeMode();
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue