helper for keyboard, change to 'on' instead of 'bind'
This commit is contained in:
parent
56fb44d1f8
commit
36409d1fa8
2 changed files with 21 additions and 21 deletions
|
|
@ -9,7 +9,8 @@
|
|||
<script type="text/javascript" src="sahli.js"></script>
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
s = 5;
|
||||
sahli = new Sahli;
|
||||
Sahli.requestsahlifile('list.sahli')
|
||||
})
|
||||
</script>
|
||||
<link rel="stylesheet" href="sahli.css" type="text/css" media="screen" />
|
||||
|
|
|
|||
37
sahli.coffee
37
sahli.coffee
|
|
@ -136,27 +136,13 @@ class @Sahli
|
|||
alert 'avatar', picdata, inserthere
|
||||
return
|
||||
|
||||
|
||||
@resizedrawbox = (height) ->
|
||||
dbox1 = $('div#drawbox')
|
||||
if 'undefined' == height
|
||||
dbox1.height window.innerHeight - 2
|
||||
else
|
||||
dbox1.height height
|
||||
dbox1.width window.innerWidth - 2
|
||||
|
||||
|
||||
@requestsahlifile = (url) ->
|
||||
ref = this
|
||||
@loadkeys()
|
||||
$.getJSON url, (json) ->
|
||||
ref.filedata = json.filedata
|
||||
ref.slides = json.slides
|
||||
ref.location = json.location
|
||||
ref.buildcompo()
|
||||
|
||||
@buildcompo = ->
|
||||
# @resizedrawbox()
|
||||
alert 'SAHLI READY TO GO'
|
||||
@filedata = json.filedata
|
||||
@slides = json.slides
|
||||
@location = json.location
|
||||
alert "SAHLI READY TO GO\n#{@filedata.length} Entries"
|
||||
|
||||
@nextpic = ->
|
||||
@dbox.children().remove()
|
||||
|
|
@ -199,3 +185,16 @@ class @Sahli
|
|||
@DEBUG = !@DEBUG
|
||||
return
|
||||
|
||||
@keycode = (char) ->
|
||||
char.toUpperCase().charCodeAt 0
|
||||
|
||||
@loadkeys = ->
|
||||
$(document).on('keydown', (ev) =>
|
||||
switch ev.which
|
||||
when @keycode(' ')
|
||||
alert "spaaaace"
|
||||
when @keycode('s')
|
||||
alert("not spaaaace")
|
||||
else
|
||||
console.log ev.which
|
||||
)
|
||||
Loading…
Add table
Add a link
Reference in a new issue