Fix ToC issues, fix #995

This commit is contained in:
Robert Lord
2018-07-05 16:28:05 -07:00
parent e621be095a
commit b2119b0313
5 changed files with 13 additions and 9 deletions

View File

@@ -3,7 +3,7 @@
;(function () {
'use strict';
var htmlPattern = /<[^>]*>/g;
var htmlPattern = /<[^>]*>/g;
var loaded = false;
var debounce = function(func, waitTime) {
@@ -67,7 +67,6 @@
}
var $best = $toc.find("[href='" + best + "']").first();
var joinedTitle = $best.data("title") + " " + originalTitle;
if (!$best.hasClass("active")) {
// .active is applied to the ToC link we're currently on, and its parent <ul>s selected by tocListSelector
// .active-expanded is applied to the ToC links that are parents of this one
@@ -81,8 +80,12 @@
if (window.history.replaceState) {
window.history.replaceState(null, "", best);
}
// TODO remove classnames
document.title = joinedTitle.replace(htmlPattern, '');
var thisTitle = $best.data("title")
if (thisTitle !== undefined && thisTitle.length > 0) {
document.title = thisTitle + " " + originalTitle;
} else {
document.title = originalTitle;
}
}
};