aboutsummaryrefslogtreecommitdiff
path: root/main.js
diff options
context:
space:
mode:
Diffstat (limited to 'main.js')
-rw-r--r--main.js9
1 files changed, 7 insertions, 2 deletions
diff --git a/main.js b/main.js
index 741e39c..7b8f761 100644
--- a/main.js
+++ b/main.js
@@ -136,14 +136,19 @@ function resizeTA(e) {
}
function renderPath() {
- let path = location.hash.slice(2);
+ let path = location.hash.slice(1);
const main = document.getElementById("main");
const o = main.cloneNode(false);
state.addcount = 0;
+ if (!path.startsWith("/")) {
+ if (/^[0-9]+$/.test(path) && data.pages[+path] &&
+ data.pages[+path].paths[0]) path = data.pages[+path].paths[0];
+ else path = "";
+ } else path = path.slice(1);
state.editing = path.endsWith("edit");
if (state.editing) path = path.slice(0,-5);
- if (!/[0-9]+(-[0-9]+)*/.test(path)) path = "";
+ if (!/^[0-9]+(-[0-9]+)*$/.test(path)) path = "";
const pieces = path.split("-");
if (pieces[0]) for (let i=0; i<pieces.length; i++) {