move global auto update option to updater dialog

This commit is contained in:
James Campos 2011-01-16 01:47:35 -08:00
parent 91552f1bf0
commit 454cedfef0
2 changed files with 25 additions and 14 deletions

View File

@ -10,7 +10,6 @@ config =
'404 Redirect': [true, 'Redirect dead threads'] '404 Redirect': [true, 'Redirect dead threads']
'Anonymize': [false, 'Make everybody anonymous'] 'Anonymize': [false, 'Make everybody anonymous']
'Auto Watch': [true, 'Automatically watch threads that you start (Firefox only)'] 'Auto Watch': [true, 'Automatically watch threads that you start (Firefox only)']
'Auto Update': [true, 'Automatically enable automatic updating']
'Comment Expansion': [true, 'Expand too long comments'] 'Comment Expansion': [true, 'Expand too long comments']
'Image Expansion': [true, 'Expand images'] 'Image Expansion': [true, 'Expand images']
'Keybinds': [false, 'Binds actions to keys'] 'Keybinds': [false, 'Binds actions to keys']
@ -899,19 +898,28 @@ updateNow = ->
updaterMake = -> updaterMake = ->
html = "<div class=move><span id=count></span> <span id=timer>Thread Updater</span></div>" html = "<div class=move><span id=count></span> <span id=timer>Thread Updater</span></div>"
html += "<div><label>Auto Update<input type=checkbox name=auto></label></div>" html += "<div><label title=\"Make all threads auto update\">Auto Update Global<input type=checkbox name=autoG></label></div>"
html += "<div><label title=\"Make this thread auto update\">Auto Update Local<input type=checkbox name=autoL></label></div>"
html += "<div><label>Interval (s)<input type=text name=interval></label></div>" html += "<div><label>Interval (s)<input type=text name=interval></label></div>"
html += "<div><input type=button value='Update Now'></div>" html += "<div><input type=button value='Update Now'></div>"
div = new Dialog('updater', 'topright', html).el div = new Dialog('updater', 'topright', html).el
auto = $ 'input[name=auto]', div autoG = $('input[name=autoG]', div)
auto.addEventListener 'click', updateAuto, true autoG.addEventListener 'click', changeCheckbox, true
autoG.checked = GM_getValue 'autoG', false
autoL = $ 'input[name=autoL]', div
autoL.addEventListener 'click', updateAuto, true
interval = $ 'input[name=interval]', div interval = $ 'input[name=interval]', div
interval.value = GM_getValue 'Interval', 10 interval.value = GM_getValue 'Interval', 10
interval.addEventListener 'change', updateInterval, true interval.addEventListener 'change', updateInterval, true
$('input[type=button]', div).addEventListener 'click', updateNow, true $('input[type=button]', div).addEventListener 'click', updateNow, true
d.body.appendChild div d.body.appendChild div
if getConfig 'Auto Update' then auto.click()
if autoG.checked then autoL.click()
watch = -> watch = ->
id = @nextSibling.name id = @nextSibling.name
@ -1165,7 +1173,7 @@ if getConfig 'Image Expansion'
thumbs = $$ 'img[md5]', root thumbs = $$ 'img[md5]', root
for thumb in thumbs for thumb in thumbs
thumb.parentNode.addEventListener 'click', imageClick, true thumb.parentNode.addEventListener 'click', imageClick, true
if g.expand then imageFull thumb if g.expand then imageToggle thumb.parentNode
if getConfig 'Localize Time' if getConfig 'Localize Time'
g.callbacks.push (root) -> g.callbacks.push (root) ->

View File

@ -5,7 +5,6 @@
'404 Redirect': [true, 'Redirect dead threads'], '404 Redirect': [true, 'Redirect dead threads'],
'Anonymize': [false, 'Make everybody anonymous'], 'Anonymize': [false, 'Make everybody anonymous'],
'Auto Watch': [true, 'Automatically watch threads that you start (Firefox only)'], 'Auto Watch': [true, 'Automatically watch threads that you start (Firefox only)'],
'Auto Update': [true, 'Automatically enable automatic updating'],
'Comment Expansion': [true, 'Expand too long comments'], 'Comment Expansion': [true, 'Expand too long comments'],
'Image Expansion': [true, 'Expand images'], 'Image Expansion': [true, 'Expand images'],
'Keybinds': [false, 'Binds actions to keys'], 'Keybinds': [false, 'Binds actions to keys'],
@ -1151,21 +1150,25 @@
return g.req = request(url, updateCallback); return g.req = request(url, updateCallback);
}; };
updaterMake = function() { updaterMake = function() {
var auto, div, html, interval; var autoG, autoL, div, html, interval;
html = "<div class=move><span id=count></span> <span id=timer>Thread Updater</span></div>"; html = "<div class=move><span id=count></span> <span id=timer>Thread Updater</span></div>";
html += "<div><label>Auto Update<input type=checkbox name=auto></label></div>"; html += "<div><label title=\"Make all threads auto update\">Auto Update Global<input type=checkbox name=autoG></label></div>";
html += "<div><label title=\"Make this thread auto update\">Auto Update Local<input type=checkbox name=autoL></label></div>";
html += "<div><label>Interval (s)<input type=text name=interval></label></div>"; html += "<div><label>Interval (s)<input type=text name=interval></label></div>";
html += "<div><input type=button value='Update Now'></div>"; html += "<div><input type=button value='Update Now'></div>";
div = new Dialog('updater', 'topright', html).el; div = new Dialog('updater', 'topright', html).el;
auto = $('input[name=auto]', div); autoG = $('input[name=autoG]', div);
auto.addEventListener('click', updateAuto, true); autoG.addEventListener('click', changeCheckbox, true);
autoG.checked = GM_getValue('autoG', false);
autoL = $('input[name=autoL]', div);
autoL.addEventListener('click', updateAuto, true);
interval = $('input[name=interval]', div); interval = $('input[name=interval]', div);
interval.value = GM_getValue('Interval', 10); interval.value = GM_getValue('Interval', 10);
interval.addEventListener('change', updateInterval, true); interval.addEventListener('change', updateInterval, true);
$('input[type=button]', div).addEventListener('click', updateNow, true); $('input[type=button]', div).addEventListener('click', updateNow, true);
d.body.appendChild(div); d.body.appendChild(div);
if (getConfig('Auto Update')) { if (autoG.checked) {
return auto.click(); return autoL.click();
} }
}; };
watch = function() { watch = function() {
@ -1449,7 +1452,7 @@
for (_i = 0, _len = thumbs.length; _i < _len; _i++) { for (_i = 0, _len = thumbs.length; _i < _len; _i++) {
thumb = thumbs[_i]; thumb = thumbs[_i];
thumb.parentNode.addEventListener('click', imageClick, true); thumb.parentNode.addEventListener('click', imageClick, true);
_results.push(g.expand ? imageFull(thumb) : void 0); _results.push(g.expand ? imageToggle(thumb.parentNode) : void 0);
} }
return _results; return _results;
}); });