Skip to content

Commit

Permalink
Refactor latest merge, update test page and version numbers.
Browse files Browse the repository at this point in the history
  • Loading branch information
blueimp committed May 26, 2012
1 parent 1e5b294 commit 6cd1ed0
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 41 deletions.
4 changes: 2 additions & 2 deletions index.html
@@ -1,7 +1,7 @@
<!DOCTYPE HTML>
<!--
/*
* jQuery File Upload Plugin Demo 6.8
* jQuery File Upload Plugin Demo 6.9
* https://github.com/blueimp/jQuery-File-Upload
*
* Copyright 2010, Sebastian Tschan
Expand Down Expand Up @@ -94,7 +94,7 @@ <h1>jQuery File Upload Demo</h1>
<!-- The global progress information -->
<div class="span5 fileupload-progress fade">
<!-- The global progress bar -->
<div class="progress progress-success progress-striped active" role="progressbar" aria-valuemin="0" aria-valuemax="100">
<div class="progress progress-success progress-striped active" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0" aria-valuetext="0%">
<div class="bar" style="width:0%;"></div>
</div>
<!-- The extended global progress information -->
Expand Down
60 changes: 27 additions & 33 deletions js/jquery.fileupload-ui.js
@@ -1,5 +1,5 @@
/*
* jQuery File Upload User Interface Plugin 6.8.2
* jQuery File Upload User Interface Plugin 6.9
* https://github.com/blueimp/jQuery-File-Upload
*
* Copyright 2010, Sebastian Tschan
Expand Down Expand Up @@ -124,20 +124,15 @@
// Iframe Transport does not support progress events.
// In lack of an indeterminate progress bar, we set
// the progress to 100%, showing the full animated bar:
var progress = parseInt(100, 10);
data.context
.find('.progress').addClass(
!$.support.transition && 'progress-animated'
)
.attr('aria-valuenow', 100)
.attr('aria-valuetext', '100%')
.find('.bar').css(
'width',
progress + '%'
).parent().attr(
'aria-valuenow',
progress
).attr(
'aria-valuetext',
progress + '%'
'100%'
);
}
return that._trigger('sent', e, data);
Expand Down Expand Up @@ -234,37 +229,36 @@
// Callback for upload progress events:
progress: function (e, data) {
if (data.context) {
var progress = parseInt(data.loaded / data.total * 100, 10);
data.context.find('.bar').css(
'width',
progress + '%'
).parent().attr(
'aria-valuenow',
progress
).attr(
'aria-valuetext',
progress + '%'
);
var progress = parseInt(data.loaded / data.total * 100, 10);
data.context.find('.progress')
.attr('aria-valuenow', progress)
.attr('aria-valuetext', progress + '%')
.find('.bar').css(
'width',
progress + '%'
);
}
},
// Callback for global upload progress events:
progressall: function (e, data) {
var $this = $(this);
var progress = parseInt(data.loaded / data.total * 100, 10);
$this.find('.fileupload-progress')
var $this = $(this),
progress = parseInt(data.loaded / data.total * 100, 10),
globalProgressNode = $this.find('.fileupload-progress'),
extendedProgressNode = globalProgressNode
.find('.progress-extended');
if (extendedProgressNode.length) {
extendedProgressNode.html(
$this.data('fileupload')._renderExtendedProgress(data)
);
}
globalProgressNode
.find('.progress')
.attr('aria-valuenow', progress)
.attr('aria-valuetext', progress + '%')
.find('.bar').css(
'width',
progress + '%'
).end()
.find('.progress-extended').each(function () {
$(this).html(
$this.data('fileupload')
._renderExtendedProgress(data)
);
});
$this.find('.fileupload-progress').find('.bar').parent()
.attr('aria-valuenow', progress)
.attr('aria-valuetext', progress + '%');
);
},
// Callback for uploads start, equivalent to the global ajaxStart event:
start: function (e) {
Expand Down
13 changes: 8 additions & 5 deletions test/index.html
@@ -1,7 +1,7 @@
<!DOCTYPE HTML>
<!--
/*
* jQuery File Upload Plugin Test 6.7
* jQuery File Upload Plugin Test 6.9
* https://github.com/blueimp/jQuery-File-Upload
*
* Copyright 2010, Sebastian Tschan
Expand Down Expand Up @@ -50,18 +50,21 @@ <h2 id="qunit-userAgent"></h2>
</button>
<input type="checkbox" class="toggle">
</div>
<div class="span5">
<!-- The global progress information -->
<div class="span5 fileupload-progress fade">
<!-- The global progress bar -->
<div class="progress progress-success progress-striped active">
<div class="progress progress-success progress-striped active" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0" aria-valuetext="0%">
<div class="bar" style="width:0%;"></div>
</div>
<!-- The extended global progress information -->
<div class="progress-extended">&nbsp;</div>
</div>
</div>
<!-- The loading indicator is shown during file processing -->
<div class="fileupload-loading"></div>
<br>
<!-- The table listing the files available for upload/download -->
<table class="table table-striped"><tbody class="files" data-toggle="modal-gallery" data-target="#modal-gallery"></tbody></table>
<table role="presentation" class="table table-striped"><tbody class="files" data-toggle="modal-gallery" data-target="#modal-gallery"></tbody></table>
</form>
</div>
<!-- The template to display files available for upload -->
Expand All @@ -75,7 +78,7 @@ <h2 id="qunit-userAgent"></h2>
<td class="error" colspan="2"><span class="label label-important">{%=locale.fileupload.error%}</span> {%=locale.fileupload.errors[file.error] || file.error%}</td>
{% } else if (o.files.valid && !i) { %}
<td>
<div class="progress progress-success progress-striped active"><div class="bar" style="width:0%;"></div></div>
<div class="progress progress-success progress-striped active" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0" aria-valuetext="0%"><div class="bar" style="width:0%;"></div></div>
</td>
<td class="start">{% if (!o.options.autoUpload) { %}
<button class="btn btn-primary">
Expand Down
4 changes: 3 additions & 1 deletion test/test.js
@@ -1,5 +1,5 @@
/*
* jQuery File Upload Plugin Test 6.6
* jQuery File Upload Plugin Test 6.9
* https://github.com/blueimp/jQuery-File-Upload
*
* Copyright 2010, Sebastian Tschan
Expand Down Expand Up @@ -1099,6 +1099,8 @@ $(function () {
addIndex
);
},
progress: $.noop,
progressall: $.noop,
done: $.noop,
stop: $.noop
})
Expand Down

0 comments on commit 6cd1ed0

Please sign in to comment.