mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-25 00:28:31 -05:00
Merge branch 'master' into production
This commit is contained in:
commit
424c987fe3
28 changed files with 119 additions and 126 deletions
|
@ -1,6 +1,10 @@
|
|||
@import "bootstrap/variables"
|
||||
@import "bootstrap/mixins"
|
||||
|
||||
// https://github.com/twbs/bootstrap/issues/9237 -- need a version that's not !important
|
||||
.secret
|
||||
display: none
|
||||
|
||||
h1 h2 h3 h4
|
||||
letter-spacing: 2px
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ block content
|
|||
p(data-i18n="account_settings.not_logged_in") Log in or create an account to change your settings.
|
||||
|
||||
else
|
||||
button.btn#save-button.disabled.hide(data-i18n="account_settings.saveBackups") Changes Save Automatically
|
||||
button.btn#save-button.disabled.secret(data-i18n="account_settings.saveBackups") Changes Save Automatically
|
||||
|
||||
ul.nav.nav-pills#settings-tabs
|
||||
li
|
||||
|
|
|
@ -9,9 +9,9 @@ block content
|
|||
|
||||
button.btn.btn-warning#unsubscribe-button(data-i18n="account.unsubscribe_button") Do it
|
||||
|
||||
.progress.progress-striped.active.hide
|
||||
.progress.progress-striped.active.secret
|
||||
.progress-bar
|
||||
|
||||
p.hide#fail-alert(data-i18n="account.unsubscribe_failed").alert.alert-danger Failed
|
||||
p.secret#fail-alert(data-i18n="account.unsubscribe_failed").alert.alert-danger Failed
|
||||
|
||||
p.hide#success-alert(data-i18n="account.unsubscribe_success").alert.alert-success Success
|
||||
p.secret#success-alert(data-i18n="account.unsubscribe_success").alert.alert-success Success
|
||||
|
|
|
@ -3,13 +3,13 @@ div.well
|
|||
span#thang-props
|
||||
a#thang-name-link
|
||||
span= thang.id
|
||||
input.hide(value=thang.id)
|
||||
input.secret(value=thang.id)
|
||||
| (
|
||||
span(data-i18n="editor.level_components_type") Type
|
||||
| :
|
||||
a#thang-type-link
|
||||
span= thang.thangType
|
||||
input.hide(value=thang.thangType)
|
||||
input.secret(value=thang.thangType)
|
||||
| )
|
||||
|
||||
#thang-components-edit-view
|
|
@ -31,4 +31,4 @@
|
|||
- path = '/file/db/thang.type/'+thangType.original+'/portrait.png'
|
||||
img(title="Add " + thangType.name, src=path, alt="")
|
||||
div.clearfix
|
||||
#editor-level-thang-edit.hide
|
||||
#editor-level-thang-edit.secret
|
|
@ -1,6 +1,6 @@
|
|||
div#color-groups-treema
|
||||
|
||||
div#color-group-settings.hide
|
||||
div#color-group-settings.secret
|
||||
div#shape-buttons
|
||||
|
||||
canvas#tinting-display(width=400, height=400)
|
||||
|
|
|
@ -21,7 +21,7 @@ block content
|
|||
.modal-footer
|
||||
button.btn(data-dismiss="modal") Cancel
|
||||
button.btn.btn-primary.new-model-submit Create
|
||||
.modal-body.wait.hide
|
||||
.modal-body.wait.secret
|
||||
h3 Reticulating Splines...
|
||||
.progress.progress-striped.active
|
||||
.progress-bar
|
||||
|
|
|
@ -22,6 +22,6 @@ block modal-body-content
|
|||
textarea#contact-message.form-control(name="message", rows=8)
|
||||
|
||||
block modal-footer-content
|
||||
span.sending-indicator.pull-left.hide(data-i18n="common.sending") Sending...
|
||||
span.sending-indicator.pull-left.secret(data-i18n="common.sending") Sending...
|
||||
a(href='#', data-dismiss="modal", aria-hidden="true", data-i18n="common.cancel").btn Cancel
|
||||
button.btn.btn-primary#contact-submit-button(data-i18n="contact.send") Send Feedback
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
img(src="http://www.manbitesgod.com/images/picturecoupleb.jpg")
|
||||
img(src="http://www.manbitesgod.com/images/manrantb.jpg")
|
||||
|
||||
.modal-body.wait.hide
|
||||
.modal-body.wait.secret
|
||||
block modal-body-wait-content
|
||||
h3 Reticulating Splines...
|
||||
.progress.progress-striped.active
|
||||
|
|
|
@ -11,11 +11,11 @@
|
|||
#canvas-left-gradient.gradient
|
||||
#canvas-top-gradient.gradient
|
||||
|
||||
a.btn.btn-primary.banner.hide#level-done-button(data-i18n="play_level.done") Done
|
||||
a.btn.btn-primary.banner.secret#level-done-button(data-i18n="play_level.done") Done
|
||||
|
||||
#goals-view.hide
|
||||
#goals-view.secret
|
||||
|
||||
#gold-view.hide.expanded
|
||||
#gold-view.secret.expanded
|
||||
|
||||
#level-chat-view
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
table
|
||||
tbody
|
||||
|
||||
.open-chat-area.hide
|
||||
.open-chat-area.secret
|
||||
table
|
||||
tbody
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
button.btn.btn-success.sign-up-button.btn-large(data-toggle="coco-modal", data-target="modal/signup", data-i18n="play_level.victory_sign_up") Sign Up to Save Progress
|
||||
span(data-i18n="play_level.victory_sign_up_poke") Want to save your code? Create a free account!
|
||||
else
|
||||
div.rating.hide
|
||||
div.rating.secret
|
||||
span(data-i18n="play_level.victory_rate_the_level") Rate the level:
|
||||
i.icon-star-empty
|
||||
i.icon-star-empty
|
||||
|
@ -30,7 +30,7 @@
|
|||
else
|
||||
a.btn.btn-primary(href="/", data-dismiss="modal", data-i18n="play_level.victory_go_home") Go Home
|
||||
if !me.get('anonymous')
|
||||
div.review.hide
|
||||
div.review.secret
|
||||
span(data-i18n="play_level.victory_review") Tell us more!
|
||||
br
|
||||
textarea
|
||||
|
|
|
@ -11,7 +11,7 @@ button.btn.btn-xs.btn-inverse#music-button(title="Toggle Music")
|
|||
| ♫
|
||||
|
||||
.scrubber
|
||||
.progress.hide
|
||||
.progress.secret
|
||||
.progress-bar
|
||||
.scrubber-handle
|
||||
|
||||
|
@ -27,11 +27,11 @@ button.btn.btn-xs.btn-inverse#music-button(title="Toggle Music")
|
|||
li(title="Ctrl/Cmd + \\: Toggle debug display").selectable#debug-toggle
|
||||
i.icon-globe
|
||||
| Debug Mode
|
||||
i.icon-ok.hide
|
||||
i.icon-ok.secret
|
||||
li(title="Ctrl/Cmd + G: Toggle grid display").selectable#grid-toggle
|
||||
i.icon-th
|
||||
span(data-i18n="play_level.grid") Grid
|
||||
i.icon-ok.hide
|
||||
i.icon-ok.secret
|
||||
li.selectable#edit-wizard-settings
|
||||
i.icon-user
|
||||
span(data-i18n="play_level.customize_wizard") Customize Wizard
|
||||
|
|
|
@ -48,7 +48,7 @@ module.exports = class SettingsView extends View
|
|||
@updateWizardColor()
|
||||
wizardSettingsTabView = new WizardSettingsTabView()
|
||||
wizardSettingsTabView.on 'change', @save, @
|
||||
@insertSubView wizardSettingsTabView
|
||||
@insertSubView wizardSettingsTabView
|
||||
|
||||
chooseTab: (category) ->
|
||||
id = "##{category}-pane"
|
||||
|
@ -102,7 +102,7 @@ module.exports = class SettingsView extends View
|
|||
res = me.save()
|
||||
return unless res
|
||||
save = $('#save-button', @$el).text($.i18n.t('common.saving', defaultValue: 'Saving...'))
|
||||
.addClass('btn-info').removeClass('hide').removeClass('btn-danger')
|
||||
.addClass('btn-info').show().removeClass('btn-danger')
|
||||
|
||||
res.error ->
|
||||
errors = JSON.parse(res.responseText)
|
||||
|
|
|
@ -5,7 +5,7 @@ template = require 'templates/account/unsubscribe'
|
|||
module.exports = class UnsubscribeView extends RootView
|
||||
id: "unsubscribe-view"
|
||||
template: template
|
||||
|
||||
|
||||
events:
|
||||
'click #unsubscribe-button': 'onUnsubscribeButtonClicked'
|
||||
|
||||
|
@ -15,21 +15,21 @@ module.exports = class UnsubscribeView extends RootView
|
|||
context
|
||||
|
||||
onUnsubscribeButtonClicked: ->
|
||||
@$el.find('#unsubscribe-button').addClass 'hide'
|
||||
@$el.find('.progress').removeClass 'hide'
|
||||
@$el.find('.alert').addClass 'hide'
|
||||
|
||||
@$el.find('#unsubscribe-button').hide()
|
||||
@$el.find('.progress').show()
|
||||
@$el.find('.alert').hide()
|
||||
|
||||
email = @getQueryVariable 'email'
|
||||
url = "/auth/unsubscribe?email=#{encodeURIComponent(email)}"
|
||||
|
||||
|
||||
success = =>
|
||||
@$el.find('.progress').addClass 'hide'
|
||||
@$el.find('#success-alert').removeClass 'hide'
|
||||
@$el.find('.progress').hide()
|
||||
@$el.find('#success-alert').show()
|
||||
me.fetch()
|
||||
|
||||
|
||||
error = =>
|
||||
@$el.find('.progress').addClass 'hide'
|
||||
@$el.find('#fail-alert').removeClass 'hide'
|
||||
@$el.find('#unsubscribe-button').removeClass 'hide'
|
||||
|
||||
@$el.find('.progress').hide()
|
||||
@$el.find('#fail-alert').show()
|
||||
@$el.find('#unsubscribe-button').show()
|
||||
|
||||
$.ajax { url: url, success: success, error: error }
|
||||
|
|
|
@ -7,7 +7,7 @@ SpriteBuilder = require 'lib/sprites/SpriteBuilder'
|
|||
module.exports = class WizardSettingsTabView extends RootView
|
||||
id: 'wizard-settings-tab-view'
|
||||
template: template
|
||||
|
||||
|
||||
events:
|
||||
'change .color-group-checkbox': (e) ->
|
||||
colorGroup = $(e.target).closest('.color-group')
|
||||
|
@ -17,13 +17,13 @@ module.exports = class WizardSettingsTabView extends RootView
|
|||
constructor: ->
|
||||
super(arguments...)
|
||||
@loadWizard()
|
||||
|
||||
|
||||
loadWizard: ->
|
||||
@wizardThangType = new ThangType()
|
||||
@wizardThangType.url = -> '/db/thang_type/wizard'
|
||||
@wizardThangType.fetch()
|
||||
@wizardThangType.once 'sync', @initCanvas, @
|
||||
|
||||
|
||||
initCanvas: ->
|
||||
@render()
|
||||
@spriteBuilder = new SpriteBuilder(@wizardThangType)
|
||||
|
@ -32,9 +32,9 @@ module.exports = class WizardSettingsTabView extends RootView
|
|||
getRenderData: ->
|
||||
c = super()
|
||||
wizardSettings = me.get('wizard')?.colorConfig or {}
|
||||
|
||||
|
||||
colorGroups = @wizardThangType.get('colorGroups') or {}
|
||||
f = (name) -> {
|
||||
f = (name) -> {
|
||||
dasherized: _.string.dasherize(name)
|
||||
humanized: _.string.humanize name
|
||||
name: name
|
||||
|
@ -42,26 +42,26 @@ module.exports = class WizardSettingsTabView extends RootView
|
|||
}
|
||||
c.colorGroups = (f(colorName) for colorName in _.keys colorGroups)
|
||||
c
|
||||
|
||||
|
||||
afterRender: ->
|
||||
wizardSettings = me.get('wizard') or {}
|
||||
wizardSettings.colorConfig ?= {}
|
||||
|
||||
|
||||
@$el.find('.selector').each (i, slider) =>
|
||||
[groupName, prop] = $(slider).attr('name').split('.')
|
||||
value = 100 * (wizardSettings.colorConfig[groupName]?[prop] ? 0.5)
|
||||
@initSlider $(slider), value, @onSliderChanged
|
||||
|
||||
|
||||
@$el.find('.color-group').each (i, colorGroup) =>
|
||||
@updateSliderVisibility($(colorGroup))
|
||||
|
||||
|
||||
updateSliderVisibility: (colorGroup) ->
|
||||
enabled = colorGroup.find('.color-group-checkbox').prop('checked')
|
||||
colorGroup.find('.sliders').toggleClass 'hide', not enabled
|
||||
|
||||
colorGroup.find('.sliders').toggle Boolean(enabled)
|
||||
|
||||
updateColorSettings: (colorGroup) ->
|
||||
wizardSettings = me.get('wizard') or {}
|
||||
wizardSettings.colorConfig ?= {}
|
||||
wizardSettings.colorConfig ?= {}
|
||||
colorName = colorGroup.data('name')
|
||||
wizardSettings.colorConfig[colorName] ?= {}
|
||||
if colorGroup.find('.color-group-checkbox').prop('checked')
|
||||
|
@ -75,7 +75,7 @@ module.exports = class WizardSettingsTabView extends RootView
|
|||
me.set('wizard', wizardSettings)
|
||||
@updateMovieClip()
|
||||
@trigger 'change'
|
||||
|
||||
|
||||
onSliderChanged: (e, result) =>
|
||||
@updateColorSettings $(result.handle).closest('.color-group')
|
||||
|
||||
|
@ -84,12 +84,12 @@ module.exports = class WizardSettingsTabView extends RootView
|
|||
@updateMovieClip()
|
||||
createjs.Ticker.setFPS 20
|
||||
createjs.Ticker.addEventListener("tick", @stage)
|
||||
|
||||
|
||||
updateMovieClip: ->
|
||||
return unless @wizardThangType.loaded
|
||||
wizardSettings = me.get('wizard') or {}
|
||||
wizardSettings.colorConfig ?= {}
|
||||
|
||||
|
||||
@stage.removeChild(@movieClip) if @movieClip
|
||||
options = {colorConfig: wizardSettings.colorConfig}
|
||||
@spriteBuilder.setOptions options
|
||||
|
@ -100,10 +100,10 @@ module.exports = class WizardSettingsTabView extends RootView
|
|||
@movieClip.scaleY = @movieClip.scaleX = 1.7 * (castAction.scale or 1)
|
||||
reg = castAction.positions?.registration
|
||||
if reg
|
||||
@movieClip.regX = reg.x
|
||||
@movieClip.regX = reg.x
|
||||
@movieClip.regY = reg.y
|
||||
@stage.addChild @movieClip
|
||||
@stage.update()
|
||||
|
||||
destroy: ->
|
||||
@stage?.removeAllEventListeners()
|
||||
@stage?.removeAllEventListeners()
|
||||
|
|
|
@ -9,10 +9,10 @@ module.exports = class LevelThangEditView extends View
|
|||
Everything below is part of the ThangComponentEditView, which is shared with the
|
||||
ThangType editor view.
|
||||
###
|
||||
|
||||
|
||||
id: "editor-level-thang-edit"
|
||||
template: template
|
||||
|
||||
|
||||
events:
|
||||
'click #all-thangs-link': 'navigateToAllThangs'
|
||||
'click #thang-name-link span': 'toggleNameEdit'
|
||||
|
@ -32,7 +32,7 @@ module.exports = class LevelThangEditView extends View
|
|||
context = super(context)
|
||||
context.thang = @thangData
|
||||
context
|
||||
|
||||
|
||||
afterRender: ->
|
||||
options =
|
||||
components: @thangData.components
|
||||
|
@ -40,7 +40,7 @@ module.exports = class LevelThangEditView extends View
|
|||
level: @level
|
||||
world: @world
|
||||
callback: @onComponentsChanged
|
||||
|
||||
|
||||
@thangComponentEditView = new ThangComponentEditView options
|
||||
@insertSubView @thangComponentEditView
|
||||
thangTypeNames = (m.get('name') for m in @supermodel.getModels ThangType)
|
||||
|
@ -57,35 +57,35 @@ module.exports = class LevelThangEditView extends View
|
|||
thangData: @thangData
|
||||
id: @oldID
|
||||
Backbone.Mediator.publish 'level-thang-edited', event
|
||||
|
||||
|
||||
navigateToAllThangs: ->
|
||||
Backbone.Mediator.publish 'level-thang-done-editing'
|
||||
|
||||
|
||||
toggleNameEdit: ->
|
||||
link = @$el.find '#thang-name-link'
|
||||
wasEditing = link.find('input:visible').length
|
||||
span = link.find('span')
|
||||
input = link.find('input')
|
||||
if wasEditing then span.text(input.val()) else input.val(span.text())
|
||||
link.find('span, input').toggleClass('hide')
|
||||
link.find('span, input').toggle()
|
||||
input.select() unless wasEditing
|
||||
@thangData.id = span.text()
|
||||
@saveThang()
|
||||
|
||||
|
||||
toggleTypeEdit: ->
|
||||
link = @$el.find '#thang-type-link'
|
||||
wasEditing = link.find('input:visible').length
|
||||
span = link.find('span')
|
||||
input = link.find('input')
|
||||
span.text(input.val()) if wasEditing
|
||||
link.find('span, input').toggleClass('hide')
|
||||
span.text(input.val()) if wasEditing
|
||||
link.find('span, input').toggle()
|
||||
input.select() unless wasEditing
|
||||
thangTypeName = input.val()
|
||||
thangType = _.find @supermodel.getModels(ThangType), (m) -> m.get('name') is thangTypeName
|
||||
if thangType and wasEditing
|
||||
@thangData.thangType = thangType.get('original')
|
||||
@saveThang()
|
||||
|
||||
|
||||
onComponentsChanged: (components) =>
|
||||
@thangData.components = components
|
||||
@saveThang()
|
||||
|
|
|
@ -374,7 +374,7 @@ module.exports = class ThangsTabView extends View
|
|||
thangData = @thangsTreema.get "id=#{e.thangID}"
|
||||
@editThangView = new LevelThangEditView thangData: thangData, supermodel: @supermodel, level: @level, world: @world
|
||||
@insertSubView @editThangView
|
||||
@$el.find('.thangs-column').addClass('hide')
|
||||
@$el.find('.thangs-column').hide()
|
||||
Backbone.Mediator.publish 'level:view-switched', e
|
||||
|
||||
onLevelThangEdited: (e) ->
|
||||
|
@ -383,7 +383,7 @@ module.exports = class ThangsTabView extends View
|
|||
|
||||
onLevelThangDoneEditing: ->
|
||||
@removeSubView @editThangView
|
||||
@$el.find('.thangs-column').removeClass('hide')
|
||||
@$el.find('.thangs-column').show()
|
||||
|
||||
|
||||
class ThangsNode extends TreemaNode.nodeMap.array
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
CocoView = require 'views/kinds/CocoView'
|
||||
template = require 'templates/editor/thang/colors_tab'
|
||||
SpriteBuilder = require 'lib/sprites/SpriteBuilder'
|
||||
{hexToHSL} = require 'lib/utils'
|
||||
{hexToHSL} = require 'lib/utils'
|
||||
|
||||
module.exports = class ColorsTabView extends CocoView
|
||||
id: 'editor-thang-colors-tab-view'
|
||||
template: template
|
||||
className: 'tab-pane'
|
||||
|
||||
|
||||
offset: 0
|
||||
|
||||
|
||||
constructor: (@thangType, options) ->
|
||||
@thangType.once 'sync', @tryToBuild, @
|
||||
@thangType.schema().once 'sync', @tryToBuild, @
|
||||
@colorConfig = { hue: 0, saturation: 0.5, lightness: 0.5 }
|
||||
@spriteBuilder = new SpriteBuilder(@thangType)
|
||||
f = =>
|
||||
f = =>
|
||||
@offset++
|
||||
@updateMovieClip()
|
||||
@interval = setInterval f, 1000
|
||||
|
@ -27,21 +27,21 @@ module.exports = class ColorsTabView extends CocoView
|
|||
@initStage()
|
||||
@initSliders()
|
||||
@tryToBuild()
|
||||
|
||||
|
||||
# sliders
|
||||
|
||||
initSliders: ->
|
||||
@hueSlider = @initSlider $("#hue-slider", @$el), 0, @makeSliderCallback 'hue'
|
||||
@saturationSlider = @initSlider $("#saturation-slider", @$el), 50, @makeSliderCallback 'saturation'
|
||||
@lightnessSlider = @initSlider $("#lightness-slider", @$el), 50, @makeSliderCallback 'lightness'
|
||||
|
||||
|
||||
makeSliderCallback: (property) ->
|
||||
(e, result) =>
|
||||
@colorConfig[property] = result.value / 100
|
||||
@updateMovieClip()
|
||||
|
||||
|
||||
# movie clip
|
||||
|
||||
|
||||
initStage: ->
|
||||
canvas = @$el.find('#tinting-display')
|
||||
@stage = new createjs.Stage(canvas[0])
|
||||
|
@ -95,7 +95,7 @@ module.exports = class ColorsTabView extends CocoView
|
|||
aHSL = hexToHSL(a)
|
||||
bHSL = hexToHSL(b)
|
||||
if aHSL[0] > bHSL[0] then -1 else 1
|
||||
|
||||
|
||||
for color in colors
|
||||
button = $('<button></button>').addClass('btn')
|
||||
button.css('background', color)
|
||||
|
@ -130,23 +130,23 @@ module.exports = class ColorsTabView extends CocoView
|
|||
@thangType.set('colorGroups', @colorGroups.data)
|
||||
|
||||
onColorGroupSelected: (e, selected) =>
|
||||
@$el.find('#color-group-settings').toggleClass('hide', not selected.length)
|
||||
@$el.find('#color-group-settings').toggle selected.length > 0
|
||||
treema = @colorGroups.getLastSelectedTreema()
|
||||
return unless treema
|
||||
@currentColorGroupTreema = treema
|
||||
|
||||
|
||||
shapes = {}
|
||||
shapes[shape] = true for shape in treema.data
|
||||
|
||||
|
||||
colors = {}
|
||||
for key, shape of @thangType.get('raw')?.shapes or {}
|
||||
continue unless shape.fc?
|
||||
colors[shape.fc] = true if shapes[key]
|
||||
|
||||
|
||||
@buttons.find('button').removeClass('selected')
|
||||
@buttons.find('button').each (i, button) ->
|
||||
$(button).addClass('selected') if colors[$(button).val()]
|
||||
|
||||
|
||||
@updateMovieClip()
|
||||
|
||||
updateColorGroup: ->
|
||||
|
@ -155,7 +155,7 @@ module.exports = class ColorsTabView extends CocoView
|
|||
return unless $(button).hasClass('selected')
|
||||
window.button = button
|
||||
colors[$(button).val()] = true
|
||||
|
||||
|
||||
shapes = []
|
||||
for key, shape of @thangType.get('raw')?.shapes or {}
|
||||
continue unless shape.fc?
|
||||
|
|
|
@ -115,7 +115,7 @@ module.exports = class CocoView extends Backbone.View
|
|||
visibleModal.willDisappear() if visibleModal
|
||||
visibleModal.destroy()
|
||||
visibleModal = null
|
||||
$('#modal-wrapper .modal').off 'hidden.bs.modal', @modalClosed
|
||||
#$('#modal-wrapper .modal').off 'hidden.bs.modal', @modalClosed
|
||||
if waitingModal
|
||||
wm = waitingModal
|
||||
waitingModal = null
|
||||
|
@ -127,7 +127,7 @@ module.exports = class CocoView extends Backbone.View
|
|||
# Loading RootViews
|
||||
|
||||
showLoading: ($el=@$el) ->
|
||||
$el.find('>').addClass('hide')
|
||||
$el.find('>').hide()
|
||||
$el.append($('<div class="loading-screen"></div>')
|
||||
.append('<h2>Loading</h2>')
|
||||
.append('<div class="progress progress-striped active loading"><div class="progress-bar"></div></div>'))
|
||||
|
@ -136,18 +136,18 @@ module.exports = class CocoView extends Backbone.View
|
|||
hideLoading: ->
|
||||
return unless @_lastLoading?
|
||||
@_lastLoading.find('.loading-screen').remove()
|
||||
@_lastLoading.find('>').removeClass('hide')
|
||||
@_lastLoading.find('>').show()
|
||||
@_lastLoading = null
|
||||
|
||||
# Loading ModalViews
|
||||
|
||||
enableModalInProgress: (modal) ->
|
||||
$('> div', modal).addClass('hide')
|
||||
$('.wait', modal).removeClass('hide')
|
||||
$('> div', modal).hide()
|
||||
$('.wait', modal).show()
|
||||
|
||||
disableModalInProgress: (modal) ->
|
||||
$('> div', modal).removeClass('hide')
|
||||
$('.wait', modal).addClass('hide')
|
||||
$('> div', modal).show()
|
||||
$('.wait', modal).hide()
|
||||
|
||||
# Subscriptions
|
||||
|
||||
|
|
|
@ -46,11 +46,11 @@ module.exports = class GoalsView extends View
|
|||
li.prepend($('<i></i>').addClass(stateIconMap[state.status]))
|
||||
list.append(li)
|
||||
goals.push goal
|
||||
if goals.length then @$el.removeClass('hide') else @$el.addClass('hide')
|
||||
@$el.toggle goals.length > 0
|
||||
|
||||
render: ->
|
||||
super()
|
||||
@$el.addClass('hide').addClass('expanded')
|
||||
|
||||
onSetLetterbox: (e) ->
|
||||
if e.on then @$el.hide() else @$el.show()
|
||||
@$el.toggle not e.on
|
||||
|
|
|
@ -19,4 +19,4 @@ module.exports = class GoldView extends View
|
|||
goldEl.text(e.gold)
|
||||
|
||||
onSetLetterbox: (e) ->
|
||||
if e.on then @$el.hide() else @$el.show()
|
||||
@$el.toggle not e.on
|
||||
|
|
|
@ -153,7 +153,7 @@ module.exports = class HUDView extends View
|
|||
@bubble.removeClass(@lastMood) if @lastMood
|
||||
@lastMood = mood
|
||||
@bubble.text('')
|
||||
group = $('<div class="enter hide"></div>')
|
||||
group = $('<div class="enter secret"></div>')
|
||||
@bubble.append(group)
|
||||
if responses
|
||||
@lastResponses = responses
|
||||
|
@ -176,7 +176,7 @@ module.exports = class HUDView extends View
|
|||
if @animator.done()
|
||||
clearInterval(@messageInterval)
|
||||
@messageInterval = null
|
||||
$('.enter', @bubble).removeClass("hide").css('opacity', 0.0).delay(500).animate({opacity:1.0}, 500, @animateEnterButton)
|
||||
$('.enter', @bubble).removeClass("secret").css('opacity', 0.0).delay(500).animate({opacity:1.0}, 500, @animateEnterButton)
|
||||
if @lastResponses
|
||||
buttons = $('.enter button')
|
||||
for response, i in @lastResponses
|
||||
|
@ -207,10 +207,10 @@ module.exports = class HUDView extends View
|
|||
|
||||
switchToDialogueElements: ->
|
||||
@dialogueMode = true
|
||||
$('.thang-elem', @$el).addClass('hide')
|
||||
@$el.find('.thang-canvas-wrapper').removeClass('hide')
|
||||
$('.thang-elem', @$el).addClass('secret')
|
||||
@$el.find('.thang-canvas-wrapper').removeClass('secret')
|
||||
$('.dialogue-area', @$el)
|
||||
.removeClass('hide')
|
||||
.removeClass('secret')
|
||||
.animate({opacity:1.0}, 200)
|
||||
$('.dialogue-bubble', @$el)
|
||||
.css('opacity', 0.0)
|
||||
|
@ -220,8 +220,8 @@ module.exports = class HUDView extends View
|
|||
|
||||
switchToThangElements: ->
|
||||
@dialogueMode = false
|
||||
$('.thang-elem', @$el).removeClass('hide')
|
||||
$('.dialogue-area', @$el).addClass('hide')
|
||||
$('.thang-elem', @$el).removeClass('secret')
|
||||
$('.dialogue-area', @$el).addClass('secret')
|
||||
|
||||
update: ->
|
||||
return unless @thang and not @speaker
|
||||
|
@ -321,7 +321,7 @@ module.exports = class HUDView extends View
|
|||
changed = true
|
||||
break
|
||||
return unless changed
|
||||
ael.toggleClass 'hidden', not timespans.length
|
||||
ael.toggleClass 'secret', not timespans.length
|
||||
@lastActionTimespans[action] = timespans
|
||||
timeline = ael.find('.action-timeline .timeline-wrapper').empty()
|
||||
lifespan = @thang.world.totalFrames / @thang.world.frameRate
|
||||
|
|
|
@ -27,10 +27,7 @@ module.exports = class LevelChatView extends View
|
|||
|
||||
updateMultiplayerVisibility: ->
|
||||
return unless @$el?
|
||||
if @session.get('multiplayer')
|
||||
@$el.removeClass('hide')
|
||||
else
|
||||
@$el.addClass('hide')
|
||||
@$el.toggle Boolean @session.get('multiplayer')
|
||||
|
||||
afterRender: ->
|
||||
@chatTables = $('table', @$el)
|
||||
|
@ -48,7 +45,7 @@ module.exports = class LevelChatView extends View
|
|||
row.fadeOut(1000, -> $(this).remove())
|
||||
|
||||
onNewMessage: (e) ->
|
||||
@$el.removeClass('hide') unless e.message.system
|
||||
@$el.show() unless e.message.system
|
||||
@addOne(e.message)
|
||||
@trimClosedPanel()
|
||||
@playNoise() if e.message.authorID isnt me.id
|
||||
|
@ -108,16 +105,10 @@ module.exports = class LevelChatView extends View
|
|||
return false
|
||||
|
||||
onIconClick: ->
|
||||
openPanel = $('.open-chat-area', @$el)
|
||||
closedPanel = $('.closed-chat-area', @$el)
|
||||
@open = not @open
|
||||
if @open
|
||||
closedPanel.addClass('hide')
|
||||
openPanel.removeClass('hide')
|
||||
@scrollDown()
|
||||
else
|
||||
openPanel.addClass('hide')
|
||||
closedPanel.removeClass('hide')
|
||||
openPanel = $('.open-chat-area', @$el).toggle @open
|
||||
closedPanel = $('.closed-chat-area', @$el).toggle not @open
|
||||
@scrollDown() if @open
|
||||
if window.getSelection?
|
||||
sel = window.getSelection()
|
||||
sel.empty?()
|
||||
|
@ -134,4 +125,4 @@ module.exports = class LevelChatView extends View
|
|||
key.deleteScope('level')
|
||||
@session.off 'change:multiplayer', @updateMultiplayerVisibility, @
|
||||
clearInterval @clearOldMessagesInterval if @clearOldMessagesInterval
|
||||
@clearOldMessages = null
|
||||
@clearOldMessages = null
|
||||
|
|
|
@ -35,7 +35,7 @@ module.exports = class MultiplayerModal extends View
|
|||
updateLinkSection: ->
|
||||
multiplayer = @$el.find('#multiplayer').prop('checked')
|
||||
la = @$el.find('#link-area')
|
||||
if multiplayer then la.show() else la.hide()
|
||||
la.toggle Boolean(multiplayer)
|
||||
true
|
||||
|
||||
onHidden: ->
|
||||
|
@ -44,4 +44,4 @@ module.exports = class MultiplayerModal extends View
|
|||
|
||||
destroy: ->
|
||||
super()
|
||||
@session.off 'change:multiplayer', @updateLinkSection, @
|
||||
@session.off 'change:multiplayer', @updateLinkSection, @
|
||||
|
|
|
@ -55,8 +55,8 @@ module.exports = class PlaybackView extends View
|
|||
@$el.find('#music-button').toggleClass('music-on', me.get('music'))
|
||||
|
||||
onSetLetterbox: (e) ->
|
||||
button = @$el.find '#play-button, .scrubber-handle'
|
||||
if e.on then button.css('visibility', 'hidden') else button.css('visibility', 'visible')
|
||||
buttons = @$el.find '#play-button, .scrubber-handle'
|
||||
buttons.css 'visibility', if e.on then 'hidden' else 'visible'
|
||||
@disabled = e.on
|
||||
|
||||
onWindowResize: (s...) =>
|
||||
|
@ -64,17 +64,17 @@ module.exports = class PlaybackView extends View
|
|||
|
||||
onNewWorld: (e) ->
|
||||
pct = parseInt(100 * e.world.totalFrames / e.world.maxTotalFrames) + '%'
|
||||
@barWidth = $('.progress', @$el).css('width', pct).removeClass('hide').width()
|
||||
@barWidth = $('.progress', @$el).css('width', pct).show().width()
|
||||
|
||||
onToggleDebug: ->
|
||||
return if @shouldIgnore()
|
||||
flag = $('#debug-toggle i.icon-ok')
|
||||
Backbone.Mediator.publish('level-set-debug', {debug: flag.hasClass('hide')})
|
||||
Backbone.Mediator.publish('level-set-debug', {debug: flag.hasClass('invisible')})
|
||||
|
||||
onToggleGrid: ->
|
||||
return if @shouldIgnore()
|
||||
flag = $('#grid-toggle i.icon-ok')
|
||||
Backbone.Mediator.publish('level-set-grid', {grid: flag.hasClass('hide')})
|
||||
Backbone.Mediator.publish('level-set-grid', {grid: flag.hasClass('invisible')})
|
||||
|
||||
onEditWizardSettings: ->
|
||||
Backbone.Mediator.publish 'edit-wizard-settings'
|
||||
|
@ -145,13 +145,11 @@ module.exports = class PlaybackView extends View
|
|||
|
||||
onSetDebug: (e) ->
|
||||
flag = $('#debug-toggle i.icon-ok')
|
||||
flag.removeClass('hide')
|
||||
flag.addClass('hide') unless e.debug
|
||||
flag.toggleClass 'invisible', not e.debug
|
||||
|
||||
onSetGrid: (e) ->
|
||||
flag = $('#grid-toggle i.icon-ok')
|
||||
flag.removeClass('hide')
|
||||
flag.addClass('hide') unless e.grid
|
||||
flag.toggleClass 'invisible', not e.grid
|
||||
|
||||
# to refactor
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ module.exports = class SpellPaletteEntryView extends View
|
|||
content.replace /\#\{(.*?)\}/g, (s, properties) => @formatValue downTheChain(owner, properties.split('.'))
|
||||
|
||||
formatValue: (v) ->
|
||||
return '<Function>' if @doc.type is 'function'
|
||||
return '[Function]' if not v and @doc.type is 'function'
|
||||
unless v?
|
||||
if @doc.owner is 'this'
|
||||
v = @thang[@doc.name]
|
||||
|
|
|
@ -117,6 +117,7 @@ module.exports = class PlayLevelView extends View
|
|||
window.onPlayLevelViewLoaded? @ # still a hack
|
||||
@loadingScreen = new LoadingScreen(@$el.find('canvas')[0])
|
||||
@loadingScreen.show()
|
||||
@$el.find('#level-done-button').hide()
|
||||
super()
|
||||
|
||||
onLevelLoaderLoaded: =>
|
||||
|
@ -197,7 +198,6 @@ module.exports = class PlayLevelView extends View
|
|||
onDonePressed: -> @showVictory()
|
||||
|
||||
onShowVictory: (e) ->
|
||||
console.log 'show vict', e
|
||||
$('#level-done-button').show()
|
||||
@showVictory() if e.showModal
|
||||
setTimeout(@preloadNextLevel, 3000)
|
||||
|
|
Loading…
Reference in a new issue