MediaWiki:Common.js: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
No edit summary
Line 586: Line 586:
     });
     });


     function logCardsWithSameClasses() {
     function logTitlesForEntity(entityValue) {
        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 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
        });
      
      
        // Iterate over the stored information to log out the cards with the same classes
             if (entityText === entityValue) {
        $.each(cardsInfo, function(key, cards) {
                 var titleText = $(this).find('.title').text().trim();
             if (cards.length > 1) { // More than one card with the same entity-type combination
                console.log('Title: ' + titleText);
                 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
     // Call the function to log titles for cards with the entity "Collective"
     logCardsWithSameClasses();
     logTitlesForEntity('Collective');
   
      
      
});
});

Navigation menu