summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorschneefux <schneefux+commit@schneefux.xyz>2014-03-30 17:42:05 +0200
committerschneefux <schneefux+commit@schneefux.xyz>2016-08-15 19:46:49 +0200
commit127abe711515ccdce26f9267c30c62e492f846bb (patch)
tree225e15aebcfb7c8b382847ea5d1b12cb3a0242e8 /js
parentd2627ce165bef202ff833d2766e307bcb6fb2bdb (diff)
downloadwvs-vplan-127abe711515ccdce26f9267c30c62e492f846bb.tar.gz
wvs-vplan-127abe711515ccdce26f9267c30c62e492f846bb.zip
benutze Ordner für heruntergeladene VPlände
Diffstat (limited to 'js')
-rw-r--r--js/index.js63
1 files changed, 33 insertions, 30 deletions
diff --git a/js/index.js b/js/index.js
index bd399ff..ab3ac6e 100644
--- a/js/index.js
+++ b/js/index.js
@@ -97,41 +97,44 @@ function download_pdf(link, id){
window.requestFileSystem(
LocalFileSystem.PERSISTENT, 0,
function onFileSystemSuccess(fileSystem){
- fileSystem.root.getFile(
- filename, {create: true, exclusive: false},
- function gotFileEntry(fileEntry){
- var sPath;
+ fileSystem.root.getDirectory('WvSVPlan', {create: true, exclusive: false},
+ function(dirEntry){
+ dirEntry.getFile(
+ filename, {create: true, exclusive: false},
+ function gotFileEntry(fileEntry){
+ var sPath;
- if(device.platform == "Android"){
- sPath = "/storage/sdcard0" + fileEntry.fullPath;
- }else{
- sPath = fileEntry.fullPath;
- }
+ if(device.platform == "Android"){
+ sPath = "/storage/sdcard0" + fileEntry.fullPath;
+ }else{
+ sPath = fileEntry.fullPath;
+ }
- console.log('Pfad: ' + sPath);
- var fileTransfer = new FileTransfer();
- fileEntry.remove();
+ console.log('Pfad: ' + sPath);
+ var fileTransfer = new FileTransfer();
+ fileEntry.remove();
- fileTransfer.download(
- link,
- sPath,
- function(theFile){
- console.log('Download fertig: ' + theFile.toURL());
- $('#pdf-' + id).attr('data-plan-url', theFile.toURL());
+ fileTransfer.download(
+ link,
+ sPath,
+ function(theFile){
+ console.log('Download fertig: ' + theFile.toURL());
+ $('#pdf-' + id).attr('data-plan-url', theFile.toURL());
- if(location.href.indexOf('page-') == -1){
- $.mobile.changePage('#page-vplan-' + id);
+ if(location.href.indexOf('page-') == -1){
+ $.mobile.changePage('#page-vplan-' + id);
+ }
+ },
+ function(error){
+ console.log('Fehler: ' + error.source + ' - '+ error.target + ' - ' + error.code);
+ fail();
}
- },
- function(error){
- console.log('Fehler: ' + error.source + ' - '+ error.target + ' - ' + error.code);
- fail();
- }
- );
- },
- fail);
- },
- fail);
+ );
+ },
+ fail);
+ },
+ fail);
+ });
}
function get_plan(link, id){