mirror of
				https://github.com/Theodor-Springmann-Stiftung/musenalm.git
				synced 2025-10-29 09:15:33 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			52 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			52 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
| <script type="module">
 | |
| 	let fieldset = document.querySelector("fieldset.selectgroup");
 | |
| 	let checkboxes = Array.from(fieldset.querySelectorAll('input[type="checkbox"]'));
 | |
| 	fieldset.addEventListener("change", (event) => {
 | |
| 		let target = event.target;
 | |
| 		if (target.type === "checkbox") {
 | |
| 			let name = target.name;
 | |
| 			let checked = target.checked;
 | |
| 			if (!checked) {
 | |
| 				let allchecked = checkboxes.filter((checkbox) => checkbox.checked);
 | |
| 				if (allchecked.length === 0) {
 | |
| 					target.checked = true;
 | |
| 				}
 | |
| 			}
 | |
| 		}
 | |
| 	});
 | |
| 
 | |
| 	const form = document.getElementById("simplesearchform");
 | |
| 	let submitBtn = null;
 | |
| 	if (form) {
 | |
| 		submitBtn = form.querySelector("#submitbutton");
 | |
| 	}
 | |
| 
 | |
| 	function checkValidity(f, btn) {
 | |
| 		if (f.checkValidity()) {
 | |
| 			btn.disabled = false;
 | |
| 		} else {
 | |
| 			btn.disabled = true;
 | |
| 		}
 | |
| 	}
 | |
| 
 | |
| 	if (form && submitBtn) {
 | |
| 		checkValidity(form, submitBtn);
 | |
| 		form.addEventListener("input", (event) => {
 | |
| 			checkValidity(form, submitBtn);
 | |
| 		});
 | |
| 	}
 | |
| 
 | |
| 	const lookupform = document.getElementById("lookupform");
 | |
| 	let lookupsubmitBtn = null;
 | |
| 	if (lookupform) {
 | |
| 		lookupsubmitBtn = lookupform.querySelector("#submitbutton");
 | |
| 	}
 | |
| 
 | |
| 	if (lookupform && lookupsubmitBtn) {
 | |
| 		checkValidity(lookupform, lookupsubmitBtn);
 | |
| 		lookupform.addEventListener("input", (event) => {
 | |
| 			checkValidity(lookupform, lookupsubmitBtn);
 | |
| 		});
 | |
| 	}
 | |
| </script>
 | 
