pull coffee-script master
This commit is contained in:
parent
dd9ce8c32c
commit
59633ea1dd
88
4chan_x.js
88
4chan_x.js
@ -61,7 +61,7 @@
|
||||
(function() {
|
||||
var $, $$, Favicon, NAMESPACE, Recaptcha, anonymize, config, d, expandComment, expandThread, g, imageHover, imgExpand, imgGif, imgPreloading, keybinds, localize, log, main, nav, nodeInserted, options, qr, quickReport, redirect, replyHiding, sauce, threadHiding, titlePost, ui, unread, updater, watcher, _config, _ref;
|
||||
var __slice = Array.prototype.slice;
|
||||
if (typeof console != "undefined" && console !== null) {
|
||||
if (typeof console !== "undefined" && console !== null) {
|
||||
log = function(arg) {
|
||||
return console.log(arg);
|
||||
};
|
||||
@ -897,29 +897,29 @@
|
||||
/*
|
||||
In order to get qr error notifications in chrome, there are two issues we
|
||||
have to work around:
|
||||
|
||||
|
||||
|
||||
|
||||
http://code.google.com/p/chromium/issues/detail?id=20773
|
||||
Let content scripts see other frames (instead of them being undefined)
|
||||
|
||||
|
||||
We can't directly pass messages between the top window and the iframe, so
|
||||
we have to break out of the sandbox and evaulate code in the global context.
|
||||
|
||||
|
||||
|
||||
|
||||
http://code.google.com/p/chromium/issues/detail?id=61856
|
||||
Support @run-at for user scripts
|
||||
|
||||
|
||||
http://www.chromium.org/developers/design-documents/user-scripts
|
||||
|
||||
|
||||
In Chromium/Google Chrome, Greasemonkey scripts are injected by default at
|
||||
a new point called "document-idle". This is different than Greasemonkey,
|
||||
which always injects at document-end.
|
||||
|
||||
|
||||
...
|
||||
|
||||
|
||||
However, if the page loads quickly, scripts may not be run until after
|
||||
window.onload has occurred -- much later than with Greasemonkey.
|
||||
|
||||
|
||||
We can't force the script to run at document-end, so we can't rely on the
|
||||
load event to tell us when the hidden iframe is ready to receive our ping;
|
||||
instead, we have to emit our own event.
|
||||
@ -1538,17 +1538,17 @@
|
||||
span = _ref[_i];
|
||||
suffix = $('a', span).href;
|
||||
_results.push((function() {
|
||||
var _len, _results;
|
||||
_results = [];
|
||||
for (i = 0, _len = prefixes.length; i < _len; i++) {
|
||||
var _len2, _results2;
|
||||
_results2 = [];
|
||||
for (i = 0, _len2 = prefixes.length; i < _len2; i++) {
|
||||
prefix = prefixes[i];
|
||||
link = $.el('a', {
|
||||
textContent: names[i],
|
||||
href: prefix + suffix
|
||||
});
|
||||
_results.push($.append(span, $.tn(' '), link));
|
||||
_results2.push($.append(span, $.tn(' '), link));
|
||||
}
|
||||
return _results;
|
||||
return _results2;
|
||||
})());
|
||||
}
|
||||
return _results;
|
||||
@ -1734,10 +1734,10 @@
|
||||
};
|
||||
Recaptcha = {
|
||||
init: function() {
|
||||
var el, recaptcha, _i, _len, _ref;
|
||||
_ref = $$('#recaptcha_table a');
|
||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||
el = _ref[_i];
|
||||
var el, recaptcha, _i, _len, _ref2;
|
||||
_ref2 = $$('#recaptcha_table a');
|
||||
for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
|
||||
el = _ref2[_i];
|
||||
el.tabIndex = 1;
|
||||
}
|
||||
recaptcha = $('#recaptcha_response_field');
|
||||
@ -1753,13 +1753,13 @@
|
||||
}
|
||||
};
|
||||
nodeInserted = function(e) {
|
||||
var callback, dialog, target, _i, _len, _ref, _results;
|
||||
var callback, dialog, target, _i, _len, _ref2, _results;
|
||||
target = e.target;
|
||||
if (target.nodeName === 'TABLE') {
|
||||
_ref = g.callbacks;
|
||||
_ref2 = g.callbacks;
|
||||
_results = [];
|
||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||
callback = _ref[_i];
|
||||
for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
|
||||
callback = _ref2[_i];
|
||||
_results.push(callback(target));
|
||||
}
|
||||
return _results;
|
||||
@ -1864,11 +1864,11 @@
|
||||
},
|
||||
cb: {
|
||||
node: function(root) {
|
||||
var thumb, _i, _len, _ref, _results;
|
||||
_ref = $$('img[md5]', root);
|
||||
var thumb, _i, _len, _ref2, _results;
|
||||
_ref2 = $$('img[md5]', root);
|
||||
_results = [];
|
||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||
thumb = _ref[_i];
|
||||
for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
|
||||
thumb = _ref2[_i];
|
||||
$.bind(thumb.parentNode, 'click', imgExpand.cb.toggle);
|
||||
_results.push(imgExpand.on ? imgExpand.expand(thumb.parentNode) : void 0);
|
||||
}
|
||||
@ -1905,14 +1905,14 @@
|
||||
}
|
||||
},
|
||||
typeChange: function(e) {
|
||||
var ch, cw, imageType, img, _i, _len, _ref, _results;
|
||||
var ch, cw, imageType, img, _i, _len, _ref2, _results;
|
||||
cw = d.body.clientWidth;
|
||||
ch = d.body.clientHeight;
|
||||
imageType = e.target.value;
|
||||
_ref = $$('img[md5] + img');
|
||||
_ref2 = $$('img[md5] + img');
|
||||
_results = [];
|
||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||
img = _ref[_i];
|
||||
for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
|
||||
img = _ref2[_i];
|
||||
_results.push(imgExpand.resize(cw, ch, imageType, img));
|
||||
}
|
||||
return _results;
|
||||
@ -1945,8 +1945,8 @@
|
||||
return imgExpand.resize(cw, ch, imageType, img);
|
||||
},
|
||||
resize: function(cw, ch, imageType, img) {
|
||||
var ih, iw, ratio, _, _ref;
|
||||
_ref = $.x("preceding::span[@class][1]/text()[2]", img).textContent.match(/(\d+)x(\d+)/), _ = _ref[0], iw = _ref[1], ih = _ref[2];
|
||||
var ih, iw, ratio, _, _ref2;
|
||||
_ref2 = $.x("preceding::span[@class][1]/text()[2]", img).textContent.match(/(\d+)x(\d+)/), _ = _ref2[0], iw = _ref2[1], ih = _ref2[2];
|
||||
iw = Number(iw);
|
||||
ih = Number(ih);
|
||||
switch (imageType) {
|
||||
@ -1967,15 +1967,15 @@
|
||||
}
|
||||
},
|
||||
dialog: function() {
|
||||
var controls, delform, imageType, option, _i, _len, _ref;
|
||||
var controls, delform, imageType, option, _i, _len, _ref2;
|
||||
controls = $.el('div', {
|
||||
id: 'imgControls',
|
||||
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>"
|
||||
});
|
||||
imageType = $.getValue('imageType', 'full');
|
||||
_ref = $$('option', controls);
|
||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||
option = _ref[_i];
|
||||
_ref2 = $$('option', controls);
|
||||
for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
|
||||
option = _ref2[_i];
|
||||
if (option.textContent === imageType) {
|
||||
option.selected = true;
|
||||
break;
|
||||
@ -1997,7 +1997,7 @@
|
||||
};
|
||||
main = {
|
||||
init: function() {
|
||||
var callback, navtopr, pathname, temp, tzOffset, _i, _len, _ref;
|
||||
var callback, navtopr, pathname, temp, tzOffset, _i, _len, _ref2;
|
||||
Favicon.halo = /ws/.test(Favicon["default"]) ? Favicon.haloSFW : Favicon.haloNSFW;
|
||||
pathname = location.pathname.substring(1).split('/');
|
||||
g.BOARD = pathname[0], temp = pathname[1];
|
||||
@ -2023,12 +2023,12 @@
|
||||
if g.hiddenThreads[0].timestamp > cutoff
|
||||
break
|
||||
g.hiddenThreads.shift()
|
||||
|
||||
|
||||
while g.hiddenReplies.length
|
||||
if g.hiddenReplies[0].timestamp > cutoff
|
||||
break
|
||||
g.hiddenReplies.shift()
|
||||
|
||||
|
||||
GM_setValue("hiddenThreads/#{g.BOARD}/", JSON.stringify(g.hiddenThreads))
|
||||
GM_setValue("hiddenReplies/#{g.BOARD}/", JSON.stringify(g.hiddenReplies))
|
||||
GM_setValue('lastChecked', now.toString())
|
||||
@ -2113,9 +2113,9 @@
|
||||
expandComment.init();
|
||||
}
|
||||
}
|
||||
_ref = g.callbacks;
|
||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||
callback = _ref[_i];
|
||||
_ref2 = g.callbacks;
|
||||
for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
|
||||
callback = _ref2[_i];
|
||||
callback();
|
||||
}
|
||||
return $.bind(d.body, 'DOMNodeInserted', nodeInserted);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user