1/* advanced search */ 2(function($){ 3 $(function(){ 4 5 /* wrap facet filter blocks */ 6 // when a facet block has the class 'theodor-disable-custom-facet-js' it is excluded 7 var facet_checkboxes = $('.route-view-facets-facetsearch .block-facet--checkbox:not(.theodor-disable-custom-facet-js)'); 8 if (facet_checkboxes.length === 0) return; 9 10 var user_logged_in = false; 11 if ( drupalSettings.user.uid !== 0 ) 12 user_logged_in = true; 13 14 15 facet_checkboxes.wrapAll('<div id="wrap-facets">'); 16 var facets_wrap = $('.route-view-facets-facetsearch #wrap-facets'); 17 //facet_checkboxes.slideUp(0); //show facets by default, see https://gitlab.palasthotel.de/palasthotel/boell-antifeminismus-begegnen/-/issues/87#note_408599 18 19 20 21 /* hide empty facet sections */ 22 23 var empties = jQuery('.route-view-facets-facetsearch .facet-empty'); 24 if ( empties.length > 0 ) { 25 empties.each(function(){ 26 jQuery(this).parent().hide(); 27 }); 28 } 29 30 /* build filter navi */ 31 facets_wrap.prepend('<div id="facet-filter-list"></div>'); 32 facets_wrap.append('<div id="facet-active-list" class="empty"><span class="remove-filters" title="remove filters">x</span></div>'); 33 34 $('.route-view-facets-facetsearch #facet-active-list').on('click', 'span.remove-filters', function(ev) { 35 ev.preventDefault(); 36 window.location.href = window.location.protocol + '//' + window.location.host + window.location.pathname; 37 }); 38 39 // hide facets checked inputs and build facet-active-list out of 'em 40 $('.route-view-facets-facetsearch input.facets-checkbox[checked="checked"]').each( function() { 41 id = $(this).attr('id'); 42 if ( id.indexOf('webseiten_zuordnung_des_termins') !== -1 ) { 43 $('#block-boellcalendar-page-title h1').append(' von'); 44 $(this).parent().clone(true, true).addClass('site-filter').insertAfter('#block-boellcalendar-page-title h1'); 45 $(this).parent().addClass('hidden').hide(); 46 } 47 else { 48 $(this).parent().clone().appendTo('#facet-active-list'); 49 50 } 51 52 }); 53 if ( $('.route-view-facets-facetsearch #facet-active-list li.facet-item').length !== 0 ) 54 $('.route-view-facets-facetsearch #facet-active-list').removeClass('empty'); 55 56 facet_checkboxes.each(function(index,Element){ 57 id = $(this).attr('id'); 58 title = $(this).find('h2').first().text(); 59 button = $('<button data-target="'+id+'">' + title + '</button>'); 60 if ( $('#' + id + ' .facet-empty').length > 0 ) 61 button.hide();//button.attr( 'disabled', true ); 62 63 visibleBoxes = $('#' + id + ' li.facet-item').not('.hidden'); 64 65 if ( visibleBoxes.length === 0 ) 66 button.attr( 'disabled', true ); 67 68 69 button.click(function(){ 70 $('.route-view-facets-facetsearch #wrap-facets button').not($(this)).removeClass('active'); 71 $(this).toggleClass('active'); 72 id = $(this).data('target'); 73 $('.route-view-facets-facetsearch .block-facet--checkbox').not('#' + id).removeClass('open').hide(); 74 $( '#' + id ).toggle().toggleClass('open'); 75 76 77 }); 78 79 if ( id != 'block-webseitenzuordnungdestermins' ) 80 $('.route-view-facets-facetsearch #facet-filter-list').append(button); 81 else if ( user_logged_in === true ) 82 $('.route-view-facets-facetsearch #facet-filter-list').append(button); 83 84 }); 85 86 87 88 }); 89})(jQuery); 90 91 92(function($, Drupal){ 93 94 $(document).ready(function() { 95 96 $('.block-facet--dropdown').each(function(index, Element){ 97 heading = $(this).find('h2'); 98 newoption = heading.text(); 99 $(heading).hide(); 100 101 $(this).find('.facets-dropdown.js-facets-dropdown option[selected="selected"]').text(newoption); 102 }); 103 104 $('.block-facet--checkbox h2').click(function(ev){ 105 $(this).parent().find('.item-list__checkbox').toggleClass( 'open'); 106 }); 107 108 //$('.block-facet--checkbox').each(function(index,element){
109 // $(this).find('.facets-widget-checkbox').slideUp(0); 110 //}); 111 }); 112 113})(jQuery, Drupal);
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.