-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);
},
receive: function(data) {
var cooldown, qr, row, tc, _ref, _ref2;
var cooldown, href, qr, row, textContent, _ref, _ref2;
$('iframe[name=iframe]').src = 'about:blank';
qr = QR.qr;
row = (_ref = $('#files input[form]', qr)) != null ? _ref.parentNode : void 0;
if (data) {
if (QR.op) {
window.location = data;
return;
}
data = JSON.parse(data);
data = JSON.parse(data);
textContent = data.textContent, href = data.href;
if (QR.op) {
window.location = href;
return;
}
if (textContent) {
$.extend($('a.error', qr), data);
tc = data.textContent;
if (tc === 'Error: Duplicate file entry detected.') {
if (textContent === 'Error: Duplicate file entry detected.') {
if (row) {
$.rm(row);
}
QR.stats();
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);
}
return;
@ -1625,16 +1625,14 @@
};
if (node = (_ref = $('table font b')) != null ? _ref.firstChild : void 0) {
textContent = node.textContent, href = node.href;
data = JSON.stringify({
textContent: textContent,
href: href
});
} else if (node = $('meta')) {
data = node.content.match(/url=(.+)/)[1];
if (/#/.test(data)) {
data = '';
}
} else {
node = $('meta');
href = node.content.match(/url=(.+)/)[1];
}
data = JSON.stringify({
textContent: textContent,
href: href
});
return parent.postMessage(data, '*');
});
}

View File

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