Dantes (обсуждение | вклад) Нет описания правки |
Dantes (обсуждение | вклад) Нет описания правки |
||
| Строка 1: | Строка 1: | ||
$(function () { | $(function () { | ||
var | $('.chem-recipe').each(function () { | ||
var $box = $(this); | |||
var name = $box.data('name'); | |||
var recipe = $box.find('.recipe').html(); | |||
var effects = $box.find('.effects').html(); | |||
var description = $box.find('.description').html(); | |||
var $formatted = $('<div class="chem-box" style="border:1px solid #aaa; border-radius:8px; padding:10px; margin:10px 0; background:#f9f9f9;"></div>'); | |||
if (name) { | |||
$('<h3 style="margin-top:0;">').text(name).appendTo($formatted); | |||
} | |||
if (recipe) { | |||
$('<div style="margin-bottom:5px;"><strong>Рецепт:</strong><br>' + recipe + '</div>').appendTo($formatted); | |||
} | |||
if (effects) { | |||
$('<div style="margin-bottom:5px;"><strong>Эффекты:</strong><br>' + effects + '</div>').appendTo($formatted); | |||
} | |||
if (description) { | |||
$('<div style="color:#555;"><em>' + description + '</em></div>').appendTo($formatted); | |||
} | |||
$box.replaceWith($formatted); | |||
}); | |||
}); | }); | ||
Версия от 13:53, 19 апреля 2025
$(function () {
$('.chem-recipe').each(function () {
var $box = $(this);
var name = $box.data('name');
var recipe = $box.find('.recipe').html();
var effects = $box.find('.effects').html();
var description = $box.find('.description').html();
var $formatted = $('<div class="chem-box" style="border:1px solid #aaa; border-radius:8px; padding:10px; margin:10px 0; background:#f9f9f9;"></div>');
if (name) {
$('<h3 style="margin-top:0;">').text(name).appendTo($formatted);
}
if (recipe) {
$('<div style="margin-bottom:5px;"><strong>Рецепт:</strong><br>' + recipe + '</div>').appendTo($formatted);
}
if (effects) {
$('<div style="margin-bottom:5px;"><strong>Эффекты:</strong><br>' + effects + '</div>').appendTo($formatted);
}
if (description) {
$('<div style="color:#555;"><em>' + description + '</em></div>').appendTo($formatted);
}
$box.replaceWith($formatted);
});
});