diff --git a/CHANGELOG.md b/CHANGELOG.md index bee6012ff..84f062a09 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ seaweedchan: - Chrome doesn't get .null, so don't style it +- Fix count when auto update is disabled and set updater text to "Update" ### 1.1.2 - 2013-04-26 seaweedchan: diff --git a/LICENSE b/LICENSE index 74426cca1..0ae73dadb 100644 --- a/LICENSE +++ b/LICENSE @@ -1,5 +1,5 @@ /* -* 4chan X - Version 1.1.2 - 2013-04-27 +* 4chan X - Version 1.1.2 - 2013-04-28 * * Licensed under the MIT license. * https://github.com/seaweedchan/4chan-x/blob/master/LICENSE diff --git a/builds/4chan-X.js b/builds/4chan-X.js index 83136a37c..0cdfbb973 100644 --- a/builds/4chan-X.js +++ b/builds/4chan-X.js @@ -18,7 +18,7 @@ // @icon data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwAgMAAAAqbBEUAAAACVBMVEUAAGcAAABmzDNZt9VtAAAAAXRSTlMAQObYZgAAAHFJREFUKFOt0LENACEIBdBv4Qju4wgWanEj3D6OcIVMKaitYHEU/jwTCQj8W75kiVCSBvdQ5/AvfVHBin11BgdRq3ysBgfwBDRrj3MCIA+oAQaku/Q1cNctrAmyDl577tOThYt/Y1RBM4DgOHzM0HFTAyLukH/cmRnqAAAAAElFTkSuQmCC // ==/UserScript== /* -* 4chan X - Version 1.1.2 - 2013-04-27 +* 4chan X - Version 1.1.2 - 2013-04-28 * * Licensed under the MIT license. * https://github.com/seaweedchan/4chan-x/blob/master/LICENSE @@ -6668,6 +6668,8 @@ if (input.name === 'Scroll BG') { $.on(input, 'change', ThreadUpdater.cb.scrollBG); ThreadUpdater.cb.scrollBG(); + } else if (input.name === 'Auto Update') { + $.on(input, 'change', ThreadUpdater.update); } subEntries.push({ el: el @@ -6763,7 +6765,8 @@ if (ThreadUpdater.online) { return ThreadUpdater.timeoutID = setTimeout(ThreadUpdater.timeout, 1000); } else { - return clearTimeout(ThreadUpdater.timeoutID); + clearTimeout(ThreadUpdater.timeoutID); + return ThreadUpdater.set('timer', 'Update'); } }, interval: function() { @@ -6785,7 +6788,9 @@ g.DEAD = false; ThreadUpdater.parse(JSON.parse(req.response).posts); ThreadUpdater.lastModified = req.getResponseHeader('Last-Modified'); - ThreadUpdater.set('timer', ThreadUpdater.getInterval()); + if (Conf['Auto Update']) { + ThreadUpdater.set('timer', ThreadUpdater.getInterval()); + } break; case 404: g.DEAD = true; @@ -6799,8 +6804,10 @@ }); break; default: - ThreadUpdater.outdateCount++; - ThreadUpdater.set('timer', ThreadUpdater.getInterval()); + if (Conf['Auto Update']) { + ThreadUpdater.outdateCount++; + ThreadUpdater.set('timer', ThreadUpdater.getInterval()); + } /* Status Code 304: Not modified By sending the `If-Modified-Since` header we get a proper status code, and no response. @@ -6866,7 +6873,11 @@ return; } ThreadUpdater.seconds = 0; - ThreadUpdater.set('timer', '...'); + if (Conf['Auto Update']) { + ThreadUpdater.set('timer', '...'); + } else { + ThreadUpdater.set('timer', 'Update'); + } if (ThreadUpdater.req) { ThreadUpdater.req.onloadend = null; ThreadUpdater.req.abort(); diff --git a/builds/4chan-X.user.js b/builds/4chan-X.user.js index fc9390c7a..abd1a9bb3 100644 --- a/builds/4chan-X.user.js +++ b/builds/4chan-X.user.js @@ -18,7 +18,7 @@ // @icon data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwAgMAAAAqbBEUAAAACVBMVEUAAGcAAABmzDNZt9VtAAAAAXRSTlMAQObYZgAAAHFJREFUKFOt0LENACEIBdBv4Qju4wgWanEj3D6OcIVMKaitYHEU/jwTCQj8W75kiVCSBvdQ5/AvfVHBin11BgdRq3ysBgfwBDRrj3MCIA+oAQaku/Q1cNctrAmyDl577tOThYt/Y1RBM4DgOHzM0HFTAyLukH/cmRnqAAAAAElFTkSuQmCC // ==/UserScript== /* -* 4chan X - Version 1.1.2 - 2013-04-27 +* 4chan X - Version 1.1.2 - 2013-04-28 * * Licensed under the MIT license. * https://github.com/seaweedchan/4chan-x/blob/master/LICENSE @@ -6689,6 +6689,8 @@ if (input.name === 'Scroll BG') { $.on(input, 'change', ThreadUpdater.cb.scrollBG); ThreadUpdater.cb.scrollBG(); + } else if (input.name === 'Auto Update') { + $.on(input, 'change', ThreadUpdater.update); } subEntries.push({ el: el @@ -6784,7 +6786,8 @@ if (ThreadUpdater.online) { return ThreadUpdater.timeoutID = setTimeout(ThreadUpdater.timeout, 1000); } else { - return clearTimeout(ThreadUpdater.timeoutID); + clearTimeout(ThreadUpdater.timeoutID); + return ThreadUpdater.set('timer', 'Update'); } }, interval: function() { @@ -6806,7 +6809,9 @@ g.DEAD = false; ThreadUpdater.parse(JSON.parse(req.response).posts); ThreadUpdater.lastModified = req.getResponseHeader('Last-Modified'); - ThreadUpdater.set('timer', ThreadUpdater.getInterval()); + if (Conf['Auto Update']) { + ThreadUpdater.set('timer', ThreadUpdater.getInterval()); + } break; case 404: g.DEAD = true; @@ -6820,8 +6825,10 @@ }); break; default: - ThreadUpdater.outdateCount++; - ThreadUpdater.set('timer', ThreadUpdater.getInterval()); + if (Conf['Auto Update']) { + ThreadUpdater.outdateCount++; + ThreadUpdater.set('timer', ThreadUpdater.getInterval()); + } /* Status Code 304: Not modified By sending the `If-Modified-Since` header we get a proper status code, and no response. @@ -6887,7 +6894,11 @@ return; } ThreadUpdater.seconds = 0; - ThreadUpdater.set('timer', '...'); + if (Conf['Auto Update']) { + ThreadUpdater.set('timer', '...'); + } else { + ThreadUpdater.set('timer', 'Update'); + } if (ThreadUpdater.req) { ThreadUpdater.req.onloadend = null; ThreadUpdater.req.abort(); diff --git a/builds/crx/script.js b/builds/crx/script.js index 6f31df349..0940138fc 100644 --- a/builds/crx/script.js +++ b/builds/crx/script.js @@ -1,5 +1,5 @@ /* -* 4chan X - Version 1.1.2 - 2013-04-27 +* 4chan X - Version 1.1.2 - 2013-04-28 * * Licensed under the MIT license. * https://github.com/seaweedchan/4chan-x/blob/master/LICENSE @@ -6668,6 +6668,8 @@ if (input.name === 'Scroll BG') { $.on(input, 'change', ThreadUpdater.cb.scrollBG); ThreadUpdater.cb.scrollBG(); + } else if (input.name === 'Auto Update') { + $.on(input, 'change', ThreadUpdater.update); } subEntries.push({ el: el @@ -6763,7 +6765,8 @@ if (ThreadUpdater.online) { return ThreadUpdater.timeoutID = setTimeout(ThreadUpdater.timeout, 1000); } else { - return clearTimeout(ThreadUpdater.timeoutID); + clearTimeout(ThreadUpdater.timeoutID); + return ThreadUpdater.set('timer', 'Update'); } }, interval: function() { @@ -6785,7 +6788,9 @@ g.DEAD = false; ThreadUpdater.parse(JSON.parse(req.response).posts); ThreadUpdater.lastModified = req.getResponseHeader('Last-Modified'); - ThreadUpdater.set('timer', ThreadUpdater.getInterval()); + if (Conf['Auto Update']) { + ThreadUpdater.set('timer', ThreadUpdater.getInterval()); + } break; case 404: g.DEAD = true; @@ -6799,8 +6804,10 @@ }); break; default: - ThreadUpdater.outdateCount++; - ThreadUpdater.set('timer', ThreadUpdater.getInterval()); + if (Conf['Auto Update']) { + ThreadUpdater.outdateCount++; + ThreadUpdater.set('timer', ThreadUpdater.getInterval()); + } /* Status Code 304: Not modified By sending the `If-Modified-Since` header we get a proper status code, and no response. @@ -6866,7 +6873,11 @@ return; } ThreadUpdater.seconds = 0; - ThreadUpdater.set('timer', '...'); + if (Conf['Auto Update']) { + ThreadUpdater.set('timer', '...'); + } else { + ThreadUpdater.set('timer', 'Update'); + } if (ThreadUpdater.req) { ThreadUpdater.req.onloadend = null; ThreadUpdater.req.abort(); diff --git a/src/Monitoring/ThreadUpdater.coffee b/src/Monitoring/ThreadUpdater.coffee index 7180fc746..43a1d1465 100644 --- a/src/Monitoring/ThreadUpdater.coffee +++ b/src/Monitoring/ThreadUpdater.coffee @@ -28,6 +28,8 @@ ThreadUpdater = if input.name is 'Scroll BG' $.on input, 'change', ThreadUpdater.cb.scrollBG ThreadUpdater.cb.scrollBG() + else if input.name is 'Auto Update' + $.on input, 'change', ThreadUpdater.update subEntries.push el: el settings = $.el 'span', @@ -74,7 +76,9 @@ ThreadUpdater = if ThreadUpdater.online = navigator.onLine ThreadUpdater.outdateCount = 0 ThreadUpdater.set 'timer', ThreadUpdater.getInterval() + ThreadUpdater.update() + ThreadUpdater.set 'status', null, null else ThreadUpdater.set 'timer', null @@ -106,6 +110,7 @@ ThreadUpdater = ThreadUpdater.timeoutID = setTimeout ThreadUpdater.timeout, 1000 else clearTimeout ThreadUpdater.timeoutID + ThreadUpdater.set 'timer', 'Update' interval: -> val = +@value if val < 1 then val = 1 @@ -118,7 +123,8 @@ ThreadUpdater = g.DEAD = false ThreadUpdater.parse JSON.parse(req.response).posts ThreadUpdater.lastModified = req.getResponseHeader 'Last-Modified' - ThreadUpdater.set 'timer', ThreadUpdater.getInterval() + if Conf['Auto Update'] + ThreadUpdater.set 'timer', ThreadUpdater.getInterval() when 404 g.DEAD = true ThreadUpdater.set 'timer', null @@ -129,8 +135,9 @@ ThreadUpdater = 404: true thread: ThreadUpdater.thread else - ThreadUpdater.outdateCount++ - ThreadUpdater.set 'timer', ThreadUpdater.getInterval() + if Conf['Auto Update'] + ThreadUpdater.outdateCount++ + ThreadUpdater.set 'timer', ThreadUpdater.getInterval() ### Status Code 304: Not modified By sending the `If-Modified-Since` header we get a proper status code, and no response. @@ -188,7 +195,10 @@ ThreadUpdater = update: -> return unless ThreadUpdater.online ThreadUpdater.seconds = 0 - ThreadUpdater.set 'timer', '...' + if Conf['Auto Update'] + ThreadUpdater.set 'timer', '...' + else + ThreadUpdater.set 'timer', 'Update' if ThreadUpdater.req # abort() triggers onloadend, we don't want that. ThreadUpdater.req.onloadend = null