parent
b4f794e160
commit
52ca8dd92d
|
@ -154,16 +154,16 @@
|
|||
</div>
|
||||
|
||||
<script>
|
||||
const isIframe = document.location.pathname.startsWith('/iframes/')
|
||||
const isIframe = document.location.pathname.startsWith(’/iframes/')
|
||||
|
||||
function getItem(key) {
|
||||
try {
|
||||
return window.localStorage.getItem(key)
|
||||
} catch (error) {
|
||||
if (error instanceof Error && error.name === 'SecurityError') {
|
||||
if (error instanceof Error && error.name === ‘SecurityError’) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.warn(
|
||||
'[localStorage] Unable to set item due to security settings'
|
||||
'[localStorage] Unable to set item due to security settings’
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -171,17 +171,17 @@
|
|||
}
|
||||
}
|
||||
|
||||
const darkMode = !isIframe && getItem('darkMode') === 'true'
|
||||
const darkMode = !isIframe && getItem(‘darkMode’) === ‘true’
|
||||
|
||||
if (darkMode) {
|
||||
document.body.style.backgroundColor = '#0f172a'
|
||||
document.body.style.backgroundColor = '#0f172a’
|
||||
}
|
||||
</script>
|
||||
|
||||
<!-- USER AGENT DATA ATTRIBUTE -->
|
||||
<script>
|
||||
var b = document.documentElement
|
||||
b.setAttribute('data-useragent', navigator.userAgent)
|
||||
b.setAttribute(‘data-useragent’, navigator.userAgent)
|
||||
</script>
|
||||
|
||||
<script>
|
||||
|
@ -199,19 +199,19 @@
|
|||
try {
|
||||
const rawColor = new URLSearchParams(
|
||||
document.location.search.substring(1)
|
||||
).get('couleur')
|
||||
).get(‘couleur’)
|
||||
const iframeColor = rawColor && parseColor(rawColor)
|
||||
;[
|
||||
document.documentElement,
|
||||
...document.querySelectorAll('[data-js-color-element]'),
|
||||
…document.querySelectorAll(’[data-js-color-element]'),
|
||||
].forEach((element) => {
|
||||
element.style.setProperty(
|
||||
'--COLOR_HUE',
|
||||
iframeColor ? iframeColor[0] : '220deg'
|
||||
'--COLOR_HUE’,
|
||||
iframeColor ? iframeColor[0] : ‘220deg’
|
||||
)
|
||||
element.style.setProperty(
|
||||
'--COLOR_SATURATION',
|
||||
iframeColor ? iframeColor[1] + '%' : '100%'
|
||||
'--COLOR_SATURATION’,
|
||||
iframeColor ? iframeColor[1] + '%’ : ‘100%’
|
||||
)
|
||||
})
|
||||
} catch (e) {
|
||||
|
@ -221,7 +221,7 @@
|
|||
|
||||
<script
|
||||
crossorigin="anonymous"
|
||||
src="https://polyfill.io/v3/polyfill.min.js?features=ResizeObserver%2CIntl.~locale.en%2CIntl.~locale.fr%2CString.prototype.replaceAll%2CObject.fromEntries%2CString.prototype.matchAll"
|
||||
src="https://polyfill.io/v3/polyfill.min.js?features=ResizeObserver%2CIntl.~locale.en%2CIntl.~locale.fr%2CString.prototype.replaceAll%2CObject.fromEntries%2CString.prototype.matchAll%2CrequestIdleCallback"
|
||||
></script>
|
||||
|
||||
<script type="module" src="{{ entry }}"></script>
|
||||
|
|
Loading…
Reference in New Issue