mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-04-27 14:33:59 -04:00
Merge branch 'master' into production
This commit is contained in:
commit
25e4e926c2
7 changed files with 28 additions and 5 deletions
app
|
@ -79,7 +79,8 @@ class CocoModel extends Backbone.Model
|
|||
TreemaNode.utils.populateDefaults(clone, @schema(), thisTV4)
|
||||
@attributesWithDefaults = clone
|
||||
duration = new Date() - t0
|
||||
console.debug "Populated defaults for #{@attributes.name or @type()} in #{duration}ms" if duration > 10
|
||||
console.debug "Populated defaults for #{@type()}#{if @attributes.name then ' ' + @attributes.name else ''} in #{duration}ms"# if duration > 10
|
||||
console.trace?()
|
||||
|
||||
loadFromBackup: ->
|
||||
return unless @saveBackups
|
||||
|
@ -109,7 +110,7 @@ class CocoModel extends Backbone.Model
|
|||
console.debug "Validation failed for #{@constructor.className}: '#{@get('name') or @}'."
|
||||
for error in errors
|
||||
console.debug "\t", error.dataPath, ':', error.message
|
||||
console.trace()
|
||||
console.trace?()
|
||||
return errors
|
||||
|
||||
save: (attrs, options) ->
|
||||
|
|
|
@ -12,6 +12,10 @@ module.exports = class HomeView extends RootView
|
|||
events:
|
||||
'click #beginner-campaign': 'onClickBeginnerCampaign'
|
||||
|
||||
constructor: ->
|
||||
super()
|
||||
window.tracker?.trackEvent 'Homepage', Action: 'Loaded'
|
||||
|
||||
getRenderData: ->
|
||||
c = super()
|
||||
if $.browser
|
||||
|
@ -28,4 +32,5 @@ module.exports = class HomeView extends RootView
|
|||
onClickBeginnerCampaign: (e) ->
|
||||
e.preventDefault()
|
||||
e.stopImmediatePropagation()
|
||||
window.tracker?.trackEvent 'Homepage', Action: 'Play'
|
||||
window.open '/play', '_blank'
|
||||
|
|
|
@ -26,7 +26,7 @@ module.exports = class RootView extends CocoView
|
|||
'change .language-dropdown': 'onLanguageChanged'
|
||||
'click .toggle-fullscreen': 'toggleFullscreen'
|
||||
'click .auth-button': 'onClickAuthButton'
|
||||
'click a': 'toggleModal'
|
||||
'click a': 'onClickAnchor'
|
||||
'click button': 'toggleModal'
|
||||
'click li': 'toggleModal'
|
||||
|
||||
|
@ -43,6 +43,7 @@ module.exports = class RootView extends CocoView
|
|||
success: (achievement) => @showNewAchievement(achievement, earnedAchievement)
|
||||
|
||||
logoutAccount: ->
|
||||
window.tracker?.trackEvent 'Homepage', Action: 'Log Out' if @id is 'home-view'
|
||||
logoutUser($('#login-email').val())
|
||||
|
||||
showWizardSettingsModal: ->
|
||||
|
@ -52,8 +53,14 @@ module.exports = class RootView extends CocoView
|
|||
|
||||
onClickAuthButton: ->
|
||||
AuthModal = require 'views/modal/AuthModal'
|
||||
window.tracker?.trackEvent 'Homepage', Action: 'Auth Modal' if @id is 'home-view'
|
||||
@openModalView new AuthModal {}
|
||||
|
||||
onClickAnchor: (e) ->
|
||||
anchorText = e?.currentTarget?.text
|
||||
window.tracker?.trackEvent 'Homepage', Action: anchorText if @id is 'home-view' and anchorText
|
||||
@toggleModal e
|
||||
|
||||
showLoading: ($el) ->
|
||||
$el ?= @$el.find('.main-content-area')
|
||||
super($el)
|
||||
|
|
|
@ -44,6 +44,7 @@ module.exports = class WorldMapView extends RootView
|
|||
@playMusicTimeout = _.delay (=> @playMusic() unless @destroyed), musicDelay
|
||||
@preloadTopHeroes()
|
||||
@hadEverChosenHero = me.get('heroConfig')?.thangType
|
||||
window.tracker?.trackEvent 'World Map', Action: 'Loaded'
|
||||
|
||||
destroy: ->
|
||||
$(window).off 'resize', @onWindowResize
|
||||
|
@ -121,7 +122,10 @@ module.exports = class WorldMapView extends RootView
|
|||
@$levelInfo = @$el.find(".level-info-container[data-level-id=#{levelID}]").show()
|
||||
@adjustLevelInfoPosition e
|
||||
else
|
||||
@startLevel $(e.target).parents('.level')
|
||||
levelElement = $(e.target).parents('.level')
|
||||
levelID = levelElement.data('level-id')
|
||||
@startLevel levelElement
|
||||
window.tracker?.trackEvent 'World Map', Action: 'Play Level', levelID: levelID
|
||||
|
||||
onClickStartLevel: (e) ->
|
||||
@startLevel $(e.target).parents('.level-info-container')
|
||||
|
@ -217,6 +221,7 @@ module.exports = class WorldMapView extends RootView
|
|||
storage.save("loaded-menu-music-#{@terrain}", true) unless @probablyCachedMusic
|
||||
|
||||
preloadTopHeroes: ->
|
||||
return # Testing to see if this is causing the weird problem with ThangTypes overwriting me
|
||||
for heroID in ['captain', 'knight']
|
||||
url = "/db/thang.type/#{ThangType.heroes[heroID]}/version"
|
||||
continue if @supermodel.getModel url
|
||||
|
|
|
@ -278,7 +278,7 @@ module.exports = class LevelPlaybackView extends CocoView
|
|||
|
||||
onProgressHover: (e) ->
|
||||
timeRatio = @$progressScrubber.width() / @totalTime
|
||||
offsetX = e.offsetX or e.clientX - $(e.target).offset().left
|
||||
offsetX = e.clientX - $(e.target).closest('#timeProgress').offset().left
|
||||
@newTime = offsetX / timeRatio
|
||||
@updatePopupContent()
|
||||
@timePopup?.onHover e
|
||||
|
|
|
@ -138,6 +138,7 @@ module.exports = class PlayLevelView extends RootView
|
|||
console.debug "Level unveiled after #{(loadDuration / 1000).toFixed(2)}s"
|
||||
application.tracker?.trackEvent 'Finished Level Load', level: @levelID, label: @levelID, loadDuration: loadDuration, ['Google Analytics']
|
||||
application.tracker?.trackTiming loadDuration, 'Level Load Time', @levelID, @levelID
|
||||
application.tracker?.trackEvent 'Play Level', Action: 'Loaded', levelID: @levelID
|
||||
|
||||
# CocoView overridden methods ###############################################
|
||||
|
||||
|
@ -361,6 +362,7 @@ module.exports = class PlayLevelView extends RootView
|
|||
@removeSubView @loadingView
|
||||
@loadingView = null
|
||||
@playAmbientSound()
|
||||
application.tracker?.trackEvent 'Play Level', Action: 'Start Level', levelID: @levelID
|
||||
|
||||
playAmbientSound: ->
|
||||
return if @ambientSound
|
||||
|
|
|
@ -98,12 +98,14 @@ module.exports = class PlayLevelModal extends ModalView
|
|||
@inventoryView.$el.add('#choose-hero-button, #play-level-button, #choose-inventory-header').removeClass 'secret'
|
||||
@inventoryView.selectedHero = @chooseHeroView.selectedHero
|
||||
@inventoryView.onShown()
|
||||
window.tracker?.trackEvent 'Play Level Modal', Action: 'Choose Inventory'
|
||||
|
||||
onClickChooseHero: (e) ->
|
||||
@chooseHeroView.$el.add('#choose-inventory-button, #choose-hero-header').removeClass 'secret'
|
||||
@inventoryView.$el.add('#choose-hero-button, #play-level-button, #choose-inventory-header').addClass 'secret'
|
||||
@chooseHeroView.onShown()
|
||||
@inventoryView.endHighlight()
|
||||
window.tracker?.trackEvent 'Play Level Modal', Action: 'Choose Hero'
|
||||
|
||||
onClickPlayLevel: (e) ->
|
||||
return if @$el.find('#play-level-button').prop 'disabled'
|
||||
|
@ -120,6 +122,7 @@ module.exports = class PlayLevelModal extends ModalView
|
|||
viewClass: viewClass
|
||||
viewArgs: [{supermodel: @supermodel}, @options.levelID]
|
||||
}
|
||||
window.tracker?.trackEvent 'Play Level Modal', Action: 'Play'
|
||||
|
||||
onEnterPressed: (e) ->
|
||||
(if @chooseHeroView.$el.hasClass('secret') then @onClickPlayLevel else @onClickChooseInventory).apply @
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue