From 13d700004227922fb99bbef3587ff1b546741ec0 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Tue, 10 May 2016 21:47:27 -0400 Subject: moving nopaint stuff into main codebase --- js/tool.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'js/tool.js') diff --git a/js/tool.js b/js/tool.js index e75bf8d..0ad23b9 100644 --- a/js/tool.js +++ b/js/tool.js @@ -114,14 +114,11 @@ var RadioGroup = Tool.extend({ } }) - - - var Checkbox = Tool.extend({ init: function (el){ this.__init(el) var name = this.name.replace(/^[x_] /,"") - var state = localStorage.getItem("ascii." + name) || this.name[0] == "x" + var state = localStorage.getItem("ascii.tools." + name) == "true" || this.name[0] == "x" this.name = name this.update(state) }, @@ -153,14 +150,18 @@ var BlurredTool = Tool.extend({ }) var HiddenCheckbox = BlurredCheckbox.extend({ + on: "o", + off: ".", init: function (el){ this.el = el this.lex = new Lex (el) - this.name = el.innerHTML - var state = this.name[0] == "o" + this.name = this.el.id + var state = localStorage.getItem("ascii.tools." + name) == "true" || this.el.innerHTML[0] == this.on this.update(state) }, update: function(state){ - this.el.innerHTML = state ? "o" : "." + this.el.innerHTML = state ? this.on : this.off + if (this.memorable) { localStorage.setItem("ascii.tools." + this.name, !! state) } + console.trace() } }) -- cgit v1.2.3-70-g09d2