From fea42b1513e321b6c397c914327a9a4a7d96e331 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Fri, 21 Nov 2014 13:33:20 -0500 Subject: split up js and style a little --- js/tool.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 js/tool.js (limited to 'js/tool.js') diff --git a/js/tool.js b/js/tool.js new file mode 100644 index 0000000..3b9b803 --- /dev/null +++ b/js/tool.js @@ -0,0 +1,16 @@ +function Tool (span) { + this.lex = new Lex (span) + this.span = span +} +Tool.prototype.use = function(){} +Tool.prototype.focus = function(){ + focused && focused.blur() + current_tool && current_tool.blur() + current_tool = this + this.span.classList.add('focused') + this.use() +} +Tool.prototype.blur = function(){ + current_tool = null + this.span.classList.remove('focused') +} -- cgit v1.2.3-70-g09d2