From c26e0cd1f6c5fa44dc4a2b1cc32553f73bfeb2b1 Mon Sep 17 00:00:00 2001 From: James Campos Date: Sun, 26 Dec 2010 16:54:40 -0800 Subject: [PATCH] auto auto updating --- 4chan_x.coffee | 5 ++++- 4chan_x.js | 11 ++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/4chan_x.coffee b/4chan_x.coffee index 6ff19083a..38f2c744b 100644 --- a/4chan_x.coffee +++ b/4chan_x.coffee @@ -10,6 +10,7 @@ config = '404 Redirect': [true, 'Redirect dead threads'] 'Anonymize': [false, 'Make everybody anonymous'] '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'] 'Image Expansion': [true, 'Expand images'] 'Keybinds': [false, 'Binds actions to keys'] @@ -856,9 +857,11 @@ updaterMake = -> div.innerHTML = html $('div.move', div).addEventListener 'mousedown', AEOS.move, true - $('input[type=checkbox]', div).addEventListener 'click', updateAuto, true + cb = $ 'input[type=checkbox]', div + cb.addEventListener 'click', updateAuto, true $('input[type=button]', div).addEventListener 'click', updateNow, true document.body.appendChild div + if getConfig 'Auto Update' then cb.click() watch = -> id = @nextSibling.name diff --git a/4chan_x.js b/4chan_x.js index 7c3bcfc92..d65018cf6 100644 --- a/4chan_x.js +++ b/4chan_x.js @@ -10,6 +10,7 @@ '404 Redirect': [true, 'Redirect dead threads'], 'Anonymize': [false, 'Make everybody anonymous'], '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'], 'Image Expansion': [true, 'Expand images'], 'Keybinds': [false, 'Binds actions to keys'], @@ -1115,16 +1116,20 @@ return request(location.href, updateCallback); }; updaterMake = function() { - var div, html; + var cb, div, html; div = AEOS.makeDialog('updater', 'topright'); html = "
Thread Updater
"; html += "
"; html += "
"; div.innerHTML = html; $('div.move', div).addEventListener('mousedown', AEOS.move, true); - $('input[type=checkbox]', div).addEventListener('click', updateAuto, true); + cb = $('input[type=checkbox]', div); + cb.addEventListener('click', updateAuto, true); $('input[type=button]', div).addEventListener('click', updateNow, true); - return document.body.appendChild(div); + document.body.appendChild(div); + if (getConfig('Auto Update')) { + return cb.click(); + } }; watch = function() { var id, text, _base, _name;