Filters
Location
Categories
Frequency
Time of Day
Venue
NameSchedule DescriptionLocationVenueInstructorStart DatePrice
';
$(ul).append(el);
$(li).append(thead);
$(li).append(ul);
$('.arlo-event-list').append(li);
});
sort('.arlo-event-list');
if (flagInit) {
$('.arlo-event-list').on('click', '.arlo-category-name', function (e) {
e.preventDefault();
$(this).parents('.arlo-event-category').toggleClass('active');
});
$('.internal-search form input').on('focusout', function () {
$(this).parents('form').trigger('submit');
});
$('.internal-search form').on('submit', function (e) {
e.preventDefault();
const inputVal = $(this)
.find('input[name="arlo-search"]')
.val()
.toLowerCase();
$('.arlo-eventtemplatecategoryitems-listitem').removeClass('visible');
if (inputVal !== '') {
$(this).addClass('filtered');
$('.arlo-category-content').addClass('filtered');
$('.arlo-eventtemplatecategoryitems-listitem .field-name').each(
function () {
if ($(this).text().toLowerCase().includes(inputVal)) {
$(this)
.parents('.arlo-eventtemplatecategoryitems-listitem')
.addClass('visible');
}
}
);
} else {
$(this).removeClass('filtered');
$('.arlo-category-content').removeClass('filtered');
}
});
$('.arlo-event-register').attr('target', '_blank');
}
flagInit = false;
$(
'.arlo-event-list .arlo-event-category:first-child() .arlo-category-name'
).trigger('click');
$( ".showhideOpeningCourses" ).prop( "checked", false );
$( ".showhideOpeningCourses" ).trigger('click');
//start of code that limits each section to 20 courses
$('ul.arlo-event-list .arlo-event-category').each(function() {
var $li = $('ul',this).children('li:not([style="display: none;"])');
if ($li.length > 25) {
$li.slice(25).hide();
}
});
//end of code that limits each section to 20 courses
}
});
function sort(selector) {
$(selector)
.children('li')
.sort(function (a, b) {
const A = parseInt($(a).find('.arlo-category-name strong').text().split('. ')[0]);
const B = parseInt($(b).find('.arlo-category-name strong').text().split('. ')[0]);
return A B ? 1 : 0;
})
.appendTo(selector);
$('.arlo-event-list li').each(function(index){
var text = $(this).find('.arlo-category-name strong').text().split('. ')[1];
$(this).find('.arlo-category-name strong').text(text);
var indexValue = $(this).index() + 1;
var dropdownIndex = $('#filters .arlo-filter-select:first option:contains("'+text+'")').index();
var options = $('#filters .arlo-filter-select:first option');
if(dropdownIndex){
$( options[ dropdownIndex ] ).text(text);
$( options[ dropdownIndex ] ).insertAfter( $( options[ indexValue ] ) );
}
});
}
$('#showhideOpeningCourses').click(function () {
if (!$(this).is(':checked')) {
$('a.arlo-waiting-list').closest('li').show();
} else {
$('a.arlo-waiting-list').closest('li').hide();
}
});
$('.toggle-button').click(function(){
$('.toggle-button').toggleClass('show');
$('.arlo-filters').toggle();
});
setTimeout(function () {
$('#filters>div>div:nth-child(4)')
.prependTo('#upcoming-events')
.wrap('');
}, 2000);
jQuery("input[name='showDayCourses[]'],input[name='showFreqCourses[]'],input[name='showVenueCourses[]'],input[name='showLocationCourses[]'],input[name='showCategory[]']").change(function () {
$('.arlo-event-listitem').hide();
let showDay = jQuery("input[name='showDayCourses[]']:checked");
let showFreq = jQuery("input[name='showFreqCourses[]']:checked");
let showVenue = jQuery("input[name='showVenueCourses[]']:checked");
let showLocation = jQuery("input[name='showLocationCourses[]']:checked");
let showCategory = jQuery("input[name='showCategory[]']:checked");
if(!showDay.length && !showFreq.length && !showVenue.length && !showLocation.length && !showCategory.length){
$('.arlo-event-listitem').show();
}
if(showDay.length && showFreq.length && showVenue.length && showLocation.length && showCategory.length){//12345
showDay.each(function(index1,showDayVal){
showFreq.each(function(index2,showFreqVal){
showVenue.each(function(index3,showVenueVal){
showLocation.each(function(index4,showLocationVenueVal){
showCategory.each(function(index5,showCategoryVal){
jQuery('.arlo-event-listitem.' +jQuery(showDayVal).attr('id')+'.'+jQuery(showFreqVal).attr('id')+'.'+jQuery(showVenueVal).attr('id')+'.'+jQuery(showLocationVenueVal+'.'+showCategoryVal).attr('id')).show();
});
});
});
});
});
}
else if(showDay.length && showFreq.length && showVenue.length && showCategory.length){//1235
showDay.each(function(index1,showDayVal){
showFreq.each(function(index2,showFreqVal){
showVenue.each(function(index3,showVenueVal){
showCategory.each(function(index4,showCategoryVal){
jQuery('.arlo-event-listitem.' +jQuery(showDayVal).attr('id')+'.'+jQuery(showFreqVal).attr('id')+'.'+jQuery(showVenueVal).attr('id')+'.'+jQuery(showCategoryVal).attr('id')).show();
});
});
});
});
}
else if(showDay.length && showFreq.length && showLocation.length && showLocation.length){//1245
showDay.each(function(index1,showDayVal){
showFreq.each(function(index2,showFreqVal){
showLocation.each(function(index3,showLocationVal){
showCategory.each(function(index4,showCategoryVal){
jQuery('.arlo-event-listitem.' +jQuery(showDayVal).attr('id')+'.'+jQuery(showFreqVal).attr('id')+'.'+jQuery(showLocationVal).attr('id')+'.'+jQuery(showCategoryVal).attr('id')).show();
});
});
});
});
}
else if(showDay.length && showVenue.length && showLocation.length && showCategory.length){//1345
showDay.each(function(index1,showDayVal){
showVenue.each(function(index2,showVenueVal){
showLocation.each(function(index3,showLocationVal){
showCategory.each(function(index4,showCategoryVal){
jQuery('.arlo-event-listitem.' +jQuery(showDayVal).attr('id')+'.'+jQuery(showVenueVal).attr('id')+'.'+jQuery(showLocationVal).attr('id')+'.'+jQuery(showCategoryVal).attr('id')).show();
});
});
});
});
}
else if(showDay.length && showFreq.length && showVenue.length && showLocation.length){//1234
showDay.each(function(index1,showDayVal){
showFreq.each(function(index2,showFreqVal){
showVenue.each(function(index3,showVenueVal){
showLocation.each(function(index4,showLocationVenueVal){
jQuery('.arlo-event-listitem.' +jQuery(showDayVal).attr('id')+'.'+jQuery(showFreqVal).attr('id')+'.'+jQuery(showVenueVal).attr('id')+'.'+jQuery(showLocationVenueVal).attr('id')).show();
});
});
});
});
}
else if(showFreq.length && showVenue.length && showLocation.length && showCategory.length){//2345
showFreq.each(function(index1,showFreqVal){
showVenue.each(function(index2,showVenueVal){
showLocation.each(function(index3,showLocationVal){
showCategory.each(function(index4,showCategoryVal){
jQuery('.arlo-event-listitem.' +jQuery(showFreqVal).attr('id')+'.'+jQuery(showVenueVal).attr('id')+'.'+jQuery(showLocationVal).attr('id')+'.'+jQuery(showCategoryVal).attr('id')).show();
});
});
});
});
}
else if(showDay.length && showFreq.length && showVenue.length){//123
showDay.each(function(index1,showDayVal){
showFreq.each(function(index2,showFreqVal){
showVenue.each(function(index3,showVenueVal){
jQuery('.arlo-event-listitem.' +jQuery(showDayVal).attr('id')+'.'+jQuery(showFreqVal).attr('id')+'.'+jQuery(showVenueVal).attr('id')).show();
});
});
});
}
else if(showDay.length && showFreq.length && showLocation.length){//124
showDay.each(function(index1,showDayVal){
showFreq.each(function(index2,showFreqVal){
showLocation.each(function(index3,showLocationVal){
jQuery('.arlo-event-listitem.' +jQuery(showDayVal).attr('id')+'.'+jQuery(showFreqVal).attr('id')+'.'+jQuery(showLocationVal).attr('id')).show();
});
});
});
}
else if(showDay.length && showFreq.length && showCategory.length){//125
showDay.each(function(index1,showDayVal){
showFreq.each(function(index2,showFreqVal){
showCategory.each(function(index3,showCategoryVal){
jQuery('.arlo-event-listitem.' +jQuery(showDayVal).attr('id')+'.'+jQuery(showFreqVal).attr('id')+'.'+jQuery(showCategoryVal).attr('id')).show();
});
});
});
}
else if(showDay.length && showVenue.length && showLocation.length){//134
showDay.each(function(index1,showDayVal){
showVenue.each(function(index2,showVenueVal){
showLocation.each(function(index3,showLocationVal){
jQuery('.arlo-event-listitem.' +jQuery(showDayVal).attr('id')+'.'+jQuery(showVenueVal).attr('id')+'.'+jQuery(showLocationVal).attr('id')).show();
});
});
});
}
else if(showDay.length && showVenue.length && showCategory.length){//135
showDay.each(function(index1,showDayVal){
showVenue.each(function(index2,showVenueVal){
showCategory.each(function(index3,showCategoryVal){
jQuery('.arlo-event-listitem.' +jQuery(showDayVal).attr('id')+'.'+jQuery(showVenueVal).attr('id')+'.'+jQuery(showCategoryVal).attr('id')).show();
});
});
});
}
else if(showDay.length && showLocation.length && showCategory.length){//145
showDay.each(function(index1,showDayVal){
showLocation.each(function(index2,showLocationVal){
showCategory.each(function(index3,showCategoryVal){
jQuery('.arlo-event-listitem.' +jQuery(showDayVal).attr('id')+'.'+jQuery(showLocationVal).attr('id')+'.'+jQuery(showCategoryVal).attr('id')).show();
});
});
});
}
else if(showFreq.length && showVenue.length && showLocation.length){//234
showFreq.each(function(index1,showFreqVal){
showVenue.each(function(index2,showVenueVal){
showLocation.each(function(index3,showLocationVal){
jQuery('.arlo-event-listitem.' +jQuery(showFreqVal).attr('id')+'.'+jQuery(showVenueVal).attr('id')+'.'+jQuery(showLocationVal).attr('id')).show();
});
});
});
}
else if(showFreq.length && showVenue.length && showCategory.length){//235
showFreq.each(function(index1,showFreqVal){
showVenue.each(function(index2,showVenueVal){
showCategory.each(function(index3,showCategoryVal){
jQuery('.arlo-event-listitem.' +jQuery(showFreqVal).attr('id')+'.'+jQuery(showVenueVal).attr('id')+'.'+jQuery(showCategoryVal).attr('id')).show();
});
});
});
}
else if(showVenue.length && showLocation.length && showCategory.length){//345
showVenue.each(function(index1,showVenueVal){
showLocation.each(function(index2,showLocationVal){
showCategory.each(function(index3,showCategoryVal){
jQuery('.arlo-event-listitem.' +jQuery(showFreqVal).attr('id')+'.'+jQuery(showVenueVal).attr('id')+'.'+jQuery(showCategoryVal).attr('id')).show();
});
});
});
}
else if(showDay.length && showFreq.length){ //12
showDay.each(function(index1,showDayVal){
showFreq.each(function(index2,showFreqVal){
jQuery('.arlo-event-listitem.' +jQuery(showDayVal).attr('id')+'.'+jQuery(showFreqVal).attr('id')).show();
});
});
}
else if(showDay.length && showVenue.length){ //13
showDay.each(function(index1,showDayVal){
showVenue.each(function(index2,showVenueVal){
jQuery('.arlo-event-listitem.' +jQuery(showDayVal).attr('id')+'.'+jQuery(showVenueVal).attr('id')).show();
});
});
}
else if(showDay.length && showLocation.length){ //14
showDay.each(function(index1,showDayVal){
showLocation.each(function(index2,showLocationVal){
jQuery('.arlo-event-listitem.' +jQuery(showDayVal).attr('id')+'.'+jQuery(showLocationVal).attr('id')).show();
});
});
}
else if(showDay.length && showCategory.length){ //15
showDay.each(function(index1,showDayVal){
showCategory.each(function(index2,showCategoryVal){
jQuery('.arlo-event-listitem.' +jQuery(showDayVal).attr('id')+'.'+jQuery(showCategoryVal).attr('id')).show();
});
});
}
else if(showFreq.length && showVenue.length){ //23
showFreq.each(function(index1,showFreqVal){
showVenue.each(function(index2,showVenueVal){
jQuery('.arlo-event-listitem.' +jQuery(showFreqVal).attr('id')+'.'+jQuery(showVenueVal).attr('id')).show();
});
});
}
else if(showFreq.length && showLocation.length){ //24
showFreq.each(function(index1,showFreqVal){
showLocation.each(function(index2,showLocationVal){
jQuery('.arlo-event-listitem.' +jQuery(showFreqVal).attr('id')+'.'+jQuery(showLocationVal).attr('id')).show();
});
});
}
else if(showFreq.length && showCategory.length){ //25
showFreq.each(function(index1,showFreqVal){
showCategory.each(function(index2,showCategoryVal){
jQuery('.arlo-event-listitem.' +jQuery(showFreqVal).attr('id')+'.'+jQuery(showCategoryVal).attr('id')).show();
});
});
}
else if(showVenue.length && showLocation.length){ //34
showVenue.each(function(index1,showVenueVal){
showLocation.each(function(index2,showLocationVal){
jQuery('.arlo-event-listitem.' +jQuery(showVenueVal).attr('id')+'.'+jQuery(showLocationVal).attr('id')).show();
});
});
}
else if(showVenue.length && showCategory.length){ //35
showVenue.each(function(index1,showVenueVal){
showCategory.each(function(index2,showCategoryVal){
jQuery('.arlo-event-listitem.' +jQuery(showVenueVal).attr('id')+'.'+jQuery(showCategoryVal).attr('id')).show();
});
});
}
else if(showLocation.length && showCategory.length){ //45
showLocation.each(function(index1,showLocationVal){
showCategory.each(function(index2,showCategoryVal){
jQuery('.arlo-event-listitem.' +jQuery(showLocationVal).attr('id')+'.'+jQuery(showCategoryVal).attr('id')).show();
});
});
}
else if(showDay.length){ //1
showDay.each(function(index1,showDayVal){
jQuery('.arlo-event-listitem.' +jQuery(showDayVal).attr('id')).show();
});
}
else if(showFreq.length){ //2
showFreq.each(function(index1,showFreqVal){
console.log(jQuery(showFreqVal).attr('id'));
jQuery('.arlo-event-listitem.' +jQuery(showFreqVal).attr('id')).show();
});
}
else if(showVenue.length){ //3
showVenue.each(function(index1,showVenueVal){
jQuery('.arlo-event-listitem.' +jQuery(showVenueVal).attr('id')).show();
});
}
else if(showLocation.length){ //4
showLocation.each(function(index1,showLocationVal){
jQuery('.arlo-event-listitem.' +jQuery(showLocationVal).attr('id')).show();
});
}
else if(showCategory.length){ //5
showCategory.each(function(index1,showCategoryVal){
jQuery('.arlo-event-listitem.' +jQuery(showCategoryVal).attr('id')).show();
});
}
//start andre code
var upcomingEventsElement = document.getElementById("upcoming-events");
upcomingEventsElement.style.opacity = 0;
setTimeout(function() {
const existingMessageElement = document.querySelector('.noResultsMessage');
if (existingMessageElement) {
existingMessageElement.remove();
}
const categories = document.querySelectorAll('.arlo-event-category');
categories.forEach(category => {
category.classList.remove('active');
category.style.display = 'block';
});
categories.forEach(category => {
const eventItems = category.querySelectorAll('.arlo-event-listitem');
const hasVisibleEvent = Array.from(eventItems).some(item => {
return getComputedStyle(item).display !== 'none';
});
if (hasVisibleEvent) {
category.classList.add('active');
} else {
category.classList.remove('active');
}
if (hasVisibleEvent) {
category.style.display = 'block';
} else {
category.style.display = 'none';
}
});
var checkbox = document.getElementById("showhideOpeningCourses");
if (checkbox.checked) {
$('a.arlo-waiting-list').closest('li').hide();
}
if (!existingMessageElement) {
const categoryElements = document.querySelectorAll('.arlo-event-category');
let allHidden = false;
categoryElements.forEach(element => {
const computedStyle = getComputedStyle(element);
if (computedStyle.display !== 'none') {
allHidden = false;
return;
}
});
const eventListElement = document.querySelector('.arlo-event-list');
const messageElement = document.createElement('div');
messageElement.textContent = "No classes match your search. Try adjusting the filters";
messageElement.className = "noResultsMessage";
if (allHidden) {
eventListElement.insertAdjacentElement('afterend', messageElement);
}
}
setTimeout(function() {
categories.forEach(category => {
const eventItems = category.querySelectorAll('.arlo-event-listitem');
const hasVisibleEvent = Array.from(eventItems).some(item => {
return getComputedStyle(item).display !== 'none';
});
if (hasVisibleEvent) {
category.classList.add('active');
} else {
category.classList.remove('active');
}
if (hasVisibleEvent) {
category.style.display = 'block';
} else {
category.style.display = 'none';
}
});
}, 100);
upcomingEventsElement.style.opacity = 100;
}, 300);
//end andre code
});
})(jQuery);
/*All tabs open by default*/
let checkInterval;
function updateCategories() {
let allItemsActive = true;
const $categories = $('.arlo-event-category');
// Check if there are no categories
if ($categories.length === 0) {
allItemsActive = false;
} else {
console.log('Function triggered');
// Loop through each category and perform updates
$categories.each(function() {
const $category = $(this);
const $items = $category.find('.arlo-event-listitem');
// Check if the category has visible events (hardcoded true for this example)
const hasVisibleEvent = true;
if (hasVisibleEvent) {
$category.addClass('active').show();
}
// Update items in the category
$items.each(function() {
if (!$(this).hasClass('active')) {
$(this).addClass('active');
allItemsActive = false; // Found an event item without active class
}
});
console.log('Class added to category and its items');
});
}
// If all items are active, clear the interval
if (allItemsActive && checkInterval) {
clearInterval(checkInterval);
checkInterval = null; // Reset the interval ID
}
}
// Initialize the interval when the document is ready
jQuery(document).ready(function() {
checkInterval = setInterval(updateCategories, 500);
});
jQuery(window).on('load', function() {
updateCategories();
});