sauce
This commit is contained in:
parent
26fc2fd2a2
commit
3e0236764d
78
4chan_x.js
78
4chan_x.js
@ -59,7 +59,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
var $, $$, NAMESPACE, anonymize, autoWatch, callback, config, d, delform, el, expand, expandComment, expandThread, g, imageClick, imageExpand, imageExpandClick, imageHover, imageResize, imageThumb, imageToggle, imageType, imageTypeChange, keybinds, log, nav, navtopr, nodeInserted, option, options, pathname, qr, quickReport, recaptcha, recaptchaListener, recaptchaReload, redirect, replyHiding, scroll, temp, text, threadHiding, tzOffset, ui, updateFavicon, updateTitle, updater, watcher, _config, _i, _j, _k, _len, _len2, _len3, _ref, _ref2, _ref3, _ref4;
|
var $, $$, NAMESPACE, anonymize, autoWatch, callback, config, d, delform, el, expand, expandComment, expandThread, g, imageClick, imageExpand, imageExpandClick, imageHover, imageResize, imageThumb, imageToggle, imageType, imageTypeChange, keybinds, log, nav, navtopr, nodeInserted, option, options, pathname, qr, quickReport, recaptcha, recaptchaListener, recaptchaReload, redirect, replyHiding, sauce, scroll, temp, text, threadHiding, tzOffset, ui, updateFavicon, updateTitle, updater, watcher, _config, _i, _j, _k, _len, _len2, _len3, _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;
|
||||||
@ -1582,6 +1582,46 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
sauce = {
|
||||||
|
init: function() {
|
||||||
|
return g.callbacks.push(sauce.cb.node);
|
||||||
|
},
|
||||||
|
cb: {
|
||||||
|
node: function(root) {
|
||||||
|
var i, link, names, prefix, prefixes, span, suffix, _i, _len, _ref, _results;
|
||||||
|
prefixes = $.getValue('flavors', g.flavors).split('\n');
|
||||||
|
names = (function() {
|
||||||
|
var _i, _len, _results;
|
||||||
|
_results = [];
|
||||||
|
for (_i = 0, _len = prefixes.length; _i < _len; _i++) {
|
||||||
|
prefix = prefixes[_i];
|
||||||
|
_results.push(prefix.match(/(\w+)\./)[1]);
|
||||||
|
}
|
||||||
|
return _results;
|
||||||
|
})();
|
||||||
|
_ref = $$('span.filesize', root);
|
||||||
|
_results = [];
|
||||||
|
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||||
|
span = _ref[_i];
|
||||||
|
suffix = $('a', span).href;
|
||||||
|
_results.push((function() {
|
||||||
|
var _len, _results;
|
||||||
|
_results = [];
|
||||||
|
for (i = 0, _len = prefixes.length; i < _len; i++) {
|
||||||
|
prefix = prefixes[i];
|
||||||
|
link = $.el('a', {
|
||||||
|
textContent: names[i],
|
||||||
|
href: prefix + suffix
|
||||||
|
});
|
||||||
|
_results.push($.append(span, $.tn(' '), link));
|
||||||
|
}
|
||||||
|
return _results;
|
||||||
|
})());
|
||||||
|
}
|
||||||
|
return _results;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
imageClick = function(e) {
|
imageClick = function(e) {
|
||||||
if (e.shiftKey || e.altKey || e.ctrlKey) {
|
if (e.shiftKey || e.altKey || e.ctrlKey) {
|
||||||
return;
|
return;
|
||||||
@ -2057,41 +2097,7 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
if ($.config('Sauce')) {
|
if ($.config('Sauce')) {
|
||||||
g.callbacks.push(function(root) {
|
sauce.init();
|
||||||
var i, l, link, names, prefix, prefixes, span, spans, suffix, _i, _len, _results;
|
|
||||||
spans = $$('span.filesize', root);
|
|
||||||
prefixes = GM_getValue('flavors', g.flavors).split('\n');
|
|
||||||
names = (function() {
|
|
||||||
var _i, _len, _results;
|
|
||||||
_results = [];
|
|
||||||
for (_i = 0, _len = prefixes.length; _i < _len; _i++) {
|
|
||||||
prefix = prefixes[_i];
|
|
||||||
_results.push(prefix.match(/(\w+)\./)[1]);
|
|
||||||
}
|
|
||||||
return _results;
|
|
||||||
})();
|
|
||||||
_results = [];
|
|
||||||
for (_i = 0, _len = spans.length; _i < _len; _i++) {
|
|
||||||
span = spans[_i];
|
|
||||||
suffix = $('a', span).href;
|
|
||||||
i = 0;
|
|
||||||
l = names.length;
|
|
||||||
_results.push((function() {
|
|
||||||
var _results;
|
|
||||||
_results = [];
|
|
||||||
while (i < l) {
|
|
||||||
link = $.el('a', {
|
|
||||||
textContent: names[i],
|
|
||||||
href: prefixes[i] + suffix
|
|
||||||
});
|
|
||||||
$.append(span, $.tn(' '), link);
|
|
||||||
_results.push(i++);
|
|
||||||
}
|
|
||||||
return _results;
|
|
||||||
})());
|
|
||||||
}
|
|
||||||
return _results;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
if ($.config('Anonymize')) {
|
if ($.config('Anonymize')) {
|
||||||
anonymize.init();
|
anonymize.init();
|
||||||
|
|||||||
@ -1249,6 +1249,21 @@ anonymize =
|
|||||||
else
|
else
|
||||||
$.remove trip
|
$.remove trip
|
||||||
|
|
||||||
|
sauce =
|
||||||
|
init: ->
|
||||||
|
g.callbacks.push sauce.cb.node
|
||||||
|
cb:
|
||||||
|
node: (root) ->
|
||||||
|
prefixes = $.getValue('flavors', g.flavors).split '\n'
|
||||||
|
names = (prefix.match(/(\w+)\./)[1] for prefix in prefixes)
|
||||||
|
for span in $$ 'span.filesize', root
|
||||||
|
suffix = $('a', span).href
|
||||||
|
for prefix, i in prefixes
|
||||||
|
link = $.el 'a',
|
||||||
|
textContent: names[i]
|
||||||
|
href: prefix + suffix
|
||||||
|
$.append span, $.tn(' '), link
|
||||||
|
|
||||||
# TODO rewrite these **************************************************************************
|
# TODO rewrite these **************************************************************************
|
||||||
|
|
||||||
imageClick = (e) ->
|
imageClick = (e) ->
|
||||||
@ -1639,19 +1654,7 @@ if $.config 'Localize Time'
|
|||||||
s.textContent = " #{month}/#{day}/#{year}(#{dotw})#{hour}:#{min_sec} "
|
s.textContent = " #{month}/#{day}/#{year}(#{dotw})#{hour}:#{min_sec} "
|
||||||
|
|
||||||
if $.config 'Sauce'
|
if $.config 'Sauce'
|
||||||
g.callbacks.push (root) ->
|
sauce.init()
|
||||||
spans = $$ 'span.filesize', root
|
|
||||||
prefixes = GM_getValue('flavors', g.flavors).split '\n'
|
|
||||||
names = (prefix.match(/(\w+)\./)[1] for prefix in prefixes)
|
|
||||||
for span in spans
|
|
||||||
suffix = $('a', span).href
|
|
||||||
i = 0; l = names.length
|
|
||||||
while i < l
|
|
||||||
link = $.el 'a',
|
|
||||||
textContent: names[i]
|
|
||||||
href: prefixes[i] + suffix
|
|
||||||
$.append span, $.tn(' '), link
|
|
||||||
i++
|
|
||||||
|
|
||||||
if $.config 'Anonymize'
|
if $.config 'Anonymize'
|
||||||
anonymize.init()
|
anonymize.init()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user