set correct hash even if browser does not implement replaceState

pull/1/head
ansuz 8 years ago
parent 303c65f2c3
commit c2770a7a74

@ -495,7 +495,7 @@ define([
}
// set the hash
if (!readOnly) { Cryptpad.setHash(editHash); }
if (!readOnly) { Cryptpad.replaceHash(editHash); }
Cryptpad.getPadTitle(function (err, title) {
if (err) {

@ -225,9 +225,9 @@ define([
return secret;
};
var setHash = common.setHash = function (hash) {
if (!/^#/.test(hash)) { hash = '#' + hash; }
var replaceHash = common.replaceHash = function (hash) {
if (window.history && window.history.replaceState) {
if (!/^#/.test(hash)) { hash = '#' + hash; }
return void window.history.replaceState({}, window.document.title, hash);
}
window.location.hash = hash;

@ -601,7 +601,7 @@ define([
}
// set the hash
if (!readOnly) { Cryptpad.setHash(editHash); }
if (!readOnly) { Cryptpad.replaceHash(editHash); }
Cryptpad.getPadTitle(function (err, title) {
if (err) {

@ -914,7 +914,7 @@ define([
editHash = Cryptpad.getEditHashFromKeys(info.channel, secret.keys);
}
// set the hash
if (!readOnly) { Cryptpad.setHash(editHash); }
if (!readOnly) { Cryptpad.replaceHash(editHash); }
module.patchText = TextPatcher.create({
realtime: realtime,

@ -585,7 +585,7 @@ define([
// set the hash
if (!window.location.hash || window.location.hash === '#') {
Cryptpad.setHash(editHash);
Cryptpad.replaceHash(editHash);
}
Cryptpad.getPadTitle(function (err, title) {

Loading…
Cancel
Save