handle dup files
This commit is contained in:
parent
a0ac470623
commit
4f6c79a371
@ -1265,6 +1265,15 @@
|
||||
$.append($('#files', QR.el), div);
|
||||
return file.click();
|
||||
},
|
||||
attachNext: function(file) {
|
||||
var oldFile;
|
||||
oldFile = $('[type=file]', QR.el);
|
||||
file || (file = $.el('input', {
|
||||
type: 'file',
|
||||
name: 'upfile'
|
||||
}));
|
||||
return $.replace(oldFile, file);
|
||||
},
|
||||
autoPost: function() {
|
||||
if (!QR.hasContent()) {
|
||||
return;
|
||||
@ -1387,32 +1396,30 @@
|
||||
return ta.focus();
|
||||
},
|
||||
receive: function(e) {
|
||||
var data, file;
|
||||
var data, file, tc;
|
||||
data = e.data;
|
||||
if (data) {
|
||||
return $.extend($('a.error', QR.el), JSON.parse(data));
|
||||
$.extend($('a.error', QR.el), JSON.parse(data));
|
||||
tc = data.textContent;
|
||||
if (tc === 'Error: Duplicate file entry detected.') {
|
||||
QR.attachNext();
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (((file = $('#files input', QR.el)) && file.files.length) || conf['Persistent QR']) {
|
||||
QR.reset(file);
|
||||
} else {
|
||||
if (((file = $('#files input', QR.el)) && file.files.length) || conf['Persistent QR']) {
|
||||
QR.reset(file);
|
||||
} else {
|
||||
QR.close();
|
||||
}
|
||||
if (conf['Cooldown']) {
|
||||
cooldown = Date.now() + 30 * SECOND;
|
||||
$.set("cooldown/" + g.BOARD, cooldown);
|
||||
return QR.cooldown();
|
||||
}
|
||||
QR.close();
|
||||
}
|
||||
if (conf['Cooldown']) {
|
||||
cooldown = Date.now() + 30 * SECOND;
|
||||
$.set("cooldown/" + g.BOARD, cooldown);
|
||||
return QR.cooldown();
|
||||
}
|
||||
},
|
||||
reset: function(file) {
|
||||
var oldFile;
|
||||
$('textarea', QR.el).value = '';
|
||||
oldFile = $('[type=file]', QR.el);
|
||||
file || (file = $.el('input', {
|
||||
type: 'file',
|
||||
name: 'upfile'
|
||||
}));
|
||||
return $.replace(oldFile, file);
|
||||
return QR.attachNext(file);
|
||||
},
|
||||
submit: function(e) {
|
||||
var captcha, challenge, el, response;
|
||||
|
||||
@ -988,6 +988,12 @@ QR =
|
||||
$.bind $('a', div), 'click', -> $.rm @parentNode
|
||||
$.append $('#files', QR.el), div
|
||||
file.click()
|
||||
attachNext: (file) ->
|
||||
oldFile = $ '[type=file]', QR.el
|
||||
file or= $.el 'input',
|
||||
type: 'file'
|
||||
name: 'upfile'
|
||||
$.replace oldFile, file
|
||||
autoPost: ->
|
||||
return unless QR.hasContent()
|
||||
QR.submit()
|
||||
@ -1089,22 +1095,21 @@ QR =
|
||||
{data} = e
|
||||
if data
|
||||
$.extend $('a.error', QR.el), JSON.parse data
|
||||
tc = data.textContent
|
||||
if tc is 'Error: Duplicate file entry detected.'
|
||||
QR.attachNext()
|
||||
return
|
||||
if ((file = $('#files input', QR.el)) and file.files.length) or conf['Persistent QR']
|
||||
QR.reset file
|
||||
else
|
||||
if ((file = $('#files input', QR.el)) and file.files.length) or conf['Persistent QR']
|
||||
QR.reset file
|
||||
else
|
||||
QR.close()
|
||||
if conf['Cooldown']
|
||||
cooldown = Date.now() + 30*SECOND
|
||||
$.set "cooldown/#{g.BOARD}", cooldown
|
||||
QR.cooldown()
|
||||
QR.close()
|
||||
if conf['Cooldown']
|
||||
cooldown = Date.now() + 30*SECOND
|
||||
$.set "cooldown/#{g.BOARD}", cooldown
|
||||
QR.cooldown()
|
||||
reset: (file) ->
|
||||
$('textarea', QR.el).value = ''
|
||||
oldFile = $ '[type=file]', QR.el
|
||||
file or= $.el 'input',
|
||||
type: 'file'
|
||||
name: 'upfile'
|
||||
$.replace oldFile, file
|
||||
QR.attachNext file
|
||||
submit: (e) ->
|
||||
#XXX e is undefined if we're called from QR.autoPost
|
||||
$('.error', qr.el).textContent = ''
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user