diff --git a/src/js/components/Dater.js b/src/js/components/Dater.js index 30439153..bcfe3f0b 100755 --- a/src/js/components/Dater.js +++ b/src/js/components/Dater.js @@ -27,12 +27,12 @@ export default class Dater extends React.Component{ // get left-over number of seconds seconds = total_seconds - (total_minutes * 60 ) if (seconds <= 9) seconds = '0'+ seconds - if (seconds == 0) seconds = '00' + if (seconds == 0) seconds = '0' // get left-over number of minutes minutes = total_minutes - (total_hours * 60 ) if (minutes <= 9 && total_hours) minutes = '0'+ minutes - if (minutes == 0) minutes = '00' + if (minutes == 0) minutes = '0' if (total_hours) string += total_hours+':' if (minutes) string += minutes+':' diff --git a/src/js/components/Modal/Modal.js b/src/js/components/Modal/Modal.js index c3360773..6133233d 100755 --- a/src/js/components/Modal/Modal.js +++ b/src/js/components/Modal/Modal.js @@ -145,7 +145,7 @@ class Modal extends React.Component{ const mapStateToProps = (state, ownProps) => { return { - current_track: (state.core.current_track !== undefined && state.core.tracks !== undefined && state.core.tracks[state.core.current_track.uri] !== undefined ? state.core.tracks[state.core.current_track.uri] : null), + current_track: (state.core.current_track !== undefined && state.core.tracks !== undefined && state.core.tracks[state.core.current_track] !== undefined ? state.core.tracks[state.core.current_track] : null), uri_schemes: (state.mopidy.uri_schemes ? state.mopidy.uri_schemes : []), search_uri_schemes: (state.ui.search_uri_schemes ? state.ui.search_uri_schemes : []), volume: state.mopidy.volume, diff --git a/src/js/components/Parallax.js b/src/js/components/Parallax.js index 7dc68bdb..6df4c8ef 100755 --- a/src/js/components/Parallax.js +++ b/src/js/components/Parallax.js @@ -61,16 +61,16 @@ export default class Parallax extends React.Component{ componentWillReceiveProps(nextProps){ if ((!this.state.url || nextProps.image != this.state.url ) && !this._loading && nextProps.image){ - this._loading = true - this.setState({ url: nextProps.image, image: false, loading: true }) - this.loadImage(nextProps.image ) + this._loading = true; + this.setState({ url: nextProps.image, image: false, loading: true }); + this.loadImage(nextProps.image) .then( response => { if (this._mounted){ - this._loading = false - this._loaded = true - this.setState({ url: nextProps.image, image: response, loading: false }) - this.updateCanvas(response) + this._loading = false; + this._loaded = true; + this.setState({ url: nextProps.image, image: response, loading: false }); + this.updateCanvas(response); } } ) @@ -96,9 +96,13 @@ export default class Parallax extends React.Component{ loadImage(url){ return new Promise((resolve, reject) => { - var imageObject = new Image() - imageObject.src = url - imageObject.crossOrigin = 'anonymous' + var imageObject = new Image(); + imageObject.src = url; + + // This seems to prevent Dirble images from loading. + // Other domains don't seem to mind any more, so perhaps we can remove for good. + // TODO: Re-test the nature of crossorigin images + // imageObject.crossOrigin = 'anonymous'; imageObject.onload = function(){ var image = { @@ -108,7 +112,7 @@ export default class Parallax extends React.Component{ original_height: imageObject.naturalHeight, object: imageObject } - resolve(image ) + resolve(image); } }) } diff --git a/src/js/components/ProgressSlider.js b/src/js/components/ProgressSlider.js index 71eb9f0e..009a4a9e 100755 --- a/src/js/components/ProgressSlider.js +++ b/src/js/components/ProgressSlider.js @@ -20,18 +20,20 @@ class ProgressSlider extends React.Component{ var percent = (sliderX / sliderWidth ).toFixed(2); if (this.props.connected && this.props.current_track){ - var destination_time = this.props.current_track.duration * percent - this.props.mopidyActions.seek(destination_time ) - this.setState({ animating: false }) + var destination_time = this.props.current_track.duration * percent; + this.props.mopidyActions.seek(destination_time); + this.setState({ animating: false }); } } render(){ - var percent = 0 + var percent = 0; if (this.props.connected && this.props.current_track){ - percent = this.props.time_position / this.props.current_track.duration + percent = this.props.time_position / this.props.current_track.duration; percent = percent * 100; - if (percent > 100 ) percent = 100 + if (percent > 1000){ + percent = 100; + } } return ( @@ -52,7 +54,7 @@ class ProgressSlider extends React.Component{ const mapStateToProps = (state, ownProps) => { return { - current_track: (state.core.current_track !== undefined && state.core.tracks !== undefined && state.core.tracks[state.core.current_track.uri] !== undefined ? state.core.tracks[state.core.current_track.uri] : null), + current_track: (state.core.current_track !== undefined && state.core.tracks !== undefined && state.core.tracks[state.core.current_track] !== undefined ? state.core.tracks[state.core.current_track] : null), connected: state.mopidy.connected, time_position: state.mopidy.time_position, play_state: state.mopidy.play_state