HEX
Server: Apache/2
System: Linux bq-e705.pointdnshere.com 4.18.0-513.11.1.el8_9.x86_64 #1 SMP Wed Jan 17 02:00:40 EST 2024 x86_64
User: wellmix (1103)
PHP: 7.4.33
Disabled: NONE
Upload Files
File: /home/wellmix/public_html/wp-content/plugins/weglot/app/javascripts/settings/admin-private-mode.js
const init_private_mode = function () {

	const $ = jQuery

	const execute = () => {
		document.querySelector("#private_mode").addEventListener('change', function(e) {

			document.querySelectorAll(".private-mode-lang--input").forEach((itm) => {
				itm.checked = e.target.checked;
			})
		})

		document.querySelectorAll(".private-mode-lang--input").forEach((itm) => {
			itm.addEventListener('change', function(e){
				if (document.querySelectorAll(".private-mode-lang--input:checked").length === 0){
					document.querySelector("#private_mode").checked = false
				}
			})
		});
	}

	document.addEventListener('DOMContentLoaded', () => {
		const private_mode = document.querySelector("#private_mode")
		if (private_mode && private_mode.length != 0){
			execute();
		}
	})
}

export default init_private_mode;