0
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-01-18 10:52:19 +01:00

docs: move color-mode script (#37658)

* docs: move color-mode script

* Move color-modes.js in static folder

* Async load color-modes.js

* Switch to DOMContentLoaded

* Revert async loading
This commit is contained in:
XhmikosR 2022-12-18 23:32:17 +02:00 committed by GitHub
parent 6807008159
commit e1315d11f2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 5 deletions

View File

@ -248,7 +248,7 @@ Here's a look at the JavaScript that powers it. Feel free to inspect our own doc
{{< example lang="js" show_preview="false" >}}
{{< js.inline >}}
{{- readFile (path.Join "site/assets/js/color-modes/index.js") -}}
{{- readFile (path.Join "site/static/docs" .Site.Params.docs_version "assets/js/color-modes.js") -}}
{{< /js.inline >}}
{{< /example >}}

View File

@ -1,6 +1,3 @@
{{- $colorModeJS := resources.Get "js/color-modes/index.js" }}
<script src="{{ $colorModeJS.Permalink | relURL }}"></script>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="{{ .Page.Params.description | default .Site.Params.description | markdownify }}">
@ -22,6 +19,9 @@
<meta name="robots" content="{{ . }}">
{{- end }}
{{- $colorModeJS := printf "/docs/%s/assets/js/color-modes.js" $.Site.Params.docs_version -}}
<script src="{{ $colorModeJS | relURL }}"></script>
{{ partial "stylesheet" . }}
{{ partial "favicons" . }}
{{ partial "social" . }}

View File

@ -46,7 +46,7 @@
}
})
window.addEventListener('load', () => {
window.addEventListener('DOMContentLoaded', () => {
showActiveTheme(getPreferredTheme())
document.querySelectorAll('[data-bs-theme-value]')