-QR.file, +QR.accept

This commit is contained in:
James Campos 2011-09-05 13:14:19 -07:00
parent 7458f23753
commit 0d562fbbe9
2 changed files with 5 additions and 7 deletions

View File

@ -1221,7 +1221,7 @@
};
QR = {
init: function() {
var accept, holder;
var holder;
g.callbacks.push(function(root) {
var quote;
quote = $('a.quotejs + a', root);
@ -1238,7 +1238,7 @@
QR.captchaNode({
target: holder.firstChild
});
accept = $('.rules').textContent.match(/: (.+) /)[1].replace(/\w+/g, function(type) {
QR.accept = $('.rules').textContent.match(/: (.+) /)[1].replace(/\w+/g, function(type) {
switch (type) {
case 'JPG':
return 'image/JPEG';
@ -1248,7 +1248,6 @@
return 'image/' + type;
}
});
QR.file = "<input type=file name=upfile accept='" + accept + "'><img alt='click here'><a class=x>X</a>";
QR.MAX_FILE_SIZE = $('input[name=MAX_FILE_SIZE]').value;
QR.spoiler = $('.postarea label') ? ' <label>[<input type=checkbox name=spoiler>Spoiler Image?]</label>' : '';
if (conf['Persistent QR']) {
@ -1263,7 +1262,7 @@
var div, file, files;
files = $('#files', QR.qr);
div = $.el('div', {
innerHTML: QR.file
innerHTML: "<input type=file name=upfile accept='" + QR.accept + "'><img alt='click here'><a class=x>X</a>"
});
file = $('input', div);
$.bind(file, 'change', QR.change);

View File

@ -972,7 +972,7 @@ QR =
holder = $ '#recaptcha_challenge_field_holder'
$.bind holder, 'DOMNodeInserted', QR.captchaNode
QR.captchaNode target: holder.firstChild
accept = $('.rules').textContent.match(/: (.+) /)[1].replace /\w+/g, (type) ->
QR.accept = $('.rules').textContent.match(/: (.+) /)[1].replace /\w+/g, (type) ->
switch type
when 'JPG'
'image/JPEG'
@ -980,7 +980,6 @@ QR =
'application/' + type
else
'image/' + type
QR.file = "<input type=file name=upfile accept='#{accept}'><img alt='click here'><a class=x>X</a>"
QR.MAX_FILE_SIZE = $('input[name=MAX_FILE_SIZE]').value
QR.spoiler = if $('.postarea label') then ' <label>[<input type=checkbox name=spoiler>Spoiler Image?]</label>' else ''
if conf['Persistent QR']
@ -991,7 +990,7 @@ QR =
foo: ->
files = $ '#files', QR.qr
div = $.el 'div',
innerHTML: QR.file
innerHTML: "<input type=file name=upfile accept='#{QR.accept}'><img alt='click here'><a class=x>X</a>"
file = $ 'input', div
$.bind file, 'change', QR.change
$.bind $('img', div), 'click', -> @previousSibling.click()