@@ -40,13 +40,10 @@ define([
4040 return ;
4141 }
4242
43- window . requestFileSystem ( LocalFileSystem . PERSISTENT , 0 , function ( fs ) {
44- fs . root . getFile ( filePath , {
45- create : true ,
46- exclusive : false
47- } , function ( fileEntry ) {
48- $txtDanger . addClass ( 'hidden' ) ;
49- $txtSuccess . addClass ( 'hidden' ) ;
43+ window . requestFileSystem ( LocalFileSystem . PERSISTENT , 0 , function ( fileSystem ) {
44+ fileSystem . root . getDirectory ( 'chamilo-lms' , { create : true } , function ( directory ) {
45+ $txtDanger . addClass ( 'hidden' )
46+ $txtSuccess . addClass ( 'hidden' )
5047
5148 $pgb
5249 . removeClass ( 'hidden' )
@@ -55,45 +52,45 @@ define([
5552 . attr ( 'aria-valuenow' , 0 )
5653 . css ( 'width' , 0 + '%' )
5754 . find ( '.sr-only' )
58- . text ( 0 + '%' ) ;
55+ . text ( 0 + '%' )
5956
60- var fileTransfer = new FileTransfer ( ) ;
57+ var fileTransfer = new FileTransfer ( )
6158 fileTransfer . onprogress = function ( e ) {
6259 if ( e . lengthComputable ) {
6360 var value = e . loaded / e . total * 100 ,
64- percentage = value . toFixed ( 2 ) ;
61+ percentage = value . toFixed ( 2 )
6562
6663 $pgb . find ( '.progress-bar' )
6764 . attr ( 'aria-valuenow' , percentage )
6865 . css ( 'width' , percentage + '%' )
6966 . find ( '.sr-only' )
70- . text ( percentage + '%' ) ;
67+ . text ( percentage + '%' )
7168
72- return ;
69+ return
7370 }
7471
7572 $pgb . find ( '.progress-bar' )
7673 . addClass ( 'progress-bar-striped active' )
7774 . attr ( 'aria-valuenow' , 100 )
7875 . css ( 'width' , 100 + '%' )
7976 . find ( '.sr-only' )
80- . text ( 100 + '%' ) ;
81- } ;
77+ . text ( 100 + '%' )
78+ }
8279 fileTransfer . download (
8380 encodeURI ( fileURL ) ,
84- fileEntry . toURL ( ) ,
81+ directory . toURL ( ) + filePath ,
8582 function ( ) {
86- $pgb . addClass ( 'hidden' ) ;
83+ $pgb . addClass ( 'hidden' )
8784
88- $txtSuccess . removeClass ( 'hidden' ) ;
85+ $txtSuccess . removeClass ( 'hidden' )
8986 } ,
9087 function ( ) {
91- $pgb . addClass ( 'hidden' ) ;
88+ $pgb . addClass ( 'hidden' )
9289
93- $txtDanger . removeClass ( 'hidden' ) ;
90+ $txtDanger . removeClass ( 'hidden' )
9491 } ,
9592 true
96- ) ;
93+ )
9794 } , onError ) ;
9895 } , onError ) ;
9996 }
0 commit comments