4,159
edits
No edit summary Tag: Reverted |
No edit summary Tag: Manual revert |
||
Line 126: | Line 126: | ||
$('.card.event').each(function() { | $('.card.event').each(function() { | ||
var existingContainer = $(this).find('.container-people-date'); | var existingContainer = $(this).find('.container-people-date'); | ||
// If the container doesn't exist, create and append it | // If the container doesn't exist, create and append it | ||
if (existingContainer.length === 0) { | if (existingContainer.length === 0) { | ||
Line 132: | Line 132: | ||
$(this).append(existingContainer); // Temporarily append to ensure it's in the DOM | $(this).append(existingContainer); // Temporarily append to ensure it's in the DOM | ||
} | } | ||
// Ensure the .people and .date elements are inside the container | // Ensure the .people and .date elements are inside the container | ||
var people = $(this).find('.people').detach(); | var people = $(this).find('.people').detach(); | ||
var date = $(this).find('.date').detach(); | var date = $(this).find('.date').detach(); | ||
existingContainer.append(people).append(date); | existingContainer.append(people).append(date); | ||
// Decide where to place the container | // Decide where to place the container | ||
if ($(this).closest('.home-chronicle-block').length) { | if ($(this).closest('.home-chronicle-block').length) { | ||
// | // Check if it's already correctly placed, if not, move it | ||
if (!existingContainer.is($(this).find('.title').next())) { | if (!existingContainer.is($(this).find('.title').next())) { | ||
$(this).find('.title').after(existingContainer); | $(this).find('.title').after(existingContainer); | ||
} | } | ||
} else if ($(this).closest('.home-chronicle-list').length) { | } else if ($(this).closest('.home-chronicle-list').length) { | ||
// | // Check if it's already correctly placed, if not, move it | ||
if (!existingContainer.is($(this).find('.title').prev())) { | |||
$(this).find('.title').before(existingContainer); | |||
} | } | ||
} | } |