diff --git a/4chan_x.user.js b/4chan_x.user.js
index b816074f9..1c07fc1e3 100644
--- a/4chan_x.user.js
+++ b/4chan_x.user.js
@@ -2836,7 +2836,7 @@
Updater = {
init: function() {
- var checkbox, checked, dialog, html, input, name, title, _i, _len, _ref;
+ var checkbox, checked, dialog, html, input, name, title, type, _i, _len, _ref;
html = '
';
checkbox = Config.updater.checkbox;
for (name in checkbox) {
@@ -2845,7 +2845,7 @@
html += "";
}
checked = Conf['Auto Update'] ? 'checked' : '';
- html += " ";
+ html += " ";
dialog = UI.dialog('updater', 'bottom: 0; right: 0;', html);
this.count = $('#count', dialog);
this.timer = $('#timer', dialog);
@@ -2855,26 +2855,31 @@
_ref = $$('input', dialog);
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
input = _ref[_i];
- if (input.type === 'checkbox') {
+ type = input.type, name = input.name;
+ if (type === 'checkbox') {
$.on(input, 'click', $.cb.checked);
- if (input.name === 'Scroll BG') {
+ }
+ switch (name) {
+ case 'Scroll BG':
$.on(input, 'click', this.cb.scrollBG);
this.cb.scrollBG.call(input);
- }
- if (input.name === 'Verbose') {
+ break;
+ case 'Verbose':
$.on(input, 'click', this.cb.verbose);
this.cb.verbose.call(input);
- } else if (input.name === 'Auto Update This') {
+ break;
+ case 'Auto Update This':
$.on(input, 'click', this.cb.autoUpdate);
this.cb.autoUpdate.call(input);
Conf[input.name] = input.checked;
- }
- } else if (input.name === 'Interval') {
- input.value = Conf['Interval'];
- $.on(input, 'input', this.cb.interval);
- this.cb.interval.call(input);
- } else if (input.type === 'button') {
- $.on(input, 'click', this.update);
+ break;
+ case 'Interval':
+ input.value = Conf['Interval'];
+ $.on(input, 'input', this.cb.interval);
+ this.cb.interval.call(input);
+ break;
+ case 'Update Now':
+ $.on(input, 'click', this.update);
}
}
$.add(d.body, dialog);
diff --git a/script.coffee b/script.coffee
index 03bc4d6b8..60c5cc859 100644
--- a/script.coffee
+++ b/script.coffee
@@ -2274,7 +2274,7 @@ Updater =
html += "
- "
+ "
dialog = UI.dialog 'updater', 'bottom: 0; right: 0;', html
@@ -2286,25 +2286,27 @@ Updater =
@lastModified = '0'
for input in $$ 'input', dialog
- if input.type is 'checkbox'
+ {type, name} = input
+ if type is 'checkbox'
$.on input, 'click', $.cb.checked
- if input.name is 'Scroll BG'
+ switch name
+ when 'Scroll BG'
$.on input, 'click', @cb.scrollBG
@cb.scrollBG.call input
- if input.name is 'Verbose'
+ when 'Verbose'
$.on input, 'click', @cb.verbose
@cb.verbose.call input
- else if input.name is 'Auto Update This'
+ 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
- else if input.name is 'Interval'
- input.value = Conf['Interval']
- $.on input, 'input', @cb.interval
- @cb.interval.call input
- else if input.type is 'button'
- $.on input, 'click', @update
+ when 'Interval'
+ input.value = Conf['Interval']
+ $.on input, 'input', @cb.interval
+ @cb.interval.call input
+ when 'Update Now'
+ $.on input, 'click', @update
$.add d.body, dialog