Skip to content
Snippets Groups Projects
Commit 365d01d6 authored by Vincent Nivoliers's avatar Vincent Nivoliers
Browse files

fixed localStorage key prefix with innerHTML

parent 56be2a13
No related branches found
No related tags found
No related merge requests found
......@@ -134,12 +134,11 @@ function openXML(filename, handler) {
}
/* exploration */
var planet = {} ;
var center_map = null ;
var storage_prefix = 'Explosurf:'
+ document.getElementById('planet-name').innerHTML.toLowerCase()
+ document.getElementById('planet-name').innerHTML.toLowerCase().replace(/\s+/mg, '')
+ ':explorer'
;
......
......@@ -11,7 +11,7 @@
/* local storage prefix */
var storage_prefix = 'Explosurf:'
+ document.getElementById('planet-name').innerHTML.toLowerCase()
+ document.getElementById('planet-name').innerHTML.toLowerCase().replace(/\s+/mg, '')
+ ':notes'
;
......
......@@ -60,7 +60,7 @@ var has_absolute_fixed_bug = (function() {
/*prefix for local storage*/
var storage_prefix = 'Explosurf:'
+ document.getElementById('planet-name').innerHTML.toLowerCase()
+ document.getElementById('planet-name').innerHTML.toLowerCase().replace(/\s+/mg, '')
+ ':pgm'
;
......@@ -203,47 +203,13 @@ document.getElementById('pgm-load-local').addEventListener(
}
) ;
/* pack the full Explosurf data in a blob */
var file_blob = null ;
function generate_blob() {
local_save() ;
var data = new Blob(
[JSON.stringify(localStorage)],
{type : 'application/json'}
) ;
if(file_blob !== null) {
window.URL.revokeObjectURL(file_blob) ;
}
file_blob = window.URL.createObjectURL(data) ;
return file_blob ;
}
/* propose the blob for download : save all data */
/* save all data using filesaver.js */
function blob_download() {
var blob = new Blob(
[JSON.stringify(localStorage)],
{type : 'application/json'}
) ;
saveAs(blob, 'explosurf.json') ;
/*
var link = document.createElement('a') ;
link.setAttribute('download', 'explosurf.json') ;
link.href = generate_blob() ;
document.body.appendChild(link) ;
setTimeout(function () {
var event ;
if(typeof MouseEvent !== 'function') {
event = document.createEvent("MouseEvent");
event.initMouseEvent("click",true,false,window,0,0,0,0,0,false,false,false,false,0,null);
} else {
event = new MouseEvent('click');
}
link.dispatchEvent(event);
document.body.removeChild(link);
}, 66);
*/
}
/* load the saved data */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment