mirror of
https://github.com/vichan-devel/vichan.git
synced 2024-11-12 01:50:48 +01:00
trivial fixes to file-selector.js
This commit is contained in:
parent
6f94a06586
commit
765dea599b
@ -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]);
|
||||
}
|
||||
});
|
||||
|
@ -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();
|
||||
|
@ -99,13 +99,6 @@
|
||||
<td>
|
||||
<input type="file" name="file" id="upload_file">
|
||||
|
||||
<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>
|
||||
|
||||
<script type="text/javascript">if (typeof init_file_selector !== 'undefined') init_file_selector({{ config.max_images }});</script>
|
||||
|
||||
{% if config.allow_upload_by_url %}
|
||||
|
Loading…
Reference in New Issue
Block a user