diff --git a/4chan_x.user.js b/4chan_x.user.js index 38ba6339e..7762539df 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -1206,8 +1206,10 @@ }); if (conf['Persistent QR']) { 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() { if (qr.el) { @@ -1267,7 +1269,8 @@ e.dataTransfer.dropEffect = 'copy'; if (e.type === 'drop') { qr.open(); - return qr.fileInput.call(e.dataTransfer); + qr.fileInput.call(e.dataTransfer); + return $.addClass(qr.el, 'dump'); } }, fileInput: function() { @@ -1332,8 +1335,6 @@ }); $.on($('form', qr.el), 'submit', qr.submit); $.on($('[type=file]', qr.el), 'change', qr.fileInput); - $.on(d, 'dragover', qr.fileDrop); - $.on(d, 'drop', qr.fileDrop); qr.inputs = { name: $('[name=name]', qr.el), email: $('[name=email]', qr.el) diff --git a/script.coffee b/script.coffee index 3b9965215..c1736cbe2 100644 --- a/script.coffee +++ b/script.coffee @@ -878,6 +878,8 @@ qr = if conf['Persistent QR'] qr.dialog() $.id('autohide').click() if conf['Auto Hide QR'] + $.on d, 'dragover', qr.fileDrop + $.on d, 'drop', qr.fileDrop open: -> if qr.el @@ -934,6 +936,7 @@ qr = if e.type is 'drop' qr.open() qr.fileInput.call e.dataTransfer + $.addClass qr.el, 'dump' fileInput: -> qr.cleanError() if @files.length is 1 @@ -1081,8 +1084,6 @@ textarea.field { $.on $('#dump', qr.el), 'click', -> qr.el.classList.toggle 'dump' $.on $('form', qr.el), 'submit', qr.submit $.on $('[type=file]', qr.el), 'change', qr.fileInput - $.on d, 'dragover', qr.fileDrop - $.on d, 'drop', qr.fileDrop # save & load inputs' value with localStorage qr.inputs =