Let it drop files before first opening the QR. Enable dump class on drop.
This commit is contained in:
parent
9cf6aa1079
commit
439422d655
@ -1206,8 +1206,10 @@
|
|||||||
});
|
});
|
||||||
if (conf['Persistent QR']) {
|
if (conf['Persistent QR']) {
|
||||||
qr.dialog();
|
qr.dialog();
|
||||||
if (conf['Auto Hide QR']) return $.id('autohide').click();
|
if (conf['Auto Hide QR']) $.id('autohide').click();
|
||||||
}
|
}
|
||||||
|
$.on(d, 'dragover', qr.fileDrop);
|
||||||
|
return $.on(d, 'drop', qr.fileDrop);
|
||||||
},
|
},
|
||||||
open: function() {
|
open: function() {
|
||||||
if (qr.el) {
|
if (qr.el) {
|
||||||
@ -1267,7 +1269,8 @@
|
|||||||
e.dataTransfer.dropEffect = 'copy';
|
e.dataTransfer.dropEffect = 'copy';
|
||||||
if (e.type === 'drop') {
|
if (e.type === 'drop') {
|
||||||
qr.open();
|
qr.open();
|
||||||
return qr.fileInput.call(e.dataTransfer);
|
qr.fileInput.call(e.dataTransfer);
|
||||||
|
return $.addClass(qr.el, 'dump');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
fileInput: function() {
|
fileInput: function() {
|
||||||
@ -1332,8 +1335,6 @@
|
|||||||
});
|
});
|
||||||
$.on($('form', qr.el), 'submit', qr.submit);
|
$.on($('form', qr.el), 'submit', qr.submit);
|
||||||
$.on($('[type=file]', qr.el), 'change', qr.fileInput);
|
$.on($('[type=file]', qr.el), 'change', qr.fileInput);
|
||||||
$.on(d, 'dragover', qr.fileDrop);
|
|
||||||
$.on(d, 'drop', qr.fileDrop);
|
|
||||||
qr.inputs = {
|
qr.inputs = {
|
||||||
name: $('[name=name]', qr.el),
|
name: $('[name=name]', qr.el),
|
||||||
email: $('[name=email]', qr.el)
|
email: $('[name=email]', qr.el)
|
||||||
|
|||||||
@ -878,6 +878,8 @@ qr =
|
|||||||
if conf['Persistent QR']
|
if conf['Persistent QR']
|
||||||
qr.dialog()
|
qr.dialog()
|
||||||
$.id('autohide').click() if conf['Auto Hide QR']
|
$.id('autohide').click() if conf['Auto Hide QR']
|
||||||
|
$.on d, 'dragover', qr.fileDrop
|
||||||
|
$.on d, 'drop', qr.fileDrop
|
||||||
|
|
||||||
open: ->
|
open: ->
|
||||||
if qr.el
|
if qr.el
|
||||||
@ -934,6 +936,7 @@ qr =
|
|||||||
if e.type is 'drop'
|
if e.type is 'drop'
|
||||||
qr.open()
|
qr.open()
|
||||||
qr.fileInput.call e.dataTransfer
|
qr.fileInput.call e.dataTransfer
|
||||||
|
$.addClass qr.el, 'dump'
|
||||||
fileInput: ->
|
fileInput: ->
|
||||||
qr.cleanError()
|
qr.cleanError()
|
||||||
if @files.length is 1
|
if @files.length is 1
|
||||||
@ -1081,8 +1084,6 @@ textarea.field {
|
|||||||
$.on $('#dump', qr.el), 'click', -> qr.el.classList.toggle 'dump'
|
$.on $('#dump', qr.el), 'click', -> qr.el.classList.toggle 'dump'
|
||||||
$.on $('form', qr.el), 'submit', qr.submit
|
$.on $('form', qr.el), 'submit', qr.submit
|
||||||
$.on $('[type=file]', qr.el), 'change', qr.fileInput
|
$.on $('[type=file]', qr.el), 'change', qr.fileInput
|
||||||
$.on d, 'dragover', qr.fileDrop
|
|
||||||
$.on d, 'drop', qr.fileDrop
|
|
||||||
|
|
||||||
# save & load inputs' value with localStorage
|
# save & load inputs' value with localStorage
|
||||||
qr.inputs =
|
qr.inputs =
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user