2014-07-17 20:16:32 -04:00
|
|
|
RootView = require 'views/kinds/RootView'
|
2014-01-03 13:32:13 -05:00
|
|
|
template = require 'templates/home'
|
2014-09-28 17:00:48 -04:00
|
|
|
WizardLank = require 'lib/surface/WizardLank'
|
2014-01-03 13:32:13 -05:00
|
|
|
ThangType = require 'models/ThangType'
|
2014-02-14 18:50:42 -05:00
|
|
|
Simulator = require 'lib/simulator/Simulator'
|
2014-11-01 17:15:57 -04:00
|
|
|
|
2014-03-16 19:59:48 -04:00
|
|
|
{me} = require '/lib/auth'
|
2014-01-03 13:32:13 -05:00
|
|
|
|
2014-07-17 20:16:32 -04:00
|
|
|
module.exports = class HomeView extends RootView
|
2014-01-03 13:32:13 -05:00
|
|
|
id: 'home-view'
|
|
|
|
template: template
|
2014-03-21 20:42:13 -04:00
|
|
|
|
2014-06-19 16:42:25 -04:00
|
|
|
events:
|
2014-11-22 20:38:01 -05:00
|
|
|
'click #play-button': 'onClickBeginnerCampaign'
|
2014-01-03 13:32:13 -05:00
|
|
|
|
2014-10-21 19:49:25 -04:00
|
|
|
constructor: ->
|
|
|
|
super()
|
|
|
|
window.tracker?.trackEvent 'Homepage', Action: 'Loaded'
|
|
|
|
|
2014-01-03 13:32:13 -05:00
|
|
|
getRenderData: ->
|
|
|
|
c = super()
|
|
|
|
if $.browser
|
2014-04-13 23:31:23 -04:00
|
|
|
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
|
2014-04-14 19:34:11 -04:00
|
|
|
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
|
|
|
|
|
2014-09-25 18:32:33 -04:00
|
|
|
onClickBeginnerCampaign: (e) ->
|
2014-11-26 09:58:23 -05:00
|
|
|
@playSound 'menu-button-click'
|
2014-09-25 18:32:33 -04:00
|
|
|
e.preventDefault()
|
|
|
|
e.stopImmediatePropagation()
|
2014-10-21 19:49:25 -04:00
|
|
|
window.tracker?.trackEvent 'Homepage', Action: 'Play'
|
2014-11-10 18:24:05 -05:00
|
|
|
window.open '/play', '_blank'
|
|
|
|
|
|
|
|
afterInsert: ->
|
|
|
|
super(arguments...)
|