mirror of
https://codeberg.org/streams/streams.git
synced 2024-09-20 00:35:30 +00:00
Scroll to doco links with anchor references when there is a ?zid parameter.
This commit is contained in:
parent
bc3605a502
commit
e058b19f53
1 changed files with 10 additions and 3 deletions
13
doc/toc.html
13
doc/toc.html
|
@ -74,7 +74,7 @@
|
|||
$(".panel-collapse.in").find('a').each(function(){
|
||||
var url = document.createElement('a');
|
||||
url.href = window.location;
|
||||
var pageName = url.href.split('/').pop().split('#').shift();
|
||||
var pageName = url.href.split('/').pop().split('#').shift().split('?').shift();
|
||||
var linkName = $(this).attr('href').split('/').pop();
|
||||
if(pageName === linkName) {
|
||||
var tocUl = $(this).closest('li').append('<ul>').find('ul');
|
||||
|
@ -116,8 +116,15 @@
|
|||
|
||||
// When the page loads, it does not scroll to the section specified in the URL because it
|
||||
// has not been constructed yet by the script. This will reload the URL
|
||||
if (typeof(location.href.split('#')[1]) !== 'undefined') {
|
||||
location.replace(location.href)
|
||||
if (typeof(location.href.split('#')[1]) !== 'undefined') {
|
||||
var p = document.createElement('a');
|
||||
p.href = location.href;
|
||||
var portstr = '';
|
||||
if(p.port !== '') {
|
||||
portstr = ':'+ p.port;
|
||||
}
|
||||
var newref = p.protocol + '//'+ p.hostname + portstr + p.pathname + p.hash.split('?').shift();
|
||||
location.replace(newref)
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
|
Loading…
Reference in a new issue