improve percentage for load/save

merge-requests/1/head
Julien Veyssier 2017-01-29 16:44:38 -03:00
parent 806fd3cc93
commit 77023a4f28
3 changed files with 8 additions and 6 deletions

View File

@ -8,6 +8,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
### Added
- add lat/lng fields in waypoint popup to view/edit coordinates with precise values
[#10](https://gitlab.com/eneiluj/gpxedit-oc/issues/10) @eneiluj
- show animation during exporting and saving
- show saving/loading ajax percentage
### Changed

View File

@ -904,7 +904,7 @@ function loadFile(file){
path : file
}
var url = OC.generateUrl('/apps/gpxedit/getgpx');
$('#loadingpc').text('0 %');
$('#loadingpc').text('0');
showLoadingAnimation();
gpxedit.currentAjax = $.ajax({
type: "POST",
@ -916,7 +916,7 @@ function loadFile(file){
xhr.addEventListener("progress", function(evt) {
if (evt.lengthComputable) {
var percentComplete = evt.loaded / evt.total * 100;
$('#loadingpc').text('('+parseInt(percentComplete)+' %)');
$('#loadingpc').text(parseInt(percentComplete));
}
}, false);
@ -1139,7 +1139,7 @@ function saveAction(targetPath){
var saveFilePath = targetPath+'/'+$('input#saveName').val();
var gpxText = generateGpx();
hideExportingAnimation();
$('#savingpc').text('0 %');
$('#savingpc').text('0');
showSavingAnimation();
var req = {
path: saveFilePath,
@ -1157,7 +1157,7 @@ function saveAction(targetPath){
if (evt.lengthComputable) {
var percentComplete = evt.loaded / evt.total * 100;
//Do something with upload progress here
$('#savingpc').text('('+parseInt(percentComplete)+' %)');
$('#savingpc').text(parseInt(percentComplete));
}
}, false);

View File

@ -49,7 +49,7 @@ p($_['gpxedit_version']);
</div>
<div id="loading"><p>
<i class="fa fa-spinner fa-pulse fa-3x fa-fw"></i>
<?php p($l->t('loading file')); ?>&nbsp;<i id="loadingpc"></i></p>
<?php p($l->t('loading file')); ?>&nbsp;(<i id="loadingpc"></i> %)</p>
</div>
<div id="exporting"><p>
<i class="fa fa-spinner fa-pulse fa-3x fa-fw"></i>
@ -57,7 +57,7 @@ p($_['gpxedit_version']);
</div>
<div id="saving"><p>
<i class="fa fa-spinner fa-pulse fa-3x fa-fw"></i>
<?php p($l->t('saving file')); ?>&nbsp;<i id="savingpc"></i></p>
<?php p($l->t('saving file')); ?>&nbsp;(<i id="savingpc"></i> %)</p>
</div>
<?php