docs: regenerate

This commit is contained in:
goat 2021-08-21 22:57:51 +02:00
parent c864cae087
commit 1eb35f29eb
No known key found for this signature in database
GPG key ID: F18F057873895461
935 changed files with 148201 additions and 35402 deletions

View file

@ -65,7 +65,7 @@ $(function () {
(function () {
anchors.options = {
placement: 'left',
visible: 'touch'
visible: 'hover'
};
anchors.add('article h2:not(.no-anchor), article h3:not(.no-anchor), article h4:not(.no-anchor)');
})();
@ -232,7 +232,7 @@ $(function () {
// Highlight the searching keywords
function highlightKeywords() {
var q = url('?q');
if (q !== null) {
if (q) {
var keywords = q.split("%20");
keywords.forEach(function (keyword) {
if (keyword !== "") {
@ -326,7 +326,7 @@ $(function () {
var itemBrief = extractContentBrief(hit.keywords);
var itemNode = $('<div>').attr('class', 'sr-item');
var itemTitleNode = $('<div>').attr('class', 'item-title').append($('<a>').attr('href', itemHref).attr("target", "_blank").text(itemTitle));
var itemTitleNode = $('<div>').attr('class', 'item-title').append($('<a>').attr('href', itemHref).attr("target", "_blank").attr("rel", "noopener noreferrer").text(itemTitle));
var itemHrefNode = $('<div>').attr('class', 'item-href').text(itemRawHref);
var itemBriefNode = $('<div>').attr('class', 'item-brief').text(itemBrief);
itemNode.append(itemTitleNode).append(itemHrefNode).append(itemBriefNode);
@ -379,7 +379,7 @@ $(function () {
navrel = navbarPath.substr(0, index + 1);
}
$('#navbar>ul').addClass('navbar-nav');
var currentAbsPath = util.getAbsolutePath(window.location.pathname);
var currentAbsPath = util.getCurrentWindowAbsolutePath();
// set active item
$('#navbar').find('a[href]').each(function (i, e) {
var href = $(e).attr("href");
@ -556,7 +556,10 @@ $(function () {
if (index > -1) {
tocrel = tocPath.substr(0, index + 1);
}
var currentHref = util.getAbsolutePath(window.location.pathname);
var currentHref = util.getCurrentWindowAbsolutePath();
if(!currentHref.endsWith('.html')) {
currentHref += '.html';
}
$('#sidetoc').find('a[href]').each(function (i, e) {
var href = $(e).attr("href");
if (util.isRelativePath(href)) {
@ -1054,14 +1057,25 @@ $(function () {
this.getAbsolutePath = getAbsolutePath;
this.isRelativePath = isRelativePath;
this.isAbsolutePath = isAbsolutePath;
this.getCurrentWindowAbsolutePath = getCurrentWindowAbsolutePath;
this.getDirectory = getDirectory;
this.formList = formList;
function getAbsolutePath(href) {
// Use anchor to normalize href
var anchor = $('<a href="' + href + '"></a>')[0];
// Ignore protocal, remove search and query
return anchor.host + anchor.pathname;
if (isAbsolutePath(href)) return href;
var currentAbsPath = getCurrentWindowAbsolutePath();
var stack = currentAbsPath.split("/");
stack.pop();
var parts = href.split("/");
for (var i=0; i< parts.length; i++) {
if (parts[i] == ".") continue;
if (parts[i] == ".." && stack.length > 0)
stack.pop();
else
stack.push(parts[i]);
}
var p = stack.join("/");
return p;
}
function isRelativePath(href) {
@ -1075,6 +1089,9 @@ $(function () {
return (/^(?:[a-z]+:)?\/\//i).test(href);
}
function getCurrentWindowAbsolutePath() {
return window.location.origin + window.location.pathname;
}
function getDirectory(href) {
if (!href) return '';
var index = href.lastIndexOf('/');