1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- /*
- * Copyright (C) 2021 Echedey López Romero <elr@disroot.org>
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
- function ResetDays() {
- let Days = document.getElementById('day');
- Days.value = '';
- }
- function LimitDays() {
- let Month = document.getElementById('month').value;
- let Days = document.getElementById('day');
- if (Month !== '') {
- let Limit;
- switch (Month) {
- case 'January':
- case 'March':
- case 'May':
- case 'July':
- case 'August':
- case 'October':
- case 'December':
- Limit = 31;
- break;
- case 'April':
- case 'June':
- case 'September':
- case 'November':
- Limit = 30;
- break;
- case 'February':
- Limit = 29;
- break;
- }
- for (Pos = 0; Pos < Days.length; Pos++) {
- let Option = Days[Pos];
- if (Option.value <= Limit) {
- Option.removeAttribute('style');
- } else {
- Option.style.display = 'none';
- }
- }
- if (Days.value > Limit) {
- Days.value = '';
- }
- } else {
- for (Pos = 0; Pos < Days.length; Pos++) {
- let Option = Days[Pos];
- Option.removeAttribute('style');
- }
- }
- }
- function AddOnChangeMonth() {
- let Month = document.getElementById('month');
- Month.setAttribute('onchange', 'LimitDays(); ResetDays();');
- }
- function Restart() {
- let Operators = document.getElementsByTagName('select');
- for (let Pos = 0; Pos < Operators.length; Pos++) {
- for (let Option = 0; Option < Operators[Pos].length; Option++) {
- Operators[Pos][Option].removeAttribute('selected');
- }
- Operators[Pos][0].setAttribute('selected', '');
- }
- let Result = document.getElementById('result');
- Result.innerHTML = '<span class="d-block text-center">--</span>\n';
- }
|