summaryrefslogtreecommitdiff
path: root/js/index.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/index.js')
-rw-r--r--js/index.js36
1 files changed, 35 insertions, 1 deletions
diff --git a/js/index.js b/js/index.js
index 9ea46ce..50a9587 100644
--- a/js/index.js
+++ b/js/index.js
@@ -167,7 +167,7 @@ function addNotification(vdate, msg, $div){
window.plugin.notification.local.onclick = function(id, state, json){
var div = JSON.parse(json).id;
location.href = '#' + div; // TODO hoffentlich funktioniert das auch immer...
- }
+ };
console.log('Benachrichtigung hinzugefügt: ' + vdate.format('DD.MM. HH:mm') + '; ' + msg);
}
@@ -730,3 +730,37 @@ function load(){
}, fail);
});
}
+
+/* löscht alle Pläne im Speicher */
+function purge(){
+ track('event/purge');
+
+ $('#purgebtn').hide('fast');
+
+ window.requestFileSystem(
+ LocalFileSystem.PERSISTENT, 0,
+ function(fileSystem){
+ fileSystem.root.getDirectory('WvSVPlan', {create: true, exclusive: false},
+ function(dirEntry){
+ var dirReader = dirEntry.createReader();
+
+ dirReader.readEntries(
+ function(entries){
+ var actual = getActual(entries);
+
+ actual.forEach(function(entry){ // akuelle aus entries löschen
+ var index = entries.indexOf(entry);
+ if(index !== -1){
+ entries.splice(index, 1);
+ }
+ });
+
+ console.log('Lösche ' + entries.length + ' alte Pläne');
+
+ entries.forEach(function(entry){
+ entry.remove(null, fail); // Datei löschen
+ });
+ }, fail);
+ }, fail);
+ }, fail);
+}