updater verbose option
This commit is contained in:
parent
0cf4819749
commit
49b0d9796a
@ -834,9 +834,10 @@ updateCallback = ->
|
|||||||
while (reply = replies.pop()) and (Number reply.id > id)
|
while (reply = replies.pop()) and (Number reply.id > id)
|
||||||
arr.push reply
|
arr.push reply
|
||||||
|
|
||||||
l = arr.length
|
if g.verbose
|
||||||
count.textContent = "+#{l}"
|
l = arr.length
|
||||||
if l > 0 then count.className = 'new'
|
count.textContent = "+#{l}"
|
||||||
|
if l > 0 then count.className = 'new'
|
||||||
|
|
||||||
#insert replies in order, so backlinks resolve
|
#insert replies in order, so backlinks resolve
|
||||||
while reply = arr.pop()
|
while reply = arr.pop()
|
||||||
@ -871,7 +872,10 @@ updateTime = ->
|
|||||||
time = 0
|
time = 0
|
||||||
g.req.abort()
|
g.req.abort()
|
||||||
updateNow()
|
updateNow()
|
||||||
$("#updater #count").textContent = 'retry'
|
if g.verbose
|
||||||
|
count = $ '#updater #count'
|
||||||
|
count.textContent = 'retry'
|
||||||
|
count.className = ''
|
||||||
else
|
else
|
||||||
span.textContent = time
|
span.textContent = time
|
||||||
|
|
||||||
@ -902,25 +906,41 @@ updateInterval = ->
|
|||||||
updateNow = ->
|
updateNow = ->
|
||||||
url = location.href + '?' + new Date().getTime() # fool the cache
|
url = location.href + '?' + new Date().getTime() # fool the cache
|
||||||
g.req = request url, updateCallback
|
g.req = request url, updateCallback
|
||||||
count = $ '#updater #count'
|
|
||||||
count.textContent = ''
|
|
||||||
count.className = ''
|
|
||||||
$("#updater #timer").textContent = 0
|
$("#updater #timer").textContent = 0
|
||||||
|
|
||||||
|
updateVerbose = ->
|
||||||
|
g.verbose = @checked
|
||||||
|
timer = $ '#updater #timer'
|
||||||
|
if @checked
|
||||||
|
timer.hidden = false
|
||||||
|
else
|
||||||
|
timer.hidden = true
|
||||||
|
$("#updater #count").textContent = 'Thread Updater'
|
||||||
|
|
||||||
updaterMake = ->
|
updaterMake = ->
|
||||||
html = "<div class=move><span id=count></span> <span id=timer>Thread Updater</span></div>"
|
html = "<div class=move><span id=count>Thread Updater</span> <span id=timer></span></div>"
|
||||||
|
html += "<div><label>Verbose<input type=checkbox name=verbose></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 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 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
|
||||||
|
|
||||||
autoG = $('input[name=autoG]', div)
|
for input in $$ 'input[type=checkbox]', div
|
||||||
autoG.addEventListener 'click', changeCheckbox, true
|
input.addEventListener 'click', changeCheckbox, true
|
||||||
autoG.checked = GM_getValue 'autoG', false
|
name = input.name
|
||||||
|
if name is 'autoL'
|
||||||
|
input.checked = GM_getValue 'autoG', true
|
||||||
|
else
|
||||||
|
input.checked = GM_getValue name, true
|
||||||
|
switch name
|
||||||
|
when 'autoL'
|
||||||
|
input.addEventListener 'click', updateAuto, true
|
||||||
|
when 'verbose'
|
||||||
|
input.addEventListener 'click', updateVerbose, true
|
||||||
|
|
||||||
autoL = $ 'input[name=autoL]', div
|
unless g.verbose = GM_getValue 'verbose', true
|
||||||
autoL.addEventListener 'click', updateAuto, true
|
$("#timer", div).hidden = true
|
||||||
|
|
||||||
interval = $ 'input[name=interval]', div
|
interval = $ 'input[name=interval]', div
|
||||||
interval.value = GM_getValue 'Interval', 10
|
interval.value = GM_getValue 'Interval', 10
|
||||||
@ -930,7 +950,7 @@ updaterMake = ->
|
|||||||
|
|
||||||
d.body.appendChild div
|
d.body.appendChild div
|
||||||
|
|
||||||
if autoG.checked then autoL.click()
|
if GM_getValue 'autoG' then updateAuto.call $("input[name=autoL]", div)
|
||||||
|
|
||||||
watch = ->
|
watch = ->
|
||||||
id = @nextSibling.name
|
id = @nextSibling.name
|
||||||
|
|||||||
71
4chan_x.js
71
4chan_x.js
@ -56,7 +56,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
var $, $$, DAY, Dialog, a, arr, as, autoWatch, autohide, b, board, callback, changeCheckbox, changeValue, clearHidden, closeQR, config, cooldown, cutoff, d, delform, down, editSauce, el, expand, expandComment, expandThread, formSubmit, g, getConfig, getThread, getTime, hide, hideReply, hideThread, href, html, i, id, iframe, iframeLoad, imageClick, imageExpand, imageExpandClick, imageResize, imageThumb, imageToggle, imageType, imageTypeChange, img, inAfter, inBefore, input, inputs, keyModeInsert, keyModeNormal, keydown, keypress, l1, lastChecked, m, mv, n, navbotr, navtopr, nodeInserted, now, omitted, onloadComment, onloadThread, option, options, parseResponse, pathname, qrListener, qrText, quickReply, recaptcha, recaptchaListener, recaptchaReload, redirect, replace, replyNav, report, request, rm, scroll, scrollThread, show, showReply, showThread, slice, span, src, start, stopPropagation, temp, text, textContent, thread, threadF, threads, tn, tzOffset, up, updateAuto, updateCallback, updateFavicon, updateInterval, updateNow, updateTime, updateTitle, updaterMake, watch, watchX, watcher, watcherUpdate, x, zeroPad, _, _base, _i, _j, _k, _l, _len, _len2, _len3, _len4, _len5, _len6, _len7, _m, _n, _ref, _ref2, _ref3, _ref4, _ref5, _ref6;
|
var $, $$, DAY, Dialog, a, arr, as, autoWatch, autohide, b, board, callback, changeCheckbox, changeValue, clearHidden, closeQR, config, cooldown, cutoff, d, delform, down, editSauce, el, expand, expandComment, expandThread, formSubmit, g, getConfig, getThread, getTime, hide, hideReply, hideThread, href, html, i, id, iframe, iframeLoad, imageClick, imageExpand, imageExpandClick, imageResize, imageThumb, imageToggle, imageType, imageTypeChange, img, inAfter, inBefore, input, inputs, keyModeInsert, keyModeNormal, keydown, keypress, l1, lastChecked, m, mv, n, navbotr, navtopr, nodeInserted, now, omitted, onloadComment, onloadThread, option, options, parseResponse, pathname, qrListener, qrText, quickReply, recaptcha, recaptchaListener, recaptchaReload, redirect, replace, replyNav, report, request, rm, scroll, scrollThread, show, showReply, showThread, slice, span, src, start, stopPropagation, temp, text, textContent, thread, threadF, threads, tn, tzOffset, up, updateAuto, updateCallback, updateFavicon, updateInterval, updateNow, updateTime, updateTitle, updateVerbose, updaterMake, watch, watchX, watcher, watcherUpdate, x, zeroPad, _, _base, _i, _j, _k, _l, _len, _len2, _len3, _len4, _len5, _len6, _len7, _m, _n, _ref, _ref2, _ref3, _ref4, _ref5, _ref6;
|
||||||
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, __slice = Array.prototype.slice;
|
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, __slice = Array.prototype.slice;
|
||||||
config = {
|
config = {
|
||||||
'404 Redirect': [true, 'Redirect dead threads'],
|
'404 Redirect': [true, 'Redirect dead threads'],
|
||||||
@ -1153,10 +1153,12 @@
|
|||||||
while ((reply = replies.pop()) && (Number(reply.id > id))) {
|
while ((reply = replies.pop()) && (Number(reply.id > id))) {
|
||||||
arr.push(reply);
|
arr.push(reply);
|
||||||
}
|
}
|
||||||
l = arr.length;
|
if (g.verbose) {
|
||||||
count.textContent = "+" + l;
|
l = arr.length;
|
||||||
if (l > 0) {
|
count.textContent = "+" + l;
|
||||||
count.className = 'new';
|
if (l > 0) {
|
||||||
|
count.className = 'new';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
while (reply = arr.pop()) {
|
while (reply = arr.pop()) {
|
||||||
table = x('ancestor::table', reply);
|
table = x('ancestor::table', reply);
|
||||||
@ -1186,7 +1188,7 @@
|
|||||||
return replace(favicon, clone);
|
return replace(favicon, clone);
|
||||||
};
|
};
|
||||||
updateTime = function() {
|
updateTime = function() {
|
||||||
var span, time;
|
var count, span, time;
|
||||||
span = $('#updater #timer');
|
span = $('#updater #timer');
|
||||||
time = Number(span.textContent);
|
time = Number(span.textContent);
|
||||||
if (++time === 0) {
|
if (++time === 0) {
|
||||||
@ -1195,7 +1197,11 @@
|
|||||||
time = 0;
|
time = 0;
|
||||||
g.req.abort();
|
g.req.abort();
|
||||||
updateNow();
|
updateNow();
|
||||||
return $("#updater #count").textContent = 'retry';
|
if (g.verbose) {
|
||||||
|
count = $('#updater #count');
|
||||||
|
count.textContent = 'retry';
|
||||||
|
return count.className = '';
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
return span.textContent = time;
|
return span.textContent = time;
|
||||||
}
|
}
|
||||||
@ -1230,34 +1236,59 @@
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
updateNow = function() {
|
updateNow = function() {
|
||||||
var count, url;
|
var url;
|
||||||
url = location.href + '?' + new Date().getTime();
|
url = location.href + '?' + new Date().getTime();
|
||||||
g.req = request(url, updateCallback);
|
g.req = request(url, updateCallback);
|
||||||
count = $('#updater #count');
|
|
||||||
count.textContent = '';
|
|
||||||
count.className = '';
|
|
||||||
return $("#updater #timer").textContent = 0;
|
return $("#updater #timer").textContent = 0;
|
||||||
};
|
};
|
||||||
|
updateVerbose = function() {
|
||||||
|
var timer;
|
||||||
|
g.verbose = this.checked;
|
||||||
|
timer = $('#updater #timer');
|
||||||
|
if (this.checked) {
|
||||||
|
return timer.hidden = false;
|
||||||
|
} else {
|
||||||
|
timer.hidden = true;
|
||||||
|
return $("#updater #count").textContent = 'Thread Updater';
|
||||||
|
}
|
||||||
|
};
|
||||||
updaterMake = function() {
|
updaterMake = function() {
|
||||||
var autoG, autoL, div, html, interval;
|
var div, html, input, interval, name, _i, _len, _ref;
|
||||||
html = "<div class=move><span id=count></span> <span id=timer>Thread Updater</span></div>";
|
html = "<div class=move><span id=count>Thread Updater</span> <span id=timer></span></div>";
|
||||||
|
html += "<div><label>Verbose<input type=checkbox name=verbose></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 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 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;
|
||||||
autoG = $('input[name=autoG]', div);
|
_ref = $$('input[type=checkbox]', div);
|
||||||
autoG.addEventListener('click', changeCheckbox, true);
|
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||||
autoG.checked = GM_getValue('autoG', false);
|
input = _ref[_i];
|
||||||
autoL = $('input[name=autoL]', div);
|
input.addEventListener('click', changeCheckbox, true);
|
||||||
autoL.addEventListener('click', updateAuto, true);
|
name = input.name;
|
||||||
|
if (name === 'autoL') {
|
||||||
|
input.checked = GM_getValue('autoG', true);
|
||||||
|
} else {
|
||||||
|
input.checked = GM_getValue(name, true);
|
||||||
|
}
|
||||||
|
switch (name) {
|
||||||
|
case 'autoL':
|
||||||
|
input.addEventListener('click', updateAuto, true);
|
||||||
|
break;
|
||||||
|
case 'verbose':
|
||||||
|
input.addEventListener('click', updateVerbose, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!(g.verbose = GM_getValue('verbose', true))) {
|
||||||
|
$("#timer", div).hidden = 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 (autoG.checked) {
|
if (GM_getValue('autoG')) {
|
||||||
return autoL.click();
|
return updateAuto.call($("input[name=autoL]", div));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
watch = function() {
|
watch = function() {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user