MCPcopy Create free account
hub / github.com/codecombat/codecombat / updateSlider

Method updateSlider

app/views/admin/CodePlaybackView.js:81–106  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

79 }
80
81 updateSlider () {
82 const value = (this.spade.elapsedTime / this.maxTime) * 100
83 this.$el.find('#slider')[0].value = value
84 if (value >= 100) {
85 this.$el.find('#play-button').text('Replay')
86 } else {
87 this.$el.find('#play-button').text('Play')
88 }
89 this.$el.find('#start-time').text((this.spade.elapsedTime / 1000).toFixed(0) + 's')
90 if (this.spade.elapsedTime >= this.maxTime) {
91 this.clearPlayback()
92 this.fun()
93 }
94 return (() => {
95 const result = []
96 for (let child of Array.from(this.$el.find('#event-container').children())) {
97 child = $(child)
98 const timeoutValue = child.data('timeout') || 0
99 if (!(timeoutValue >= 0)) { continue }
100 const percentage = timeoutValue / 100
101 child.css('background-color', `rgba(${Math.round(100 * percentage)}, ${Math.round(255 * percentage)}, ${Math.round(100 * percentage)}, ${0.125 + ((0.5 - 0.125) * percentage)})`)
102 result.push(child.data('timeout', timeoutValue - 1))
103 }
104 return result
105 })()
106 }
107
108 onPlayClicked (e) {
109 this.clearPlayback()

Callers

nothing calls this directly

Calls 3

clearPlaybackMethod · 0.95
funMethod · 0.95
dataMethod · 0.80

Tested by

no test coverage detected