1(function($){jQuery(document).ready(function(){console.log('JQuery for custom Dropdowns - Loaded OK!');CustomDropdown.init()});var CustomDropdown={init:function(){CustomDropdown.Handlers()},Handlers:function(){CustomDropdown.dropdown();CustomDropdown.select()},dropdown:function(){$('.custom_dropdown').on('click',function(ev){if($(this).find('.options').is(':visible')){$(this).removeClass('open');$(this).find('.options').slideUp()}else{$(this).find('.options').slideDown();$(this).addClass('open')} 2$(this).mouseleave(function(){$(this).removeClass('open');$(this).find('.options').slideUp()})})},select:function(){$('.custom_dropdown .options .option').on('click',function(ev){$(this).closest('.custom_dropdown').find('.main_value').attr('data-value',$(this).data('option')).text($(this).text());let classes=$(this).parent().parent().attr('class').split(/\s+/);if(classes.includes('countries-dropdown')){let country=$(this).data('option');let url=window.location.pathname.split('/');url.forEach(function(el,idx){if(el=='')url.splice(idx,1)});url.splice(-1,1);url=url.join('/');url='/'+url+'/'+country;window.location.href=url;return} 3if(classes.includes('language-dropdown')||classes.includes('petitions-language-dropdown')||classes.includes('news-language-dropdown')){return} 4let parent=$(this).closest('.custom_dropdown');if($(parent).hasClass('sector-category')){let topicFilter=$(parent).parent().find('.topic-category');$(topicFilter).find('.use-filter').each(function(idx,el){$(el).removeClass('use-filter')});var dropdown_title=$(topicFilter).attr("class").split(/\s+/)[1].split("-")[0];dropdown_title=dropdown_title[0].toUpperCase()+dropdown_title.substring(1);$(topicFilter).find('.main_value').attr('data-value','').text(dropdown_title+"s")}else if($(parent).hasClass('topic-category')){let sectorFilter=$(parent).parent().find('.sector-category');$(sectorFilter).find('.use-filter').each(function(idx,el){$(el).removeClass('use-filter')});var dropdown_title=$(sectorFilter).attr("class").split(/\s+/)[1].split("-")[0];dropdown_title=dropdown_title[0].toUpperCase()+dropdown_title.substring(1);$(sectorFilter).find('.main_value').attr('data-value','').text(dropdown_title+"s")} 5if($(this).data('option')=='all'&&!$(this).hasClass('use-filter')){$(this).parent().find('.use-filter').each(function(idx,el){$(el).removeClass('use-filter')});$(this).addClass('use-filter')}else{if($(this).hasClass('use-filter')){$(this).removeClass('use-filter')}else{$(this).parent().find('.option[data-option=all]').removeClass('use-filter');$(this).addClass('use-filter')}} 6if($(this).parent().find('.use-filter').length===0){var closest_dropdown=$(this).closest('.custom_dropdown');var dropdown_title=closest_dropdown.attr("class").split(/\s+/)[1].split("-")[0];dropdown_title=dropdown_title[0].toUpperCase()+dropdown_title.substring(1);closest_dropdown.find('.main_value').attr('data-value','').text(dropdown_title+"s")} 7var curFilters=[];$('.use-filter').each(function(idx,el){var type=$(this).parent().data('filter-type');var value=$(this).data('option');if(curFilters.length==0){curFilters.push({filterType:type,values:[value]})}else{curFilters.forEach(function(item,index){if(item.filterType==type){curFilters[index].values.push(value)}else{curFilters.push({filterType:type,values:[value]})}})}});CustomDropdown.ajax(curFilters)})},ajax:function($filters){$('.loading-wrapper').css('display','block');$.ajax({type:"GET",url:ajax_elements.ajaxurl,data:{action:'filter_publications',filters:$filters},beforeSend:function(res){console.log('Sending...')},success:function(res){$('.publications__articles').html(res);$('.loading-wrapper').css('display','none');if($filters.length>0){$('.pagination').hide()}else{$('.pagination').show()}}})}}})(jQuery)
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.