-string test, +object test

This commit is contained in:
James Campos 2011-09-25 00:32:32 -07:00
parent 4cdf3319b8
commit 1b6e77be81
2 changed files with 29 additions and 31 deletions

View File

@ -1509,25 +1509,25 @@
return (_base = $('[name=resto]', qr)).value || (_base.value = tid); return (_base = $('[name=resto]', qr)).value || (_base.value = tid);
}, },
receive: function(data) { receive: function(data) {
var cooldown, qr, row, tc, _ref, _ref2; var cooldown, href, qr, row, textContent, _ref, _ref2;
$('iframe[name=iframe]').src = 'about:blank'; $('iframe[name=iframe]').src = 'about:blank';
qr = QR.qr; qr = QR.qr;
row = (_ref = $('#files input[form]', qr)) != null ? _ref.parentNode : void 0; row = (_ref = $('#files input[form]', qr)) != null ? _ref.parentNode : void 0;
if (data) { data = JSON.parse(data);
if (QR.op) { textContent = data.textContent, href = data.href;
window.location = data; if (QR.op) {
return; window.location = href;
} return;
data = JSON.parse(data); }
if (textContent) {
$.extend($('a.error', qr), data); $.extend($('a.error', qr), data);
tc = data.textContent; if (textContent === 'Error: Duplicate file entry detected.') {
if (tc === 'Error: Duplicate file entry detected.') {
if (row) { if (row) {
$.rm(row); $.rm(row);
} }
QR.stats(); QR.stats();
setTimeout(QR.submit, 1000); setTimeout(QR.submit, 1000);
} else if (tc === 'You seem to have mistyped the verification.') { } else if (textContent === 'You seem to have mistyped the verification.') {
setTimeout(QR.submit, 1000); setTimeout(QR.submit, 1000);
} }
return; return;
@ -1625,16 +1625,14 @@
}; };
if (node = (_ref = $('table font b')) != null ? _ref.firstChild : void 0) { if (node = (_ref = $('table font b')) != null ? _ref.firstChild : void 0) {
textContent = node.textContent, href = node.href; textContent = node.textContent, href = node.href;
data = JSON.stringify({ } else {
textContent: textContent, node = $('meta');
href: href href = node.content.match(/url=(.+)/)[1];
});
} else if (node = $('meta')) {
data = node.content.match(/url=(.+)/)[1];
if (/#/.test(data)) {
data = '';
}
} }
data = JSON.stringify({
textContent: textContent,
href: href
});
return parent.postMessage(data, '*'); return parent.postMessage(data, '*');
}); });
} }

View File

@ -1147,18 +1147,18 @@ QR =
$('iframe[name=iframe]').src = 'about:blank' $('iframe[name=iframe]').src = 'about:blank'
{qr} = QR {qr} = QR
row = $('#files input[form]', qr)?.parentNode row = $('#files input[form]', qr)?.parentNode
if data data = JSON.parse data
if QR.op {textContent, href} = data
window.location = data if QR.op
return window.location = href
data = JSON.parse data return
if textContent
$.extend $('a.error', qr), data $.extend $('a.error', qr), data
tc = data.textContent if textContent is 'Error: Duplicate file entry detected.'
if tc is 'Error: Duplicate file entry detected.'
$.rm row if row $.rm row if row
QR.stats() QR.stats()
setTimeout QR.submit, 1000 setTimeout QR.submit, 1000
else if tc is 'You seem to have mistyped the verification.' else if textContent is 'You seem to have mistyped the verification.'
setTimeout QR.submit, 1000 setTimeout QR.submit, 1000
return return
$.rm row if row $.rm row if row
@ -1220,10 +1220,10 @@ QR =
$ = (css) -> document.querySelector css $ = (css) -> document.querySelector css
if node = $('table font b')?.firstChild if node = $('table font b')?.firstChild
{textContent, href} = node {textContent, href} = node
data = JSON.stringify {textContent, href} else
else if node = $ 'meta' node = $ 'meta'
data = node.content.match(/url=(.+)/)[1] href = node.content.match(/url=(.+)/)[1]
if /#/.test data then data = '' #not op data = JSON.stringify { textContent, href }
parent.postMessage data, '*' parent.postMessage data, '*'
#if we're an iframe, parent will blank us #if we're an iframe, parent will blank us