HEX
Server: Apache
System: Linux b5.s-host.com.ua 4.18.0-305.10.2.el7.x86_64 #1 SMP Fri Jul 23 21:00:55 UTC 2021 x86_64
User: unelbhzm (1470)
PHP: 8.0.18
Disabled: NONE
Upload Files
File: /sites/nuofama.com/wp-content/themes/blocksy/static/js/customizer/customizer-color-scheme.js
export const listenToChanges = () => {
	const renderValue = () => {
		if (!wp.customize._value['customizer_color_scheme']) {
			return
		}

		if (!document.body) {
			return
		}

		const overlay = document.querySelector('.wp-full-overlay')
		document.body.classList.remove('ct-dark-mode')

		overlay.classList.add('ct-disable-transitions')

		setTimeout(
			() => overlay.classList.remove('ct-disable-transitions'),
			500
		)

		if (wp.customize._value['customizer_color_scheme']() === 'yes') {
			document.body.classList.add('ct-dark-mode')
		}
	}

	wp.customize.bind('change', (e) => {
		if (e.id !== 'customizer_color_scheme') return
		renderValue()
	})

	wp.customize.bind('ready', () => renderValue())
}