Skip to content

Commit cdd1102

Browse files
fix: router
1 parent e5c9a06 commit cdd1102

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

examples/buddybook/index.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,18 @@
2020
browser: true
2121
};
2222
</script>
23+
<script type="text/javascript">
24+
(function(l) {
25+
if (l.search[1] === '/' ) {
26+
var decoded = l.search.slice(1).split('&').map(function(s) {
27+
return s.replace(/~and~/g, '&')
28+
}).join('?');
29+
window.history.replaceState(null, null,
30+
l.pathname.slice(0, -1) + decoded + l.hash
31+
);
32+
}
33+
}(window.location))
34+
</script>
2335
</head>
2436
<body>
2537
<div id="root"></div>

examples/buddybook/public/404.html

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8">
5+
<title>BuddyBook</title>
6+
<script type="text/javascript">
7+
var pathSegmentsToKeep = 1;
8+
9+
var l = window.location;
10+
l.replace(
11+
l.protocol + '//' + l.hostname + (l.port ? ':' + l.port : '') +
12+
l.pathname.split('/').slice(0, 1 + pathSegmentsToKeep).join('/') + '/?/' +
13+
l.pathname.slice(1).split('/').slice(pathSegmentsToKeep).join('/').replace(/&/g, '~and~') +
14+
(l.search ? '&' + l.search.slice(1).replace(/&/g, '~and~') : '') +
15+
l.hash
16+
);
17+
</script>
18+
</head>
19+
<body>
20+
</body>
21+
</html>

0 commit comments

Comments
 (0)