|
271 | 271 |
|
272 | 272 | // Plugins
|
273 | 273 | self['vps_safemode'] = !self['vps_overwrite'];
|
| 274 | + |
| 275 | + if (self['always_zap'] === 'yes' || self['always_zap'] === '1' || self['always_zap'] === true) { |
| 276 | + self['justplay'] = true; |
| 277 | + self['always_zap'] = true; |
| 278 | + } else { |
| 279 | + if (self['justplay'] === 'yes' || self['justplay'] === '1' || self['justplay'] === true) { |
| 280 | + self['justplay'] = true; |
| 281 | + self['always_zap'] = false; |
| 282 | + } else { |
| 283 | + self['always_zap'] = true; |
| 284 | + self['justplay'] = false; |
| 285 | + } |
| 286 | + } |
| 287 | + |
274 | 288 | }
|
275 | 289 |
|
276 | 290 | get bouquetSRefs() {
|
|
742 | 756 | filteringParamNames.forEach((param) => formData.delete(param));
|
743 | 757 | }
|
744 | 758 |
|
| 759 | + |
| 760 | + const justplay = formData.get("justplay") == "1"; |
| 761 | + const always_zap = formData.get("always_zap") == "1"; |
| 762 | + |
| 763 | + formData.set("justplay", (!always_zap && justplay) ? "1": "0") |
| 764 | + formData.set("always_zap", (always_zap && justplay) ? "1": "0") |
| 765 | + |
745 | 766 | paramsNotToSend.forEach((param) => formData.delete(param));
|
746 | 767 |
|
747 | 768 | Object.entries(formDataObj).forEach(([name, value]) => {
|
|
920 | 941 | evt.preventDefault();
|
921 | 942 | self.saveEntry();
|
922 | 943 | };
|
923 |
| - // at least one option must be checked |
| 944 | + |
| 945 | + // at least one option must be checked, both can be checked |
924 | 946 | (document.querySelectorAll('input[name="justplay"], input[name="always_zap"]') || nullEl).forEach((node) => {
|
925 |
| - node.onchange = (input) => { |
926 |
| - const checkedInputs = document.querySelectorAll( |
927 |
| - 'input[name="justplay"]:checked, input[name="always_zap"]:checked' |
928 |
| - ); |
929 |
| - checkedInputs.length < 1 && (event.target.checked = !event.target.checked); |
| 947 | + node.onchange = (event) => { |
| 948 | + const zapChecked = document.querySelector('input[name="justplay"]').checked; |
| 949 | + const recordChecked = document.querySelector('input[name="always_zap"]').checked; |
| 950 | + |
| 951 | + // If trying to uncheck when neither would be checked, prevent it |
| 952 | + if (!event.target.checked && !recordChecked && !zapChecked) { |
| 953 | + event.target.checked = true; |
| 954 | + } |
930 | 955 | };
|
931 | 956 | });
|
932 | 957 |
|
|
0 commit comments