pull coffee-script master

This commit is contained in:
James Campos 2011-04-24 12:57:59 -07:00
parent dd9ce8c32c
commit 59633ea1dd

View File

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