diff --git a/app/core/social-handlers/GPlusHandler.coffee b/app/core/social-handlers/GPlusHandler.coffee index 6eab09c07..5312456ba 100644 --- a/app/core/social-handlers/GPlusHandler.coffee +++ b/app/core/social-handlers/GPlusHandler.coffee @@ -58,7 +58,7 @@ module.exports = GPlusHandler = class GPlusHandler extends CocoClass console.error 'Unable to save G+ token key', e @accessToken = e @trigger 'logged-in' - + loginCodeCombat: -> # email and profile data loaded separately gapi.client.request(path: plusURL, callback: @onPersonEntityReceived) @@ -71,7 +71,8 @@ module.exports = GPlusHandler = class GPlusHandler extends CocoClass for gpProp, userProp of userPropsToSave keys = gpProp.split('.') value = r - value = value[key] for key in keys + for key in keys + value = value[key] if value and not me.get(userProp) @shouldSave = true me.set(userProp, value) diff --git a/app/lib/sprites/SpriteParser.coffee b/app/lib/sprites/SpriteParser.coffee index 5bdc183aa..d79436609 100644 --- a/app/lib/sprites/SpriteParser.coffee +++ b/app/lib/sprites/SpriteParser.coffee @@ -62,9 +62,9 @@ module.exports = class SpriteParser break continue unless container.bounds and instructions.length @addContainer {c: instructions, b: container.bounds}, container.name - + childrenMovieClips = [] - + for movieClip, index in movieClips lastBounds = null # fill in bounds which are null... @@ -73,7 +73,7 @@ module.exports = class SpriteParser movieClip.frameBounds[boundsIndex] = _.clone(lastBounds) else lastBounds = bounds - + localGraphics = @getGraphicsFromBlock(movieClip, source) [shapeKeys, localShapes] = @getShapesFromBlock movieClip, source localContainers = @getContainersFromMovieClip movieClip, source, true @@ -90,7 +90,7 @@ module.exports = class SpriteParser bounds: movieClip.bounds frameBounds: movieClip.frameBounds }, movieClip.name - + for movieClip in movieClips if movieClip.name not in childrenMovieClips for bounds in movieClip.frameBounds @@ -390,7 +390,7 @@ module.exports = class SpriteParser name = node.callee.property?.name return unless name in ['get', 'to', 'wait'] return if name is 'get' and callExpressions.length # avoid Ease calls in the tweens - flattenedRanges = _.flatten [a.range for a in node.arguments] + flattenedRanges = _.flatten [(a.range for a in node.arguments)] range = [_.min(flattenedRanges), _.max(flattenedRanges)] # Replace 'this.' references with just the 'name' argsSource = @subSourceFromRange(range, source) diff --git a/app/lib/surface/Lank.coffee b/app/lib/surface/Lank.coffee index 35932e272..77f83fb31 100644 --- a/app/lib/surface/Lank.coffee +++ b/app/lib/surface/Lank.coffee @@ -326,7 +326,7 @@ module.exports = Lank = class Lank extends CocoClass newScaleFactorX = @thang?.scaleFactorX ? @thang?.scaleFactor ? 1 newScaleFactorY = @thang?.scaleFactorY ? @thang?.scaleFactor ? 1 - if @thang?.spriteName is 'Beam' + if @layer?.name is 'Land' or @thang?.spriteName is 'Beam' @scaleFactorX = newScaleFactorX @scaleFactorY = newScaleFactorY else if @thang and (newScaleFactorX isnt @targetScaleFactorX or newScaleFactorY isnt @targetScaleFactorY) diff --git a/app/lib/surface/SingularSprite.coffee b/app/lib/surface/SingularSprite.coffee index 836812219..99950869c 100644 --- a/app/lib/surface/SingularSprite.coffee +++ b/app/lib/surface/SingularSprite.coffee @@ -65,12 +65,12 @@ module.exports = class SingularSprite extends createjs.Sprite @regY = -reg.y * scale @scaleX = @scaleY = 1 / @resolutionFactor - if @camera and @thangType.get('name') in floors - @baseScaleY *= @camera.y2x @scaleX *= -1 if action.flipX @scaleY *= -1 if action.flipY @baseScaleX = @scaleX @baseScaleY = @scaleY + if @camera and @thangType.get('name') in floors + @baseScaleY *= @camera.y2x @currentAnimation = actionName return diff --git a/app/lib/world/system.coffee b/app/lib/world/system.coffee index 74b26e7d8..8c86d3c2e 100644 --- a/app/lib/world/system.coffee +++ b/app/lib/world/system.coffee @@ -46,7 +46,8 @@ module.exports = class System hashString: (s) -> return @hashes[s] if s of @hashes hash = 0 - hash = hash * 31 + s.charCodeAt(i) for i in [0 ... Math.min(s.length, 100)] + for i in [0 ... Math.min(s.length, 100)] + hash = hash * 31 + s.charCodeAt(i) hash = @hashes[s] = hash % 3.141592653589793 hash diff --git a/app/templates/common/search-view.jade b/app/templates/common/search-view.jade index 2581ddb8d..2bb4559cd 100644 --- a/app/templates/common/search-view.jade +++ b/app/templates/common/search-view.jade @@ -9,10 +9,11 @@ block content li.active(data-i18n="#{currentEditor}") | #{currentEditor} - if me.get('anonymous') - a.btn.btn-primary.open-modal-button(data-toggle="coco-modal", data-target="core/AuthModal", role="button", data-i18n="#{currentNewSignup}") Log in to Create a New Content - else - a.btn.btn-primary.open-modal-button#new-model-button(data-i18n="#{currentNew}") Create a New Something + if me.isAdmin() || !newModelsAdminOnly + if me.get('anonymous') + a.btn.btn-primary.open-modal-button(data-toggle="coco-modal", data-target="core/AuthModal", role="button", data-i18n="#{currentNewSignup}") Log in to Create a New Something + else + a.btn.btn-primary.open-modal-button#new-model-button(data-i18n="#{currentNew}") Create a New Something input#search(data-i18n="[placeholder]#{currentSearch}") hr div.results diff --git a/app/templates/editor/level/edit.jade b/app/templates/editor/level/edit.jade index 8716b0c62..f1e3999d5 100644 --- a/app/templates/editor/level/edit.jade +++ b/app/templates/editor/level/edit.jade @@ -92,9 +92,9 @@ block header li(class=anonymous ? "disabled": "") a(data-i18n="common.fork")#fork-start-button Fork li(class=anonymous ? "disabled": "") - a(data-toggle="coco-modal", data-target="modal/RevertModal", data-i18n="editor.revert")#revert-button Revert + a(data-toggle="coco-modal", data-target="modal/RevertModal", data-i18n="editor.revert", disabled=anonymous)#revert-button Revert li(class=anonymous ? "disabled": "") - a(data-toggle="coco-modal", data-target="editor/level/modals/GenerateTerrainModal", data-i18n="editor.generate_terrain").generate-terrain-button Generate Terrain + a(data-toggle="coco-modal", data-target="editor/level/modals/GenerateTerrainModal", data-i18n="editor.generate_terrain", disabled=anonymous).generate-terrain-button Generate Terrain li(class=anonymous ? "disabled": "") a(data-i18n="editor.pop_i18n")#pop-level-i18n-button Populate i18n li.divider diff --git a/app/templates/editor/thang/thang-type-edit-view.jade b/app/templates/editor/thang/thang-type-edit-view.jade index f9c5b1231..1947d1607 100644 --- a/app/templates/editor/thang/thang-type-edit-view.jade +++ b/app/templates/editor/thang/thang-type-edit-view.jade @@ -52,11 +52,11 @@ block header span.glyphicon-chevron-down.glyphicon ul.dropdown-menu li.dropdown-header(data-i18n="common.actions") Actions - li(class=anonymous ? "disabled": "") + li(class=!me.isAdmin() ? "disabled": "") a(data-i18n="common.fork")#fork-start-button Fork - li(class=anonymous ? "disabled": "") - a(data-toggle="coco-modal", data-target="modal/RevertModal", data-i18n="editor.revert")#revert-button Revert - li(class=anonymous ? "disabled": "") + li(class=!authorized ? "disabled": "") + a(data-toggle="coco-modal", data-target="modal/RevertModal", data-i18n="editor.revert", disabled=!authorized)#revert-button Revert + li(class=!authorized ? "disabled": "") a(data-i18n="editor.pop_i18n")#pop-level-i18n-button Populate i18n li.divider li.dropdown-header(data-i18n="common.info") Info diff --git a/app/views/core/CocoView.coffee b/app/views/core/CocoView.coffee index 593c79e07..65f554051 100644 --- a/app/views/core/CocoView.coffee +++ b/app/views/core/CocoView.coffee @@ -199,6 +199,7 @@ module.exports = class CocoView extends Backbone.View # special handler for opening modals that are dynamically loaded, rather than static in the page. It works (or should work) like Bootstrap's modals, except use coco-modal for the data-toggle value. elem = $(e.target) return unless elem.data('toggle') is 'coco-modal' + return if elem.attr('disabled') target = elem.data('target') Modal = require 'views/'+target e.stopPropagation() diff --git a/app/views/editor/ForkModal.coffee b/app/views/editor/ForkModal.coffee index dc0cae36e..bc293c715 100644 --- a/app/views/editor/ForkModal.coffee +++ b/app/views/editor/ForkModal.coffee @@ -6,7 +6,6 @@ module.exports = class ForkModal extends ModalView id: 'fork-modal' template: template instant: false - modalWidthPercent: 60 events: 'click #fork-model-confirm-button': 'forkModel' diff --git a/app/views/editor/achievement/AchievementSearchView.coffee b/app/views/editor/achievement/AchievementSearchView.coffee index 6abf581f4..d14695482 100644 --- a/app/views/editor/achievement/AchievementSearchView.coffee +++ b/app/views/editor/achievement/AchievementSearchView.coffee @@ -14,6 +14,7 @@ module.exports = class AchievementSearchView extends SearchView context.currentNew = 'editor.new_achievement_title' context.currentNewSignup = 'editor.new_achievement_title_login' context.currentSearch = 'editor.achievement_search_title' + context.newModelsAdminOnly = true context.unauthorized = true unless me.isAdmin() @$el.i18n() context diff --git a/app/views/editor/article/ArticleSearchView.coffee b/app/views/editor/article/ArticleSearchView.coffee index 49f22bc64..4f517470c 100644 --- a/app/views/editor/article/ArticleSearchView.coffee +++ b/app/views/editor/article/ArticleSearchView.coffee @@ -14,5 +14,6 @@ module.exports = class ArticleSearchView extends SearchView context.currentNew = 'editor.new_article_title' context.currentNewSignup = 'editor.new_article_title_login' context.currentSearch = 'editor.article_search_title' + context.newModelsAdminOnly = true @$el.i18n() context diff --git a/app/views/editor/level/LevelEditView.coffee b/app/views/editor/level/LevelEditView.coffee index f00d52cbf..53dabaa61 100644 --- a/app/views/editor/level/LevelEditView.coffee +++ b/app/views/editor/level/LevelEditView.coffee @@ -40,7 +40,7 @@ module.exports = class LevelEditView extends RootView 'click .play-with-team-button': 'onPlayLevel' 'click .play-with-team-parent': 'onPlayLevelTeamSelect' 'click #commit-level-start-button': 'startCommittingLevel' - 'click #fork-start-button': 'startForking' + 'click li:not(.disabled) > #fork-start-button': 'startForking' 'click #level-history-button': 'showVersionHistory' 'click #undo-button': 'onUndo' 'mouseenter #undo-button': 'showUndoDescription' @@ -50,7 +50,7 @@ module.exports = class LevelEditView extends RootView 'click #components-tab': -> @subviews.editor_level_components_tab_view.refreshLevelThangsTreema @level.get('thangs') 'click #level-patch-button': 'startPatchingLevel' 'click #level-watch-button': 'toggleWatchLevel' - 'click #pop-level-i18n-button': 'onPopulateI18N' + 'click li:not(.disabled) > #pop-level-i18n-button': 'onPopulateI18N' 'click a[href="#editor-level-documentation"]': 'onClickDocumentationTab' 'mouseup .nav-tabs > li a': 'toggleTab' @@ -66,7 +66,7 @@ module.exports = class LevelEditView extends RootView showLoading: ($el) -> $el ?= @$el.find('.outer-content') super($el) - + getTitle: -> "LevelEditor - " + (@level.get('name') or '...') onLoaded: -> @@ -170,7 +170,7 @@ module.exports = class LevelEditView extends RootView button = @$el.find('#level-watch-button') @level.watch(button.find('.watch').is(':visible')) button.find('> span').toggleClass('secret') - + onPopulateI18N: -> @level.populateI18N() f = -> document.location.reload() diff --git a/app/views/editor/thang/ThangTypeEditView.coffee b/app/views/editor/thang/ThangTypeEditView.coffee index 165d6f7f9..ba8616b7f 100644 --- a/app/views/editor/thang/ThangTypeEditView.coffee +++ b/app/views/editor/thang/ThangTypeEditView.coffee @@ -45,13 +45,13 @@ module.exports = class ThangTypeEditView extends RootView 'click #stop-button': 'stopAnimation' 'click #play-button': 'playAnimation' 'click #history-button': 'showVersionHistory' - 'click #fork-start-button': 'startForking' + 'click li:not(.disabled) > #fork-start-button': 'startForking' 'click #save-button': 'openSaveModal' 'click #patches-tab': -> @patchesView.load() 'click .play-with-level-button': 'onPlayLevel' 'click .play-with-level-parent': 'onPlayLevelSelect' 'keyup .play-with-level-input': 'onPlayLevelKeyUp' - 'click #pop-level-i18n-button': 'onPopulateLevelI18N' + 'click li:not(.disabled) > #pop-level-i18n-button': 'onPopulateLevelI18N' onClickSetVectorIcon: -> diff --git a/app/views/editor/thang/ThangTypeSearchView.coffee b/app/views/editor/thang/ThangTypeSearchView.coffee index 7c5ff18f5..c51351ab7 100644 --- a/app/views/editor/thang/ThangTypeSearchView.coffee +++ b/app/views/editor/thang/ThangTypeSearchView.coffee @@ -15,6 +15,7 @@ module.exports = class ThangTypeSearchView extends SearchView context.currentNew = 'editor.new_thang_title' context.currentNewSignup = 'editor.new_thang_title_login' context.currentSearch = 'editor.thang_search_title' + context.newModelsAdminOnly = true @$el.i18n() context diff --git a/app/views/play/level/tome/SpellView.coffee b/app/views/play/level/tome/SpellView.coffee index 49800668b..2527c72a4 100644 --- a/app/views/play/level/tome/SpellView.coffee +++ b/app/views/play/level/tome/SpellView.coffee @@ -312,7 +312,8 @@ module.exports = class SpellView extends CocoView # Lock contiguous section of default code # Only works for languages without closing delimeters on blocks currently lines = @aceDoc.getAllLines() - lastRow = row for line, row in lines when not /^\s*$/.test(line) + for line, row in lines when not /^\s*$/.test(line) + lastRow = row if lastRow? @readOnlyRanges.push new Range 0, 0, lastRow, lines[lastRow].length - 1