4,114
edits
No edit summary Tags: Manual revert Reverted |
No edit summary Tag: Manual revert |
||
Line 18: | Line 18: | ||
} | } | ||
// | // Check if the specific element exists on the page | ||
if ($('#show-article-wrapper-entry').length > 0 || $('#show-article-wrapper').length > 0) { | if ($('#show-article-wrapper-entry').length > 0 || $('#show-article-wrapper').length > 0) { | ||
var images = []; // Initialize an empty array to store the images | var images = []; // Initialize an empty array to store the images | ||
// Find all image containers within the article content and extract the necessary information | |||
$('.article-images .image-container').each(function() { | $('.article-images .image-container').each(function() { | ||
var img = $(this).find('img'); | var img = $(this).find('img'); | ||
Line 39: | Line 41: | ||
} | } | ||
// | // Using delegated event handling for both #list and #list-list | ||
$('#list, #list-list').on('mousedown', '.filtered-value-option', function(event) { | $('#list, #list-list').on('mousedown', '.filtered-value-option', function(event) { | ||
console.log("Filter clicked within context:", this); | console.log("Filter clicked within context:", this); | ||
Line 57: | Line 59: | ||
console.log("Parents of event target:", $(event.target).parents()); | console.log("Parents of event target:", $(event.target).parents()); | ||
}); | }); | ||
// Format paragraphs | // Format paragraphs | ||
Line 134: | Line 114: | ||
} | } | ||
// Function to check if filters are cleared and update visibility of community elements | |||
function checkFiltersCleared(selector, communityElement) { | function checkFiltersCleared(selector, communityElement) { | ||
var checkedFilters = $(selector + ' .filtered-value-option input[type="checkbox"]:checked'); | var checkedFilters = $(selector + ' .filtered-value-option input[type="checkbox"]:checked'); | ||
Line 146: | Line 128: | ||
communityElement.hide(); // Hide the element if any filters are active | communityElement.hide(); // Hide the element if any filters are active | ||
} | } | ||
} | } | ||
// Event delegation for filter changes in both block and list views | |||
$('#list, #list-list').on('change', '.filtered-value-option input[type="checkbox"]', function() { | $('#list, #list-list').on('change', '.filtered-value-option input[type="checkbox"]', function() { | ||
// Determine the closest list or list-list element to identify the context | // Determine the closest list or list-list element to identify the context | ||
Line 164: | Line 146: | ||
selectors.forEach(function(selector) { | selectors.forEach(function(selector) { | ||
checkFiltersCleared(selector, communityFeatured); | checkFiltersCleared(selector, communityFeatured); | ||
}); | }); | ||
// Function to check if all filters are cleared and return boolean | // Function to check if all filters are cleared and return boolean |