mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2024-06-14 11:52:32 +03:00
Merge branch 'master' of github.com:squidfunk/mkdocs-material
This commit is contained in:
commit
bbfaa57d3c
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
2
material/assets/javascripts/bundle.1fe7f735.min.js
vendored
Normal file
2
material/assets/javascripts/bundle.1fe7f735.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
material/assets/javascripts/bundle.1fe7f735.min.js.map
Normal file
1
material/assets/javascripts/bundle.1fe7f735.min.js.map
Normal file
File diff suppressed because one or more lines are too long
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"assets/javascripts/bundle.js": "assets/javascripts/bundle.193efd2f.min.js",
|
"assets/javascripts/bundle.js": "assets/javascripts/bundle.1fe7f735.min.js",
|
||||||
"assets/javascripts/bundle.js.map": "assets/javascripts/bundle.193efd2f.min.js.map",
|
"assets/javascripts/bundle.js.map": "assets/javascripts/bundle.1fe7f735.min.js.map",
|
||||||
"assets/javascripts/vendor.js": "assets/javascripts/vendor.8caa27b7.min.js",
|
"assets/javascripts/vendor.js": "assets/javascripts/vendor.8caa27b7.min.js",
|
||||||
"assets/javascripts/vendor.js.map": "assets/javascripts/vendor.8caa27b7.min.js.map",
|
"assets/javascripts/vendor.js.map": "assets/javascripts/vendor.8caa27b7.min.js.map",
|
||||||
"assets/javascripts/worker/search.js": "assets/javascripts/worker/search.37585f48.min.js",
|
"assets/javascripts/worker/search.js": "assets/javascripts/worker/search.37585f48.min.js",
|
||||||
|
@ -179,7 +179,7 @@
|
|||||||
</div>
|
</div>
|
||||||
{% block scripts %}
|
{% block scripts %}
|
||||||
<script src="{{ 'assets/javascripts/vendor.8caa27b7.min.js' | url }}"></script>
|
<script src="{{ 'assets/javascripts/vendor.8caa27b7.min.js' | url }}"></script>
|
||||||
<script src="{{ 'assets/javascripts/bundle.193efd2f.min.js' | url }}"></script>
|
<script src="{{ 'assets/javascripts/bundle.1fe7f735.min.js' | url }}"></script>
|
||||||
{%- set translations = {} -%}
|
{%- set translations = {} -%}
|
||||||
{%- for key in [
|
{%- for key in [
|
||||||
"clipboard.copy",
|
"clipboard.copy",
|
||||||
|
@ -52,7 +52,7 @@ theme:
|
|||||||
language: en
|
language: en
|
||||||
features:
|
features:
|
||||||
- tabs
|
- tabs
|
||||||
#- instant
|
- instant
|
||||||
palette:
|
palette:
|
||||||
primary: indigo
|
primary: indigo
|
||||||
accent: indigo
|
accent: indigo
|
||||||
|
@ -46,7 +46,8 @@ import {
|
|||||||
take,
|
take,
|
||||||
shareReplay,
|
shareReplay,
|
||||||
pluck,
|
pluck,
|
||||||
catchError
|
catchError,
|
||||||
|
map
|
||||||
} from "rxjs/operators"
|
} from "rxjs/operators"
|
||||||
|
|
||||||
import {
|
import {
|
||||||
@ -352,8 +353,28 @@ export function initialize(config: unknown) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
/* Enable instant loading, if not on file:// protocol */
|
/* Enable instant loading, if not on file:// protocol */
|
||||||
if (config.features.includes("instant") && location.protocol !== "file:")
|
if (config.features.includes("instant") && location.protocol !== "file:") {
|
||||||
setupInstantLoading({ document$, location$, viewport$ })
|
|
||||||
|
/* Fetch sitemap and extract URL whitelist */
|
||||||
|
base$
|
||||||
|
.pipe(
|
||||||
|
switchMap(base => ajax({
|
||||||
|
url: `${base}/sitemap.xml`,
|
||||||
|
responseType: "document",
|
||||||
|
withCredentials: true
|
||||||
|
})
|
||||||
|
.pipe<Document>(
|
||||||
|
pluck("response")
|
||||||
|
)
|
||||||
|
),
|
||||||
|
map(document => (
|
||||||
|
getElements("loc", document).map(node => node.textContent!)
|
||||||
|
))
|
||||||
|
)
|
||||||
|
.subscribe(urls => {
|
||||||
|
setupInstantLoading(urls, { document$, location$, viewport$ })
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------- */
|
/* ----------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
@ -100,7 +100,7 @@ interface SetupOptions {
|
|||||||
* @param options - Options
|
* @param options - Options
|
||||||
*/
|
*/
|
||||||
export function setupInstantLoading(
|
export function setupInstantLoading(
|
||||||
{ document$, viewport$, location$ }: SetupOptions
|
urls: string[], { document$, viewport$, location$ }: SetupOptions
|
||||||
): void {
|
): void {
|
||||||
|
|
||||||
/* Disable automatic scroll restoration */
|
/* Disable automatic scroll restoration */
|
||||||
@ -125,7 +125,11 @@ export function setupInstantLoading(
|
|||||||
switchMap(ev => {
|
switchMap(ev => {
|
||||||
if (ev.target instanceof HTMLElement) {
|
if (ev.target instanceof HTMLElement) {
|
||||||
const el = ev.target.closest("a")
|
const el = ev.target.closest("a")
|
||||||
if (el && !el.target && isLocalLocation(el)) {
|
if (
|
||||||
|
el && !el.target &&
|
||||||
|
isLocalLocation(el) &&
|
||||||
|
urls.includes(el.href)
|
||||||
|
) {
|
||||||
if (!isAnchorLocation(el))
|
if (!isAnchorLocation(el))
|
||||||
ev.preventDefault()
|
ev.preventDefault()
|
||||||
return of(el)
|
return of(el)
|
||||||
|
Loading…
Reference in New Issue
Block a user