diff --git a/app/assets/javascripts/graph.js b/app/assets/javascripts/graph.js deleted file mode 100644 index 434cf70a..00000000 --- a/app/assets/javascripts/graph.js +++ /dev/null @@ -1,10 +0,0 @@ -function initGraphNav() { - $(".graph svg").css("position", "relative"); - $("body").bind("keyup", function(e) { - if(e.keyCode == 37) { // left - $(".graph svg").animate({ left: "+=400" }); - } else if(e.keyCode == 39) { // right - $(".graph svg").animate({ left: "-=400" }); - } - }); -} diff --git a/app/assets/javascripts/graph.js.coffee b/app/assets/javascripts/graph.js.coffee new file mode 100644 index 00000000..5fe8ae3f --- /dev/null +++ b/app/assets/javascripts/graph.js.coffee @@ -0,0 +1,10 @@ +initGraphNav = -> + $('.graph svg').css 'position', 'relative' + + $('body').bind 'keyup', (e) -> + if e.keyCode is 37 # left + $('.graph svg').animate left: '+=400' + else if e.keyCode is 39 # right + $('.graph svg').animate left: '-=400' + +window.initGraphNav = initGraphNav