Et encore un bug à cause des guillemets.
This commit is contained in:
parent
fe03134924
commit
b5e94bc733
|
@ -8,7 +8,7 @@ function State(init) {
|
||||||
var futureHashChange = null;
|
var futureHashChange = null;
|
||||||
State.prototype.commit = function() {
|
State.prototype.commit = function() {
|
||||||
try {
|
try {
|
||||||
futureHashChange = "#"+encodeURI($.JSON.encode(this));
|
futureHashChange = "#"+encodeURI('"'+$.JSON.encode(this));
|
||||||
location.hash = futureHashChange;
|
location.hash = futureHashChange;
|
||||||
return this;
|
return this;
|
||||||
} catch(e) {alert("Error State.prototype.commit");alert(e);}
|
} catch(e) {alert("Error State.prototype.commit");alert(e);}
|
||||||
|
@ -46,8 +46,10 @@ function hashchange() {
|
||||||
if (futureHashChange === location.hash) {
|
if (futureHashChange === location.hash) {
|
||||||
futureHashChange = null;
|
futureHashChange = null;
|
||||||
} else {
|
} else {
|
||||||
var stateJSON = decodeURI(location.hash.substring(location.hash.indexOf("#") + 1));
|
var stateJSON = location.hash.substring(location.hash.indexOf("#") + 1);
|
||||||
state = new State($.parseJSON(stateJSON)).validate();
|
if (stateJSON.charAt(0) != '"') { stateJSON = decodeURI(stateJSON); }
|
||||||
|
stateJSON = stateJSON.substring(1);
|
||||||
|
state = new State($.parseJSON(stateJSON || '{}')).validate();
|
||||||
}
|
}
|
||||||
} catch(e) {alert("Error hashchange");alert(e);}
|
} catch(e) {alert("Error hashchange");alert(e);}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user