Skip to content

Commit f893b50

Browse files
committed
Rename JS file, and local-storage key to be Docsy-specific
1 parent 60c5c3b commit f893b50

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

assets/js/color-mode.js assets/js/dark-mode.js

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
/*!
2+
* This is a Docsy-adapted version of https://github.com/twbs/examples/blob/main/color-modes/js/color-modes.js.
3+
*
4+
* Original header:
5+
*
26
* Color mode toggler for Bootstrap's docs (https://getbootstrap.com/)
37
* Copyright 2011-2024 The Bootstrap Authors
48
* Licensed under the Creative Commons Attribution 3.0 Unported License.
@@ -7,8 +11,9 @@
711
(() => {
812
'use strict'
913

10-
const getStoredTheme = () => localStorage.getItem('theme')
11-
const setStoredTheme = theme => localStorage.setItem('theme', theme)
14+
const themeKey = 'td-color-theme'
15+
const getStoredTheme = () => localStorage.getItem(themeKey)
16+
const setStoredTheme = theme => localStorage.setItem(themeKey, theme)
1217

1318
const getPreferredTheme = () => {
1419
const storedTheme = getStoredTheme()

layouts/partials/scripts.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
{{ end -}}
7575

7676
{{ if .Site.Params.ui.showLightDarkModeMenu -}}
77-
{{ $jsArray = $jsArray | append (resources.Get "js/color-mode.js") -}}
77+
{{ $jsArray = $jsArray | append (resources.Get "js/dark-mode.js") -}}
7878
{{ end -}}
7979

8080
{{ $js := $jsArray | resources.Concat "js/main.js" -}}

0 commit comments

Comments
 (0)