da.html aktualisiert
This commit is contained in:
parent
1900605b4a
commit
2c66275a0a
104
da.html
104
da.html
|
@ -9,7 +9,8 @@
|
||||||
border: 1px solid #ccc;
|
border: 1px solid #ccc;
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
position: relative; /* Um Positionierung für den edit-button zu ermöglichen */
|
border-radius: 0.75em;
|
||||||
|
|
||||||
}
|
}
|
||||||
.weekday-btn-container {
|
.weekday-btn-container {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
@ -18,73 +19,10 @@
|
||||||
.weekday-btn-container div {
|
.weekday-btn-container div {
|
||||||
margin-right: 10px;
|
margin-right: 10px;
|
||||||
}
|
}
|
||||||
.custom-checkbox {
|
|
||||||
position: relative;
|
|
||||||
cursor: pointer;
|
|
||||||
width: 24px;
|
|
||||||
height: 24px;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
margin-right: 5px;
|
|
||||||
}
|
|
||||||
.custom-checkbox input {
|
|
||||||
position: absolute;
|
|
||||||
opacity: 0;
|
|
||||||
cursor: pointer;
|
|
||||||
height: 0;
|
|
||||||
width: 0;
|
|
||||||
}
|
|
||||||
.checkmark {
|
|
||||||
position: absolute;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
height: 24px;
|
|
||||||
width: 24px;
|
|
||||||
background-color: #eee;
|
|
||||||
border-radius: 50%;
|
|
||||||
z-index: -1;
|
|
||||||
}
|
|
||||||
.custom-checkbox input:checked ~ .checkmark {
|
|
||||||
background-color: #54f17b;
|
|
||||||
}
|
|
||||||
.checkmark:after {
|
|
||||||
content: "";
|
|
||||||
position: absolute;
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
.custom-checkbox input:checked ~ .checkmark:after {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
.custom-checkbox .checkmark:after {
|
|
||||||
content: "";
|
|
||||||
top: 50%;
|
|
||||||
left: 50%;
|
|
||||||
transform: translate(-50%, -50%);
|
|
||||||
width: 12px;
|
|
||||||
height: 12px;
|
|
||||||
border-radius: 50%;
|
|
||||||
background: white;
|
|
||||||
}
|
|
||||||
h1{
|
h1{
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
|
||||||
}
|
}
|
||||||
.edit-button {
|
|
||||||
position: absolute;
|
|
||||||
bottom: 5px;
|
|
||||||
right: 5px;
|
|
||||||
background-color: #2196F3;
|
|
||||||
color: white;
|
|
||||||
border: none;
|
|
||||||
border-radius: 50%;
|
|
||||||
width: 30px;
|
|
||||||
height: 30px;
|
|
||||||
cursor: pointer;
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
@ -113,51 +51,33 @@
|
||||||
|
|
||||||
const daysValue = item.daysValue;
|
const daysValue = item.daysValue;
|
||||||
|
|
||||||
const weekdays = ['Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa', 'So'];
|
const weekdays = ['Montag', 'Dienstag', 'Mittwoch', 'Donnerstag', 'Freitag', 'Samstag', 'Sonntag'];
|
||||||
|
|
||||||
const weekdayContainer = document.createElement('div');
|
const weekdayContainer = document.createElement('div');
|
||||||
weekdayContainer.classList.add('weekday-btn-container');
|
weekdayContainer.classList.add('weekday-btn-container');
|
||||||
|
|
||||||
weekdays.forEach((day, index) => {
|
weekdays.forEach(day => {
|
||||||
const checkboxDiv = document.createElement('div');
|
const checkboxDiv = document.createElement('div');
|
||||||
const checkbox = document.createElement('label');
|
const checkbox = document.createElement('input');
|
||||||
checkbox.classList.add('custom-checkbox');
|
checkbox.type = 'checkbox';
|
||||||
|
checkbox.id = `${day.toLowerCase()}Checkbox`;
|
||||||
const input = document.createElement('input');
|
checkbox.checked = daysValue[day];
|
||||||
input.type = 'checkbox';
|
|
||||||
input.id = `${day.toLowerCase()}Checkbox`;
|
|
||||||
input.checked = daysValue[Object.keys(daysValue)[index]];
|
|
||||||
|
|
||||||
// Preventing checkbox clicks
|
// Preventing checkbox clicks
|
||||||
checkbox.addEventListener('click', function(event) {
|
checkbox.addEventListener('click', function(event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
});
|
});
|
||||||
|
|
||||||
const checkmark = document.createElement('span');
|
const label = document.createElement('label');
|
||||||
checkmark.classList.add('checkmark');
|
label.textContent = day;
|
||||||
|
label.htmlFor = `${day.toLowerCase()}Checkbox`;
|
||||||
const labelText = document.createElement('span');
|
|
||||||
labelText.textContent = day;
|
|
||||||
checkbox.appendChild(input);
|
|
||||||
checkbox.appendChild(checkmark);
|
|
||||||
checkbox.appendChild(labelText);
|
|
||||||
|
|
||||||
checkboxDiv.appendChild(checkbox);
|
checkboxDiv.appendChild(checkbox);
|
||||||
|
checkboxDiv.appendChild(label);
|
||||||
weekdayContainer.appendChild(checkboxDiv);
|
weekdayContainer.appendChild(checkboxDiv);
|
||||||
});
|
});
|
||||||
|
|
||||||
jsonElement.appendChild(weekdayContainer);
|
jsonElement.appendChild(weekdayContainer);
|
||||||
|
|
||||||
const editButton = document.createElement('div'); // Jetzt innerhalb der Schleife erstellt
|
|
||||||
editButton.classList.add('edit-button');
|
|
||||||
editButton.innerHTML = '✎';
|
|
||||||
|
|
||||||
// Add click event for edit button
|
|
||||||
editButton.addEventListener('click', function() {
|
|
||||||
console.log('Edit button clicked');
|
|
||||||
});
|
|
||||||
|
|
||||||
jsonElement.appendChild(editButton); // Hinzufügen des edit-buttons zum JSON-Element
|
|
||||||
jsonContainer.appendChild(jsonElement);
|
jsonContainer.appendChild(jsonElement);
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue