From 36409d1fa89f8f61c542f0b785801b78fb309453 Mon Sep 17 00:00:00 2001 From: Iam Naughton Phier Date: Tue, 17 Feb 2015 18:38:40 +0200 Subject: [PATCH] helper for keyboard, change to 'on' instead of 'bind' --- index.html | 3 ++- sahli.coffee | 39 +++++++++++++++++++-------------------- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/index.html b/index.html index ce26e7c..f32820c 100644 --- a/index.html +++ b/index.html @@ -9,7 +9,8 @@ diff --git a/sahli.coffee b/sahli.coffee index c4af151..c1f5d38 100644 --- a/sahli.coffee +++ b/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() @@ -198,4 +184,17 @@ class @Sahli $('h1#top').fadeToggle() @DEBUG = !@DEBUG return - \ No newline at end of file + + @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 + ) \ No newline at end of file