summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorczaks <marcin@6irc.net>2015-03-31 06:50:05 +0200
committerczaks <marcin@6irc.net>2015-03-31 06:50:05 +0200
commit765dea599bd010bc00a3a40df58953b239ec0e9d (patch)
tree4da1c5760230aa4a85c5a24f9ce7832bc4ee41ce /js
parent6f94a0658603f3f39032655b3cebe738c2bced0d (diff)
trivial fixes to file-selector.js
Diffstat (limited to 'js')
-rw-r--r--js/file-selector.js11
-rw-r--r--js/upload-selection.js2
2 files changed, 12 insertions, 1 deletions
diff --git a/js/file-selector.js b/js/file-selector.js
index fc9c83e2..6aad9382 100644
--- a/js/file-selector.js
+++ b/js/file-selector.js
@@ -34,8 +34,16 @@ if (typeof max_images == 'undefined') {
var max_images = 1;
}
+$('<div class="dropzone-wrap" style="display: none;">'+
+ '<div class="dropzone" tabindex="0">'+
+ '<div class="file-hint">'+_('Select/drop/paste files here')+'</div>'+
+ '<div class="file-thumbs"></div>'+
+ '</div>'+
+ '</div>'+
+'</div>').prependTo('#upload td');
+
var files = [];
-$('#upload_file').hide(); // hide the original file selector
+$('#upload_file').remove(); // remove the original file selector
$('.dropzone-wrap').css('user-select', 'none').show(); // let jquery add browser specific prefix
function addFile(file) {
@@ -83,6 +91,7 @@ $(document).on('ajax_before_post', function (e, formData) {
for (var i=0; i<max_images; i++) {
var key = 'file';
if (i > 0) key += i + 1;
+ if (typeof files[i] === 'undefined') break;
formData.append(key, files[i]);
}
});
diff --git a/js/upload-selection.js b/js/upload-selection.js
index e2032748..b342a134 100644
--- a/js/upload-selection.js
+++ b/js/upload-selection.js
@@ -25,6 +25,7 @@ $(function(){
$("#upload_url").hide();
$("#upload_embed").hide();
$(".add_image").hide();
+ $(".dropzone-wrap").hide();
$('[id^=upload_file]').each(function(i, v) {
$(v).val('');
@@ -40,6 +41,7 @@ $(function(){
enable_file = function() {
disable_all();
$("#upload").show();
+ $(".dropzone-wrap").show();
$(".file_separator").show();
$("[id^=upload_file]").show();
$(".add_image").show();