1 2/* Generic Javascript theme file */ 3 4const ajaxurl = '/wordpress/wp-admin/admin-ajax.php'; 5var _Home_script = false; 6var _Narrativa_script = false; 7 8jQuery(document).ready(function($) { 9 10 /* Gestione click su item widget Novità della settimana */ 11 12 /* Gestione filtri widget Novità della settimana */ 13 14 $(".week-news .filter .filter-panel .label").on('click', (e) => { 15 e.preventDefault(); 16 17 $(".week-news .filter-panel .label").removeClass('active'); 18 let cat = $(e.currentTarget).addClass('active').data('category'); 19 20 jQuery(".week-news .item-card").hide(); 21 22 if (typeof cat !== 'undefined') { 23 24 jQuery(".week-news .item-card").each(function() { 25 if( $( this ).data('category').includes(` ${cat} `)) { 26 $( this ).show(); 27 } 28 }); 29 30 } else { 31 jQuery(".week-news .item-card").show(); 32 } 33 34 }); 35 36 37 /* Gestione filtri widget Articoli in primo piano */ 38 39 $(".articles-list .tags-wrapper .label").on('click', (e) => { 40 e.preventDefault(); 41 42 if ( $(e.target).data('external')) { 43 window.location.href = $(e.target).data('external'); 44 } else { 45 $(".articles-list .filter-panel .label").removeClass('active'); 46 let cat = $(e.currentTarget).addClass('active').data('category'); 47 48 jQuery(".articles-list .item-card").hide(); 49 50 if (typeof cat !== 'undefined') { 51 52 jQuery(".articles-list .item-card").each(function() { 53 if( $( this ).data('category').includes(cat)) 54 $( this ).show(); 55 }); 56 57 } else { 58 59 jQuery(".articles-list .item-card").show(); 60 } 61 } 62 63 }); 64 65 66 /* Gestione filtri widget Eventi */ 67 68 $(".events-row .filter .filter-panel .label").on('click', (e) => { 69 e.preventDefault(); 70 71 $(".events-row .filter-panel .label").removeClass('active'); 72 let cat = $(e.currentTarget).addClass('active').data('category'); 73 74 jQuery(".events-row .swiper-slide").hide(); 75 76 if (typeof cat !== 'undefined') { 77 78 jQuery(".events-row .swiper-slide").each(function() { 79 if( $( this ).data('category').includes(` ${cat} `)) { 80 $( this ).show(); 81 } 82 }); 83 84 } else { 85 jQuery(".events-row .swiper-slide").show(); 86 } 87 88 }); 89 90 /* Gestione filtri widget Ricerca ragazzi */ 91 92 //valori di base 93 $("#ricerca-ragazzi-search-button").attr("href", window.location.origin+"/cerca/?_s&type=sw_book&_categories=ragazzi&_sort=publish_date_desc"); 94 $("#ricerca-ragazzi-search-icon").unbind('click'); 95 $("#ricerca-ragazzi-search-icon").click(function() { 96 location.href = window.location.origin+"/cerca/?_s&type=sw_book&_categories=ragazzi&_sort=publish_date_desc"; 97 }); 98 99 var ricerca_ragazzi_accordions = document.querySelectorAll(".ricerca-ragazzi-accordion"); 100 ricerca_ragazzi_accordions.forEach(function (accordion) { 101 var accordionNavbar = accordion.querySelector(".accordion-navbar"); 102 accordionNavbar.addEventListener("click", function () { 103 var panel = accordion.querySelector(".panel"); 104 if(panel.style.maxHeight) // reimpostiamo il maxHeight del pannello delle opzioni 105 panel.style.maxHeight = "320px"; 106 }) 107 108 }) 109 110 $(".ricerca-ragazzi-eta-span, .ricerca-ragazzi-tema-span").on('click', (e) => { 111 e.preventDefault(); 112 var elem = $(e.currentTarget); 113 let tass; 114 if( typeof elem.data('eta') !== 'undefined' ) 115 tass = "eta"; 116 else if( typeof elem.data('tema') !== 'undefined' ) 117 tass = "tema"; 118 119 $(".ricerca-ragazzi-"+tass+"-span").removeClass('active'); 120 elem.addClass('active'); 121 122 var opt_slug = elem.data(tass); 123 opt_text = ( opt_slug == 'all' ) ? "" : (": "+elem.text()); 124 125 $("#ricerca-ragazzi-"+tass+"-display").text(opt_text); 126 $( "#ricerca-ragazzi-"+tass+"-header" ).trigger('click'); 127 128 var target_url = window.location.origin+"/cerca/?_s&type=sw_book&_categories=ragazzi&_sort=publish_date_desc"; 129 130 var selected_eta = $(".ricerca-ragazzi-eta-span.active").data("eta"); 131 if(selected_eta != "all") 132 target_url += ("&_eta="+selected_eta); 133 134 var selected_tema = $(".ricerca-ragazzi-tema-span.active").data("tema"); 135 if(selected_tema != "all") 136 target_url += ("&_tema="+selected_tema); 137 138 $("#ricerca-ragazzi-search-button").attr("href", target_url); 139 $("#ricerca-ragazzi-search-icon").unbind('click'); 140 $("#ricerca-ragazzi-search-icon").click(function() { 141 location.href = target_url; 142 }); 143 144 }); 145 146 /* Share */ 147 jQuery(".share .social-wrap a").click(function(e){ 148 149 e.preventDefault(); 150 151 var url = jQuery(this).data("attrHref"); 152 153 if(typeof url !=="undefined"){ 154 window.open(url, "fbShareWindow", "height=300,width=550,resizable=1"); 155 return false;
156 } 157 }); 158 159 jQuery(".search-toggle").click(()=>{ 160 jQuery("#search-s-input").focus() 161 }); 162 163 $("#calendar-panel-add, .calendar-panel-item").click(()=>{ 164 jQuery('.calendar-panel').toggle() 165 }); 166 167 // Gestione click su tag in vari punti 168 $(".item-info-wrap span.tag").on('click', (e) => { 169 e.preventDefault(); 170 window.location.href = $(e.target).data('href'); 171 }); 172 173}); 174
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.