HEX
Server: nginx/1.24.0
System: Linux nowruzgan 6.8.0-57-generic #59-Ubuntu SMP PREEMPT_DYNAMIC Sat Mar 15 17:40:59 UTC 2025 x86_64
User: babak (1000)
PHP: 8.3.6
Disabled: NONE
Upload Files
File: /var/www/school/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())
}