codecombat/app/views/HomeView.coffee

42 lines
1.2 KiB
CoffeeScript
Raw Normal View History

RootView = require 'views/kinds/RootView'
2014-01-03 13:32:13 -05:00
template = require 'templates/home'
WizardLank = require 'lib/surface/WizardLank'
2014-01-03 13:32:13 -05:00
ThangType = require 'models/ThangType'
Simulator = require 'lib/simulator/Simulator'
2014-03-16 19:59:48 -04:00
{me} = require '/lib/auth'
2014-01-03 13:32:13 -05:00
module.exports = class HomeView extends RootView
2014-01-03 13:32:13 -05:00
id: 'home-view'
template: template
events:
'click #play-button': 'onClickBeginnerCampaign'
2014-01-03 13:32:13 -05:00
constructor: ->
super()
window.tracker?.trackEvent 'Homepage', Action: 'Loaded'
2014-01-03 13:32:13 -05:00
getRenderData: ->
c = super()
if $.browser
majorVersion = $.browser.versionNumber
2014-01-03 13:32:13 -05:00
c.isOldBrowser = true if $.browser.mozilla && majorVersion < 21
c.isOldBrowser = true if $.browser.chrome && majorVersion < 17
c.isOldBrowser = true if $.browser.safari && majorVersion < 6
2014-01-03 13:32:13 -05:00
else
console.warn 'no more jquery browser version...'
2014-03-16 19:59:48 -04:00
c.isEnglish = (me.get('preferredLanguage') or 'en').startsWith 'en'
2014-04-09 01:50:13 -04:00
c.languageName = me.get('preferredLanguage')
2014-01-03 13:32:13 -05:00
c
onClickBeginnerCampaign: (e) ->
@playSound 'menu-button-click'
e.preventDefault()
e.stopImmediatePropagation()
window.tracker?.trackEvent 'Homepage', Action: 'Play'
window.open '/play', '_blank'
afterInsert: ->
super(arguments...)