Upcoming Writing Courses

Filters

Time of the Day
Frequency
Categories
Location
Venue
' ); const ul = $('
    '); const thead = '
    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'); $( "#LOC_" + locationName).prop( "checked", false ); $( "#LOC_" + locationName).trigger('click'); function filterEventsByCategory(categoryName) { // Get all elements with the class "arlo-event-category" const eventCategoryElements = document.querySelectorAll('.arlo-event-category'); // Loop through each element eventCategoryElements.forEach((element) => { // Find the category name within the element const categoryElement = element.querySelector('.arlo-category-name strong'); if (categoryElement) { const elementCategoryName = categoryElement.textContent; // Check if the category name matches the provided categoryName if (elementCategoryName !== categoryName) { // Hide the element if it doesn't match element.style.display = 'none'; } else { // Show the element if it matches element.style.display = 'block'; if (!element.classList.contains('active')) { element.classList.add('active'); } } } }); } $(".arlo-event-list").hide(); setTimeout(function() { filterEventsByCategory(categoryName); // Find all elements with class "arlo-event-category" that are not display none const categoryElements = document.querySelectorAll('.arlo-event-category:not([style*="display: none"])'); // Loop through each category element categoryElements.forEach(categoryElement => { // Find all child elements with class "arlo-event-listitem" that are not display none const listItems = categoryElement.querySelectorAll('.arlo-event-listitem:not([style*="display: none"])'); // Hide any child elements after the 6th one for (let i = 6; i 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 = true; 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);