don't have json curlies in the json payload in fragment
parent
fc3a1d41e7
commit
ab4be051fe
|
@ -412,6 +412,8 @@ var hash_accessor = (function (window) {
|
||||||
var json_str_escaped = window.location.hash.slice(1);
|
var json_str_escaped = window.location.hash.slice(1);
|
||||||
// unescape
|
// unescape
|
||||||
var json_str = decodeURIComponent(json_str_escaped);
|
var json_str = decodeURIComponent(json_str_escaped);
|
||||||
|
// if it doesn't have curly braces, add them
|
||||||
|
if (json_str[0] != "{") json_str = "{" + json_str + "}";
|
||||||
return JSON.parse(json_str);
|
return JSON.parse(json_str);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
return {};
|
return {};
|
||||||
|
@ -419,6 +421,8 @@ var hash_accessor = (function (window) {
|
||||||
},
|
},
|
||||||
save: function (obj) {
|
save: function (obj) {
|
||||||
var data = JSON.stringify(obj);
|
var data = JSON.stringify(obj);
|
||||||
|
// remove the abominable curlies
|
||||||
|
data = data.slice(1, data.length - 1);
|
||||||
|
|
||||||
//restdb.io
|
//restdb.io
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in New Issue