MediaWiki:Common.js: Difference between revisions

Jump to navigation Jump to search
no edit summary
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) {
                 // Block view: place container after the title
                 // 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) {
                 // List view: instead of placing container, insert .date directly after .title
                 // Check if it's already correctly placed, if not, move it
                 var titleEl = $(this).find('.title');
                 if (!existingContainer.is($(this).find('.title').prev())) {
                if (titleEl.length && date.length) {
                    $(this).find('.title').before(existingContainer);
                    date.insertAfter(titleEl);
                 }
                 }
             }
             }

Navigation menu