mirror of
https://github.com/jashkenas/coffeescript.git
synced 2022-11-09 12:23:24 -05:00
Merge branch 'keyboard' of https://github.com/willmoffat/coffee-script
This commit is contained in:
commit
ff8c340330
2 changed files with 26 additions and 10 deletions
|
@ -83,7 +83,7 @@
|
|||
<textarea id="repl_source" rows="100">alert "Hello CoffeeScript!"</textarea>
|
||||
</div>
|
||||
<div id="repl_results_wrap"><pre id="repl_results"></pre></div>
|
||||
<div class="minibutton dark run">Run</div>
|
||||
<div class="minibutton dark run" title="Ctrl-Enter">Run</div>
|
||||
<br class="clear" />
|
||||
</div>
|
||||
</div>
|
||||
|
@ -1501,7 +1501,7 @@ Expressions
|
|||
$('#repl_source').keyup -> compileSource()
|
||||
|
||||
# Eval the compiled js.
|
||||
$('.minibutton.run').click ->
|
||||
evalJS = ->
|
||||
try
|
||||
eval window.compiledJS
|
||||
catch error then alert error
|
||||
|
@ -1517,6 +1517,8 @@ Expressions
|
|||
closeMenus = ->
|
||||
$('.navigation.active').removeClass 'active'
|
||||
|
||||
$('.minibutton.run').click evalJS
|
||||
|
||||
# Bind navigation buttons to open the menus.
|
||||
$('.navigation').click (e) ->
|
||||
return if e.target.tagName.toLowerCase() is 'a'
|
||||
|
@ -1528,7 +1530,13 @@ Expressions
|
|||
$(this).addClass 'active'
|
||||
false
|
||||
|
||||
$(document.body).click (e) ->
|
||||
# Dismiss console if Escape pressed or click falls outside console
|
||||
# Trigger Run button on Ctrl-Enter
|
||||
$(document.body)
|
||||
.keydown (e) ->
|
||||
closeMenus() if e.which == 27
|
||||
evalJS() if e.which == 13 and (e.metaKey or e.ctrlKey) and $('.minibutton.run:visible').length
|
||||
.click (e) ->
|
||||
return false if $(e.target).hasClass('minibutton')
|
||||
closeMenus()
|
||||
|
||||
|
|
14
index.html
14
index.html
|
@ -61,7 +61,7 @@
|
|||
<textarea id="repl_source" rows="100">alert "Hello CoffeeScript!"</textarea>
|
||||
</div>
|
||||
<div id="repl_results_wrap"><pre id="repl_results"></pre></div>
|
||||
<div class="minibutton dark run">Run</div>
|
||||
<div class="minibutton dark run" title="Ctrl-Enter">Run</div>
|
||||
<br class="clear" />
|
||||
</div>
|
||||
</div>
|
||||
|
@ -2417,7 +2417,7 @@ task(<span class="String"><span class="String">'</span>build:parser<span class="
|
|||
$('#repl_source').keyup -> compileSource()
|
||||
|
||||
# Eval the compiled js.
|
||||
$('.minibutton.run').click ->
|
||||
evalJS = ->
|
||||
try
|
||||
eval window.compiledJS
|
||||
catch error then alert error
|
||||
|
@ -2433,6 +2433,8 @@ task(<span class="String"><span class="String">'</span>build:parser<span class="
|
|||
closeMenus = ->
|
||||
$('.navigation.active').removeClass 'active'
|
||||
|
||||
$('.minibutton.run').click evalJS
|
||||
|
||||
# Bind navigation buttons to open the menus.
|
||||
$('.navigation').click (e) ->
|
||||
return if e.target.tagName.toLowerCase() is 'a'
|
||||
|
@ -2444,7 +2446,13 @@ task(<span class="String"><span class="String">'</span>build:parser<span class="
|
|||
$(this).addClass 'active'
|
||||
false
|
||||
|
||||
$(document.body).click (e) ->
|
||||
# Dismiss console if Escape pressed or click falls outside console
|
||||
# Trigger Run button on Ctrl-Enter
|
||||
$(document.body)
|
||||
.keydown (e) ->
|
||||
closeMenus() if e.which == 27
|
||||
evalJS() if e.which == 13 and (e.metaKey or e.ctrlKey) and $('.minibutton.run:visible').length
|
||||
.click (e) ->
|
||||
return false if $(e.target).hasClass('minibutton')
|
||||
closeMenus()
|
||||
|
||||
|
|
Loading…
Reference in a new issue