From 80046be0b260b7d9c3b1d2cfa425c7a4d036dcf4 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Thu, 12 Jul 2012 15:08:51 +0200 Subject: [PATCH] Tiny cleanup of previous cleanup. Use the 'change' event instead of 'input' for the interval input. --- 4chan_x.user.js | 12 +++++------- script.coffee | 11 ++++------- 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index e494062f2..b8fd8f022 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -2824,7 +2824,7 @@ Updater = { init: function() { - var checkbox, checked, dialog, html, input, name, title, type, _i, _len, _ref; + var checkbox, checked, dialog, html, input, name, title, _i, _len, _ref; html = '
'; checkbox = Config.updater.checkbox; for (name in checkbox) { @@ -2843,11 +2843,10 @@ _ref = $$('input', dialog); for (_i = 0, _len = _ref.length; _i < _len; _i++) { input = _ref[_i]; - type = input.type, name = input.name; - if (type === 'checkbox') { + if (input.type === 'checkbox') { $.on(input, 'click', $.cb.checked); } - switch (name) { + switch (input.name) { case 'Scroll BG': $.on(input, 'click', this.cb.scrollBG); this.cb.scrollBG.call(input); @@ -2859,11 +2858,10 @@ case 'Auto Update This': $.on(input, 'click', this.cb.autoUpdate); this.cb.autoUpdate.call(input); - Conf[input.name] = input.checked; break; case 'Interval': input.value = Conf['Interval']; - $.on(input, 'input', this.cb.interval); + $.on(input, 'change', this.cb.interval); this.cb.interval.call(input); break; case 'Update Now': @@ -2913,7 +2911,7 @@ } }, autoUpdate: function() { - if (this.checked) { + if (Conf['Auto Update This'] = this.checked) { return Updater.timeoutID = setTimeout(Updater.timeout, 1000); } else { return clearTimeout(Updater.timeoutID); diff --git a/script.coffee b/script.coffee index eae046280..3c4a5ea67 100644 --- a/script.coffee +++ b/script.coffee @@ -2277,10 +2277,9 @@ Updater = @lastModified = '0' for input in $$ 'input', dialog - {type, name} = input - if type is 'checkbox' + if input.type is 'checkbox' $.on input, 'click', $.cb.checked - switch name + switch input.name when 'Scroll BG' $.on input, 'click', @cb.scrollBG @cb.scrollBG.call input @@ -2290,11 +2289,9 @@ Updater = when 'Auto Update This' $.on input, 'click', @cb.autoUpdate @cb.autoUpdate.call input - # Required for the QR's update after posting. - Conf[input.name] = input.checked when 'Interval' input.value = Conf['Interval'] - $.on input, 'input', @cb.interval + $.on input, 'change', @cb.interval @cb.interval.call input when 'Update Now' $.on input, 'click', @update @@ -2331,7 +2328,7 @@ Updater = textContent: 'Thread Updater' Updater.timer.hidden = true autoUpdate: -> - if @checked + if Conf['Auto Update This'] = @checked Updater.timeoutID = setTimeout Updater.timeout, 1000 else clearTimeout Updater.timeoutID