PageSourceSearch

https://cittadinanzattiva.it/templates/frontend/js/logic.js?v=1790912314

js cittadinanzattiva.it collected 2026-10-02 03:38:56 UTC 14,524 bytes, 402 lines download raw bytes

1jQuery(document).ready(function ($) {
2
3    //Menu Hamburger
4    jQuery('#hamburger').on('click', function () {
5        if (jQuery(this).hasClass('opened')) {
6            jQuery(this).removeClass('opened');
7            jQuery('#menu-top').animate({
8                right: '-100%'
9            });
10        } else {
11            jQuery(this).addClass('opened');
12            jQuery('#menu-top').animate({
13                right: 0
14            }, 700);
15        }
16    });
17    //Sottomenu
18    jQuery('body').on('click', '#menu-top li.deeper.parent > span', function () {
19        sottoMenu = jQuery(this).next('ul.nav-child');
20        if (sottoMenu.hasClass('opened')) {
21            sottoMenu.removeClass('opened').slideUp();
22        } else {
23            //Chiude solo i padri
24            if (jQuery(this).parents('ul').length == 1) {
25                jQuery('#menu-top ul.nav.menu > li.deeper.parent > ul.nav-child').removeClass('opened').slideUp();
26            }
27            sottoMenu.addClass('opened').slideDown();
28        }
29    });
30
31    jQuery('#chiudi-menu').on('click', function () {
32        jQuery('#hamburger').removeClass('opened');
33        jQuery('#menu-top').animate({
34            right: '-100%'
35        }, 600);
36    });
37
38    //link pagina media
39    jQuery(".media-blocco-contenitore .media-blocco h3").each(function () {
40        var linkH3 = jQuery(this).text().replace(/\s+/g, '-').toLowerCase();
41        jQuery(this).wrap("<a href='" + linkH3 + ".html'></a>").prepend('<i class=\"fas fa-link\"></i>');
42
43    });
44
45    //Gestione voci active
46    jQuery('#menu-top li.current').parents('ul').addClass('opened').show();
47
48    //Icone menu social
49    jQuery('body').find('ul.nav.mod-menu li.item-112 a').html('<span class="fab fa-facebook-square"></span>');
50    jQuery('body').find('ul.nav.mod-menu li.item-114 a').html('<span class="fa-brands fa-square-x-twitter"></span>');
51    jQuery('body').find('ul.nav.mod-menu li.item-115 a').html('<span class="fab fa-linkedin"></span>');
52    jQuery('body').find('ul.nav.mod-menu li.item-116 a').html('<span class="fab fa-instagram-square"></span>');
53    jQuery('body').find('ul.nav.mod-menu li.item-117 a').html('<span class="fab fa-youtube-square"></span>');
54    jQuery('body').find('ul.nav.mod-menu li.item-118 a').html('<span class="fab fa-flickr"></span>');
55    jQuery('body').find('ul.nav.mod-menu li.item-113 a').html('<span class="fas fa-envelope-square"></span>');
56    jQuery('body').find('ul.nav.mod-menu li.item-619 a').html('<span class="fa-brands fa-spotify"></span>');
57
58    //Lightslider
59    jQuery('.slider-contenitore .slider .articoli').lightSlider({
60        adaptiveHeight: true,
61        item: 1,
62        slideMargin: 0,
63        loop: true,
64        auto: true,
65        controls: false,
66        pauseOnHover: true,
67        pause: 3500,
68        speed: 1000,
69        pager: true
70    });
71
72    //Lightslider
73
74    var sliderPrimoPiano = jQuery('.primo-piano-contenitore .primo-piano .articoli').lightSlider({
75        adaptiveHeight: false,
76        item: 3,
77        slideMargin: 70,
78        loop: true,
79        auto: true,
80        controls: false,
81        pauseOnHover: true,
82        pause: 3500,
83        speed: 1000,
84        pager: false,
85        responsive: [
86            {
87                breakpoint: 960,
88                settings: {
89                    item: 2,
90                    slideMargin: 50,
91                }
92            },
93            {
94                breakpoint: 640,
95                settings: {
96                    item: 1,
97                    slideMargin: 30,
98                }
99            },
100        ]
101    });
102
103    jQuery('.primo-piano-contenitore .primo-piano #goToPrevSlidePP').on('click', function () {
104        sliderPrimoPiano.goToPrevSlide();
105    });
106
107    jQuery('.primo-piano-contenitore .primo-piano #goToNextSlidePP').on('click', function () {
108        sliderPrimoPiano.goToNextSlide();
109    });
110
111    // Menu cosa facciamo
112
113    var sliderMenuCosaFacciamo = jQuery('.cosa-facciamo-link-contenitore .cosa-facciamo-link .articoli').lightSlider({
114        adaptiveHeight: true,
115        item: 3,
116        slideMargin: 70,
117        loop: true,
118        auto: true,
119        controls: false,
120        pauseOnHover: true,
121        pause: 3500,
122        speed: 1000,
123        pager: false,
124        responsive: [
125            {
126                breakpoint: 960,
127                settings: {
128                    item: 2,
129                    slideMargin: 50,
130                }
131            },
132            {
133                breakpoint: 640,
134                settings: {
135                    item: 1,
136                    slideMargin: 30,
137                }
138            },
139        ]
140    });
141
142    jQuery('.cosa-facciamo-link-contenitore .cosa-facciamo-link  #goToPrevSlideMCF').on('click', function () {
143        sliderMenuCosaFacciamo.goToPrevSlide();
144    });
145
146    jQuery('.cosa-facciamo-link-contenitore .cosa-facciamo-link  #goToNextSlideMCF').on('click', function () {
147        sliderMenuCosaFacciamo.goToNextSlide();
148    });
149
150    /* GALLERY COSA FACCIAMO PAGINA */
151
152    jQuery('.cosa-facciamo-pagina-contenitore .cosa-facciamo-pagina .articoli .articolo .slider-cf-pagina-contenitore .slider-cf-pagina').lightSlider({
153        adaptiveHeight: true,
154        item: 1,
155        slideMargin: 2,
156        loop: true,
157        auto: false,
158        controls: false,
159        pauseOnHover: true,
160        pause: 3500,
161        speed: 1000,
162        pager: true
163    });
164
165    /* MEDIA */
166
167    jQuery('.media-blocco-contenitore .media-blocco .articoli').lightSlider({
168        adaptiveHeight: true,
169        item: 1,
170        slideMargin: 2,
171        loop: true,
172        auto: false,
173        controls: false,
174        pauseOnHover: true,
175        pause: 3500,
176        speed: 1000,
177        pager: true,
178        responsive: [
179            {
180                breakpoint: 960,
181                settings: {
182                    item: 1,
183                    slideMargin: 10,
184                }
185            }
186        ]
187    });
188    /* ASSEGNA LA CLASSE active alle voci principlai di menu*/
189    jQuery('ul.mod-menu__sub li.active').closest('li.deeper.parent').addClass('active');
190    jQuery('ul.mod-menu__sub li.alias-parent-active').closest('li.deeper.parent').addClass('active');
191
192    /*Assegna i background ai tag nella pagina LE VOCI DELLA CITTADINANZA*/
193
194    var imgColours = ['#569fd5', '#d55470', '#959b37', '#7b3585', '#bd6628', '#eaa521', '#d55470', '#e41e26'];
195
196// V3 : sequential colors
197    var $imgs = jQuery('.contenuti-contenitore .contenuti ul.com-tags__category').find('li'),
198        imgsCount = $imgs.length,
199        coloursCount = imgColours.length;
200
201    for (var i = 0; i < imgsCount; i++) {
202        var color = imgColours[i % coloursCount];
203        $imgs.eq(i).css({backgroundColor: color});
204    }
205
206    //Fix immagine singolo articolo (solo la prima immagine nell'articolo di 800x450)
207    if (jQuery('body').hasClass('article')) {
208
209        if (jQuery('figure.left.item-image').length == 0) {
210
211            let firstImage = jQuery('.contenuti-contenitore .contenuti .com-content-article .com-content-article__body').find('img:first');
212            let imgW = parseInt(firstImage.width());
213            let imgH = parseInt(firstImage.height());
214
215            if (imgW === 800 && imgH === 450) {
216
217                let imgSrc = firstImage.prop('src');
218
219                firstImage.remove();
220                jQuery('ul.tags.list-inline').after(`
221				<figure class="left item-image">
222					<img src="` + imgSrc + `" itemprop="image">
223				</figure>
224			`);
225            }
226        }
227    }
228
229    //Fix immagine articolo in categoria blog (solo la prima immagine nell'articolo di 800x450)
230    if (jQuery('body').hasClass('category')) {
231
232        jQuery('.com-content-category-blog__item').each(function () {
233            let articolo = jQuery(this);
234            if (articolo.find('figure.left.item-image').length == 0) {
235
236                let firstImage = articolo.find('img:first');
237                if (firstImage.length > 0) {
238                    // let imgW = parseInt(firstImage.width());
239                    // let imgH = parseInt(firstImage.height());
240
241                    //if (imgW === 800 && imgH === 450) {
242                    let imgSrc = firstImage.prop('src');
243                    console.log(imgSrc);
244                    firstImage.remove();
245                    jQuery(this).prepend(`
246                        <figure class="left item-image">
247                            <img src="` + imgSrc + `" itemprop="image">
248                        </figure>
249                    `);
250                }
251                // }
252            }
253
254        });
255    }
256
257    if (jQuery('body').hasClass('article')) {
258        let src = jQuery('.com-content-article.item-page figure img').attr('src');
259        console.log(src);
260        jQuery('.com-content-article__body').find('img[src$="' + src + '"]').remove();
261    }
262
263    //Carica altri articoli stesso TAG
264    jQuery('body').on('click', '#carica-altri-tag', function () {
265        elemento = jQuery(this);
266        parametri = elemento.data();
267        // console.log(parametri);
268
269        jQuery.ajax(
270            {
271                url: '/templates/frontend/php/ajax/carica-tag-lista-articoli.php',
272                type: 'post',
273                dataType: 'json',
274                data: {
275                    parametri: parametri
276                },
277                success: function (resp) {
278                    // console.log(resp);
279                    jQuery('.tag-lista-articoli').append(resp.articoli);
280
281                    if (resp.num_articoli < parametri.step) {
282                        elemento.remove();
283                    } else {
284                        elemento.data('min', parametri.min + parametri.step);
285                    }
286                }
287            }
288        );
289    });
290
291    //Eliminazione TAG RETI dai TAG più popolari (.mod-tagspopular.tagspopular > ul > li > a)
292    //MAX 8 TAG, quindi eliminare l'eccedenza
293    //Ricalcolo colori tags
294    jQuery('.mod-tagspopular.tagspopular > ul > li > a').each(function () {
295        // console.log(jQuery(this).text().toLowerCase().trim());
296        if (
297            jQuery(this).text().toLowerCase().trim() === 'scuola'
298            || jQuery(this).text().toLowerCase().trim() === 'salute'
299            || jQuery(this).text().toLowerCase().trim() === 'consumatori'
300            || jQuery(this).text().toLowerCase().trim() === 'giustizia'
301            || jQuery(this).text().toLowerCase().trim() === 'europa'
302            || jQuery(this).text().toLowerCase().trim() === 'attivismo civico'
303        ) {
304            jQuery(this).parent('li').remove();
305        }
306    }).promise().done(function () {
307
308        tags = jQuery('.mod-tagspopular.tagspopular > ul > li').slice(0, 8);
309        jQuery('.mod-tagspopular.tagspopular > ul > li').remove();
310        jQuery('.mod-tagspopular.tagspopular > ul').append(tags);
311
312        var imgColours = ['#569fd5', '#d55470', '#959b37', '#7b3585', '#bd6628', '#eaa521', '#d55470', '#e41e26'];
313
314        /*Assegna i background ai tag nella pagina home */
315        var $imgs = jQuery('.trending-topic-contenitore .trending-topic-tag ul').find('li'),
316            imgsCount = $imgs.length,
317            coloursCount = imgColours.length;
318
319        for (var i = 0; i < imgsCount; i++) {
320            var color = imgColours[i % coloursCount];
321            $imgs.eq(i).css({backgroundColor: color});
322        }
323    });
324
325    //Fix link per filtro categoria su articoli per tag
326    console.log(window.location.pathname);
327    let currUrl = window.location.pathname;
328    let catIdClass = window.location.search.replace('?', '').replace('=', '-');
329
330    if (currUrl.indexOf('/le-voci-della-cittadinanza/') !== -1) {
331
332        jQuery('.trending-topic-contenitore .trending-topic ul.mod-menu > li > a').each(function () {
333            let catId = jQuery(this).prop('href').replace(window.location.protocol + '//', '').replace(window.location.host, '').replace('/', '');
334            newHref = currUrl + '?catid=' + catId;
335
336            jQuery(this).prop('href', newHref);
337        });
338
339        if (catIdClass == '' || catIdClass == 'catid-0') {
340            jQuery('.trending-topic-contenitore .trending-topic ul.mod-menu > li > a[class="^catid-"]').each(function () {
341                jQuery(this).removeClass('attivo');
342            }).promise().done(function () {
343                jQuery('.trending-topic-contenitore .trending-topic ul.mod-menu > li > a.tutto').addClass('attivo');
344            });
345        } else {
346            jQuery('.trending-topic-contenitore .trending-topic ul.mod-menu > li > a.tutto').removeClass('attivo');
347            jQuery('.trending-topic-contenitore .trending-topic ul.mod-menu > li > a.' + catIdClass).addClass('attivo');
348        }
349
350    }
351
352    //LE NOSTRE RETI - LEGGI TUTTO
353
354    jQuery('body').on('click', '.le-nostre-reti-contenitore .le-nostre-reti .articoli .articolo .leggi-tutto', function () {
355
356        if (jQuery(this).hasClass('aperto')) {
357            jQuery(this).html('<i class="fas fa-chevron-down"></i>Continua').removeClass('aperto');
358        } else {
359            jQuery(this).html('<i class="fas fa-chevron-up"></i>Chiudi').addClass('aperto');
360        }
361        jQuery(this).prev('.testo-completo').slideToggle('slow');
362
363    });
364
365
366    //CREAZIONE LINK LINGUA INGLESE
367    linkInglese = jQuery('.fields-container .field-entry.link-pagina-inglese .field-value').text();
368    jQuery('.fields-container .field-entry.link-pagina-inglese .field-value').html('Consulta  la <a href="' + linkInglese + '" target="_blank">versione in inglese</a>');
369
370
371
372
373// AGGIUNGI CLASSE ALL'ARCHIVIO P CON IFRAME
374    jQuery('.contenuti-contenitore .contenuti .com-content-category-blog .blog-items .blog-item .item-content')
375        .find('p').children('iframe').parent().addClass('video');
376
377
378
379    // SISTEMA ACCORDION
380    jQuery(".contenuti-accordion > li > span").click(function(e) {
381        // Prevenire la propagazione del click (nel caso ci siano elementi nidificati)
382        e.stopPropagation();
383
384        // Seleziona il <li> contenitore dello span cliccato
385        var parentLi = jQuery(this).parent();
386
387        // Chiude tutti gli altri <ul> aperti all'interno di .contenuti-accordion
388        jQuery(".contenuti-accordion > li > ul").not(parentLi.children("ul")).slideUp();
389
390        // Rimuove la classe active dagli altri <li>
391        jQuery(".contenuti-accordion > li").not(parentLi).removeClass("active");
392
393        // Alterna la visibilità del <ul> relativo e aggiunge/rimuove la classe active
394        parentLi.children("ul").slideToggle();
395        parentLi.toggleClass("active");
396    });
397
398
399
400
401
402});

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.