General qr.el
This commit is contained in:
parent
9f160ce9db
commit
be8a3b9686
102
4chan_x.user.js
102
4chan_x.user.js
@ -743,7 +743,7 @@
|
|||||||
},
|
},
|
||||||
cb: {
|
cb: {
|
||||||
keydown: function(e) {
|
keydown: function(e) {
|
||||||
var key, o, qr, range, selEnd, selStart, ta, thread, valEnd, valMid, valStart, value, _ref, _ref2, _ref3;
|
var key, o, range, selEnd, selStart, ta, thread, valEnd, valMid, valStart, value, _ref, _ref2, _ref3;
|
||||||
if (((_ref = d.activeElement.nodeName) === 'TEXTAREA' || _ref === 'INPUT') && !e.altKey && !e.ctrlKey && !(e.keyCode === 27)) {
|
if (((_ref = d.activeElement.nodeName) === 'TEXTAREA' || _ref === 'INPUT') && !e.altKey && !e.ctrlKey && !(e.keyCode === 27)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -759,8 +759,8 @@
|
|||||||
case keybinds.close:
|
case keybinds.close:
|
||||||
if (o = $('#overlay')) {
|
if (o = $('#overlay')) {
|
||||||
$.rm(o);
|
$.rm(o);
|
||||||
} else if (qr = $('#qr')) {
|
} else if (qr.el) {
|
||||||
$.rm(qr);
|
qr.close();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case keybinds.spoiler:
|
case keybinds.spoiler:
|
||||||
@ -834,8 +834,8 @@
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case keybinds.submit:
|
case keybinds.submit:
|
||||||
if (qr = $('#qr_form')) {
|
if (qr.el) {
|
||||||
qr.submit();
|
qr.submit.call($('form', qr.el));
|
||||||
} else {
|
} else {
|
||||||
$('.postarea form').submit();
|
$('.postarea form').submit();
|
||||||
}
|
}
|
||||||
@ -881,10 +881,10 @@
|
|||||||
if (quote) {
|
if (quote) {
|
||||||
return qr.quote(qrLink);
|
return qr.quote(qrLink);
|
||||||
} else {
|
} else {
|
||||||
if (!$('#qr')) {
|
if (!qr.el) {
|
||||||
qr.dialog(qrLink);
|
qr.dialog(qrLink);
|
||||||
}
|
}
|
||||||
return $('#qr textarea').focus();
|
return $('textarea', qr.el).focus();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
open: function(thread, tab) {
|
open: function(thread, tab) {
|
||||||
@ -1226,8 +1226,8 @@
|
|||||||
submit.disabled = false;
|
submit.disabled = false;
|
||||||
submit.value = 'Submit';
|
submit.value = 'Submit';
|
||||||
}
|
}
|
||||||
if ((_ref = $('#auto')) != null ? _ref.checked : void 0) {
|
if ((_ref = $('#auto', qr.el)) != null ? _ref.checked : void 0) {
|
||||||
return qr.submit.call($('#qr_form'));
|
return qr.submit.call($('form', qr.el));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1247,40 +1247,37 @@
|
|||||||
autohide: {
|
autohide: {
|
||||||
set: function() {
|
set: function() {
|
||||||
var _ref;
|
var _ref;
|
||||||
return (_ref = $('#qr input[title=autohide]:not(:checked)')) != null ? _ref.click() : void 0;
|
return (_ref = $('input[title=autohide]:not(:checked)', qr.el)) != null ? _ref.click() : void 0;
|
||||||
},
|
},
|
||||||
unset: function() {
|
unset: function() {
|
||||||
var _ref;
|
var _ref;
|
||||||
return (_ref = $('#qr input[title=autohide]:checked')) != null ? _ref.click() : void 0;
|
return (_ref = $('input[title=autohide]:checked', qr.el)) != null ? _ref.click() : void 0;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
cb: {
|
cb: {
|
||||||
autohide: function(e) {
|
autohide: function(e) {
|
||||||
var dialog;
|
|
||||||
dialog = $('#qr');
|
|
||||||
if (this.checked) {
|
if (this.checked) {
|
||||||
return $.addClass(dialog, 'auto');
|
return $.addClass(qr.el, 'auto');
|
||||||
} else {
|
} else {
|
||||||
return $.removeClass(dialog, 'auto');
|
return $.removeClass(qr.el, 'auto');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
message: function(e) {
|
message: function(e) {
|
||||||
var data, dialog, duration;
|
var data, duration;
|
||||||
Recaptcha.reload();
|
Recaptcha.reload();
|
||||||
$('iframe[name=iframe]').src = 'about:blank';
|
$('iframe[name=iframe]').src = 'about:blank';
|
||||||
data = e.data;
|
data = e.data;
|
||||||
dialog = $('#qr');
|
|
||||||
if (data) {
|
if (data) {
|
||||||
$('input[name=recaptcha_response_field]', dialog).value = '';
|
$('input[name=recaptcha_response_field]', qr.el).value = '';
|
||||||
$('#error').textContent = data;
|
$('#error', qr.el).textContent = data;
|
||||||
qr.autohide.unset();
|
qr.autohide.unset();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (dialog) {
|
if (qr.el) {
|
||||||
if (g.REPLY && $.config('Persistent QR')) {
|
if (g.REPLY && $.config('Persistent QR')) {
|
||||||
qr.refresh(dialog);
|
qr.refresh();
|
||||||
} else {
|
} else {
|
||||||
$.rm(dialog);
|
qr.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($.config('Cooldown')) {
|
if ($.config('Cooldown')) {
|
||||||
@ -1305,7 +1302,7 @@
|
|||||||
if (g.REPLY && $('img.favicon').src === Favicon.empty) {
|
if (g.REPLY && $('img.favicon').src === Favicon.empty) {
|
||||||
watcher.watch(null, g.THREAD_ID);
|
watcher.watch(null, g.THREAD_ID);
|
||||||
} else {
|
} else {
|
||||||
id = $('input[name=resto]').value;
|
id = $('input[name=resto]', qr.el).value;
|
||||||
op = d.getElementById(id);
|
op = d.getElementById(id);
|
||||||
if ($('img.favicon', op).src === Favicon.empty) {
|
if ($('img.favicon', op).src === Favicon.empty) {
|
||||||
watcher.watch(op, id);
|
watcher.watch(op, id);
|
||||||
@ -1319,7 +1316,7 @@
|
|||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
}
|
}
|
||||||
if (isQR) {
|
if (isQR) {
|
||||||
return $('#error').textContent = 'Error: File too large.';
|
return $('#error', qr.el).textContent = 'Error: File too large.';
|
||||||
} else {
|
} else {
|
||||||
return alert('Error: File too large.');
|
return alert('Error: File too large.');
|
||||||
}
|
}
|
||||||
@ -1327,17 +1324,17 @@
|
|||||||
if (!e) {
|
if (!e) {
|
||||||
this.submit();
|
this.submit();
|
||||||
}
|
}
|
||||||
$('#error').textContent = '';
|
$('#error', qr.el).textContent = '';
|
||||||
qr.autohide.set();
|
qr.autohide.set();
|
||||||
return qr.sage = /sage/i.test($('input[name=email]', this).value);
|
return qr.sage = /sage/i.test($('input[name=email]', this).value);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
quote: function(link) {
|
quote: function(link) {
|
||||||
var dialog, id, s, selection, selectionID, ta, text, _ref;
|
var id, s, selection, selectionID, ta, text, _ref;
|
||||||
if (dialog = $('#qr')) {
|
if (qr.el) {
|
||||||
qr.autohide.unset();
|
qr.autohide.unset();
|
||||||
} else {
|
} else {
|
||||||
dialog = qr.dialog(link);
|
qr.dialog(link);
|
||||||
}
|
}
|
||||||
id = link.textContent;
|
id = link.textContent;
|
||||||
text = ">>" + id + "\n";
|
text = ">>" + id + "\n";
|
||||||
@ -1348,48 +1345,49 @@
|
|||||||
text += ">" + s + "\n";
|
text += ">" + s + "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ta = $('textarea', dialog);
|
ta = $('textarea', qr.el);
|
||||||
ta.focus();
|
ta.focus();
|
||||||
return ta.value += text;
|
return ta.value += text;
|
||||||
},
|
},
|
||||||
refresh: function(dialog) {
|
refresh: function() {
|
||||||
var c, m;
|
var c, m;
|
||||||
$('form', dialog).reset();
|
$('form', qr.el).reset();
|
||||||
c = d.cookie;
|
c = d.cookie;
|
||||||
$('input[name=name]', dialog).value = (m = c.match(/4chan_name=([^;]+)/)) ? decodeURIComponent(m[1]) : '';
|
$('input[name=name]', qr.el).value = (m = c.match(/4chan_name=([^;]+)/)) ? decodeURIComponent(m[1]) : '';
|
||||||
$('input[name=email]', dialog).value = (m = c.match(/4chan_email=([^;]+)/)) ? decodeURIComponent(m[1]) : '';
|
$('input[name=email]', qr.el).value = (m = c.match(/4chan_email=([^;]+)/)) ? decodeURIComponent(m[1]) : '';
|
||||||
return $('input[name=pwd]', dialog).value = (m = c.match(/4chan_pass=([^;]+)/)) ? decodeURIComponent(m[1]) : $('input[name=pwd]').value;
|
return $('input[name=pwd]', qr.el).value = (m = c.match(/4chan_pass=([^;]+)/)) ? decodeURIComponent(m[1]) : $('input[name=pwd]').value;
|
||||||
},
|
},
|
||||||
dialog: function(link) {
|
dialog: function(link) {
|
||||||
var THREAD_ID, challenge, dialog, html, spoiler, submitDisabled, submitValue;
|
var THREAD_ID, challenge, html, spoiler, submitDisabled, submitValue;
|
||||||
submitValue = $('#com_submit').value;
|
submitValue = $('#com_submit').value;
|
||||||
submitDisabled = $('#com_submit').disabled ? 'disabled' : '';
|
submitDisabled = $('#com_submit').disabled ? 'disabled' : '';
|
||||||
THREAD_ID = g.THREAD_ID || $.x('ancestor::div[@class="thread"]/div', link).id;
|
THREAD_ID = g.THREAD_ID || $.x('ancestor::div[@class="thread"]/div', link).id;
|
||||||
spoiler = $('.postarea label') ? '<label> [<input type=checkbox name=spoiler>Spoiler Image?]</label>' : '';
|
spoiler = $('.postarea label') ? '<label> [<input type=checkbox name=spoiler>Spoiler Image?]</label>' : '';
|
||||||
challenge = $('input[name=recaptcha_challenge_field]').value;
|
challenge = $('input[name=recaptcha_challenge_field]').value;
|
||||||
html = " <div class=move> <input class=inputtext type=text name=name placeholder=Name form=qr_form> Quick Reply <input type=checkbox id=autohide title=autohide> <a name=close title=close>X</a> </div> <form name=post action=http://sys.4chan.org/" + g.BOARD + "/post method=POST enctype=multipart/form-data target=iframe id=qr_form> <input type=hidden name=resto value=" + THREAD_ID + "> <input type=hidden name=recaptcha_challenge_field value=" + challenge + "> <div><input class=inputtext type=text name=email placeholder=E-mail>" + spoiler + "</div> <div><input class=inputtext type=text name=sub placeholder=Subject><input type=submit value=" + submitValue + " id=com_submit " + submitDisabled + "><label><input type=checkbox id=auto>auto</label></div> <div><textarea class=inputtext name=com placeholder=Comment></textarea></div> <div><img src=http://www.google.com/recaptcha/api/image?c=" + challenge + "></div> <div><input class=inputtext type=text name=recaptcha_response_field placeholder=Verification required autocomplete=off></div> <div><input type=file name=upfile></div> <div><input class=inputtext type=password name=pwd maxlength=8 placeholder=Password><input type=hidden name=mode value=regist></div> </form> <div id=error class=error></div> ";
|
html = " <div class=move> <input class=inputtext type=text name=name placeholder=Name form=qr_form> Quick Reply <input type=checkbox id=autohide title=autohide> <a name=close title=close>X</a> </div> <form name=post action=http://sys.4chan.org/" + g.BOARD + "/post method=POST enctype=multipart/form-data target=iframe id=qr_form> <input type=hidden name=resto value=" + THREAD_ID + "> <input type=hidden name=recaptcha_challenge_field value=" + challenge + "> <div><input class=inputtext type=text name=email placeholder=E-mail>" + spoiler + "</div> <div><input class=inputtext type=text name=sub placeholder=Subject><input type=submit value=" + submitValue + " id=com_submit " + submitDisabled + "><label><input type=checkbox id=auto>auto</label></div> <div><textarea class=inputtext name=com placeholder=Comment></textarea></div> <div><img src=http://www.google.com/recaptcha/api/image?c=" + challenge + "></div> <div><input class=inputtext type=text name=recaptcha_response_field placeholder=Verification required autocomplete=off></div> <div><input type=file name=upfile></div> <div><input class=inputtext type=password name=pwd maxlength=8 placeholder=Password><input type=hidden name=mode value=regist></div> </form> <div id=error class=error></div> ";
|
||||||
dialog = ui.dialog('qr', {
|
qr.el = ui.dialog('qr', {
|
||||||
top: '0px',
|
top: '0px',
|
||||||
left: '0px'
|
left: '0px'
|
||||||
}, html);
|
}, html);
|
||||||
qr.refresh(dialog);
|
qr.refresh;
|
||||||
$.bind($('input[name=name]', dialog), 'mousedown', function(e) {
|
$.bind($('input[name=name]', qr.el), 'mousedown', function(e) {
|
||||||
return e.stopPropagation();
|
return e.stopPropagation();
|
||||||
});
|
});
|
||||||
$.bind($('#autohide', dialog), 'click', qr.cb.autohide);
|
$.bind($('#autohide', qr.el), 'click', qr.cb.autohide);
|
||||||
$.bind($('a[name=close]', dialog), 'click', function() {
|
$.bind($('a[name=close]', qr.el), 'click', qr.close);
|
||||||
return $.rm(dialog);
|
$.bind($('form', qr.el), 'submit', qr.submit);
|
||||||
});
|
$.bind($('img', qr.el), 'click', Recaptcha.reload);
|
||||||
$.bind($('form', dialog), 'submit', qr.submit);
|
$.bind($('input[name=recaptcha_response_field]', qr.el), 'keydown', Recaptcha.listener);
|
||||||
$.bind($('img', dialog), 'click', Recaptcha.reload);
|
return $.append(d.body, qr.el);
|
||||||
$.bind($('input[name=recaptcha_response_field]', dialog), 'keydown', Recaptcha.listener);
|
|
||||||
$.append(d.body, dialog);
|
|
||||||
return dialog;
|
|
||||||
},
|
},
|
||||||
persist: function() {
|
persist: function() {
|
||||||
$.append(d.body, qr.dialog());
|
$.append(d.body, qr.dialog());
|
||||||
return qr.autohide.set();
|
return qr.autohide.set();
|
||||||
},
|
},
|
||||||
|
close: function() {
|
||||||
|
$.rm(qr.el);
|
||||||
|
return qr.el = null;
|
||||||
|
},
|
||||||
sys: function() {
|
sys: function() {
|
||||||
var c, duration, id, noko, recaptcha, thread, _, _ref;
|
var c, duration, id, noko, recaptcha, thread, _, _ref;
|
||||||
if (recaptcha = $('#recaptcha_response_field')) {
|
if (recaptcha = $('#recaptcha_response_field')) {
|
||||||
@ -2411,7 +2409,7 @@
|
|||||||
Recaptcha.reload();
|
Recaptcha.reload();
|
||||||
}
|
}
|
||||||
if (e.keyCode === 13 && cooldown.duration) {
|
if (e.keyCode === 13 && cooldown.duration) {
|
||||||
$('#auto').checked = true;
|
$('#auto', qr.el).checked = true;
|
||||||
return qr.autohide.set();
|
return qr.autohide.set();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -2419,13 +2417,13 @@
|
|||||||
return window.location = 'javascript:Recaptcha.reload()';
|
return window.location = 'javascript:Recaptcha.reload()';
|
||||||
},
|
},
|
||||||
reloaded: function(e) {
|
reloaded: function(e) {
|
||||||
var dialog, target;
|
var target;
|
||||||
if (!(dialog = $('#qr'))) {
|
if (!qr.el) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
target = e.target;
|
target = e.target;
|
||||||
$('img', dialog).src = "http://www.google.com/recaptcha/api/image?c=" + target.value;
|
$('img', qr.el).src = "http://www.google.com/recaptcha/api/image?c=" + target.value;
|
||||||
return $('input[name=recaptcha_challenge_field]', dialog).value = target.value;
|
return $('input[name=recaptcha_challenge_field]', qr.el).value = target.value;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
nodeInserted = function(e) {
|
nodeInserted = function(e) {
|
||||||
|
|||||||
@ -546,8 +546,8 @@ keybinds =
|
|||||||
when keybinds.close
|
when keybinds.close
|
||||||
if o = $ '#overlay'
|
if o = $ '#overlay'
|
||||||
$.rm o
|
$.rm o
|
||||||
else if qr = $ '#qr'
|
else if qr.el
|
||||||
$.rm qr
|
qr.close()
|
||||||
when keybinds.spoiler
|
when keybinds.spoiler
|
||||||
ta = d.activeElement
|
ta = d.activeElement
|
||||||
return unless ta.nodeName is 'TEXTAREA'
|
return unless ta.nodeName is 'TEXTAREA'
|
||||||
@ -598,8 +598,8 @@ keybinds =
|
|||||||
when keybinds.previousPage
|
when keybinds.previousPage
|
||||||
$('input[value=Previous]')?.click()
|
$('input[value=Previous]')?.click()
|
||||||
when keybinds.submit
|
when keybinds.submit
|
||||||
if qr = $('#qr_form')
|
if qr.el
|
||||||
qr.submit()
|
qr.submit.call $ 'form', qr.el
|
||||||
else
|
else
|
||||||
$('.postarea form').submit()
|
$('.postarea form').submit()
|
||||||
else
|
else
|
||||||
@ -635,9 +635,9 @@ keybinds =
|
|||||||
if quote
|
if quote
|
||||||
qr.quote qrLink
|
qr.quote qrLink
|
||||||
else
|
else
|
||||||
unless $ '#qr'
|
unless qr.el
|
||||||
qr.dialog qrLink
|
qr.dialog qrLink
|
||||||
$('#qr textarea').focus()
|
$('textarea', qr.el).focus()
|
||||||
|
|
||||||
open: (thread, tab) ->
|
open: (thread, tab) ->
|
||||||
id = thread.firstChild.id
|
id = thread.firstChild.id
|
||||||
@ -960,8 +960,8 @@ cooldown =
|
|||||||
for submit in submits
|
for submit in submits
|
||||||
submit.disabled = false
|
submit.disabled = false
|
||||||
submit.value = 'Submit'
|
submit.value = 'Submit'
|
||||||
if $('#auto')?.checked
|
if $('#auto', qr.el)?.checked
|
||||||
qr.submit.call $ '#qr_form'
|
qr.submit.call $ 'form', qr.el
|
||||||
|
|
||||||
qr =
|
qr =
|
||||||
init: ->
|
init: ->
|
||||||
@ -977,35 +977,33 @@ qr =
|
|||||||
|
|
||||||
autohide:
|
autohide:
|
||||||
set: ->
|
set: ->
|
||||||
$('#qr input[title=autohide]:not(:checked)')?.click()
|
$('input[title=autohide]:not(:checked)', qr.el)?.click()
|
||||||
unset: ->
|
unset: ->
|
||||||
$('#qr input[title=autohide]:checked')?.click()
|
$('input[title=autohide]:checked', qr.el)?.click()
|
||||||
|
|
||||||
cb:
|
cb:
|
||||||
autohide: (e) ->
|
autohide: (e) ->
|
||||||
dialog = $ '#qr'
|
|
||||||
if @checked
|
if @checked
|
||||||
$.addClass dialog, 'auto'
|
$.addClass qr.el, 'auto'
|
||||||
else
|
else
|
||||||
$.removeClass dialog, 'auto'
|
$.removeClass qr.el, 'auto'
|
||||||
|
|
||||||
message: (e) ->
|
message: (e) ->
|
||||||
Recaptcha.reload()
|
Recaptcha.reload()
|
||||||
$('iframe[name=iframe]').src = 'about:blank'
|
$('iframe[name=iframe]').src = 'about:blank'
|
||||||
|
|
||||||
{data} = e
|
{data} = e
|
||||||
dialog = $ '#qr'
|
|
||||||
if data # error message
|
if data # error message
|
||||||
$('input[name=recaptcha_response_field]', dialog).value = ''
|
$('input[name=recaptcha_response_field]', qr.el).value = ''
|
||||||
$('#error').textContent = data
|
$('#error', qr.el).textContent = data
|
||||||
qr.autohide.unset()
|
qr.autohide.unset()
|
||||||
return
|
return
|
||||||
|
|
||||||
if dialog
|
if qr.el
|
||||||
if g.REPLY and $.config 'Persistent QR'
|
if g.REPLY and $.config 'Persistent QR'
|
||||||
qr.refresh dialog
|
qr.refresh()
|
||||||
else
|
else
|
||||||
$.rm dialog
|
qr.close()
|
||||||
if $.config 'Cooldown'
|
if $.config 'Cooldown'
|
||||||
duration = if qr.sage then 60 else 30
|
duration = if qr.sage then 60 else 30
|
||||||
$.setValue g.BOARD+'/cooldown', Date.now() + duration * 1000
|
$.setValue g.BOARD+'/cooldown', Date.now() + duration * 1000
|
||||||
@ -1024,7 +1022,7 @@ qr =
|
|||||||
if g.REPLY and $('img.favicon').src is Favicon.empty
|
if g.REPLY and $('img.favicon').src is Favicon.empty
|
||||||
watcher.watch null, g.THREAD_ID
|
watcher.watch null, g.THREAD_ID
|
||||||
else
|
else
|
||||||
id = $('input[name=resto]').value
|
id = $('input[name=resto]', qr.el).value
|
||||||
op = d.getElementById id
|
op = d.getElementById 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
|
||||||
@ -1035,21 +1033,21 @@ qr =
|
|||||||
if inputfile.value and inputfile.files[0].size > $('input[name=MAX_FILE_SIZE]').value
|
if inputfile.value and inputfile.files[0].size > $('input[name=MAX_FILE_SIZE]').value
|
||||||
e.preventDefault() if e
|
e.preventDefault() if e
|
||||||
if isQR
|
if isQR
|
||||||
$('#error').textContent = 'Error: File too large.'
|
$('#error', qr.el).textContent = 'Error: File too large.'
|
||||||
else
|
else
|
||||||
alert 'Error: File too large.'
|
alert 'Error: File too large.'
|
||||||
|
|
||||||
else if isQR
|
else if isQR
|
||||||
if !e then @submit()
|
if !e then @submit()
|
||||||
$('#error').textContent = ''
|
$('#error', qr.el).textContent = ''
|
||||||
qr.autohide.set()
|
qr.autohide.set()
|
||||||
qr.sage = /sage/i.test $('input[name=email]', @).value
|
qr.sage = /sage/i.test $('input[name=email]', @).value
|
||||||
|
|
||||||
quote: (link) ->
|
quote: (link) ->
|
||||||
if dialog = $ '#qr'
|
if qr.el
|
||||||
qr.autohide.unset()
|
qr.autohide.unset()
|
||||||
else
|
else
|
||||||
dialog = qr.dialog link
|
qr.dialog link
|
||||||
|
|
||||||
id = link.textContent
|
id = link.textContent
|
||||||
text = ">>#{id}\n"
|
text = ">>#{id}\n"
|
||||||
@ -1060,16 +1058,16 @@ qr =
|
|||||||
if selectionID == id
|
if selectionID == id
|
||||||
text += ">#{s}\n"
|
text += ">#{s}\n"
|
||||||
|
|
||||||
ta = $ 'textarea', dialog
|
ta = $ 'textarea', qr.el
|
||||||
ta.focus()
|
ta.focus()
|
||||||
ta.value += text
|
ta.value += text
|
||||||
|
|
||||||
refresh: (dialog) ->
|
refresh: ->
|
||||||
$('form', dialog).reset()
|
$('form', qr.el).reset()
|
||||||
c = d.cookie
|
c = d.cookie
|
||||||
$('input[name=name]', dialog).value = if m = c.match(/4chan_name=([^;]+)/) then decodeURIComponent m[1] else ''
|
$('input[name=name]', qr.el).value = if m = c.match(/4chan_name=([^;]+)/) then decodeURIComponent m[1] else ''
|
||||||
$('input[name=email]', dialog).value = if m = c.match(/4chan_email=([^;]+)/) then decodeURIComponent m[1] else ''
|
$('input[name=email]', qr.el).value = if m = c.match(/4chan_email=([^;]+)/) then decodeURIComponent m[1] else ''
|
||||||
$('input[name=pwd]', dialog).value = if m = c.match(/4chan_pass=([^;]+)/) then decodeURIComponent m[1] else $('input[name=pwd]').value
|
$('input[name=pwd]', qr.el).value = if m = c.match(/4chan_pass=([^;]+)/) then decodeURIComponent m[1] else $('input[name=pwd]').value
|
||||||
|
|
||||||
dialog: (link) ->
|
dialog: (link) ->
|
||||||
submitValue = $('#com_submit').value
|
submitValue = $('#com_submit').value
|
||||||
@ -1098,25 +1096,27 @@ qr =
|
|||||||
</form>
|
</form>
|
||||||
<div id=error class=error></div>
|
<div id=error class=error></div>
|
||||||
"
|
"
|
||||||
dialog = ui.dialog 'qr', top: '0px', left: '0px', html
|
qr.el = ui.dialog 'qr', top: '0px', left: '0px', html
|
||||||
|
|
||||||
qr.refresh dialog
|
qr.refresh
|
||||||
|
|
||||||
$.bind $('input[name=name]', dialog), 'mousedown', (e) -> e.stopPropagation()
|
$.bind $('input[name=name]', qr.el), 'mousedown', (e) -> e.stopPropagation()
|
||||||
$.bind $('#autohide', dialog), 'click', qr.cb.autohide
|
$.bind $('#autohide', qr.el), 'click', qr.cb.autohide
|
||||||
$.bind $('a[name=close]', dialog), 'click', -> $.rm dialog
|
$.bind $('a[name=close]', qr.el), 'click', qr.close
|
||||||
$.bind $('form', dialog), 'submit', qr.submit
|
$.bind $('form', qr.el), 'submit', qr.submit
|
||||||
$.bind $('img', dialog), 'click', Recaptcha.reload
|
$.bind $('img', qr.el), 'click', Recaptcha.reload
|
||||||
$.bind $('input[name=recaptcha_response_field]', dialog), 'keydown', Recaptcha.listener
|
$.bind $('input[name=recaptcha_response_field]', qr.el), 'keydown', Recaptcha.listener
|
||||||
|
|
||||||
$.append d.body, dialog
|
$.append d.body, qr.el
|
||||||
|
|
||||||
dialog
|
|
||||||
|
|
||||||
persist: ->
|
persist: ->
|
||||||
$.append d.body, qr.dialog()
|
$.append d.body, qr.dialog()
|
||||||
qr.autohide.set()
|
qr.autohide.set()
|
||||||
|
|
||||||
|
close: ->
|
||||||
|
$.rm qr.el
|
||||||
|
qr.el = null
|
||||||
|
|
||||||
sys: ->
|
sys: ->
|
||||||
if recaptcha = $ '#recaptcha_response_field' #post reporting
|
if recaptcha = $ '#recaptcha_response_field' #post reporting
|
||||||
$.bind recaptcha, 'keydown', Recaptcha.listener
|
$.bind recaptcha, 'keydown', Recaptcha.listener
|
||||||
@ -1826,15 +1826,15 @@ Recaptcha =
|
|||||||
if e.keyCode is 8 and @value is '' # backspace to reload
|
if e.keyCode is 8 and @value is '' # backspace to reload
|
||||||
Recaptcha.reload()
|
Recaptcha.reload()
|
||||||
if e.keyCode is 13 and cooldown.duration # press enter to enable auto-post if cooldown is still running
|
if e.keyCode is 13 and cooldown.duration # press enter to enable auto-post if cooldown is still running
|
||||||
$('#auto').checked = true
|
$('#auto', qr.el).checked = true
|
||||||
qr.autohide.set()
|
qr.autohide.set()
|
||||||
reload: ->
|
reload: ->
|
||||||
window.location = 'javascript:Recaptcha.reload()'
|
window.location = 'javascript:Recaptcha.reload()'
|
||||||
reloaded: (e) ->
|
reloaded: (e) ->
|
||||||
return unless dialog = $ '#qr'
|
return unless qr.el
|
||||||
{target} = e
|
{target} = e
|
||||||
$('img', dialog).src = "http://www.google.com/recaptcha/api/image?c=" + target.value
|
$('img', qr.el).src = "http://www.google.com/recaptcha/api/image?c=" + target.value
|
||||||
$('input[name=recaptcha_challenge_field]', dialog).value = target.value
|
$('input[name=recaptcha_challenge_field]', qr.el).value = target.value
|
||||||
|
|
||||||
nodeInserted = (e) ->
|
nodeInserted = (e) ->
|
||||||
{target} = e
|
{target} = e
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user