support html5 multiple upload

closes #126
This commit is contained in:
onli
2014-04-23 02:27:14 +02:00
parent a04a2de5c5
commit f704df9365
3 changed files with 85 additions and 62 deletions
+1 -1
View File
@@ -18,7 +18,7 @@
<div id="upload_form_1" class="upload_form">
<div class="form_field clearfix">
<label for="userfile_1" class="uploadform_userfile_label">{$CONST.ENTER_MEDIA_UPLOAD}</label>
<input id="userfile_1" class="uploadform_userfile check_input" name="serendipity[userfile][1]" type="file">
<input id="userfile_1" class="uploadform_userfile check_input" name="serendipity[userfile][1]" type="file" multiple>
</div>
<div class="form_field clearfix">
@@ -1296,6 +1296,19 @@ $(function() {
});
}
if ($('.uploadform_userfile').length > 0) {
$('.uploadform_userfile').change(function() {
if ($(this).get(0).files.length > 1) {
$(this).parent().siblings(':first').fadeOut();
$(this).parent().siblings(':first').find('input').val('');
$(this).attr('name', $(this).attr('name') + '[]');
}
if ($(this).get(0).files.length == 1) {
$(this).parent().siblings(':first').fadeIn();
}
});
}
// reopen detail element after spamblock action
if ($('#serendipity_comments_list').length > 0 && window.location.hash && $('#' + window.location.hash.replace('#', '')).length > 0) {
$('#' + window.location.hash.replace('#', '')).find(".toggle_info").click();