From afff1056cbbc27157f5cc5743f6f208f6269e23b Mon Sep 17 00:00:00 2001 From: Nick Winter Date: Wed, 19 Nov 2014 16:36:06 -0800 Subject: [PATCH 1/3] Don't be draggin' all these images around yo. --- app/templates/game-menu/game-menu-modal.jade | 2 +- app/templates/game-menu/inventory-modal.jade | 6 +++--- app/templates/game-menu/options-view.jade | 4 ++-- app/templates/play/level/thang_avatar.jade | 4 ++-- app/templates/play/level/tome/spell_palette.jade | 3 ++- app/templates/play/modal/item-details-view.jade | 10 +++++----- .../play/modal/play-achievements-modal.jade | 4 ++-- app/templates/play/modal/play-heroes-modal.jade | 6 +++--- app/templates/play/modal/play-items-modal.jade | 14 +++++++------- app/templates/play/world-map-view.jade | 2 +- app/views/game-menu/InventoryModal.coffee | 2 +- app/views/play/level/LevelHUDView.coffee | 4 ++-- app/views/play/level/tome/SpellPaletteView.coffee | 2 +- 13 files changed, 32 insertions(+), 31 deletions(-) diff --git a/app/templates/game-menu/game-menu-modal.jade b/app/templates/game-menu/game-menu-modal.jade index 8ff4359a8..f8fef45e0 100644 --- a/app/templates/game-menu/game-menu-modal.jade +++ b/app/templates/game-menu/game-menu-modal.jade @@ -1,6 +1,6 @@ .modal-dialog .modal-content - img(src="/images/pages/play/modal/game-menu-background.png")#game-menu-background + img(src="/images/pages/play/modal/game-menu-background.png", draggable="false")#game-menu-background div#close-modal span.glyphicon.glyphicon-remove diff --git a/app/templates/game-menu/inventory-modal.jade b/app/templates/game-menu/inventory-modal.jade index fac3ffd2e..66a6e7397 100644 --- a/app/templates/game-menu/inventory-modal.jade +++ b/app/templates/game-menu/inventory-modal.jade @@ -1,6 +1,6 @@ .modal-dialog .modal-content - img(src="/images/pages/play/modal/inventory-background.png")#play-items-modal-narrow-bg + img(src="/images/pages/play/modal/inventory-background.png", draggable="false")#play-items-modal-narrow-bg div#gems-count-container span#gems-count.big-font= gems @@ -38,14 +38,14 @@ h4#restricted-description(data-i18n="inventory.restricted_title") for item in itemGroups.restrictedItems.models .item(class=item.classes, data-item-id=item.id) - img(src=item.getPortraitURL()) + img(src=item.getPortraitURL(), draggable="false") .clearfix if itemGroups.lockedItems.models.length h4#locked-description(data-i18n="play.locked") for item in itemGroups.lockedItems.models .item(class=item.classes, data-item-id=item.id) - img(src=item.getPortraitURL()) + img(src=item.getPortraitURL(), draggable="false") .clearfix #item-details-view diff --git a/app/templates/game-menu/options-view.jade b/app/templates/game-menu/options-view.jade index 1fb39cfe2..5f43a07a8 100644 --- a/app/templates/game-menu/options-view.jade +++ b/app/templates/game-menu/options-view.jade @@ -1,7 +1,7 @@ #player-avatar-container(title="Click to change your avatar") if !me.get('photoURL') .editable-icon.glyphicon.glyphicon-pencil - img.profile-photo(src=me.getPhotoURL(230)) + img.profile-photo(src=me.getPhotoURL(230), draggable="false") .form-group input#player-name.profile-caption(name="playerName", type="text", value=me.get('name', true)) @@ -32,7 +32,7 @@ span.help-block(data-i18n="options.autorun_description") Control automatic code execution. - img.hr(src="/images/pages/play/modal/hr.png") + img.hr(src="/images/pages/play/modal/hr.png", draggable="false") h3(data-i18n="options.editor_config_title") Editor Configuration diff --git a/app/templates/play/level/thang_avatar.jade b/app/templates/play/level/thang_avatar.jade index e92cbb7fd..b8e4dd12b 100644 --- a/app/templates/play/level/thang_avatar.jade +++ b/app/templates/play/level/thang_avatar.jade @@ -1,8 +1,8 @@ .thang-avatar-wrapper(class="team-" + (thang.team || "neutral")) //canvas(width=100, height=100, title=thang.id + " - " + thang.team) //- var title = thang.id + " - " + thang.team + (thang.type ? ' - type: "' + thang.type + '"' : '') - img.avatar(src=avatarURL) - img.avatar-frame(src="/images/level/thang_avatar_frame.png") + img.avatar(src=avatarURL, draggable="false") + img.avatar-frame(src="/images/level/thang_avatar_frame.png", draggable="false") .badge.problems .badge.shared-thangs if includeName diff --git a/app/templates/play/level/tome/spell_palette.jade b/app/templates/play/level/tome/spell_palette.jade index 304ef1a64..f601b8178 100644 --- a/app/templates/play/level/tome/spell_palette.jade +++ b/app/templates/play/level/tome/spell_palette.jade @@ -1,4 +1,4 @@ -img(src="/images/level/code_palette_wood_background.png").code-palette-background +img(src="/images/level/code_palette_wood_background.png", draggable="false").code-palette-background span.code-palette-background if entryGroupSlugs // Non-hero; group by entry groups, or maybe nothing. @@ -15,3 +15,4 @@ else // Hero; group by items, no tabs. h4(data-i18n="play_level.tome_your_skills") .properties + diff --git a/app/templates/play/modal/item-details-view.jade b/app/templates/play/modal/item-details-view.jade index 0974ccca7..a381fa3dd 100644 --- a/app/templates/play/modal/item-details-view.jade +++ b/app/templates/play/modal/item-details-view.jade @@ -7,16 +7,16 @@ .nano .nano-content #item-container - img.item-img(src=item.getPortraitURL()) - img.item-shadow(src=item.getPortraitURL()) + img.item-img(src=item.getPortraitURL(), draggable="false") + img.item-shadow(src=item.getPortraitURL(), draggable="false") - img.hr(src="/images/pages/play/modal/hr.png") + img.hr(src="/images/pages/play/modal/hr.png", draggable="false") for stat in stats div.stat-row.big-font div.stat-label= stat.name div.stat= stat.display - img.hr(src="/images/pages/play/modal/hr.png" class=stat.isLast ? "" : "faded") + img.hr(src="/images/pages/play/modal/hr.png", class=stat.isLast ? "" : "faded", draggable="false") if props.length #skills @@ -40,5 +40,5 @@ if item && !item.owned button#selected-item-unlock-button.btn.big-font.unlock-button(disabled=!item.affordable, data-item-id=item.id) span(data-i18n="play.unlock") Unlock span.spl= '('+item.get('gems') - img(src="/images/common/gem.png") + img(src="/images/common/gem.png", draggable="false") span ) diff --git a/app/templates/play/modal/play-achievements-modal.jade b/app/templates/play/modal/play-achievements-modal.jade index b71a88d9d..71e593170 100644 --- a/app/templates/play/modal/play-achievements-modal.jade +++ b/app/templates/play/modal/play-achievements-modal.jade @@ -7,7 +7,7 @@ block modal-body-content for achievement in achievements .panel(class=achievement.earned ? 'earned' : '') .panel-body - img.icon(src=achievement.getImageURL()) + img.icon(src=achievement.getImageURL(), draggable="false") h3= achievement.name p= achievement.description @@ -22,7 +22,7 @@ block modal-body-content if rewards && rewards.gems span.gems.label.label-default span= rewards.gems - img.gem(src="/images/common/gem.png") + img.gem(src="/images/common/gem.png", draggable="false") - worth = achievement.get('worth') if worth diff --git a/app/templates/play/modal/play-heroes-modal.jade b/app/templates/play/modal/play-heroes-modal.jade index 7de87994b..92c06b6b6 100644 --- a/app/templates/play/modal/play-heroes-modal.jade +++ b/app/templates/play/modal/play-heroes-modal.jade @@ -1,7 +1,7 @@ .modal-dialog .modal-content - img(src="/images/pages/play/modal/heroes-background.png")#play-heroes-background + img(src="/images/pages/play/modal/heroes-background.png", draggable="false")#play-heroes-background h1(data-i18n="choose_hero.choose_hero") @@ -15,13 +15,13 @@ li(data-hero-id=hero.get('original'), title=hero.name, data-slide-to=index, data-target="#hero-carousel", class="hero-indicator hero-index-" + index + (hero.locked ? " locked" : "")) .hero-avatar if hero.locked - img.lock-indicator(src="/images/pages/game-menu/lock.png") + img.lock-indicator(src="/images/pages/game-menu/lock.png", draggable="false") .carousel-inner for hero in heroes div(class="item hero-item" + (hero.locked ? " locked" : ""), data-hero-id=hero.get('original')) canvas.hero-canvas .hero-feature-image - img + img(draggable="false") .hero-stats h2= hero.name .hero-description= hero.description diff --git a/app/templates/play/modal/play-items-modal.jade b/app/templates/play/modal/play-items-modal.jade index ec6b2d21d..3e81ebf53 100644 --- a/app/templates/play/modal/play-items-modal.jade +++ b/app/templates/play/modal/play-items-modal.jade @@ -1,7 +1,7 @@ .modal-dialog .modal-content - img(src="/images/pages/play/modal/items-background.png")#play-items-modal-bg - img(src="/images/pages/play/modal/items-background-narrow.png")#play-items-modal-narrow-bg + img(src="/images/pages/play/modal/items-background.png", draggable="false")#play-items-modal-bg + img(src="/images/pages/play/modal/items-background-narrow.png", draggable="false")#play-items-modal-narrow-bg h1.big-font(data-i18n="play.items") @@ -15,7 +15,7 @@ for category, index in itemCategories li(class=index ? "" : "active") a.one-line(href="#item-category-" + category, data-toggle="tab") - img.tab-icon(src="/images/pages/play/modal/item-icon-"+category+".png") + img.tab-icon(src="/images/pages/play/modal/item-icon-"+category+".png", draggable="false") span.big-font= itemCategoryNames[index] @@ -31,15 +31,15 @@ if item.silhouetted && !item.owned span.glyphicon.glyphicon-lock.bolder span.glyphicon.glyphicon-lock - img.item-silhouette(src=item.getPortraitURL()) + img.item-silhouette(src=item.getPortraitURL(), draggable="false") if item.level .required-level div(data-i18n="general.player_level") div= item.level else strong.big-font= item.name - img.item-img(src=item.getPortraitURL()) - img.item-shadow(src=item.getPortraitURL()) + img.item-img(src=item.getPortraitURL(), draggable="false") + img.item-shadow(src=item.getPortraitURL(), draggable="false") if item.owned span.big-font.owned(data-i18n="play.owned") @@ -47,7 +47,7 @@ span.big-font.locked(data-i18n="play.locked") else span.cost - img(src="/images/common/gem.png") + img(src="/images/common/gem.png", draggable="false") span.big-font= item.get('gems') if item.equippable // Temp, while we only have Warriors: prevent them from buying non-Warrior stuff diff --git a/app/templates/play/world-map-view.jade b/app/templates/play/world-map-view.jade index fc43175f7..f579a1d0e 100644 --- a/app/templates/play/world-map-view.jade +++ b/app/templates/play/world-map-view.jade @@ -3,7 +3,7 @@ .gradient.vertical-gradient.right-gradient .gradient.horizontal-gradient.bottom-gradient .gradient.vertical-gradient.left-gradient - img.map-background(src="/images/pages/play/map_" + mapType + ".jpg", alt="") + img.map-background(src="/images/pages/play/map_" + mapType + ".jpg", alt="", draggable="false") - var seenNext = nextLevel; each level in campaign.levels diff --git a/app/views/game-menu/InventoryModal.coffee b/app/views/game-menu/InventoryModal.coffee index d83089468..c5baa7e20 100644 --- a/app/views/game-menu/InventoryModal.coffee +++ b/app/views/game-menu/InventoryModal.coffee @@ -84,7 +84,7 @@ module.exports = class InventoryModal extends ModalView # sort into one of the four groups locked = not (item.get('original') in me.items()) - locked = false if me.get('slug') is 'nick' + #locked = false if me.get('slug') is 'nick' if not item.getFrontFacingStats().props.length and not _.size(item.getFrontFacingStats().stats) and not locked # Temp: while there are placeholder items null # Don't put into a collection diff --git a/app/views/play/level/LevelHUDView.coffee b/app/views/play/level/LevelHUDView.coffee index 669da3687..23a6c9617 100644 --- a/app/views/play/level/LevelHUDView.coffee +++ b/app/views/play/level/LevelHUDView.coffee @@ -79,7 +79,7 @@ module.exports = class LevelHUDView extends CocoView wrapper.removeClass (i, css) -> (css.match(/\bteam-\S+/g) or []).join ' ' wrapper.addClass "team-#{team}" if thangType.get('raster') - wrapper.empty().append($('').addClass('avatar').attr('src', '/file/'+thangType.get('raster'))) + wrapper.empty().append($('').addClass('avatar').attr('src', '/file/'+thangType.get('raster'))) else return unless stage = thangType.getPortraitStage options, 100 newCanvas = $(stage.canvas).addClass('thang-canvas avatar') @@ -87,7 +87,7 @@ module.exports = class LevelHUDView extends CocoView stage.update() @stage?.stopTalking() @stage = stage - wrapper.append($('').addClass('avatar-frame').attr('src', '/images/level/thang_avatar_frame.png')) + wrapper.append($('').addClass('avatar-frame').attr('src', '/images/level/thang_avatar_frame.png')) onThangBeganTalking: (e) -> return unless @stage and @thang is e.thang diff --git a/app/views/play/level/tome/SpellPaletteView.coffee b/app/views/play/level/tome/SpellPaletteView.coffee index 9d3fd3a0a..cd0629b7c 100644 --- a/app/views/play/level/tome/SpellPaletteView.coffee +++ b/app/views/play/level/tome/SpellPaletteView.coffee @@ -51,7 +51,7 @@ module.exports = class SpellPaletteView extends CocoView @entryGroupElements = {} for group, entries of @entryGroups @entryGroupElements[group] = itemGroup = $('
').appendTo @$el.find('.properties') - itemGroup.append $('').attr('src', entries[0].options.item.getPortraitURL()).css('top', Math.max(0, 19 * (entries.length - 2) / 2) + 2) if entries[0].options.item?.getPortraitURL + itemGroup.append $('').attr('src', entries[0].options.item.getPortraitURL()).css('top', Math.max(0, 19 * (entries.length - 2) / 2) + 2) if entries[0].options.item?.getPortraitURL for entry in entries itemGroup.append entry.el entry.render() # Render after appending so that we can access parent container for popover From 81d6c186dcaebaa44eaf5e3cb02b72a98f4433db Mon Sep 17 00:00:00 2001 From: Matt Lott Date: Wed, 19 Nov 2014 17:12:57 -0800 Subject: [PATCH 2/3] Add time to missing null check error messages --- app/views/play/level/tome/ProblemAlertView.coffee | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/app/views/play/level/tome/ProblemAlertView.coffee b/app/views/play/level/tome/ProblemAlertView.coffee index 24eb6b1c9..a94987bf7 100644 --- a/app/views/play/level/tome/ProblemAlertView.coffee +++ b/app/views/play/level/tome/ProblemAlertView.coffee @@ -35,7 +35,17 @@ module.exports = class ProblemAlertView extends CocoView context = super context if @problem? format = (s) -> marked(s.replace(//g, '>')) if s? - context.message = format @problem.aetherProblem.message + message = @problem.aetherProblem.message + # Add time to problem message if hint is for a missing null check + # NOTE: This may need to be updated with Aether error hint changes + if @problem.aetherProblem.hint? and /(?:null|undefined)/.test @problem.aetherProblem.hint + age = @problem.aetherProblem.userInfo?.age + if age? + if /^Line \d+:/.test message + message = message.replace /^(Line \d+)/, "$1, time #{age.toFixed(1)}" + else + message = "Time #{age.toFixed(1)}: #{message}" + context.message = format message context.hint = format @problem.aetherProblem.hint context From 8280347752424c832934e6e2fd2c51ecf05b8167 Mon Sep 17 00:00:00 2001 From: Nick Winter Date: Wed, 19 Nov 2014 18:36:09 -0800 Subject: [PATCH 3/3] Fixes to spell palette doc hovering and ensuring at least two column layout. --- app/styles/play/level/tome/spell_palette.sass | 7 ++++++- .../play/level/tome/spell_palette_entry.sass | 4 ++++ app/views/play/level/tome/SpellPaletteView.coffee | 14 ++++++++++++-- 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/app/styles/play/level/tome/spell_palette.sass b/app/styles/play/level/tome/spell_palette.sass index 5b644a3b3..64755f641 100644 --- a/app/styles/play/level/tome/spell_palette.sass +++ b/app/styles/play/level/tome/spell_palette.sass @@ -71,7 +71,7 @@ .property-entry-item-group display: inline-block min-height: 38px - max-width: 212px + width: 212px @include flexbox() @include flex-wrap() @include flex-center() @@ -93,3 +93,8 @@ width: 174px width: -webkit-calc(100% - 38px) width: calc(100% - 38px) + +@media only screen and (max-width: 1100px) + #spell-palette-view + // Make sure we have enough room for at least two columns + padding-left: 12px diff --git a/app/styles/play/level/tome/spell_palette_entry.sass b/app/styles/play/level/tome/spell_palette_entry.sass index b88b6bfb2..93640e9ef 100644 --- a/app/styles/play/level/tome/spell_palette_entry.sass +++ b/app/styles/play/level/tome/spell_palette_entry.sass @@ -24,6 +24,10 @@ &.pinned background-color: darken(#FFFFFF, 25%) + &.single-entry + height: 38px + line-height: 38px + // Originally pulled these colors from the most relevant textmate-theme classes, but then fudged them a lot. //&.function // color: black diff --git a/app/views/play/level/tome/SpellPaletteView.coffee b/app/views/play/level/tome/SpellPaletteView.coffee index cd0629b7c..6a89679f1 100644 --- a/app/views/play/level/tome/SpellPaletteView.coffee +++ b/app/views/play/level/tome/SpellPaletteView.coffee @@ -51,10 +51,20 @@ module.exports = class SpellPaletteView extends CocoView @entryGroupElements = {} for group, entries of @entryGroups @entryGroupElements[group] = itemGroup = $('
').appendTo @$el.find('.properties') - itemGroup.append $('').attr('src', entries[0].options.item.getPortraitURL()).css('top', Math.max(0, 19 * (entries.length - 2) / 2) + 2) if entries[0].options.item?.getPortraitURL - for entry in entries + if entries[0].options.item?.getPortraitURL + itemImage = $('').attr('src', entries[0].options.item.getPortraitURL()).css('top', Math.max(0, 19 * (entries.length - 2) / 2) + 2) + itemGroup.append itemImage + firstEntry = entries[0] + do (firstEntry) -> + itemImage.on "mouseenter", (e) -> firstEntry.onMouseEnter e + itemImage.on "mouseleave", (e) -> firstEntry.onMouseLeave e + for entry, entryIndex in entries itemGroup.append entry.el entry.render() # Render after appending so that we can access parent container for popover + if entries.length is 1 + entry.$el.addClass 'single-entry' + if entryIndex is 0 + entry.$el.addClass 'first-entry' @$el.addClass 'hero' @updateMaxHeight() unless application.isIPadApp