Merge pull request #58 from xwiki-labs/replaceState

use replaceState if available
pull/1/head
ansuz 8 years ago committed by GitHub
commit 4c5cb79c20

@ -498,9 +498,7 @@ define([
} }
// set the hash // set the hash
if (!readOnly) { if (!readOnly) { Cryptpad.replaceHash(editHash); }
window.location.hash = editHash;
}
Cryptpad.getPadTitle(function (err, title) { Cryptpad.getPadTitle(function (err, title) {
if (err) { if (err) {

@ -225,6 +225,14 @@ define([
return secret; return secret;
}; };
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;
};
var storageKey = common.storageKey = 'CryptPad_RECENTPADS'; var storageKey = common.storageKey = 'CryptPad_RECENTPADS';
/* /*

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

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

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

Loading…
Cancel
Save