Dantes (обсуждение | вклад) Нет описания правки |
Dantes (обсуждение | вклад) Нет описания правки |
||
| Строка 1: | Строка 1: | ||
document.querySelectorAll('.recipe- | <script> | ||
document.addEventListener('DOMContentLoaded', function () { | |||
document.querySelectorAll('.recipe-card').forEach(function (card) { | |||
var borderColor = card.getAttribute('data-border'); | |||
if (borderColor) { | |||
card.style.borderColor = borderColor; | |||
card.querySelectorAll('.collapsible-content').forEach(function (block) { | |||
block.style.borderLeftColor = borderColor; | |||
}); | |||
} | |||
}); | |||
var icon = document.createElement('img'); | document.querySelectorAll('.recipe-list li').forEach(function (item) { | ||
if (item.classList.contains('instruction')) return; | |||
if (item.querySelector('.chem-icon')) return; | |||
}); | var icon = document.createElement('img'); | ||
icon.className = 'chem-icon'; | |||
icon.src = 'Beaker.png'; | |||
item.insertBefore(icon, item.firstChild); | |||
}); | |||
document.querySelectorAll('.collapsible-header').forEach(function (header) { | |||
header.addEventListener('click', function () { | |||
var content = this.nextElementSibling; | |||
content.classList.toggle('active'); | |||
}); | }); | ||
} | }); | ||
}); | }); | ||
</script> | |||
Версия от 17:47, 5 мая 2025
<script>
document.addEventListener('DOMContentLoaded', function () {
document.querySelectorAll('.recipe-card').forEach(function (card) {
var borderColor = card.getAttribute('data-border');
if (borderColor) {
card.style.borderColor = borderColor;
card.querySelectorAll('.collapsible-content').forEach(function (block) {
block.style.borderLeftColor = borderColor;
});
}
});
document.querySelectorAll('.recipe-list li').forEach(function (item) {
if (item.classList.contains('instruction')) return;
if (item.querySelector('.chem-icon')) return;
var icon = document.createElement('img');
icon.className = 'chem-icon';
icon.src = 'Beaker.png';
item.insertBefore(icon, item.firstChild);
});
document.querySelectorAll('.collapsible-header').forEach(function (header) {
header.addEventListener('click', function () {
var content = this.nextElementSibling;
content.classList.toggle('active');
});
});
});
</script>