make sauce prefixes editable
This commit is contained in:
parent
5c2a3831ba
commit
1064c471af
@ -250,6 +250,13 @@ if lastChecked < now - 1*DAY
|
||||
GM_setValue("hiddenReplies/#{BOARD}/", JSON.stringify(hiddenReplies))
|
||||
GM_setValue('lastChecked', now)
|
||||
|
||||
defaultSaucePrefix = [
|
||||
'http://regex.info/exif.cgi?url='
|
||||
'http://iqdb.org/?url='
|
||||
'http://saucenao.com/search.php?db=999&url='
|
||||
'http://tineye.com/search?url='
|
||||
].join '\n'
|
||||
|
||||
GM_addStyle('
|
||||
#watcher {
|
||||
position: absolute;
|
||||
@ -322,11 +329,13 @@ options = ->
|
||||
for option of config
|
||||
checked = if getConfig option then "checked" else ""
|
||||
html += "<label>#{option}<input #{checked} name=\"#{option}\" type=\"checkbox\"></label><br>"
|
||||
html += "<div><textarea cols=50 rows=4></textarea></div>"
|
||||
html += "<input type=\"button\" value=\"hidden: #{hiddenNum}\"><br>"
|
||||
div.innerHTML = html
|
||||
$('div.move', div).addEventListener('mousedown', AEOS.move, true)
|
||||
$('div.move', div).addEventListener 'mousedown', AEOS.move, true
|
||||
$('a.pointer', div).addEventListener 'click', optionsClose, true
|
||||
$('input[type="button"]', div).addEventListener('click', clearHidden, true)
|
||||
$('textarea', div).value = GM_getValue 'saucePrefix', defaultSaucePrefix
|
||||
$('input[type="button"]', div).addEventListener 'click', clearHidden, true
|
||||
addTo d.body, div
|
||||
|
||||
|
||||
@ -430,12 +439,13 @@ optionsClose = ->
|
||||
inputs = $$('input', div)
|
||||
for input in inputs
|
||||
GM_setValue(input.name, input.checked)
|
||||
remove(div)
|
||||
GM_setValue 'saucePrefix', $('textarea', div).value
|
||||
remove div
|
||||
|
||||
|
||||
close = ->
|
||||
div = this.parentNode.parentNode
|
||||
remove(div)
|
||||
remove div
|
||||
|
||||
|
||||
iframeLoad = ->
|
||||
@ -752,20 +762,16 @@ recaptcha.addEventListener('keydown', recaptchaListener, true)
|
||||
|
||||
#major features
|
||||
|
||||
sauces =
|
||||
exif: 'http://regex.info/exif.cgi?url='
|
||||
iqdb: 'http://iqdb.org/?url='
|
||||
saucenao: 'http://saucenao.com/search.php?db=999&url='
|
||||
tineye: 'http://tineye.com/search?url='
|
||||
|
||||
if getConfig 'Sauce'
|
||||
spans = $$ 'span.filesize'
|
||||
prefixes = GM_getValue('saucePrefix', defaultSaucePrefix).split '\n'
|
||||
names = prefix.match(/(\w+)\./)[1] for prefix in prefixes
|
||||
for span in spans
|
||||
suffix = $('a', span).href
|
||||
for sauce of sauces
|
||||
for prefix in prefixes
|
||||
link = n 'a',
|
||||
textContent: sauce
|
||||
href: sauces[sauce] + suffix
|
||||
textContent: names[_j]
|
||||
href: prefix + suffix
|
||||
addTo span, tn(' '), link
|
||||
|
||||
if getConfig('Reply Hiding')
|
||||
|
||||
86
4chan_x.js
86
4chan_x.js
@ -1,5 +1,5 @@
|
||||
(function() {
|
||||
var $, $$, AEOS, BOARD, DAY, PAGENUM, REPLY, THREAD_ID, _i, _j, _len, _len2, _ref, _ref2, a, addTo, arr, as, autoWatch, autohide, b, board, callback, callbacks, clearHidden, close, config, cutoff, d, delform, down, el, expandComment, expandThread, favEmpty, favNormal, favicon, getConfig, getTime, head, hiddenReplies, hiddenThreads, hide, hideReply, hideThread, href, html, i, i1, id, iframe, iframeLoad, iframeLoop, img, inAfter, inBefore, input, inputs, l, l1, lastChecked, link, magic, n, navtopr, nodeInserted, nop, now, omitted, onloadComment, onloadThread, options, optionsClose, parseResponse, pathname, quickReply, r, recaptcha, recaptchaListener, recaptchaReload, redirect, remove, replace, replyNav, report, sauce, sauces, show, showReply, showThread, slice, span, spans, src, stopPropagation, submit, suffix, text, textContent, thread, threadF, threads, tn, up, watch, watchX, watched, watcher, watcherUpdate, x, xhrs;
|
||||
var $, $$, AEOS, BOARD, DAY, PAGENUM, REPLY, THREAD_ID, _i, _j, _len, _len2, _ref, _ref2, _result, a, addTo, arr, as, autoWatch, autohide, b, board, callback, callbacks, clearHidden, close, config, cutoff, d, defaultSaucePrefix, delform, down, el, expandComment, expandThread, favEmpty, favNormal, favicon, getConfig, getTime, head, hiddenReplies, hiddenThreads, hide, hideReply, hideThread, href, html, i, i1, id, iframe, iframeLoad, iframeLoop, img, inAfter, inBefore, input, inputs, l, l1, lastChecked, link, magic, n, names, navtopr, nodeInserted, nop, now, omitted, onloadComment, onloadThread, options, optionsClose, parseResponse, pathname, prefix, prefixes, quickReply, r, recaptcha, recaptchaListener, recaptchaReload, redirect, remove, replace, replyNav, report, show, showReply, showThread, slice, span, spans, src, stopPropagation, submit, suffix, text, textContent, thread, threadF, threads, tn, up, watch, watchX, watched, watcher, watcherUpdate, x, xhrs;
|
||||
var __slice = Array.prototype.slice, __hasProp = Object.prototype.hasOwnProperty;
|
||||
config = {
|
||||
'Thread Hiding': true,
|
||||
@ -307,6 +307,7 @@
|
||||
GM_setValue("hiddenReplies/" + (BOARD) + "/", JSON.stringify(hiddenReplies));
|
||||
GM_setValue('lastChecked', now);
|
||||
}
|
||||
defaultSaucePrefix = ['http://regex.info/exif.cgi?url=', 'http://iqdb.org/?url=', 'http://saucenao.com/search.php?db=999&url=', 'http://tineye.com/search?url='].join('\n');
|
||||
GM_addStyle('\
|
||||
#watcher {\
|
||||
position: absolute;\
|
||||
@ -378,10 +379,12 @@
|
||||
checked = getConfig(option) ? "checked" : "";
|
||||
html += ("<label>" + (option) + "<input " + (checked) + " name=\"" + (option) + "\" type=\"checkbox\"></label><br>");
|
||||
}
|
||||
html += "<div><textarea cols=50 rows=4></textarea></div>";
|
||||
html += ("<input type=\"button\" value=\"hidden: " + (hiddenNum) + "\"><br>");
|
||||
div.innerHTML = html;
|
||||
$('div.move', div).addEventListener('mousedown', AEOS.move, true);
|
||||
$('a.pointer', div).addEventListener('click', optionsClose, true);
|
||||
$('textarea', div).value = GM_getValue('saucePrefix', defaultSaucePrefix);
|
||||
$('input[type="button"]', div).addEventListener('click', clearHidden, true);
|
||||
return addTo(d.body, div);
|
||||
}
|
||||
@ -498,6 +501,7 @@
|
||||
input = _ref2[_i];
|
||||
GM_setValue(input.name, input.checked);
|
||||
}
|
||||
GM_setValue('saucePrefix', $('textarea', div).value);
|
||||
return remove(div);
|
||||
};
|
||||
close = function() {
|
||||
@ -867,25 +871,27 @@
|
||||
}
|
||||
recaptcha = $('#recaptcha_response_field');
|
||||
recaptcha.addEventListener('keydown', recaptchaListener, true);
|
||||
sauces = {
|
||||
exif: 'http://regex.info/exif.cgi?url=',
|
||||
iqdb: 'http://iqdb.org/?url=',
|
||||
saucenao: 'http://saucenao.com/search.php?db=999&url=',
|
||||
tineye: 'http://tineye.com/search?url='
|
||||
};
|
||||
if (getConfig('Sauce')) {
|
||||
spans = $$('span.filesize');
|
||||
prefixes = GM_getValue('saucePrefix', defaultSaucePrefix).split('\n');
|
||||
names = (function() {
|
||||
_result = []; _ref = prefixes;
|
||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||
prefix = _ref[_i];
|
||||
_result.push(prefix.match(/(\w+)\./)[1]);
|
||||
}
|
||||
return _result;
|
||||
})();
|
||||
_ref = spans;
|
||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||
span = _ref[_i];
|
||||
suffix = $('a', span).href;
|
||||
_ref2 = sauces;
|
||||
for (sauce in _ref2) {
|
||||
if (!__hasProp.call(_ref2, sauce)) continue;
|
||||
_j = _ref2[sauce];
|
||||
_ref2 = prefixes;
|
||||
for (_j = 0, _len2 = _ref2.length; _j < _len2; _j++) {
|
||||
prefix = _ref2[_j];
|
||||
link = n('a', {
|
||||
textContent: sauce,
|
||||
href: sauces[sauce] + suffix
|
||||
textContent: names[_j],
|
||||
href: prefix + suffix
|
||||
});
|
||||
addTo(span, tn(' '), link);
|
||||
}
|
||||
@ -893,12 +899,12 @@
|
||||
}
|
||||
if (getConfig('Reply Hiding')) {
|
||||
callbacks.push(function(root) {
|
||||
var _k, _l, _len2, _len3, _ref3, _ref4, _result, _result2, next, obj, td, tds;
|
||||
var _k, _l, _len3, _len4, _ref3, _ref4, _result2, _result3, next, obj, td, tds;
|
||||
tds = $$('td.doubledash', root);
|
||||
_result = []; _ref3 = tds;
|
||||
for (_k = 0, _len2 = _ref3.length; _k < _len2; _k++) {
|
||||
_result2 = []; _ref3 = tds;
|
||||
for (_k = 0, _len3 = _ref3.length; _k < _len3; _k++) {
|
||||
td = _ref3[_k];
|
||||
_result.push((function() {
|
||||
_result2.push((function() {
|
||||
a = n('a', {
|
||||
textContent: '[ - ]',
|
||||
className: 'pointer',
|
||||
@ -907,15 +913,15 @@
|
||||
replace(td.firstChild, a);
|
||||
next = td.nextSibling;
|
||||
id = next.id;
|
||||
_result2 = []; _ref4 = hiddenReplies;
|
||||
for (_l = 0, _len3 = _ref4.length; _l < _len3; _l++) {
|
||||
_result3 = []; _ref4 = hiddenReplies;
|
||||
for (_l = 0, _len4 = _ref4.length; _l < _len4; _l++) {
|
||||
obj = _ref4[_l];
|
||||
_result2.push(obj.id === id ? hideReply(next) : null);
|
||||
_result3.push(obj.id === id ? hideReply(next) : null);
|
||||
}
|
||||
return _result2;
|
||||
return _result3;
|
||||
})());
|
||||
}
|
||||
return _result;
|
||||
return _result2;
|
||||
});
|
||||
}
|
||||
if (getConfig('Quick Reply')) {
|
||||
@ -926,25 +932,25 @@
|
||||
hide(iframe);
|
||||
addTo(d.body, iframe);
|
||||
callbacks.push(function(root) {
|
||||
var _k, _len2, _ref3, _result, quote, quotes;
|
||||
var _k, _len3, _ref3, _result2, quote, quotes;
|
||||
quotes = $$('a.quotejs:not(:first-child)', root);
|
||||
_result = []; _ref3 = quotes;
|
||||
for (_k = 0, _len2 = _ref3.length; _k < _len2; _k++) {
|
||||
_result2 = []; _ref3 = quotes;
|
||||
for (_k = 0, _len3 = _ref3.length; _k < _len3; _k++) {
|
||||
quote = _ref3[_k];
|
||||
_result.push(quote.addEventListener('click', quickReply, true));
|
||||
_result2.push(quote.addEventListener('click', quickReply, true));
|
||||
}
|
||||
return _result;
|
||||
return _result2;
|
||||
});
|
||||
recaptcha.id = '';
|
||||
}
|
||||
if (getConfig('Quick Report')) {
|
||||
callbacks.push(function(root) {
|
||||
var _k, _len2, _ref3, _result, arr, el;
|
||||
var _k, _len3, _ref3, _result2, arr, el;
|
||||
arr = $$('span[id^=no]', root);
|
||||
_result = []; _ref3 = arr;
|
||||
for (_k = 0, _len2 = _ref3.length; _k < _len2; _k++) {
|
||||
_result2 = []; _ref3 = arr;
|
||||
for (_k = 0, _len3 = _ref3.length; _k < _len3; _k++) {
|
||||
el = _ref3[_k];
|
||||
_result.push((function() {
|
||||
_result2.push((function() {
|
||||
a = n('a', {
|
||||
textContent: '[ ! ]',
|
||||
className: 'pointer',
|
||||
@ -954,7 +960,7 @@
|
||||
return inAfter(el, tn(' '));
|
||||
})());
|
||||
}
|
||||
return _result;
|
||||
return _result2;
|
||||
});
|
||||
}
|
||||
if (getConfig('Thread Watcher')) {
|
||||
@ -988,7 +994,7 @@
|
||||
}
|
||||
if (getConfig('Anonymize')) {
|
||||
callbacks.push(function(root) {
|
||||
var _k, _len3, _ref3, _result, name, names, trip, trips;
|
||||
var _k, _len3, _ref3, _result2, name, trip, trips;
|
||||
names = $$('span.postername, span.commentpostername', root);
|
||||
_ref3 = names;
|
||||
for (_k = 0, _len3 = _ref3.length; _k < _len3; _k++) {
|
||||
@ -996,22 +1002,22 @@
|
||||
name.innerHTML = 'Anonymous';
|
||||
}
|
||||
trips = $$('span.postertrip', root);
|
||||
_result = []; _ref3 = trips;
|
||||
_result2 = []; _ref3 = trips;
|
||||
for (_k = 0, _len3 = _ref3.length; _k < _len3; _k++) {
|
||||
trip = _ref3[_k];
|
||||
_result.push(trip.parentNode.nodeName === 'A' ? remove(trip.parentNode) : remove(trip));
|
||||
_result2.push(trip.parentNode.nodeName === 'A' ? remove(trip.parentNode) : remove(trip));
|
||||
}
|
||||
return _result;
|
||||
return _result2;
|
||||
});
|
||||
}
|
||||
if (getConfig('Reply Navigation')) {
|
||||
callbacks.push(function(root) {
|
||||
var _k, _len3, _ref3, _result, arr, down, el, up;
|
||||
var _k, _len3, _ref3, _result2, arr, down, el, up;
|
||||
arr = $$('span[id^=norep]', root);
|
||||
_result = []; _ref3 = arr;
|
||||
_result2 = []; _ref3 = arr;
|
||||
for (_k = 0, _len3 = _ref3.length; _k < _len3; _k++) {
|
||||
el = _ref3[_k];
|
||||
_result.push((function() {
|
||||
_result2.push((function() {
|
||||
span = n('span');
|
||||
up = n('a', {
|
||||
textContent: '▲',
|
||||
@ -1027,7 +1033,7 @@
|
||||
return inAfter(el, span);
|
||||
})());
|
||||
}
|
||||
return _result;
|
||||
return _result2;
|
||||
});
|
||||
}
|
||||
if (REPLY) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user