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

Method onClickSpectateButton

app/views/ladder/LadderView.js:388–399  ·  view source on GitHub ↗
(e)

Source from the content-addressed store, hash-verified

386 }
387
388 onClickSpectateButton (e) {
389 e.preventDefault()
390 e.stopImmediatePropagation()
391 const humanSession = this.ladderTab.spectateTargets != null ? this.ladderTab.spectateTargets.humans : undefined
392 const ogreSession = this.ladderTab.spectateTargets != null ? this.ladderTab.spectateTargets.ogres : undefined
393 let url = `/play/spectate/${this.level.get('slug')}?`
394 if (humanSession && ogreSession) { url += `session-one=${humanSession}&session-two=${ogreSession}` }
395 if (this.league) { url += '&league=' + this.league.id }
396 if (key.command) { url += '&autoplay=false' }
397 if (this.tournamentState === 'ended') { url += '&tournament=' + this.tournamentId }
398 return window.open(url, key.command ? '_blank' : 'spectate') // New tab for spectating specific matches
399 }
400 // Backbone.Mediator.publish 'router:navigate', route: url
401
402 onClickSimulateAllButton (e) {

Callers

nothing calls this directly

Calls 2

getMethod · 0.45
openMethod · 0.45

Tested by

no test coverage detected