4,554
edits
No edit summary |
No edit summary |
||
Line 586: | Line 586: | ||
}); | }); | ||
function | function logCardsWithSameClasses() { | ||
var cardsInfo = {}; // Object to store the occurrence of entity-type combinations | |||
$('.card').each(function() { | $('.card').each(function() { | ||
var entityText = $(this).find('.entity').text().trim(); | var entityText = $(this).find('.entity').text().trim(); | ||
var typeText = $(this).find('.type').text().trim(); | var typeText = $(this).find('.type').text().trim(); | ||
var key = entityText + '-' + typeText; // Creating a unique key for the combination | |||
// | if (!cardsInfo[key]) { | ||
cardsInfo[key] = []; // Initialize an array if this is the first encounter | |||
} | |||
// | cardsInfo[key].push(this); // Add the card to the array for this entity-type combination | ||
if ( | }); | ||
// Iterate over the stored information to log out the cards with the same classes | |||
$( | $.each(cardsInfo, function(key, cards) { | ||
if (cards.length > 1) { // More than one card with the same entity-type combination | |||
console.log('Cards with entity-type ' + key + ':'); | |||
$.each(cards, function(index, card) { | |||
console.log(card); // Log the card element, or you can log an identifier or other info | |||
}); | |||
} | } | ||
}); | }); | ||
} | } | ||
// | // Call the function to log out the cards with the same classes | ||
logCardsWithSameClasses(); | |||
}); | }); |