MediaWiki:Common.js: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
No edit summary
Line 585: Line 585:
// Initially hide all cards
// Initially hide all cards
$('div.filtered-list-item .card').hide();
$('div.filtered-list-item .card').hide();
console.log('All cards are now hidden.');
$('.card').each(function() {
$('.card').each(function() {
var typeText = $(this).find('.type a').text().trim();
var typeText = $(this).find('.type a').text().trim();
var subjectText = $(this).find('.subject').text().trim();
var subjectText = $(this).find('.subject').text().trim();
console.log('Checking card with type:', typeText, 'and subject:', subjectText);
// Check if the card's type matches 'Book' and if the subject includes 'Activism'
// Check if the card's type matches 'Book' and if the subject includes 'Activism'
if (typeText === typeValue && subjectText.split(',').map(function(s) { return s.trim(); }).includes(subjectValue)) {
if (typeText === typeValue && subjectText.split(',').map(function(s) { return s.trim(); }).includes(subjectValue)) {
console.log('Match found:', this);
// Show this card and its parent
// If the conditions are met, show this card (and ensure its parent is visible)
$(this).show().closest('div.filtered-list-item').show();
$(this).closest('div.filtered-list-item').show();
}
}
});
});
Line 605: Line 600:
// Call the function to filter and display only cards with the type "Book" and subject "Activism"
// Call the function to filter and display only cards with the type "Book" and subject "Activism"
filterCardsToShowOnlyTypeAndSubject('Book', 'Activism');
filterCardsToShowOnlyTypeAndSubject('Book', 'Activism');
 
});
});

Navigation menu