diff --git a/javascript/DocumentationViewer.js b/javascript/DocumentationViewer.js
index 129184c..4c5539f 100644
--- a/javascript/DocumentationViewer.js
+++ b/javascript/DocumentationViewer.js
@@ -1,7 +1,6 @@
(function($) {
$(document).ready(function() {
-
/** -----------------------------------------------
* TABLE OF CONTENTS
*
@@ -9,10 +8,13 @@
*/
if($("#table-of-contents").length > 0) {
var toc = '
In this document:
';
-
- $('#left-column h1, #left-column h2, #left-column h3, #left-column h4').each(function(i) {
+
+ // Remove existing anchor redirection in the url
+ var pageURL = window.location.href.replace(/#[a-zA-Z0-9\-\_]*/g, '');
+
+ $('#left-column h1[id], #left-column h2[id], #left-column h3[id], #left-column h4[id]').each(function(i) {
var current = $(this);
- toc += '- ' + current.html() + '
';
+ toc += '- ' + current.html() + '
';
});
toc += '
';
@@ -25,7 +27,7 @@
*
* Automatically adds anchor links to headings that have IDs
*/
- $("h1[id], h2[id], h3[id], h4[id], h5[id], h6[id]").each(function() {
+ $("#left-column h1[id], #left-column h2[id], #left-column h3[id], #left-column h4[id], #left-column h5[id], #left-column h6[id]").each(function() {
var link = '¶';
$(this).append(' ' + link);
});