Skip to content

Commit 65b1c39

Browse files
committed
Fixes
1 parent dec4846 commit 65b1c39

File tree

4 files changed

+24
-71
lines changed

4 files changed

+24
-71
lines changed

assets/js/entry/html.js

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,25 @@ onDocumentReady(() => {
4040
if (isPreview) {
4141
initPreview()
4242
} else {
43-
new Swup({
44-
animationSelector: false,
45-
containers: ['#main'],
46-
hooks: {'page:view': initSidebarContent},
47-
linkSelector: 'a[href]:not([href^="/"]):not([href^="http"]):not(.no-swup)',
48-
plugins: [new SwupA11yPlugin()]
49-
})
43+
if (window.location.protocol !== 'file:') {
44+
new Swup({
45+
animationSelector: false,
46+
containers: ['#main'],
47+
ignoreVisit: (url) => {
48+
const path = url.split('#')[0]
49+
return path === window.location.pathname ||
50+
path === window.location.pathname + '.html'
51+
},
52+
hooks: {
53+
'page:view': () => {
54+
initSidebarContent()
55+
initSearchPage()
56+
}
57+
},
58+
linkSelector: 'a[href]:not([href^="/"]):not([href^="http"])',
59+
plugins: [new SwupA11yPlugin()]
60+
})
61+
}
5062

5163
initVersions()
5264
initSidebarDrawer()

assets/js/search-page.js

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,13 @@ import { qs, escapeHtmlEntities, isBlank, getQueryParamByName, getProjectNameAnd
55
import { setSearchInputValue } from './search-bar'
66

77
const EXCERPT_RADIUS = 80
8-
98
const SEARCH_CONTAINER_SELECTOR = '#search'
109

10+
lunr.tokenizer.separator = /\s+/
11+
lunr.QueryLexer.termSeparator = /\s+/
12+
lunr.Pipeline.registerFunction(docTokenFunction, 'docTokenSplitter')
13+
lunr.Pipeline.registerFunction(docTrimmerFunction, 'docTrimmer')
14+
1115
/**
1216
* Performs a full-text search within the documentation
1317
* for the query in URL params and renders the result.
@@ -49,12 +53,6 @@ function renderResults ({ value, results, errorMessage }) {
4953
}
5054

5155
async function getIndex () {
52-
// lunr by default splits on - but we don't want that.
53-
lunr.tokenizer.separator = /\s+/
54-
lunr.QueryLexer.termSeparator = /\s+/
55-
lunr.Pipeline.registerFunction(docTokenFunction, 'docTokenSplitter')
56-
lunr.Pipeline.registerFunction(docTrimmerFunction, 'docTrimmer')
57-
5856
const cachedIndex = await loadIndex()
5957
if (cachedIndex) { return cachedIndex }
6058

assets/js/sidebar/sidebar-list.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ function renderSidebarNodeList (nodesByType, type) {
6565
})
6666

6767
nodeList.querySelectorAll('li a').forEach(anchor => {
68-
anchor.classList.add('no-swup')
6968
anchor.addEventListener('click', event => {
7069
const target = event.target
7170
const listItem = target.closest('li')

formatters/html/dist/html-MT3ZX75M.js

Lines changed: 0 additions & 56 deletions
This file was deleted.

0 commit comments

Comments
 (0)