Implement back/forward buttons (fix #180)

This commit is contained in:
Feross Aboukhadijeh
2016-03-20 22:54:51 -07:00
parent 90f1b02895
commit d0ddf6909a
5 changed files with 100 additions and 29 deletions

View File

@@ -17,7 +17,7 @@ function App (state, dispatch) {
// * The mouse is over the controls or we're scrubbing (see CSS)
// * The video is paused
// * The video is playing remotely on Chromecast or Airplay
var hideControls = state.url === 'player' &&
var hideControls = state.location.current().url === 'player' &&
state.video.mouseStationarySince !== 0 &&
new Date().getTime() - state.video.mouseStationarySince > 2000 &&
!state.video.isPaused &&
@@ -25,10 +25,10 @@ function App (state, dispatch) {
// Hide the header on Windows/Linux when in the player
// On OSX, the header appears as part of the title bar
var hideHeader = process.platform !== 'darwin' && state.url === 'player'
var hideHeader = process.platform !== 'darwin' && state.location.current().url === 'player'
var cls = [
'view-' + state.url, /* e.g. view-home, view-player */
'view-' + state.location.current().url, /* e.g. view-home, view-player */
'is-' + process.platform /* e.g. is-darwin, is-win32, is-linux */
]
if (state.window.isFullScreen) cls.push('is-fullscreen')
@@ -75,9 +75,9 @@ function App (state, dispatch) {
}
function getView () {
if (state.url === 'home') {
if (state.location.current().url === 'home') {
return TorrentList(state, dispatch)
} else if (state.url === 'player') {
} else if (state.location.current().url === 'player') {
return Player(state, dispatch)
}
}

View File

@@ -9,14 +9,14 @@ function Header (state, dispatch) {
<div class='header'>
${getTitle()}
<div class='nav left'>
<i
class='icon back'
<i.icon.back
class=${state.location.hasBack() ? '' : 'disabled'}
title='back'
onclick=${() => dispatch('back')}>
chevron_left
</i>
<i
class='icon forward'
<i.icon.forward
class=${state.location.hasForward() ? '' : 'disabled'}
title='forward'
onclick=${() => dispatch('forward')}>
chevron_right
@@ -35,7 +35,7 @@ function Header (state, dispatch) {
}
function getAddButton () {
if (state.url !== 'player') {
if (state.location.current().url !== 'player') {
return hx`
<i
class='icon add'