move getConfig, zeroPad to $
This commit is contained in:
parent
664acccb04
commit
6dc60e79a4
90
4chan_x.js
90
4chan_x.js
@ -56,7 +56,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
var $, $$, DAY, a, arr, as, autoWatch, callback, changeCheckbox, changeValue, clearHidden, closeQR, config, cooldown, cutoff, d, delform, down, editSauce, el, expand, expandComment, expandThread, g, getConfig, getThread, hideReply, hideThread, href, html, i, id, imageClick, imageExpand, imageExpandClick, imageHover, imageResize, imageThumb, imageToggle, imageType, imageTypeChange, img, input, inputs, keyModeInsert, keyModeNormal, keydown, keypress, l1, lastChecked, log, navbotr, navtopr, nodeInserted, now, omitted, onloadComment, onloadThread, option, options, parseResponse, pathname, qr, recaptcha, recaptchaListener, recaptchaReload, redirect, replyNav, report, request, scroll, scrollThread, showReply, showThread, span, src, start, stopPropagation, temp, text, textContent, threadF, threads, tzOffset, ui, up, updateAuto, updateCallback, updateFavicon, updateInterval, updateNow, updateTime, updateTitle, updateVerbose, updaterMake, watch, watchX, watcher, watcherUpdate, zeroPad, _i, _j, _k, _l, _len, _len2, _len3, _len4, _len5, _len6, _len7, _m, _n, _ref, _ref2, _ref3, _ref4;
|
var $, $$, DAY, a, arr, as, autoWatch, callback, changeCheckbox, changeValue, clearHidden, closeQR, config, cooldown, cutoff, d, delform, down, editSauce, el, expand, expandComment, expandThread, g, getThread, hideReply, hideThread, href, html, i, id, imageClick, imageExpand, imageExpandClick, imageHover, imageResize, imageThumb, imageToggle, imageType, imageTypeChange, img, input, inputs, keyModeInsert, keyModeNormal, keydown, keypress, l1, lastChecked, log, navbotr, navtopr, nodeInserted, now, omitted, onloadComment, onloadThread, option, options, parseResponse, pathname, qr, recaptcha, recaptchaListener, recaptchaReload, redirect, replyNav, report, request, scroll, scrollThread, showReply, showThread, span, src, start, stopPropagation, temp, text, textContent, threadF, threads, tzOffset, ui, up, updateAuto, updateCallback, updateFavicon, updateInterval, updateNow, updateTime, updateTitle, updateVerbose, updaterMake, watch, watchX, watcher, watcherUpdate, _i, _j, _k, _l, _len, _len2, _len3, _len4, _len5, _len6, _len7, _m, _n, _ref, _ref2, _ref3, _ref4;
|
||||||
var __slice = Array.prototype.slice;
|
var __slice = Array.prototype.slice;
|
||||||
if (typeof console != "undefined" && console !== null) {
|
if (typeof console != "undefined" && console !== null) {
|
||||||
log = console.log;
|
log = console.log;
|
||||||
@ -242,6 +242,16 @@
|
|||||||
return object;
|
return object;
|
||||||
};
|
};
|
||||||
$.extend($, {
|
$.extend($, {
|
||||||
|
config: function(name) {
|
||||||
|
return GM_getValue(name, config[name][0]);
|
||||||
|
},
|
||||||
|
zeroPad: function(n) {
|
||||||
|
if (n < 10) {
|
||||||
|
return '0' + n;
|
||||||
|
} else {
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
},
|
||||||
slice: function(arr, id) {
|
slice: function(arr, id) {
|
||||||
var el, i, _len;
|
var el, i, _len;
|
||||||
for (i = 0, _len = arr.length; i < _len; i++) {
|
for (i = 0, _len = arr.length; i < _len; i++) {
|
||||||
@ -364,16 +374,6 @@
|
|||||||
}
|
}
|
||||||
return _results;
|
return _results;
|
||||||
};
|
};
|
||||||
getConfig = function(name) {
|
|
||||||
return GM_getValue(name, config[name][0]);
|
|
||||||
};
|
|
||||||
zeroPad = function(n) {
|
|
||||||
if (n < 10) {
|
|
||||||
return '0' + n;
|
|
||||||
} else {
|
|
||||||
return n;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
autoWatch = function() {
|
autoWatch = function() {
|
||||||
var autoText;
|
var autoText;
|
||||||
autoText = $('textarea', this).value.slice(0, 25);
|
autoText = $('textarea', this).value.slice(0, 25);
|
||||||
@ -490,7 +490,7 @@
|
|||||||
trip = ((_ref = $('span.postertrip', reply)) != null ? _ref.textContent : void 0) || '';
|
trip = ((_ref = $('span.postertrip', reply)) != null ? _ref.textContent : void 0) || '';
|
||||||
table = $.x('ancestor::table', reply);
|
table = $.x('ancestor::table', reply);
|
||||||
$.hide(table);
|
$.hide(table);
|
||||||
if (getConfig('Show Stubs')) {
|
if ($.config('Show Stubs')) {
|
||||||
a = $.el('a', {
|
a = $.el('a', {
|
||||||
textContent: "[ + ] " + name + " " + trip,
|
textContent: "[ + ] " + name + " " + trip,
|
||||||
className: 'pointer'
|
className: 'pointer'
|
||||||
@ -512,7 +512,7 @@
|
|||||||
GM_setValue("hiddenThreads/" + g.BOARD + "/", JSON.stringify(g.hiddenThreads));
|
GM_setValue("hiddenThreads/" + g.BOARD + "/", JSON.stringify(g.hiddenThreads));
|
||||||
}
|
}
|
||||||
$.hide(div);
|
$.hide(div);
|
||||||
if (getConfig('Show Stubs')) {
|
if ($.config('Show Stubs')) {
|
||||||
if (span = $('.omittedposts', div)) {
|
if (span = $('.omittedposts', div)) {
|
||||||
num = Number(span.textContent.match(/\d+/)[0]);
|
num = Number(span.textContent.match(/\d+/)[0]);
|
||||||
} else {
|
} else {
|
||||||
@ -923,7 +923,7 @@
|
|||||||
for (option in config) {
|
for (option in config) {
|
||||||
value = config[option];
|
value = config[option];
|
||||||
description = value[1];
|
description = value[1];
|
||||||
checked = getConfig(option) ? "checked" : "";
|
checked = $.config(option) ? "checked" : "";
|
||||||
html += "<label title=\"" + description + "\">" + option + "<input " + checked + " name=\"" + option + "\" type=\"checkbox\"></label><br>";
|
html += "<label title=\"" + description + "\">" + option + "<input " + checked + " name=\"" + option + "\" type=\"checkbox\"></label><br>";
|
||||||
}
|
}
|
||||||
html += "<div><a class=sauce>Flavors</a></div>";
|
html += "<div><a class=sauce>Flavors</a></div>";
|
||||||
@ -999,7 +999,7 @@
|
|||||||
dialog = $('#qr');
|
dialog = $('#qr');
|
||||||
if (data === 'Post successful!') {
|
if (data === 'Post successful!') {
|
||||||
if (dialog) {
|
if (dialog) {
|
||||||
if (getConfig('Persistent QR')) {
|
if ($.config('Persistent QR')) {
|
||||||
qr.refresh(dialog);
|
qr.refresh(dialog);
|
||||||
} else {
|
} else {
|
||||||
$.remove(dialog);
|
$.remove(dialog);
|
||||||
@ -1107,7 +1107,7 @@
|
|||||||
value: $.x(xpath, link).name
|
value: $.x(xpath, link).name
|
||||||
});
|
});
|
||||||
$.append(clone, input);
|
$.append(clone, input);
|
||||||
} else if (getConfig('Persistent QR')) {
|
} else if ($.config('Persistent QR')) {
|
||||||
submit = $('input[type=submit]', clone);
|
submit = $('input[type=submit]', clone);
|
||||||
auto = $.el('label', {
|
auto = $.el('label', {
|
||||||
textContent: 'Auto'
|
textContent: 'Auto'
|
||||||
@ -1133,7 +1133,7 @@
|
|||||||
if (recaptcha = $('#recaptcha_response_field')) {
|
if (recaptcha = $('#recaptcha_response_field')) {
|
||||||
$.bind(recaptcha, 'keydown', recaptchaListener);
|
$.bind(recaptcha, 'keydown', recaptchaListener);
|
||||||
}
|
}
|
||||||
if (getConfig('Auto Watch')) {
|
if ($.config('Auto Watch')) {
|
||||||
html = $('b').innerHTML;
|
html = $('b').innerHTML;
|
||||||
_ref = html.match(/<!-- thread:(\d+),no:(\d+) -->/), _ = _ref[0], thread = _ref[1], id = _ref[2];
|
_ref = html.match(/<!-- thread:(\d+),no:(\d+) -->/), _ = _ref[0], thread = _ref[1], id = _ref[2];
|
||||||
if (thread === '0') {
|
if (thread === '0') {
|
||||||
@ -1316,7 +1316,7 @@
|
|||||||
input.value = 404;
|
input.value = 404;
|
||||||
}
|
}
|
||||||
s = '';
|
s = '';
|
||||||
if (getConfig('Unread Count')) {
|
if ($.config('Unread Count')) {
|
||||||
s += "(" + g.replies.length + ") ";
|
s += "(" + g.replies.length + ") ";
|
||||||
}
|
}
|
||||||
s += "/" + g.BOARD + "/ - 404";
|
s += "/" + g.BOARD + "/ - 404";
|
||||||
@ -1673,7 +1673,7 @@
|
|||||||
});
|
});
|
||||||
$.bind(a, 'click', options);
|
$.bind(a, 'click', options);
|
||||||
$.replace(navbotr, a);
|
$.replace(navbotr, a);
|
||||||
} else if (getConfig('404 Redirect') && d.title === '4chan - 404') {
|
} else if ($.config('404 Redirect') && d.title === '4chan - 404') {
|
||||||
redirect();
|
redirect();
|
||||||
} else {
|
} else {
|
||||||
return;
|
return;
|
||||||
@ -1702,7 +1702,7 @@
|
|||||||
g.replies = g.replies.slice(i);
|
g.replies = g.replies.slice(i);
|
||||||
return updateTitle();
|
return updateTitle();
|
||||||
};
|
};
|
||||||
if (getConfig('Image Expansion')) {
|
if ($.config('Image Expansion')) {
|
||||||
delform = $('form[name=delform]');
|
delform = $('form[name=delform]');
|
||||||
expand = $.el('div', {
|
expand = $.el('div', {
|
||||||
innerHTML: "<select id=imageType name=imageType><option>full</option><option>fit width</option><option>fit screen</option></select> <label>Expand Images<input type=checkbox id=imageExpand></label>"
|
innerHTML: "<select id=imageType name=imageType><option>full</option><option>fit width</option><option>fit screen</option></select> <label>Expand Images<input type=checkbox id=imageExpand></label>"
|
||||||
@ -1732,10 +1732,10 @@
|
|||||||
return _results;
|
return _results;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (getConfig('Image Hover')) {
|
if ($.config('Image Hover')) {
|
||||||
imageHover.init();
|
imageHover.init();
|
||||||
}
|
}
|
||||||
if (getConfig('Image Auto-Gif')) {
|
if ($.config('Image Auto-Gif')) {
|
||||||
g.callbacks.push(function(root) {
|
g.callbacks.push(function(root) {
|
||||||
var src, thumb, thumbs, _i, _len, _results;
|
var src, thumb, thumbs, _i, _len, _results;
|
||||||
thumbs = $$('img[md5]', root);
|
thumbs = $$('img[md5]', root);
|
||||||
@ -1748,7 +1748,7 @@
|
|||||||
return _results;
|
return _results;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (getConfig('Localize Time')) {
|
if ($.config('Localize Time')) {
|
||||||
g.callbacks.push(function(root) {
|
g.callbacks.push(function(root) {
|
||||||
var date, day, dotw, hour, min_sec, month, s, span, spans, year, _, _i, _len, _ref, _results;
|
var date, day, dotw, hour, min_sec, month, s, span, spans, year, _, _i, _len, _ref, _results;
|
||||||
spans = $$('span[id^=no]', root);
|
spans = $$('span[id^=no]', root);
|
||||||
@ -1762,16 +1762,16 @@
|
|||||||
hour = g.chanOffset + Number(hour);
|
hour = g.chanOffset + Number(hour);
|
||||||
date = new Date(year, month, day, hour);
|
date = new Date(year, month, day, hour);
|
||||||
year = date.getFullYear() - 2000;
|
year = date.getFullYear() - 2000;
|
||||||
month = zeroPad(date.getMonth() + 1);
|
month = $.zeroPad(date.getMonth() + 1);
|
||||||
day = zeroPad(date.getDate());
|
day = $.zeroPad(date.getDate());
|
||||||
hour = zeroPad(date.getHours());
|
hour = $.zeroPad(date.getHours());
|
||||||
dotw = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'][date.getDay()];
|
dotw = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'][date.getDay()];
|
||||||
_results.push(s.textContent = " " + month + "/" + day + "/" + year + "(" + dotw + ")" + hour + ":" + min_sec + " ");
|
_results.push(s.textContent = " " + month + "/" + day + "/" + year + "(" + dotw + ")" + hour + ":" + min_sec + " ");
|
||||||
}
|
}
|
||||||
return _results;
|
return _results;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (getConfig('Sauce')) {
|
if ($.config('Sauce')) {
|
||||||
g.callbacks.push(function(root) {
|
g.callbacks.push(function(root) {
|
||||||
var i, l, link, names, prefix, prefixes, span, spans, suffix, _i, _len, _results;
|
var i, l, link, names, prefix, prefixes, span, spans, suffix, _i, _len, _results;
|
||||||
spans = $$('span.filesize', root);
|
spans = $$('span.filesize', root);
|
||||||
@ -1808,7 +1808,7 @@
|
|||||||
return _results;
|
return _results;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (getConfig('Reply Hiding')) {
|
if ($.config('Reply Hiding')) {
|
||||||
g.callbacks.push(function(root) {
|
g.callbacks.push(function(root) {
|
||||||
var id, next, obj, td, tds, _i, _len, _results;
|
var id, next, obj, td, tds, _i, _len, _results;
|
||||||
tds = $$('td.doubledash', root);
|
tds = $$('td.doubledash', root);
|
||||||
@ -1837,10 +1837,10 @@
|
|||||||
return _results;
|
return _results;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (getConfig('Quick Reply')) {
|
if ($.config('Quick Reply')) {
|
||||||
qr.init();
|
qr.init();
|
||||||
}
|
}
|
||||||
if (getConfig('Quick Report')) {
|
if ($.config('Quick Report')) {
|
||||||
g.callbacks.push(function(root) {
|
g.callbacks.push(function(root) {
|
||||||
var arr, el, _i, _len, _results;
|
var arr, el, _i, _len, _results;
|
||||||
arr = $$('span[id^=no]', root);
|
arr = $$('span[id^=no]', root);
|
||||||
@ -1858,7 +1858,7 @@
|
|||||||
return _results;
|
return _results;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (getConfig('Thread Watcher')) {
|
if ($.config('Thread Watcher')) {
|
||||||
html = '<div class="move">Thread Watcher</div><div></div>';
|
html = '<div class="move">Thread Watcher</div><div></div>';
|
||||||
watcher = ui.dialog('watcher', {
|
watcher = ui.dialog('watcher', {
|
||||||
top: '50px',
|
top: '50px',
|
||||||
@ -1889,7 +1889,7 @@
|
|||||||
$.before(input, img);
|
$.before(input, img);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (getConfig('Anonymize')) {
|
if ($.config('Anonymize')) {
|
||||||
g.callbacks.push(function(root) {
|
g.callbacks.push(function(root) {
|
||||||
var name, names, trip, trips, _i, _j, _len, _len2, _results;
|
var name, names, trip, trips, _i, _j, _len, _len2, _results;
|
||||||
names = $$('span.postername, span.commentpostername', root);
|
names = $$('span.postername, span.commentpostername', root);
|
||||||
@ -1906,7 +1906,7 @@
|
|||||||
return _results;
|
return _results;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (getConfig('Reply Navigation')) {
|
if ($.config('Reply Navigation')) {
|
||||||
g.callbacks.push(function(root) {
|
g.callbacks.push(function(root) {
|
||||||
var arr, down, el, span, up, _i, _len, _results;
|
var arr, down, el, span, up, _i, _len, _results;
|
||||||
arr = $$('span[id^=norep]', root);
|
arr = $$('span[id^=norep]', root);
|
||||||
@ -1930,12 +1930,12 @@
|
|||||||
return _results;
|
return _results;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (getConfig('Keybinds')) {
|
if ($.config('Keybinds')) {
|
||||||
d.addEventListener('keydown', keydown, true);
|
d.addEventListener('keydown', keydown, true);
|
||||||
d.addEventListener('keypress', keypress, true);
|
d.addEventListener('keypress', keypress, true);
|
||||||
}
|
}
|
||||||
if (g.REPLY) {
|
if (g.REPLY) {
|
||||||
if (getConfig('Image Preloading')) {
|
if ($.config('Image Preloading')) {
|
||||||
g.callbacks.push(function(root) {
|
g.callbacks.push(function(root) {
|
||||||
var parent, thumb, thumbs, _i, _len, _results;
|
var parent, thumb, thumbs, _i, _len, _results;
|
||||||
thumbs = $$('img[md5]', root);
|
thumbs = $$('img[md5]', root);
|
||||||
@ -1950,13 +1950,13 @@
|
|||||||
return _results;
|
return _results;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (getConfig('Thread Updater')) {
|
if ($.config('Thread Updater')) {
|
||||||
updaterMake();
|
updaterMake();
|
||||||
}
|
}
|
||||||
if (getConfig('Quick Reply') && getConfig('Persistent QR')) {
|
if ($.config('Quick Reply') && $.config('Persistent QR')) {
|
||||||
qr.persist();
|
qr.persist();
|
||||||
}
|
}
|
||||||
if (getConfig('Post in Title')) {
|
if ($.config('Post in Title')) {
|
||||||
if (!(text = $('span.filetitle').textContent)) {
|
if (!(text = $('span.filetitle').textContent)) {
|
||||||
text = $('blockquote').textContent;
|
text = $('blockquote').textContent;
|
||||||
}
|
}
|
||||||
@ -1964,7 +1964,7 @@
|
|||||||
d.title = "/" + g.BOARD + "/ - " + text;
|
d.title = "/" + g.BOARD + "/ - " + text;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (getConfig('Unread Count')) {
|
if ($.config('Unread Count')) {
|
||||||
g.replies = [];
|
g.replies = [];
|
||||||
d.title = '(0) ' + d.title;
|
d.title = '(0) ' + d.title;
|
||||||
window.addEventListener('scroll', scroll, true);
|
window.addEventListener('scroll', scroll, true);
|
||||||
@ -1974,20 +1974,20 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (getConfig('Thread Hiding')) {
|
if ($.config('Thread Hiding')) {
|
||||||
delform = $('form[name=delform]');
|
delform = $('form[name=delform]');
|
||||||
start = $('form[name=delform] > *');
|
start = $('form[name=delform] > *');
|
||||||
if (getConfig('Image Expansion')) {
|
if ($.config('Image Expansion')) {
|
||||||
start = start.nextSibling;
|
start = start.nextSibling;
|
||||||
}
|
}
|
||||||
d.addEventListener('DOMNodeInserted', stopPropagation, true);
|
d.addEventListener('DOMNodeInserted', stopPropagation, true);
|
||||||
threadF(start);
|
threadF(start);
|
||||||
d.removeEventListener('DOMNodeInserted', stopPropagation, true);
|
d.removeEventListener('DOMNodeInserted', stopPropagation, true);
|
||||||
}
|
}
|
||||||
if (getConfig('Auto Watch')) {
|
if ($.config('Auto Watch')) {
|
||||||
$('form[name="post"]').addEventListener('submit', autoWatch, true);
|
$('form[name="post"]').addEventListener('submit', autoWatch, true);
|
||||||
}
|
}
|
||||||
if (getConfig('Thread Navigation')) {
|
if ($.config('Thread Navigation')) {
|
||||||
arr = $$('div > span.filesize, form > span.filesize');
|
arr = $$('div > span.filesize, form > span.filesize');
|
||||||
l1 = arr.length - 1;
|
l1 = arr.length - 1;
|
||||||
for (i = 0, _len4 = arr.length; i < _len4; i++) {
|
for (i = 0, _len4 = arr.length; i < _len4; i++) {
|
||||||
@ -2030,7 +2030,7 @@
|
|||||||
window.location = window.location;
|
window.location = window.location;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (getConfig('Thread Expansion')) {
|
if ($.config('Thread Expansion')) {
|
||||||
omitted = $$('span.omittedposts');
|
omitted = $$('span.omittedposts');
|
||||||
for (_l = 0, _len5 = omitted.length; _l < _len5; _l++) {
|
for (_l = 0, _len5 = omitted.length; _l < _len5; _l++) {
|
||||||
span = omitted[_l];
|
span = omitted[_l];
|
||||||
@ -2042,7 +2042,7 @@
|
|||||||
$.replace(span, a);
|
$.replace(span, a);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (getConfig('Comment Expansion')) {
|
if ($.config('Comment Expansion')) {
|
||||||
as = $$('span.abbr a');
|
as = $$('span.abbr a');
|
||||||
for (_m = 0, _len6 = as.length; _m < _len6; _m++) {
|
for (_m = 0, _len6 = as.length; _m < _len6; _m++) {
|
||||||
a = as[_m];
|
a = as[_m];
|
||||||
|
|||||||
@ -145,6 +145,10 @@ $.extend = (object, properties) ->
|
|||||||
object
|
object
|
||||||
|
|
||||||
$.extend $,
|
$.extend $,
|
||||||
|
config: (name) ->
|
||||||
|
GM_getValue name, config[name][0]
|
||||||
|
zeroPad: (n) ->
|
||||||
|
if n < 10 then '0' + n else n
|
||||||
slice: (arr, id) ->
|
slice: (arr, id) ->
|
||||||
# do I actually need this?
|
# do I actually need this?
|
||||||
for el, i in arr
|
for el, i in arr
|
||||||
@ -236,10 +240,6 @@ $.extend $,
|
|||||||
$$ = (selector, root=d.body) ->
|
$$ = (selector, root=d.body) ->
|
||||||
result = root.querySelectorAll selector
|
result = root.querySelectorAll selector
|
||||||
node for node in result
|
node for node in result
|
||||||
getConfig = (name) ->
|
|
||||||
GM_getValue name, config[name][0]
|
|
||||||
zeroPad = (n) ->
|
|
||||||
if n < 10 then '0' + n else n
|
|
||||||
|
|
||||||
#funks
|
#funks
|
||||||
autoWatch = ->
|
autoWatch = ->
|
||||||
@ -341,7 +341,7 @@ hideReply = (reply) ->
|
|||||||
trip = $('span.postertrip', reply)?.textContent or ''
|
trip = $('span.postertrip', reply)?.textContent or ''
|
||||||
table = $.x 'ancestor::table', reply
|
table = $.x 'ancestor::table', reply
|
||||||
$.hide table
|
$.hide table
|
||||||
if getConfig 'Show Stubs'
|
if $.config 'Show Stubs'
|
||||||
a = $.el 'a',
|
a = $.el 'a',
|
||||||
textContent: "[ + ] #{name} #{trip}"
|
textContent: "[ + ] #{name} #{trip}"
|
||||||
className: 'pointer'
|
className: 'pointer'
|
||||||
@ -359,7 +359,7 @@ hideThread = (div) ->
|
|||||||
}
|
}
|
||||||
GM_setValue("hiddenThreads/#{g.BOARD}/", JSON.stringify(g.hiddenThreads))
|
GM_setValue("hiddenThreads/#{g.BOARD}/", JSON.stringify(g.hiddenThreads))
|
||||||
$.hide div
|
$.hide div
|
||||||
if getConfig 'Show Stubs'
|
if $.config 'Show Stubs'
|
||||||
if span = $ '.omittedposts', div
|
if span = $ '.omittedposts', div
|
||||||
num = Number(span.textContent.match(/\d+/)[0])
|
num = Number(span.textContent.match(/\d+/)[0])
|
||||||
else
|
else
|
||||||
@ -679,7 +679,7 @@ options = ->
|
|||||||
html = '<div class="move">Options <a name=close>X</a></div><div>'
|
html = '<div class="move">Options <a name=close>X</a></div><div>'
|
||||||
for option, value of config
|
for option, value of config
|
||||||
description = value[1]
|
description = value[1]
|
||||||
checked = if getConfig option then "checked" else ""
|
checked = if $.config option then "checked" else ""
|
||||||
html += "<label title=\"#{description}\">#{option}<input #{checked} name=\"#{option}\" type=\"checkbox\"></label><br>"
|
html += "<label title=\"#{description}\">#{option}<input #{checked} name=\"#{option}\" type=\"checkbox\"></label><br>"
|
||||||
html += "<div><a class=sauce>Flavors</a></div>"
|
html += "<div><a class=sauce>Flavors</a></div>"
|
||||||
html += "<div><textarea style=\"display: none;\" name=flavors>#{GM_getValue 'flavors', g.flavors}</textarea></div>"
|
html += "<div><textarea style=\"display: none;\" name=flavors>#{GM_getValue 'flavors', g.flavors}</textarea></div>"
|
||||||
@ -743,7 +743,7 @@ qr =
|
|||||||
dialog = $ '#qr'
|
dialog = $ '#qr'
|
||||||
if data is 'Post successful!'
|
if data is 'Post successful!'
|
||||||
if dialog
|
if dialog
|
||||||
if getConfig 'Persistent QR'
|
if $.config 'Persistent QR'
|
||||||
qr.refresh dialog
|
qr.refresh dialog
|
||||||
else
|
else
|
||||||
$.remove dialog
|
$.remove dialog
|
||||||
@ -832,7 +832,7 @@ qr =
|
|||||||
name: 'resto'
|
name: 'resto'
|
||||||
value: $.x(xpath, link).name
|
value: $.x(xpath, link).name
|
||||||
$.append clone, input
|
$.append clone, input
|
||||||
else if getConfig 'Persistent QR'
|
else if $.config 'Persistent QR'
|
||||||
submit = $ 'input[type=submit]', clone
|
submit = $ 'input[type=submit]', clone
|
||||||
auto = $.el 'label',
|
auto = $.el 'label',
|
||||||
textContent: 'Auto'
|
textContent: 'Auto'
|
||||||
@ -856,7 +856,7 @@ qr =
|
|||||||
if recaptcha = $ '#recaptcha_response_field'
|
if recaptcha = $ '#recaptcha_response_field'
|
||||||
# post reporting
|
# post reporting
|
||||||
$.bind recaptcha, 'keydown', recaptchaListener
|
$.bind recaptcha, 'keydown', recaptchaListener
|
||||||
if getConfig 'Auto Watch'
|
if $.config 'Auto Watch'
|
||||||
html = $('b').innerHTML
|
html = $('b').innerHTML
|
||||||
[_, thread, id] = html.match(/<!-- thread:(\d+),no:(\d+) -->/)
|
[_, thread, id] = html.match(/<!-- thread:(\d+),no:(\d+) -->/)
|
||||||
if thread is '0'
|
if thread is '0'
|
||||||
@ -983,7 +983,7 @@ updateCallback = ->
|
|||||||
input.disabled = true
|
input.disabled = true
|
||||||
input.value = 404
|
input.value = 404
|
||||||
s = ''
|
s = ''
|
||||||
if getConfig 'Unread Count' then s += "(#{g.replies.length}) "
|
if $.config 'Unread Count' then s += "(#{g.replies.length}) "
|
||||||
s += "/#{g.BOARD}/ - 404"
|
s += "/#{g.BOARD}/ - 404"
|
||||||
d.title = s
|
d.title = s
|
||||||
g.dead = true
|
g.dead = true
|
||||||
@ -1310,7 +1310,7 @@ if navtopr = $ '#navtopr a'
|
|||||||
className: 'pointer'
|
className: 'pointer'
|
||||||
$.bind a, 'click', options
|
$.bind a, 'click', options
|
||||||
$.replace navbotr, a
|
$.replace navbotr, a
|
||||||
else if getConfig('404 Redirect') and d.title is '4chan - 404'
|
else if $.config('404 Redirect') and d.title is '4chan - 404'
|
||||||
redirect()
|
redirect()
|
||||||
else
|
else
|
||||||
return
|
return
|
||||||
@ -1332,7 +1332,7 @@ scroll = ->
|
|||||||
updateTitle()
|
updateTitle()
|
||||||
|
|
||||||
#major features
|
#major features
|
||||||
if getConfig 'Image Expansion'
|
if $.config 'Image Expansion'
|
||||||
delform = $ 'form[name=delform]'
|
delform = $ 'form[name=delform]'
|
||||||
expand = $.el 'div',
|
expand = $.el 'div',
|
||||||
innerHTML:
|
innerHTML:
|
||||||
@ -1354,10 +1354,10 @@ if getConfig 'Image Expansion'
|
|||||||
thumb.parentNode.addEventListener 'click', imageClick, true
|
thumb.parentNode.addEventListener 'click', imageClick, true
|
||||||
if g.expand then imageToggle thumb.parentNode
|
if g.expand then imageToggle thumb.parentNode
|
||||||
|
|
||||||
if getConfig 'Image Hover'
|
if $.config 'Image Hover'
|
||||||
imageHover.init()
|
imageHover.init()
|
||||||
|
|
||||||
if getConfig 'Image Auto-Gif'
|
if $.config 'Image Auto-Gif'
|
||||||
g.callbacks.push (root) ->
|
g.callbacks.push (root) ->
|
||||||
thumbs = $$ 'img[md5]', root
|
thumbs = $$ 'img[md5]', root
|
||||||
for thumb in thumbs
|
for thumb in thumbs
|
||||||
@ -1365,7 +1365,7 @@ if getConfig 'Image Auto-Gif'
|
|||||||
if /gif$/.test src
|
if /gif$/.test src
|
||||||
thumb.src = src
|
thumb.src = src
|
||||||
|
|
||||||
if getConfig 'Localize Time'
|
if $.config 'Localize Time'
|
||||||
g.callbacks.push (root) ->
|
g.callbacks.push (root) ->
|
||||||
spans = $$ 'span[id^=no]', root
|
spans = $$ 'span[id^=no]', root
|
||||||
for span in spans
|
for span in spans
|
||||||
@ -1377,9 +1377,9 @@ if getConfig 'Localize Time'
|
|||||||
hour = g.chanOffset + Number hour
|
hour = g.chanOffset + Number hour
|
||||||
date = new Date year, month, day, hour
|
date = new Date year, month, day, hour
|
||||||
year = date.getFullYear() - 2000
|
year = date.getFullYear() - 2000
|
||||||
month = zeroPad date.getMonth() + 1
|
month = $.zeroPad date.getMonth() + 1
|
||||||
day = zeroPad date.getDate()
|
day = $.zeroPad date.getDate()
|
||||||
hour = zeroPad date.getHours()
|
hour = $.zeroPad date.getHours()
|
||||||
dotw = [
|
dotw = [
|
||||||
'Sun'
|
'Sun'
|
||||||
'Mon'
|
'Mon'
|
||||||
@ -1391,7 +1391,7 @@ if getConfig 'Localize Time'
|
|||||||
][date.getDay()]
|
][date.getDay()]
|
||||||
s.textContent = " #{month}/#{day}/#{year}(#{dotw})#{hour}:#{min_sec} "
|
s.textContent = " #{month}/#{day}/#{year}(#{dotw})#{hour}:#{min_sec} "
|
||||||
|
|
||||||
if getConfig 'Sauce'
|
if $.config 'Sauce'
|
||||||
g.callbacks.push (root) ->
|
g.callbacks.push (root) ->
|
||||||
spans = $$ 'span.filesize', root
|
spans = $$ 'span.filesize', root
|
||||||
prefixes = GM_getValue('flavors', g.flavors).split '\n'
|
prefixes = GM_getValue('flavors', g.flavors).split '\n'
|
||||||
@ -1406,7 +1406,7 @@ if getConfig 'Sauce'
|
|||||||
$.append span, $.tn(' '), link
|
$.append span, $.tn(' '), link
|
||||||
i++
|
i++
|
||||||
|
|
||||||
if getConfig 'Reply Hiding'
|
if $.config 'Reply Hiding'
|
||||||
g.callbacks.push (root) ->
|
g.callbacks.push (root) ->
|
||||||
tds = $$('td.doubledash', root)
|
tds = $$('td.doubledash', root)
|
||||||
for td in tds
|
for td in tds
|
||||||
@ -1422,10 +1422,10 @@ if getConfig 'Reply Hiding'
|
|||||||
if obj.id is id
|
if obj.id is id
|
||||||
hideReply(next)
|
hideReply(next)
|
||||||
|
|
||||||
if getConfig 'Quick Reply'
|
if $.config 'Quick Reply'
|
||||||
qr.init()
|
qr.init()
|
||||||
|
|
||||||
if getConfig 'Quick Report'
|
if $.config 'Quick Report'
|
||||||
g.callbacks.push (root) ->
|
g.callbacks.push (root) ->
|
||||||
arr = $$('span[id^=no]', root)
|
arr = $$('span[id^=no]', root)
|
||||||
for el in arr
|
for el in arr
|
||||||
@ -1436,7 +1436,7 @@ if getConfig 'Quick Report'
|
|||||||
$.after el, a
|
$.after el, a
|
||||||
$.after el, $.tn(' ')
|
$.after el, $.tn(' ')
|
||||||
|
|
||||||
if getConfig 'Thread Watcher'
|
if $.config 'Thread Watcher'
|
||||||
#create watcher
|
#create watcher
|
||||||
html = '<div class="move">Thread Watcher</div><div></div>'
|
html = '<div class="move">Thread Watcher</div><div></div>'
|
||||||
watcher = ui.dialog 'watcher', top: '50px', left: '0px', html
|
watcher = ui.dialog 'watcher', top: '50px', left: '0px', html
|
||||||
@ -1461,7 +1461,7 @@ if getConfig 'Thread Watcher'
|
|||||||
$.bind img, 'click', watch
|
$.bind img, 'click', watch
|
||||||
$.before input, img
|
$.before input, img
|
||||||
|
|
||||||
if getConfig 'Anonymize'
|
if $.config 'Anonymize'
|
||||||
g.callbacks.push (root) ->
|
g.callbacks.push (root) ->
|
||||||
names = $$('span.postername, span.commentpostername', root)
|
names = $$('span.postername, span.commentpostername', root)
|
||||||
for name in names
|
for name in names
|
||||||
@ -1473,7 +1473,7 @@ if getConfig 'Anonymize'
|
|||||||
else
|
else
|
||||||
$.remove trip
|
$.remove trip
|
||||||
|
|
||||||
if getConfig 'Reply Navigation'
|
if $.config 'Reply Navigation'
|
||||||
g.callbacks.push (root) ->
|
g.callbacks.push (root) ->
|
||||||
arr = $$('span[id^=norep]', root)
|
arr = $$('span[id^=norep]', root)
|
||||||
for el in arr
|
for el in arr
|
||||||
@ -1489,27 +1489,27 @@ if getConfig 'Reply Navigation'
|
|||||||
$.append span, $.tn(' '), up, $.tn(' '), down
|
$.append span, $.tn(' '), up, $.tn(' '), down
|
||||||
$.after el, span
|
$.after el, span
|
||||||
|
|
||||||
if getConfig 'Keybinds'
|
if $.config 'Keybinds'
|
||||||
d.addEventListener 'keydown', keydown, true
|
d.addEventListener 'keydown', keydown, true
|
||||||
d.addEventListener 'keypress', keypress, true
|
d.addEventListener 'keypress', keypress, true
|
||||||
|
|
||||||
if g.REPLY
|
if g.REPLY
|
||||||
if getConfig 'Image Preloading'
|
if $.config 'Image Preloading'
|
||||||
g.callbacks.push (root) ->
|
g.callbacks.push (root) ->
|
||||||
thumbs = $$ 'img[md5]', root
|
thumbs = $$ 'img[md5]', root
|
||||||
for thumb in thumbs
|
for thumb in thumbs
|
||||||
parent = thumb.parentNode
|
parent = thumb.parentNode
|
||||||
el = $.el 'img', src: parent.href
|
el = $.el 'img', src: parent.href
|
||||||
if getConfig 'Thread Updater'
|
if $.config 'Thread Updater'
|
||||||
updaterMake()
|
updaterMake()
|
||||||
if getConfig('Quick Reply') and getConfig 'Persistent QR'
|
if $.config('Quick Reply') and $.config 'Persistent QR'
|
||||||
qr.persist()
|
qr.persist()
|
||||||
if getConfig 'Post in Title'
|
if $.config 'Post in Title'
|
||||||
unless text = $('span.filetitle').textContent
|
unless text = $('span.filetitle').textContent
|
||||||
text = $('blockquote').textContent
|
text = $('blockquote').textContent
|
||||||
if text
|
if text
|
||||||
d.title = "/#{g.BOARD}/ - #{text}"
|
d.title = "/#{g.BOARD}/ - #{text}"
|
||||||
if getConfig 'Unread Count'
|
if $.config 'Unread Count'
|
||||||
g.replies = []
|
g.replies = []
|
||||||
d.title = '(0) ' + d.title
|
d.title = '(0) ' + d.title
|
||||||
window.addEventListener 'scroll', scroll, true
|
window.addEventListener 'scroll', scroll, true
|
||||||
@ -1518,19 +1518,19 @@ if g.REPLY
|
|||||||
updateTitle()
|
updateTitle()
|
||||||
|
|
||||||
else #not reply
|
else #not reply
|
||||||
if getConfig 'Thread Hiding'
|
if $.config 'Thread Hiding'
|
||||||
delform = $('form[name=delform]')
|
delform = $('form[name=delform]')
|
||||||
start = $ 'form[name=delform] > *'
|
start = $ 'form[name=delform] > *'
|
||||||
start = start.nextSibling if getConfig 'Image Expansion' #skip over image expansion dialog
|
start = start.nextSibling if $.config 'Image Expansion' #skip over image expansion dialog
|
||||||
#don't confuse other scripts
|
#don't confuse other scripts
|
||||||
d.addEventListener('DOMNodeInserted', stopPropagation, true)
|
d.addEventListener('DOMNodeInserted', stopPropagation, true)
|
||||||
threadF start
|
threadF start
|
||||||
d.removeEventListener('DOMNodeInserted', stopPropagation, true)
|
d.removeEventListener('DOMNodeInserted', stopPropagation, true)
|
||||||
|
|
||||||
if getConfig 'Auto Watch'
|
if $.config 'Auto Watch'
|
||||||
$('form[name="post"]').addEventListener('submit', autoWatch, true)
|
$('form[name="post"]').addEventListener('submit', autoWatch, true)
|
||||||
|
|
||||||
if getConfig 'Thread Navigation'
|
if $.config 'Thread Navigation'
|
||||||
arr = $$ 'div > span.filesize, form > span.filesize'
|
arr = $$ 'div > span.filesize, form > span.filesize'
|
||||||
l1 = arr.length - 1
|
l1 = arr.length - 1
|
||||||
for el, i in arr
|
for el, i in arr
|
||||||
@ -1565,7 +1565,7 @@ else #not reply
|
|||||||
if location.hash is '#p0'
|
if location.hash is '#p0'
|
||||||
window.location = window.location
|
window.location = window.location
|
||||||
|
|
||||||
if getConfig 'Thread Expansion'
|
if $.config 'Thread Expansion'
|
||||||
omitted = $$('span.omittedposts')
|
omitted = $$('span.omittedposts')
|
||||||
for span in omitted
|
for span in omitted
|
||||||
a = $.el 'a',
|
a = $.el 'a',
|
||||||
@ -1574,7 +1574,7 @@ else #not reply
|
|||||||
$.bind a, 'click', expandThread
|
$.bind a, 'click', expandThread
|
||||||
$.replace(span, a)
|
$.replace(span, a)
|
||||||
|
|
||||||
if getConfig 'Comment Expansion'
|
if $.config 'Comment Expansion'
|
||||||
as = $$('span.abbr a')
|
as = $$('span.abbr a')
|
||||||
for a in as
|
for a in as
|
||||||
a.addEventListener('click', expandComment, true)
|
a.addEventListener('click', expandComment, true)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user