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

Method onClickSwitchTeam

app/views/play/menu/MyCodeView.js:107–123  ·  view source on GitHub ↗
(e)

Source from the content-addressed store, hash-verified

105 }
106
107 onClickSwitchTeam (e) {
108 const protocol = window.location.protocol + '//'
109 const host = window.location.host
110 const pathname = window.location.pathname
111 let query = window.location.search
112 query = query.replace(/team=[^&]*&?/, '')
113 if (query) {
114 if (query.endsWith('?') || query.endsWith('&')) {
115 query += 'team='
116 } else {
117 query += '&team='
118 }
119 } else {
120 query = '?team='
121 }
122 window.location.href = protocol + host + pathname + query + this.otherTeam()
123 }
124
125 otherTeam () {
126 const teams = _.without(['humans', 'ogres'], this.options.team)

Callers

nothing calls this directly

Calls 1

otherTeamMethod · 0.95

Tested by

no test coverage detected