Style: no more var

This commit is contained in:
DC
2016-08-31 14:36:11 -07:00
parent 0bda5358bd
commit 3f6cc97a02
54 changed files with 676 additions and 679 deletions

View File

@@ -4,7 +4,7 @@ const {dispatcher} = require('../lib/dispatcher')
class Header extends React.Component {
render () {
var loc = this.props.state.location
const loc = this.props.state.location
return (
<div className='header'>
{this.getTitle()}
@@ -31,12 +31,12 @@ class Header extends React.Component {
getTitle () {
if (process.platform !== 'darwin') return null
var state = this.props.state
const state = this.props.state
return (<div className='title ellipsis'>{state.window.title}</div>)
}
getAddButton () {
var state = this.props.state
const state = this.props.state
if (state.location.url() !== 'home') return null
return (
<i

View File

@@ -29,7 +29,7 @@ class PathSelector extends React.Component {
}
handleClick () {
var opts = Object.assign({
const opts = Object.assign({
defaultPath: this.props.value,
properties: [ 'openFile', 'openDirectory' ]
}, this.props.dialog)

View File

@@ -4,11 +4,11 @@ const {dispatch, dispatcher} = require('../lib/dispatcher')
module.exports = class RemoveTorrentModal extends React.Component {
render () {
var state = this.props.state
var message = state.modal.deleteData
const state = this.props.state
const message = state.modal.deleteData
? 'Are you sure you want to remove this torrent from the list and delete the data file?'
: 'Are you sure you want to remove this torrent from the list?'
var buttonText = state.modal.deleteData ? 'Remove Data' : 'Remove'
const buttonText = state.modal.deleteData ? 'Remove Data' : 'Remove'
return (
<div>

View File

@@ -6,20 +6,20 @@ const {dispatcher} = require('../lib/dispatcher')
module.exports = class UnsupportedMediaModal extends React.Component {
render () {
var state = this.props.state
var err = state.modal.error
var message = (err && err.getMessage)
const state = this.props.state
const err = state.modal.error
const message = (err && err.getMessage)
? err.getMessage()
: err
var playerPath = state.saved.prefs.externalPlayerPath
var playerName = playerPath
const playerPath = state.saved.prefs.externalPlayerPath
const playerName = playerPath
? path.basename(playerPath).split('.')[0]
: 'VLC'
var onPlay = dispatcher('openExternalPlayer')
var actionButton = state.modal.externalPlayerInstalled
const onPlay = dispatcher('openExternalPlayer')
const actionButton = state.modal.externalPlayerInstalled
? (<button className='button-raised' onClick={onPlay}>Play in {playerName}</button>)
: (<button className='button-raised' onClick={() => this.onInstall()}>Install VLC</button>)
var playerMessage = state.modal.externalPlayerNotFound
const playerMessage = state.modal.externalPlayerNotFound
? 'Couldn\'t run external player. Please make sure it\'s installed.'
: ''
return (
@@ -39,7 +39,7 @@ module.exports = class UnsupportedMediaModal extends React.Component {
electron.shell.openExternal('http://www.videolan.org/vlc/')
// TODO: dcposch send a dispatch rather than modifying state directly
var state = this.props.state
const state = this.props.state
state.modal.externalPlayerInstalled = true // Assume they'll install it successfully
}
}

View File

@@ -5,7 +5,7 @@ const {dispatch} = require('../lib/dispatcher')
module.exports = class UpdateAvailableModal extends React.Component {
render () {
var state = this.props.state
const state = this.props.state
return (
<div className='update-available-modal'>
<p><strong>A new version of WebTorrent is available: v{state.modal.version}</strong></p>