if -> switch
This commit is contained in:
parent
b505dd34df
commit
e06970ef71
@ -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 = '<div class=move><span id=count></span> <span id=timer></span></div>';
|
||||
checkbox = Config.updater.checkbox;
|
||||
for (name in checkbox) {
|
||||
@ -2845,7 +2845,7 @@
|
||||
html += "<div><label title='" + title + "'>" + name + "<input name='" + name + "' type=checkbox " + checked + "></label></div>";
|
||||
}
|
||||
checked = Conf['Auto Update'] ? 'checked' : '';
|
||||
html += " <div><label title='Controls whether *this* thread automatically updates or not'>Auto Update This<input name='Auto Update This' type=checkbox " + checked + "></label></div> <div><label>Interval (s)<input type=number name=Interval class=field min=5></label></div> <div><input value='Update Now' type=button></div>";
|
||||
html += " <div><label title='Controls whether *this* thread automatically updates or not'>Auto Update This<input name='Auto Update This' type=checkbox " + checked + "></label></div> <div><label>Interval (s)<input type=number name=Interval class=field min=5></label></div> <div><input value='Update Now' type=button name='Update Now'></div>";
|
||||
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);
|
||||
|
||||
@ -2274,7 +2274,7 @@ Updater =
|
||||
html += "
|
||||
<div><label title='Controls whether *this* thread automatically updates or not'>Auto Update This<input name='Auto Update This' type=checkbox #{checked}></label></div>
|
||||
<div><label>Interval (s)<input type=number name=Interval class=field min=5></label></div>
|
||||
<div><input value='Update Now' type=button></div>"
|
||||
<div><input value='Update Now' type=button name='Update Now'></div>"
|
||||
|
||||
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
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user