Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. /**
  2.  *
  3.  * Phonegap sqlite backup plugin for Android
  4.  * patadejaguar@gmail.com 2012
  5.  *
  6.  */
  7. var ROOTH_PATH  = "/mnt/sdcard/";
  8. var LocalBackup = function() {};
  9.  
  10. if( window.resolveLocalFileSystemURI ){
  11.     window.resolveLocalFileSystemURI(ROOTH_PATH, function(dirEntry) {}, function(evt){ ROOTH_PATH  = "/mnt/extsd/"; });
  12. }
  13. LocalBackup.prototype.run = function(content, success, fail) {
  14.     fail    = (typeof fail != "function") ? function(){} : fail;
  15.     success = (typeof sucess != "function") ? function(){} : success;
  16.     return cordova.exec( function(args) { success(args); }, function(args) { fail(args);},
  17.                         'LocalBackup', 'backup', [content]);
  18. };
  19.  
  20. LocalBackup.prototype.restore = function(content, success, fail) {
  21.     fail    = (typeof fail != "function") ? function(){} : fail;
  22.     success = (typeof sucess != "function") ? function(){} : success;
  23.     return cordova.exec( function(args) { success(args); }, function(args) { fail(args);},
  24.                         'LocalBackup', 'restore', [content]);
  25. };
  26.  
  27. if(!window.plugins) {
  28.     window.plugins = {};
  29. }