Add location.url() shorthand
location.url() === location.current().url
This commit is contained in:
@@ -306,7 +306,7 @@ function dispatch (action, ...args) {
|
||||
state.playing.isStalled = true
|
||||
}
|
||||
if (action === 'mediaError') {
|
||||
if (state.location.current().url === 'player') {
|
||||
if (state.location.url() === 'player') {
|
||||
state.playing.location = 'error'
|
||||
ipcRenderer.send('checkForVLC')
|
||||
ipcRenderer.once('checkForVLC', function (e, isInstalled) {
|
||||
@@ -386,7 +386,7 @@ function pause () {
|
||||
}
|
||||
|
||||
function playPause () {
|
||||
if (state.location.current().url !== 'player') return
|
||||
if (state.location.url() !== 'player') return
|
||||
if (state.playing.isPaused) {
|
||||
play()
|
||||
} else {
|
||||
@@ -1236,7 +1236,7 @@ function showDoneNotification (torrent) {
|
||||
// * The video is paused
|
||||
// * The video is playing remotely on Chromecast or Airplay
|
||||
function showOrHidePlayerControls () {
|
||||
var hideControls = state.location.current().url === 'player' &&
|
||||
var hideControls = state.location.url() === 'player' &&
|
||||
state.playing.mouseStationarySince !== 0 &&
|
||||
new Date().getTime() - state.playing.mouseStationarySince > 2000 &&
|
||||
!state.playing.isPaused &&
|
||||
|
||||
@@ -6,6 +6,11 @@ function LocationHistory () {
|
||||
this._forward = []
|
||||
this._pending = false
|
||||
}
|
||||
|
||||
LocationHistory.prototype.url = function () {
|
||||
return this.current() && this.current().url
|
||||
}
|
||||
|
||||
LocationHistory.prototype.current = function () {
|
||||
return this._history[this._history.length - 1]
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ function App (state) {
|
||||
// * 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.location.current().url === 'player' &&
|
||||
var hideControls = state.location.url() === 'player' &&
|
||||
state.playing.mouseStationarySince !== 0 &&
|
||||
new Date().getTime() - state.playing.mouseStationarySince > 2000 &&
|
||||
!state.playing.isPaused &&
|
||||
@@ -30,10 +30,10 @@ function App (state) {
|
||||
|
||||
// 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.location.current().url === 'player'
|
||||
var hideHeader = process.platform !== 'darwin' && state.location.url() === 'player'
|
||||
|
||||
var cls = [
|
||||
'view-' + state.location.current().url, /* e.g. view-home, view-player */
|
||||
'view-' + state.location.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')
|
||||
@@ -81,6 +81,6 @@ function getModal (state) {
|
||||
}
|
||||
|
||||
function getView (state) {
|
||||
var url = state.location.current().url
|
||||
var url = state.location.url()
|
||||
return Views[url](state)
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ function Header (state) {
|
||||
}
|
||||
|
||||
function getAddButton () {
|
||||
if (state.location.current().url !== 'player') {
|
||||
if (state.location.url() !== 'player') {
|
||||
return hx`
|
||||
<i
|
||||
class='icon add'
|
||||
|
||||
Reference in New Issue
Block a user