aboutsummaryrefslogtreecommitdiffstats
path: root/doc/toc.html
diff options
context:
space:
mode:
authorMario Vavti <mario@mariovavti.com>2017-02-02 09:38:07 +0100
committerMario Vavti <mario@mariovavti.com>2017-02-02 09:38:07 +0100
commitc3bada3c329cac9b712e0d4d0c5fb0bb73f24d45 (patch)
treea13c2d56c1b14ba99a853fb7494a9214d075554d /doc/toc.html
parent2e0180ba55e5cbefcfc4066a82dbcaa5b59cacc2 (diff)
parent23303391e070120851d505a2ec8f3b9b696329e2 (diff)
downloadvolse-hubzilla-c3bada3c329cac9b712e0d4d0c5fb0bb73f24d45.tar.gz
volse-hubzilla-c3bada3c329cac9b712e0d4d0c5fb0bb73f24d45.tar.bz2
volse-hubzilla-c3bada3c329cac9b712e0d4d0c5fb0bb73f24d45.zip
resolve merge conflict
Diffstat (limited to 'doc/toc.html')
-rw-r--r--doc/toc.html12
1 files changed, 9 insertions, 3 deletions
diff --git a/doc/toc.html b/doc/toc.html
index eeb0fe437..4c52c5e74 100644
--- a/doc/toc.html
+++ b/doc/toc.html
@@ -72,13 +72,10 @@
// Generate the table of contents in the side nav menu (see view/tpl/help.tpl)
$(document).ready(function () {
$(".panel-collapse.in").find('a').each(function(){
- window.console.log($(this).attr('href'));
var url = document.createElement('a');
url.href = window.location;
var pageName = url.href.split('/').pop().split('#').shift();
- window.console.log('pageName: ' + pageName);
var linkName = $(this).attr('href').split('/').pop();
- window.console.log('linkName: ' + linkName);
if(pageName === linkName) {
var tocUl = $(this).closest('li').append('<ul>').find('ul');
tocUl.removeClass(); // Classes are automatically added to <ul> elements by something else
@@ -110,8 +107,17 @@
$('#doco-side-toc li')
.removeClass('selected-doco-nav')
.eq(i).addClass('selected-doco-nav');
+ if (typeof($('#doco-side-toc li').eq(i).find('a').attr('href').split('#')[1]) !== 'undefined') {
+ window.history.pushState({}, '', location.href.split('#')[0] + '#' + $('#doco-side-toc li').eq(i).find('a').attr('href').split('#')[1]);
+ }
}
});
});
+
+ // 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)
+ }
});
</script>