@@ -12,26 +12,30 @@ module.exports = {
12
12
if ( type === 'body' ) {
13
13
return `
14
14
<script type='text/javascript'>
15
- var hash = window.location.hash;
16
- if (hash && hash.length > 1) {
17
- var pathName = window.location.pathname;
18
- if (pathName.indexOf('/methods/') === -1 &&
19
- pathName.indexOf('/properties/') === -1 &&
20
- pathName.indexOf('/events/') === -1) {
21
- var type = hash.slice(1, hash.indexOf('_'));
22
- var name = hash.slice(hash.indexOf('_') + 1, hash.length);
23
- var anchor = '?anchor=' + name + '&show=inherited,protected,private,deprecated';
24
- var newPath = pathName;
25
- if (type === 'method') {
26
- newPath = pathName + '/methods/' + name;
27
- } else if (type === 'property') {
28
- newPath = pathName + '/properties/' + name;
29
- } else if (type === 'event') {
30
- newPath = pathName + '/events/' + name;
15
+ function hashToQuery() {
16
+ var hash = window.location.hash;
17
+ if (hash && hash.length > 1) {
18
+ var pathName = window.location.pathname;
19
+ if (pathName.indexOf('/methods/') === -1 &&
20
+ pathName.indexOf('/properties/') === -1 &&
21
+ pathName.indexOf('/events/') === -1) {
22
+ var type = hash.slice(1, hash.indexOf('_'));
23
+ var name = hash.slice(hash.indexOf('_') + 1, hash.length);
24
+ var anchor = '?anchor=' + name + '&show=inherited,protected,private,deprecated';
25
+ var newPath = pathName;
26
+ if (type === 'method') {
27
+ newPath = pathName + '/methods/' + name;
28
+ } else if (type === 'property') {
29
+ newPath = pathName + '/properties/' + name;
30
+ } else if (type === 'event') {
31
+ newPath = pathName + '/events/' + name;
32
+ }
33
+ window.location.href = window.location.origin + newPath + anchor;
31
34
}
32
- window.location.href = window.location.origin + newPath + anchor;
33
35
}
34
36
}
37
+ hashToQuery()
38
+ window.onhashchange = hashToQuery;
35
39
</script>
36
40
`
37
41
}
0 commit comments