mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-24 08:08:15 -05:00
40 lines
1.2 KiB
CoffeeScript
40 lines
1.2 KiB
CoffeeScript
RootView = require 'views/kinds/RootView'
|
|
template = require 'templates/home'
|
|
WizardLank = require 'lib/surface/WizardLank'
|
|
ThangType = require 'models/ThangType'
|
|
Simulator = require 'lib/simulator/Simulator'
|
|
|
|
{me} = require '/lib/auth'
|
|
|
|
module.exports = class HomeView extends RootView
|
|
id: 'home-view'
|
|
template: template
|
|
|
|
events:
|
|
'click #play-button': 'onClickBeginnerCampaign'
|
|
|
|
constructor: ->
|
|
super()
|
|
window.tracker?.trackEvent 'Homepage', Action: 'Loaded'
|
|
|
|
getRenderData: ->
|
|
c = super()
|
|
if $.browser
|
|
majorVersion = $.browser.versionNumber
|
|
c.isOldBrowser = true if $.browser.mozilla && majorVersion < 21
|
|
c.isOldBrowser = true if $.browser.chrome && majorVersion < 17
|
|
c.isOldBrowser = true if $.browser.safari && majorVersion < 6
|
|
else
|
|
console.warn 'no more jquery browser version...'
|
|
c.isEnglish = (me.get('preferredLanguage') or 'en').startsWith 'en'
|
|
c.languageName = me.get('preferredLanguage')
|
|
c
|
|
|
|
onClickBeginnerCampaign: (e) ->
|
|
e.preventDefault()
|
|
e.stopImmediatePropagation()
|
|
window.tracker?.trackEvent 'Homepage', Action: 'Play'
|
|
window.open '/play', '_blank'
|
|
|
|
afterInsert: ->
|
|
super(arguments...)
|