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,9 +1530,15 @@ Expressions
|
|||
$(this).addClass 'active'
|
||||
false
|
||||
|
||||
$(document.body).click (e) ->
|
||||
return false if $(e.target).hasClass('minibutton')
|
||||
closeMenus()
|
||||
# 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()
|
||||
|
||||
$('#open_webchat').click ->
|
||||
$(this).replaceWith $('<iframe src="http://webchat.freenode.net/?channels=coffeescript" width="625" height="400"></iframe>')
|
||||
|
|
18
index.html
18
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,9 +2446,15 @@ task(<span class="String"><span class="String">'</span>build:parser<span class="
|
|||
$(this).addClass 'active'
|
||||
false
|
||||
|
||||
$(document.body).click (e) ->
|
||||
return false if $(e.target).hasClass('minibutton')
|
||||
closeMenus()
|
||||
# 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()
|
||||
|
||||
$('#open_webchat').click ->
|
||||
$(this).replaceWith $('<iframe src="http://webchat.freenode.net/?channels=coffeescript" width="625" height="400"></iframe>')
|
||||
|
|
Loading…
Reference in a new issue