This commit is contained in:
James Campos 2011-09-05 20:29:15 -07:00
parent 5abf8531df
commit 4e37bd7961
2 changed files with 27 additions and 6 deletions

View File

@ -1306,7 +1306,6 @@
}, },
attach: function() { attach: function() {
var div, file, files; var div, file, files;
$('#autopost', QR.qr).checked = true;
files = $('#files', QR.qr); files = $('#files', QR.qr);
div = $.el('div', { div = $.el('div', {
innerHTML: "<input type=file name=upfile accept='" + QR.accept + "'><img alt='click here'><a class=x>X</a>" innerHTML: "<input type=file name=upfile accept='" + QR.accept + "'><img alt='click here'><a class=x>X</a>"
@ -1490,6 +1489,10 @@
row = (_ref = $('#files input[form]', qr)) != null ? _ref.parentNode : void 0; row = (_ref = $('#files input[form]', qr)) != null ? _ref.parentNode : void 0;
data = e.data; data = e.data;
if (data) { if (data) {
if (QR.op) {
window.location = data;
}
return;
data = JSON.parse(data); data = JSON.parse(data);
$.extend($('a.error', QR.qr), data); $.extend($('a.error', QR.qr), data);
tc = data.textContent; tc = data.textContent;
@ -1563,8 +1566,12 @@
$('#qr_form', qr).submit(); $('#qr_form', qr).submit();
} }
QR.sage = /sage/i.test($('[name=email]', qr).value); QR.sage = /sage/i.test($('[name=email]', qr).value);
id = $('input[name=resto]', qr).value;
QR.op = !id;
if (QR.op) {
$('[name=email]', qr).value = 'noko';
}
if (conf['Thread Watcher'] && conf['Auto Watch Reply']) { if (conf['Thread Watcher'] && conf['Auto Watch Reply']) {
id = $('input[name=resto]', qr.el).value;
op = $.id(id); op = $.id(id);
if ($('img.favicon', op).src === Favicon.empty) { if ($('img.favicon', op).src === Favicon.empty) {
return watcher.watch(op, id); return watcher.watch(op, id);
@ -1579,12 +1586,18 @@
} }
return $.globalEval(function() { return $.globalEval(function() {
var data, href, node, textContent, _ref; var data, href, node, textContent, _ref;
if (node = (_ref = document.querySelector('table font b')) != null ? _ref.firstChild : void 0) { $ = function(css) {
return document.querySelector(css);
};
if (node = (_ref = $('table font b')) != null ? _ref.firstChild : void 0) {
textContent = node.textContent, href = node.href; textContent = node.textContent, href = node.href;
alert(textContent);
data = JSON.stringify({ data = JSON.stringify({
textContent: textContent, textContent: textContent,
href: href href: href
}); });
} else if (node = $('meta')) {
data = node.content.match(/url=(.+)/)[1];
} }
return parent.postMessage(data, '*'); return parent.postMessage(data, '*');
}); });

View File

@ -993,7 +993,7 @@ QR =
if conf['Auto Hide QR'] if conf['Auto Hide QR']
$('#autohide', QR.qr).checked = true $('#autohide', QR.qr).checked = true
attach: -> attach: ->
$('#autopost', QR.qr).checked = true #$('#autopost', QR.qr).checked = true
files = $ '#files', QR.qr files = $ '#files', QR.qr
div = $.el 'div', div = $.el 'div',
innerHTML: "<input type=file name=upfile accept='#{QR.accept}'><img alt='click here'><a class=x>X</a>" innerHTML: "<input type=file name=upfile accept='#{QR.accept}'><img alt='click here'><a class=x>X</a>"
@ -1156,6 +1156,8 @@ QR =
row = $('#files input[form]', qr)?.parentNode row = $('#files input[form]', qr)?.parentNode
{data} = e {data} = e
if data if data
window.location = data if QR.op
return
data = JSON.parse data data = JSON.parse data
$.extend $('a.error', QR.qr), data $.extend $('a.error', QR.qr), data
tc = data.textContent tc = data.textContent
@ -1201,8 +1203,10 @@ QR =
input.setAttribute 'form', 'qr_form' input.setAttribute 'form', 'qr_form'
$('#qr_form', qr).submit() if not e $('#qr_form', qr).submit() if not e
QR.sage = /sage/i.test $('[name=email]', qr).value QR.sage = /sage/i.test $('[name=email]', qr).value
id = $('input[name=resto]', qr).value
QR.op = not id
$('[name=email]', qr).value = 'noko' if QR.op
if conf['Thread Watcher'] and conf['Auto Watch Reply'] if conf['Thread Watcher'] and conf['Auto Watch Reply']
id = $('input[name=resto]', qr.el).value
op = $.id id op = $.id id
if $('img.favicon', op).src is Favicon.empty if $('img.favicon', op).src is Favicon.empty
watcher.watch op, id watcher.watch op, id
@ -1211,9 +1215,13 @@ QR =
$.bind recaptcha, 'keydown', Recaptcha.listener $.bind recaptcha, 'keydown', Recaptcha.listener
return return
$.globalEval -> $.globalEval ->
if node = document.querySelector('table font b')?.firstChild $ = (css) -> document.querySelector css
if node = $('table font b')?.firstChild
{textContent, href} = node {textContent, href} = node
alert textContent
data = JSON.stringify {textContent, href} data = JSON.stringify {textContent, href}
else if node = $ 'meta'
data = node.content.match(/url=(.+)/)[1]
parent.postMessage data, '*' parent.postMessage data, '*'
#parent will blank us on message receival; #parent will blank us on message receival;
#if we're not an iframe, we won't get blanked #if we're not an iframe, we won't get blanked