mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-27 17:45:40 -05:00
This commit is contained in:
commit
7a866981f7
3 changed files with 14 additions and 11 deletions
|
@ -42,6 +42,9 @@ module.exports = class Thang
|
|||
setGoalState: (goalID, status) ->
|
||||
@world.setGoalState goalID, status
|
||||
|
||||
getThangByID: (id) ->
|
||||
@world.getThangByID id
|
||||
|
||||
addComponents: (components...) ->
|
||||
# We don't need to keep the components around after attaching them, but we will keep their initial config for recreating Thangs
|
||||
@components ?= []
|
||||
|
|
|
@ -151,7 +151,7 @@ module.exports = class PlaybackView extends View
|
|||
@newTime = 0
|
||||
@currentTime = 0
|
||||
|
||||
@timePopup = new HoverPopup unless @timePopup?
|
||||
@timePopup ?= new HoverPopup
|
||||
|
||||
|
||||
#TODO: Why do we need defaultValues here at all? Fallback language has been set to 'en'... oO
|
||||
|
@ -192,7 +192,7 @@ module.exports = class PlaybackView extends View
|
|||
@$progressScrubber.slider('disable', true)
|
||||
catch e
|
||||
#console.warn('error disabling scrubber')
|
||||
@timePopup.disable()
|
||||
@timePopup?.disable()
|
||||
$('#volume-button', @$el).removeClass('disabled')
|
||||
|
||||
onEnableControls: (e) ->
|
||||
|
@ -203,7 +203,7 @@ module.exports = class PlaybackView extends View
|
|||
@$progressScrubber.slider('enable', true)
|
||||
catch e
|
||||
#console.warn('error enabling scrubber')
|
||||
@timePopup.enable()
|
||||
@timePopup?.enable()
|
||||
|
||||
onSetPlaying: (e) ->
|
||||
@playing = (e ? {}).playing ? true
|
||||
|
@ -242,21 +242,21 @@ module.exports = class PlaybackView extends View
|
|||
@lastProgress = e.progress
|
||||
|
||||
onProgressEnter: (e) ->
|
||||
#Why it needs itself as parameter you ask? Ask Twitter instead..
|
||||
@timePopup.enter @timePopup
|
||||
# Why it needs itself as parameter you ask? Ask Twitter instead.
|
||||
@timePopup?.enter @timePopup
|
||||
|
||||
onProgressLeave: (e) ->
|
||||
@timePopup.leave @timePopup
|
||||
@timePopup?.leave @timePopup
|
||||
|
||||
onProgressHover: (e) ->
|
||||
timeRatio = @$progressScrubber.width() / @totalTime
|
||||
@newTime = e.offsetX / timeRatio
|
||||
@updatePopupContent()
|
||||
@timePopup.onHover e
|
||||
@timePopup?.onHover e
|
||||
|
||||
#Show it instantaniously if close enough to current time.
|
||||
if Math.abs(@currentTime - @newTime) < 1 and not @timePopup.shown
|
||||
@timePopup.show() unless @timePopup.shown
|
||||
# Show it instantaneously if close enough to current time.
|
||||
if @timePopup and Math.abs(@currentTime - @newTime) < 1 and not @timePopup.shown
|
||||
@timePopup.show()
|
||||
|
||||
updateProgress: (progress) ->
|
||||
$('.scrubber .progress-bar', @$el).css('width', "#{progress*100}%")
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
"d3": "~3.4.4",
|
||||
"nanoscroller": "~0.8.0",
|
||||
"jquery.tablesorter": "~2.15.13",
|
||||
"treema": "~0.0.1",
|
||||
"treema": ">=0.0.1",
|
||||
"bootstrap": "~3.1.1",
|
||||
"validated-backbone-mediator": "~0.1.3"
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue