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

Method activatePoll

app/views/play/CampaignView.js:2355–2377  ·  view source on GitHub ↗
(forceShowPoll)

Source from the content-addressed store, hash-verified

2353 }
2354
2355 activatePoll (forceShowPoll) {
2356 if (this.shouldShow('promotion')) { return }
2357 if (!this.poll) { return }
2358 const pollTitle = utils.i18n(this.poll.attributes, 'name')
2359 const $pollButton = this.$el.find('button.poll')
2360 .removeClass('hidden')
2361 .addClass('highlighted')
2362 .attr({ title: pollTitle })
2363 .addClass('has-tooltip')
2364 .tooltip({ title: pollTitle })
2365
2366 if ((me.get('lastLevel') === 'shadow-guard') || forceShowPoll) {
2367 return this.showPoll()
2368 } else {
2369 $pollButton.tooltip('show')
2370 setTimeout(() => {
2371 $pollButton?.tooltip('hide')
2372 if (!this.destroyed) {
2373 storage.save('ignored-poll', true, 5) // Don't show again in next N minutes
2374 }
2375 }, 20000) // Don't leave the poll open forever
2376 }
2377 }
2378
2379 showPoll () {
2380 if (!this.shouldShow('poll')) { return false }

Callers 1

onPollSyncMethod · 0.95

Calls 4

shouldShowMethod · 0.95
showPollMethod · 0.95
getMethod · 0.45
saveMethod · 0.45

Tested by

no test coverage detected