aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/twbs/bootstrap/site/static/docs/5.3/assets/js
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2023-01-20 11:05:15 +0000
committerMario <mario@mariovavti.com>2023-01-20 11:05:15 +0000
commit9dc949b62c6b5e3c8872211f71b11714d9d22b22 (patch)
tree38c06e7a128742e219eb74d6adb035f2f106918a /vendor/twbs/bootstrap/site/static/docs/5.3/assets/js
parent40394b94d7c8a8bf1f61f5482195164fff434b90 (diff)
downloadvolse-hubzilla-9dc949b62c6b5e3c8872211f71b11714d9d22b22.tar.gz
volse-hubzilla-9dc949b62c6b5e3c8872211f71b11714d9d22b22.tar.bz2
volse-hubzilla-9dc949b62c6b5e3c8872211f71b11714d9d22b22.zip
native dark theme initial checkin
Diffstat (limited to 'vendor/twbs/bootstrap/site/static/docs/5.3/assets/js')
-rw-r--r--vendor/twbs/bootstrap/site/static/docs/5.3/assets/js/color-modes.js62
-rw-r--r--vendor/twbs/bootstrap/site/static/docs/5.3/assets/js/validate-forms.js19
2 files changed, 81 insertions, 0 deletions
diff --git a/vendor/twbs/bootstrap/site/static/docs/5.3/assets/js/color-modes.js b/vendor/twbs/bootstrap/site/static/docs/5.3/assets/js/color-modes.js
new file mode 100644
index 000000000..41b6b893e
--- /dev/null
+++ b/vendor/twbs/bootstrap/site/static/docs/5.3/assets/js/color-modes.js
@@ -0,0 +1,62 @@
+/*!
+ * Color mode toggler for Bootstrap's docs (https://getbootstrap.com/)
+ * Copyright 2011-2022 The Bootstrap Authors
+ * Licensed under the Creative Commons Attribution 3.0 Unported License.
+ */
+
+(() => {
+ 'use strict'
+
+ const storedTheme = localStorage.getItem('theme')
+
+ const getPreferredTheme = () => {
+ if (storedTheme) {
+ return storedTheme
+ }
+
+ return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light'
+ }
+
+ const setTheme = function (theme) {
+ if (theme === 'auto' && window.matchMedia('(prefers-color-scheme: dark)').matches) {
+ document.documentElement.setAttribute('data-bs-theme', 'dark')
+ } else {
+ document.documentElement.setAttribute('data-bs-theme', theme)
+ }
+ }
+
+ setTheme(getPreferredTheme())
+
+ const showActiveTheme = theme => {
+ const activeThemeIcon = document.querySelector('.theme-icon-active use')
+ const btnToActive = document.querySelector(`[data-bs-theme-value="${theme}"]`)
+ const svgOfActiveBtn = btnToActive.querySelector('svg use').getAttribute('href')
+
+ document.querySelectorAll('[data-bs-theme-value]').forEach(element => {
+ element.classList.remove('active')
+ })
+
+ btnToActive.classList.add('active')
+ activeThemeIcon.setAttribute('href', svgOfActiveBtn)
+ }
+
+ window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', () => {
+ if (storedTheme !== 'light' || storedTheme !== 'dark') {
+ setTheme(getPreferredTheme())
+ }
+ })
+
+ window.addEventListener('DOMContentLoaded', () => {
+ showActiveTheme(getPreferredTheme())
+
+ document.querySelectorAll('[data-bs-theme-value]')
+ .forEach(toggle => {
+ toggle.addEventListener('click', () => {
+ const theme = toggle.getAttribute('data-bs-theme-value')
+ localStorage.setItem('theme', theme)
+ setTheme(theme)
+ showActiveTheme(theme)
+ })
+ })
+ })
+})()
diff --git a/vendor/twbs/bootstrap/site/static/docs/5.3/assets/js/validate-forms.js b/vendor/twbs/bootstrap/site/static/docs/5.3/assets/js/validate-forms.js
new file mode 100644
index 000000000..30ea0aa6b
--- /dev/null
+++ b/vendor/twbs/bootstrap/site/static/docs/5.3/assets/js/validate-forms.js
@@ -0,0 +1,19 @@
+// Example starter JavaScript for disabling form submissions if there are invalid fields
+(() => {
+ 'use strict'
+
+ // Fetch all the forms we want to apply custom Bootstrap validation styles to
+ const forms = document.querySelectorAll('.needs-validation')
+
+ // Loop over them and prevent submission
+ Array.from(forms).forEach(form => {
+ form.addEventListener('submit', event => {
+ if (!form.checkValidity()) {
+ event.preventDefault()
+ event.stopPropagation()
+ }
+
+ form.classList.add('was-validated')
+ }, false)
+ })
+})()