mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-27 17:45:40 -05:00
Support for seeing this.now() in spell palette.
This commit is contained in:
parent
2b1079912a
commit
50f683534f
6 changed files with 28 additions and 12 deletions
|
@ -11,5 +11,5 @@ module.exports.load = (key) ->
|
||||||
module.exports.save = (key, value) ->
|
module.exports.save = (key, value) ->
|
||||||
s = JSON.stringify(value)
|
s = JSON.stringify(value)
|
||||||
localStorage.setItem(key, s)
|
localStorage.setItem(key, s)
|
||||||
|
|
||||||
module.exports.remove = (key) -> localStorage.removeItem key
|
module.exports.remove = (key) -> localStorage.removeItem key
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
button.close(type="button", data-dismiss="alert") ×
|
button.close(type="button", data-dismiss="alert") ×
|
||||||
span.problem-message= message
|
span.problem-message!= message
|
||||||
if hint
|
if hint
|
||||||
br
|
br
|
||||||
span.problem-hint= hint
|
span.problem-hint!= hint
|
|
@ -17,7 +17,7 @@ else if doc.type == 'function'
|
||||||
div
|
div
|
||||||
code= doc.owner + '.' + doc.name + '(' + argumentExamples.join(', ') + ');'
|
code= doc.owner + '.' + doc.name + '(' + argumentExamples.join(', ') + ');'
|
||||||
|
|
||||||
if doc.type != 'function' && doc.type != 'snippet'
|
if (doc.type != 'function' && doc.type != 'snippet') || doc.name == 'now'
|
||||||
p.value
|
p.value
|
||||||
strong Current Value:
|
strong Current Value:
|
||||||
pre
|
pre
|
||||||
|
|
|
@ -17,8 +17,9 @@ module.exports = class ProblemAlertView extends View
|
||||||
|
|
||||||
getRenderData: (context={}) ->
|
getRenderData: (context={}) ->
|
||||||
context = super context
|
context = super context
|
||||||
context.message = @problem.aetherProblem.message.replace("\n", "<br>")
|
format = (s) -> s?.replace("\n", "<br>").replace('<', '<').replace('>', '>')
|
||||||
context.hint = @problem.aetherProblem.hint?.replace("\n", "<br>")
|
context.message = format @problem.aetherProblem.message
|
||||||
|
context.hint = format @problem.aetherProblem.hint
|
||||||
context
|
context
|
||||||
|
|
||||||
afterRender: ->
|
afterRender: ->
|
||||||
|
|
|
@ -98,6 +98,7 @@ module.exports = class SpellPaletteEntryView extends View
|
||||||
content.replace /\#\{(.*?)\}/g, (s, properties) => @formatValue downTheChain(owner, properties.split('.'))
|
content.replace /\#\{(.*?)\}/g, (s, properties) => @formatValue downTheChain(owner, properties.split('.'))
|
||||||
|
|
||||||
formatValue: (v) ->
|
formatValue: (v) ->
|
||||||
|
return @thang.now() if @doc.name is 'now'
|
||||||
return '[Function]' if not v and @doc.type is 'function'
|
return '[Function]' if not v and @doc.type is 'function'
|
||||||
unless v?
|
unless v?
|
||||||
if @doc.owner is 'this'
|
if @doc.owner is 'this'
|
||||||
|
|
|
@ -15,12 +15,26 @@ exports.config =
|
||||||
javascripts:
|
javascripts:
|
||||||
defaultExtension: 'coffee'
|
defaultExtension: 'coffee'
|
||||||
joinTo:
|
joinTo:
|
||||||
'javascripts/world.js': /^((app(\/|\\)lib(\/|\\)world(?!(\/|\\)test))|(app(\/|\\)lib(\/|\\)CocoClass.coffee)|(app(\/|\\)lib(\/|\\)utils.coffee)|(vendor(\/|\\)scripts(\/|\\)Box2dWeb-2.1.a.3)|(bower_components(\/|\\)lodash(\/|\\)dist(\/|\\)lodash.js)|(vendor(\/|\\)scripts(\/|\\)string_score.js)|(bower_components(\/|\\)aether(\/|\\)build(\/|\\)aether.js))/
|
'javascripts/world.js': ///^(
|
||||||
|
(app[\/\\]lib[\/\\]world(?![\/\\]test))
|
||||||
|
|(app[\/\\]lib[\/\\]CocoClass.coffee)
|
||||||
|
|(app[\/\\]lib[\/\\]utils.coffee)
|
||||||
|
|(vendor[\/\\]scripts[\/\\]Box2dWeb-2.1.a.3)
|
||||||
|
|(vendor[\/\\]scripts[\/\\]string_score.js)
|
||||||
|
|(bower_components[\/\\]lodash[\/\\]dist[\/\\]lodash.js)
|
||||||
|
|(bower_components[\/\\]aether[\/\\]build[\/\\]aether.js)
|
||||||
|
)///
|
||||||
'javascripts/app.js': /^app/
|
'javascripts/app.js': /^app/
|
||||||
'javascripts/vendor.js': /^(vendor(\/|\\)(?!(scripts\/Box2d|scripts\/box2d))|bower_components)/
|
'javascripts/vendor.js': ///^(
|
||||||
'javascripts/vendor_with_box2d.js': /^(vendor(\/|\\)(?!scripts\/box2d)|bower_components)/ # include box2dweb for profiling (and for IE9...)
|
vendor[\/\\](?!(scripts[\/\\]Box2d|scripts[\/\\]box2d))
|
||||||
'test/javascripts/test.js': /^test(\/|\\)(?!vendor)/
|
|bower_components
|
||||||
'test/javascripts/test-vendor.js': /^test(\/|\\)(?=vendor)/
|
)///
|
||||||
|
'javascripts/vendor_with_box2d.js': ///^(
|
||||||
|
vendor[\/\\](?!scripts[\/\\]box2d)
|
||||||
|
|bower_components # include box2dweb for profiling (and for IE9...)
|
||||||
|
)///
|
||||||
|
'test/javascripts/test.js': /^test[\/\\](?!vendor)/
|
||||||
|
'test/javascripts/test-vendor.js': /^test[\/\\](?=vendor)/
|
||||||
order:
|
order:
|
||||||
before: [
|
before: [
|
||||||
'bower_components/jquery/jquery.js'
|
'bower_components/jquery/jquery.js'
|
||||||
|
|
Loading…
Reference in a new issue