From 55c93772db3c95fc71de9da80a071eca2a0e1315 Mon Sep 17 00:00:00 2001 From: Vermilingua Date: Tue, 29 Oct 2013 18:33:07 +1100 Subject: [PATCH 1/2] should fix the issue, maybe --- script/engine.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/script/engine.js b/script/engine.js index 0dd2ef6..9cdc1e9 100644 --- a/script/engine.js +++ b/script/engine.js @@ -235,6 +235,8 @@ var Engine = { import64: function() { var string64 = prompt("put the save code here.",""); + string64 = string64.replace(/\s/g, ''); + string64 = string64.replace(/\W/g, ''); var decodedSave = Base64.decode(string64); localStorage.gameState = decodedSave; location.reload(); From 2c31e4ecdaeb7202e8f33a237753e9206b791c3b Mon Sep 17 00:00:00 2001 From: Vermilingua Date: Thu, 31 Oct 2013 07:17:41 +1100 Subject: [PATCH 2/2] strips nonwords, spaces, and newlines from both the input and output --- script/engine.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/script/engine.js b/script/engine.js index 9cdc1e9..86c53af 100644 --- a/script/engine.js +++ b/script/engine.js @@ -230,6 +230,9 @@ var Engine = { export64: function() { Engine.saveGame(); var string64 = Base64.encode(localStorage.gameState); + string64 = string64.replace(/\s/g, ''); + string64 = string64.replace(/\W/g, ''); + string64 = string64.replace(/\n/g, ''); prompt("save this.",string64); }, @@ -237,6 +240,7 @@ var Engine = { var string64 = prompt("put the save code here.",""); string64 = string64.replace(/\s/g, ''); string64 = string64.replace(/\W/g, ''); + string64 = string64.replace(/\n/g, ''); var decodedSave = Base64.decode(string64); localStorage.gameState = decodedSave; location.reload();