Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'master' of github.com:pederbl/swash

  • Loading branch information...
commit 17a198ac5d7ac8916754052cf89d460e75896855 2 parents f325029 + 61f1dad
@LinusU LinusU authored
View
3  .gitignore
@@ -6,10 +6,11 @@ lib-cov
*.out
*.pid
*.gz
+**/*.swp
pids
logs
results
node_modules
-npm-debug.log
+npm-debug.log
View
BIN  src/.app.coffee.swp
Binary file not shown
View
23 src/app.coffee
@@ -5,10 +5,27 @@ window.Swash =
version = ->
'Swash v. 0.1.0'
+ constructor: ->
+ @id = @randomString()
+
+ randomString: ->
+ i = 12
+ chars = "ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz"
+ while i--
+ rnum = Math.floor(Math.random() * chars.length);
+ r = (r || '') + chars.substring rnum, rnum+1
+ r
+
init: ->
- document.addEventListener 'keyup', (e)->
- if e.ctrlKey and e.keyCode == 65
- window.Swash.run_code()
+ document.addEventListener 'keydown', (e)=>
+ if (e.ctrlKey or e.metaKey) and e.keyCode is 13
+ @run_code()
+
+ document.addEventListener 'keyup', (e)=>
+ if (e.keyCode is 9)
+ $(e.target).trigger type: "keypress", which: 32
+ $(e.target).trigger type: "keypress", which: 32
+ e.preventDefault();
log: (msg)->
a.innerHTML += msg + '<br />'
Please sign in to comment.
Something went wrong with that request. Please try again.