Connection to the dropbox datastore api

-> this is the first attempt, improvements welcome :)
This commit is contained in:
Jens Neuber
2014-07-13 19:45:53 +02:00
parent 4f82e33f7c
commit aca23d6043
3 changed files with 340 additions and 15 deletions
+23 -8
View File
@@ -77,7 +77,8 @@
options: {
state: null,
debug: false,
log: false
log: false,
dropbox: true
},
init: function(options) {
@@ -107,7 +108,7 @@
}
$('<div>').attr('id', 'locationSlider').appendTo('#main');
var menu = $('<div>')
.addClass('menu')
.appendTo('body');
@@ -157,8 +158,16 @@
.text(_('app store.'))
.click(function() { window.open('https://itunes.apple.com/us/app/a-dark-room/id736683061'); })
.appendTo(menu);
if(this.options.dropbox && Engine.Dropbox) {
this.dropbox = Engine.Dropbox.init();
$('<span>')
.addClass('menuBtn')
.text(_('dropbox.'))
.click(Engine.Dropbox.startDropbox)
.appendTo(menu);
}
// Register keypress handlers
$('body').off('keydown').keydown(Engine.keyDown);
@@ -289,13 +298,19 @@
}
});
},
generateExport64: function(){
var string64 = Base64.encode(localStorage.gameState);
string64 = string64.replace(/\s/g, '');
string64 = string64.replace(/\./g, '');
string64 = string64.replace(/\n/g, '');
return string64;
},
export64: function() {
Engine.saveGame();
var string64 = Base64.encode(localStorage.gameState);
string64 = string64.replace(/\s/g, '');
string64 = string64.replace(/\./g, '');
string64 = string64.replace(/\n/g, '');
var string64 = Engine.generateExport64();
Engine.enableSelection();
Events.startEvent({
title: _('Export'),