PageSourceSearch

https://www.piemonteopen.com/Areas/Federtennis/Scripts/frontend-min.js

js piemonteopen.com collected 2026-09-25 07:00:01 UTC 51,482 bytes, 1,141 lines download raw bytes

1// @codekit-append "main.js";
2
3(function ($) {
4    /* $ rappresenta la nostra versione di jQuery, abbiamo dichiarato la variabile nell'head dell'html, subito dopo l'inclusione di jQuery */
5
6    /* Variabili globali */
7    window.isMobile = false;
8
9    /* Funzioni Globali */
10    var responsiveResize = function () {
11        if (window.matchMedia("(max-width: 1023px)").matches) {
12            $('body')
13                .addClass('cc-mobile')
14                .removeClass('cc-desktop');
15            window.isMobile = true;
16        } else {
17            $('body')
18                .addClass('cc-desktop')
19                .removeClass('cc-mobile');
20            window.isMobile = false;
21        }
22
23        visualSliderMobile();
24
25        sponsorSlider();
26
27        initSectionPlayMobileSlider();
28
29        initPromoCorsoMobileSlider();
30
31        initCompetitionsMobileSlider();
32
33    };
34
35    var syncSearchBars = function () {
36        var dest;
37        var source;
38        if (window.matchMedia("(max-width: 1023px)").matches) {
39
40            dest = $(".cc-header-desktop").find("input[name=search-terms]");
41            source = $(".cc-header-mobile").find("input[name=search-terms]");
42        } else {
43            source = $(".cc-header-desktop").find("input[name=search-terms]");
44            dest = $(".cc-header-mobile").find("input[name=search-terms]");
45        }
46        dest.val(source.val());
47    }
48
49    var stringIsNotNullOrEmpty = function (value) {
50        return value != null && value != "" && typeof value != 'undefined';
51    };
52    //Set live class to the real live event
53    var setLiveEventClass = function (slidesContainer) {
54        var today = new Date().today();
55        var timeNow = new Date().timeNow();
56        var currentDateTime = Date.parse(today + " " + timeNow);
57
58        var timesAvailableElements = slidesContainer.find('.cc-front .cc-time');
59        var nearestPassedTimeElement = $("");
60        var liveTimeElement;
61        var isLast = false;
62        for (var i = 0; i < timesAvailableElements.length; i++) {
63            var specificEventTime = $(timesAvailableElements[i]).data('time');
64            var specificEventDateTime = Date.parse(today + " " + specificEventTime);
65
66            if (specificEventDateTime <= currentDateTime) {
67                nearestPassedTimeElement = $(timesAvailableElements[i]);
68
69            }
70            else {
71                nearestPassedTimeElement.closest('.cc-event').addClass('cc-live');
72                isLast = true;
73                break;
74            }
75        }
76        if (!isLast) {
77            nearestPassedTimeElement.closest('.cc-event').addClass('cc-live');
78        }
79    };
80
81    var refreshpickerSelect = function () {
82        $('.selectpicker').selectpicker('refresh');
83    };
84
85    var textareaAutoResize = function (textareaObject) {
86        var offset = textareaObject.prop('offsetHeight') - textareaObject.prop('clientHeight');
87        textareaObject.css('height', 'auto').css('height', textareaObject.prop('scrollHeight') + offset);
88    };
89    $(document).on("keyup change keydown paste cut", '.cc-textarea-autosize', function () {
90        textareaAutoResize($(this));
91    });
92
93    $(document).on("click", '.cc-comments-section .cc-col-text .cc-button-reply.cc-button-reply-active', function () {
94        $(this).removeClass('cc-button-reply-active');
95        $(this).closest('.cc-col-text').find('.cc-reply-area').slideToggle(200).find('.cc-textarea').focus();
96    });
97
98
99    var renderPickerSelect = function () {
100        $('.selectpicker').selectpicker('render');
101    };
102
103    /*use slick plugin to go to specific slide */
104    var slickGoToSlide = function (slidesContainer, classFocusElement) {
105        if (stringIsNotNullOrEmpty(classFocusElement)) {
106            var liveEvent = parseInt(slidesContainer.find(classFocusElement).parent().attr('data-slick-index'));
107            if (slidesContainer.length > 0) {
108                slidesContainer.slick('slickGoTo', liveEvent);
109            }
110        }
111    };
112
113    /* Header Search */
114    var searchButton = function () {
115        $('.cc-header .cc-main-header .cc-link-search').click(function () {
116            $('.cc-header .cc-main-header .cc-find').fadeIn(200);
117            $('.cc-header .cc-main-header .cc-find .cc-input-find').focus();
118        });
119
120        $('.cc-header .cc-main-header .cc-find .cc-svg').click(function () {
121            $('.cc-header .cc-main-header .cc-find').fadeOut(200);
122        });
123    };
124
125
126    /* Steacky Header */
127    var steackyHeader = function () {
128        if ($(document).scrollTop() > 34) {
129            $('.cc-header .cc-main-header .cc-content-info').addClass('cc-sticky');
130        } else {
131            $('.cc-header .cc-main-header .cc-content-info').removeClass('cc-sticky');
132        }
133    };
134
135    /* Funzionamento menu mobile */
136    var mobileMenu = function () {
137        $(document).on("click", '.cc-header .cc-header-mobile .cc-content-button-menu', function () {
138            $('.cc-header .cc-header-mobile .cc-nav').toggleClass('cc-nav-visible');
139            /*$('body').toggleClass('cc-no-scroll');*/
140        });
141
142        $(document).on("click", '.cc-header .cc-header-mobile .cc-nav .cc-link-parent', function () {
143            $(this).closest('.cc-nav').addClass('cc-exploded');
144            $(this).closest('.cc-content-link').addClass('cc-exploded-second');
145            $('.cc-header .cc-header-mobile .cc-nav .cc-button-back').fadeIn(200);
146        });
147
148        $(document).on("click", '.cc-header .cc-header-mobile .cc-nav .cc-link-parent-third', function () {
149            $(this).closest('.cc-internal-menu').addClass('cc-third-on');
150            $(this).closest('.cc-content-link').addClass('cc-exploded-third');
151            $('.cc-header .cc-header-mobile .cc-nav .cc-button-back-2').fadeIn(200);
152        });
153
154        $(document).on("click", '.cc-header .cc-header-mobile .cc-nav .cc-button-back', function () {
155            $('.cc-header .cc-header-mobile .cc-nav .cc-button-back').hide();
156            $('.cc-header .cc-header-mobile .cc-nav').removeClass('cc-exploded');
157            $('.cc-header .cc-header-mobile .cc-nav .cc-content-link').removeClass('cc-exploded-second');
158        });
159
160        $(document).on("click", '.cc-header .cc-header-mobile .cc-nav .cc-button-back-2', function () {
161            $('.cc-header .cc-header-mobile .cc-nav .cc-button-back-2').hide();
162            $('.cc-header .cc-header-mobile .cc-nav .cc-internal-menu').removeClass('cc-third-on');
163            $('.cc-header .cc-header-mobile .cc-nav .cc-content-link').removeClass('cc-exploded-third');
164        });
165    };
166
167
168    /* Visual slider mobile */
169    var visualSliderMobile = function () {
170        if ($('.cc-visual-slider.cc-animated').length > 0) {
171
172            if (window.isMobile) {
173                if ($('.cc-visual-slider.cc-animated .slick-slide').length == 0) {
174                    $('.cc-visual-slider.cc-animated').each(function () {
175                        var $currentSlide = $(this).find('.cc-gallery-pagination .cc-current');
176                        var $totalSlide = $(this).find('.cc-gallery-pagination .cc-total');
177                        var $slickElement = $(this).find('.cc-slides');
178
179
180                        $slickElement.on('init reInit afterChange', function (event, slick, currentSlide, nextSlide) {
181                            var i = 0;
182
183                            if (slick.slideCount > 0) {
184                                i = (currentSlide ? currentSlide : 0) + 1;
185                            } else {
186                                i = 0;
187                            }
188
189                            $currentSlide.text(i);
190                            $totalSlide.text(slick.slideCount);
191
192                        });
193
194                        $(this).find('.cc-mobile-hp-news-slides').slick({
195                            lazyLoad: 'progressive',
196                            infinite: true,
197                            autoplay: false,
198                            autoplaySpeed: 5000,
199                            speed: 700,
200                            slidesToShow: 1,
201                            adaptiveHeight: false,
202                            prevArrow: '<div class="cc-svg cc-svg-arrow-caret-left"><span>PrevGallery</span></div>',
203                            nextArrow: '<div class="cc-svg cc-svg-arrow-caret-right"><span>Next</span></div>',
204                            appendArrow: $('.cc-visual-slider .cc-content-graphic-news .cc-content-pagination')
205                        });
206                    });
207                }
208            } else {
209                if ($('.cc-visual-slider.cc-animated .slick-slide').length > 0) {
210                    $('.cc-visual-slider.cc-animated').each(function () {
211                        $(this).find('.cc-mobile-hp-news-slides').slick('unslick');
212                    });
213                }
214
215            }
216
217        }
218    };
219
220
221    /* Settare l'icona favoriti su attiva o no */
222    var setFavoriteIcon = function () {
223        $(document).on('click', '.cc-content-category .cc-favorite-icon', function (e) {
224            e.preventDefault();
225            e.stopPropagation();
226            $(this).parent().toggleClass('cc-favorite');
227        });
228    };
229
230
231    /* Sponsor slider mobile */
232    var sponsorSlider = function () {
233        if ($('.cc-sponsor-slider').length > 0) {
234
235            if (window.isMobile) {
236                if ($('.cc-sponsor-slider .slick-slide').length == 0) {
237                    $('.cc-sponsor-slider').each(function () {
238
239                        $(this).slick({
240                            lazyLoad: 'progressive',
241                            infinite: true,
242                            autoplay: true,
243                            autoplaySpeed: 2000,
244                            speed: 700,
245                            slidesToShow: 6,
246                            adaptiveHeight: false,
247                            prevArrow: '<div class="cc-svg cc-svg-arrow-caret-left"><span>PrevGallery</span></div>',
248                            nextArrow: '<div class="cc-svg cc-svg-arrow-caret-right"><span>Next</span></div>',
249                            appendArrow: $('.cc-visual-slider .cc-content-graphic-news .cc-content-pagination'),
250                            responsive: [
251                                {
252                                    breakpoint: 991,
253                                    settings: {
254                                        slidesToShow: 4
255                                    }
256                                },
257                                {
258                                    breakpoint: 767,
259                                    settings: {
260                                        slidesToShow: 2
261                                    }
262                                },
263                                {
264                                    breakpoint: 480,
265                                    settings: {
266                                        slidesToShow: 1
267                                    }
268                                }
269                            ]
270                        });
271                    });
272                }
273            } else {
274                if ($('.cc-sponsor-slider .slick-slide').length > 0) {
275                    $('.cc-sponsor-slider').each(function () {
276                        $(this).slick('unslick');
277                    });
278                }
279
280            }
281
282        }
283    };
284
285
286
287
288
289    $(document).on("click", ".cc-wrapper .cc-button-show-chat", function () {
290        $('.cc-live-tv-visual .cc-col-chat').fadeIn(350);
291    });
292    $(document).on("click", ".cc-wrapper .cc-live-tv-visual .cc-chat-head .cc-close-button", function () {
293        $('.cc-live-tv-visual .cc-col-chat').fadeOut(350);
294    });
295
296
297
298    $(document).on("click", ".cc-live-tv-visual .cc-col-chat .cc-chat-main .cc-report", function () {
299        $('.cc-overlay-report').fadeIn(350);
300    });
301
302    $(document).on("click", ".cc-comments-section .cc-content-message .cc-content-text .cc-report", function () {
303        $('.cc-overlay-report').fadeIn(350);
304    });
305
306    $(document).on("click", ".cc-comments-section .cc-content-message .cc-content-text .cc-delete", function () {
307        $('.cc-overlay-delete').fadeIn(350);
308    });
309
310
311
312
313
314
315
316
317
318
319
320    /* Fa scrollare la chat... Funzione da richiamare quando scrivi un nuovo messaggio */
321    var chatScrollDown = function () {
322        if ($('.cc-chat-main').length > 0) {
323            var i = 0;
324
325            $('.cc-chat-main .cc-content-message').each(function () {
326                i += $(this).height();
327            });
328
329            $('.cc-chat-main').animate({
330                scrollTop: i
331            }, 500);
332        }
333    };
334
335    //get time now "HH:MM"
336    Date.prototype.timeNow = function () {
337        return ((this.getHours() < 10) ? "0" : "") + this.getHours() + ":" + ((this.getMinutes() < 10) ? "0" : "") + this.getMinutes();
338    };
339
340    //get today date "MM/dd/yyyy"
341    Date.prototype.today = function () {
342        return (((this.getMonth() + 1) < 10) ? "0" : "") + (this.getMonth() + 1) + "/" + ((this.getDate() < 10) ? "0" : "") + this.getDate() + "/" + this.getFullYear();
343    };
344
345
346
347    /* Gallery Slider */ /* TEO */
348    var gallerySlider = function () {
349
350        if ($('.cc-gallery-slider').length > 0) {
351
352            if ($('.cc-gallery-slider .cc-slider .slick-slide').length == 0) {
353                $('.cc-gallery-slider .cc-slider').each(function () {
354                    var slidesContainer = $(this);
355
356                    var $currentSlide = $(this).parent().find('.cc-gallery-pagination .cc-current');
357                    var $totalSlide = $(this).parent().find('.cc-gallery-pagination .cc-total');
358                    var $slickElement = $(this);
359
360                    $slickElement.on('init reInit afterChange', function (event, slick, currentSlide, nextSlide) {
361                        var i = 0;
362
363                        if (slick.slideCount > 0) {
364                            i = (currentSlide ? currentSlide : 0) + 1;
365                        } else {
366                            i = 0;
367                        }
368
369                        $currentSlide.text(i);
370                        //$totalSlide.text(slick.slideCount);
371
372                    });
373
374
375                    slidesContainer.slick({
376                        lazyLoad: 'progressive',
377                        infinite: false,
378                        autoplay: false,
379                        autoplaySpeed: 5000,
380                        speed: 700,
381                        slidesToScroll: 1,
382                        slidesToShow: 1,
383                        centerMode: true,
384                        centerPadding: '15%',
385                        adaptiveHeight: true,
386                        prevArrow: '<button class="cc-slider-prev"></button>',
387                        nextArrow: '<button class="cc-slider-next"></button>',
388                        appendArrow: $('.cc-champion-card-slider'),
389                        responsive: [
390                            {
391                                breakpoint: 1023,
392                                settings: {
393                                    centerPadding: '10%'
394                                }
395                            },
396                            {
397                                breakpoint: 767,
398                                settings: {
399                                    centerPadding: '8%'
400                                }
401                            },
402                            {
403                                breakpoint: 480,
404                                settings: {
405                                    centerPadding: '0%'
406                                }
407                            }
408                        ]
409                    });
410                });
411            }
412        }
413    };
414
415
416    /*
417     NEW FOR CLAMP
418     */
419    var screenIsDesktop = function () {
420        var mq = window.matchMedia("(min-width: 1024px)");
421        return mq.matches;
422    };
423
424    var screenIsTablet = function () {
425        var mq = window.matchMedia("(min-width: 768px) and (max-width: 1023px)");
426        return mq.matches;
427    };
428
429    var screenIsMobile = function () {
430        var mq = window.matchMedia("(max-width: 1023px)");
431        return mq.matches;
432    };
433
434
435    var clampContentManager = function () {
436
437        var clampClassPrefix = 'cc-clamp';
438        var clampResponsiveSuffix = "";
439        if (screenIsDesktop()) {
440            clampResponsiveSuffix = "d";
441        }
442        if (screenIsTablet()) {
443            clampResponsiveSuffix = "t";
444        }
445        if (screenIsMobile()) {
446            clampResponsiveSuffix = "m";
447        }
448
449        var clampClassResponsivePrefix = clampClassPrefix + '-' + clampResponsiveSuffix + '-';
450        $('.cc-wrapper').find('[class*=' + clampClassResponsivePrefix + ']').each(function () {
451            var clampClassAttr = $(this).attr('class');
452            if (clampClassAttr.indexOf(clampClassResponsivePrefix) > -1) {
453                var clampClassAttrArray = clampClassAttr.split(' ');
454                if (clampClassAttrArray.length > 0) {
455                    var clampValue = '';
456                    for (var i = 0; i < clampClassAttrArray.length; i++) {
457                        var currentClass = clampClassAttrArray[i];
458                        if (clampClassAttrArray[i].indexOf(clampClassResponsivePrefix) > -1) {
459                            clampValue = currentClass.replace(clampClassResponsivePrefix, '').trim();
460                            break;
461                        }
462                    }
463                    if (clampValue != '') {
464                        window.$clamp($(this)[0], { clamp: clampValue, truncationChar: '...' });
465                    }
466                }
467            }
468        });
469    };
470
471    /*
472     END FOR CLAMP
473     */
474
475
476    /* Home, section play, slider mobile */
477    var initSectionPlayMobileSlider = function () {
478
479        if ($('.cc-section-play-mobile-slider').length > 0 && $('#pageMode').val() === 'false') {
480
481            if (!window.isMobile) {
482
483                if ($('.cc-section-play-mobile-slider .slick-slide').length > 0) {
484                    $('.cc-section-play-mobile-slider .cc-slider').each(function () {
485                        $(this).slick('unslick');
486                    });
487                }
488
489            } else {
490
491                if ($('.cc-section-play-mobile-slider .slick-slide').length === 0) {
492                    $('.cc-section-play-mobile-slider .cc-slider').each(function () {
493                        $(this).slick({
494                            lazyLoad: 'progressive',
495                            infinite: true,
496                            autoplay: false,
497                            autoplaySpeed: 5000,
498                            speed: 700,
499                            slidesToShow: 1,
500                            adaptiveHeight: false,
501                            prevArrow: '<div class="cc-content-arrow cc-content-arrow-left"><div class="cc-svg cc-svg-arrow-caret-left-fit"><span>PrevGallery</span></div></div>',
502                            nextArrow: '<div class="cc-content-arrow cc-content-arrow-right"><div class="cc-svg cc-svg-arrow-caret-right-fit"><span>Next</span></div></div>',
503                            arrows: true
504                        });
505                    });
506                }
507            }
508        }
509    };
510
511
512    /* Home, section play, slider mobile */
513    var initPromoCorsoMobileSlider = function () {
514
515        if ($('.cc-home-promo-corso-mobile-slider').length > 0) {
516
517            if (!window.isMobile) {
518
519                if ($('.cc-home-promo-corso-mobile-slider .slick-slide').length > 0) {
520                    $('.cc-home-promo-corso-mobile-slider .cc-slider').each(function () {
521                        $(this).slick('unslick');
522                    });
523                }
524
525            } else {
526
527                if ($('.cc-home-promo-corso-mobile-slider .slick-slide').length == 0) {
528                    $('.cc-home-promo-corso-mobile-slider .cc-slider').each(function () {
529                        $(this).slick({
530                            lazyLoad: 'progressive',
531                            infinite: true,
532                            autoplay: false,
533                            autoplaySpeed: 5000,
534                            speed: 700,
535                            centerMode: true,
536                            centerPadding: '8%',
537                            slidesToShow: 1,
538                            adaptiveHeight: false,
539                            prevArrow: '<div class="cc-content-arrow cc-content-arrow-left"><div class="cc-svg cc-svg-arrow-caret-left-fit"><span>PrevGallery</span></div></div>',
540                            nextArrow: '<div class="cc-content-arrow cc-content-arrow-right"><div class="cc-svg cc-svg-arrow-caret-right-fit"><span>Next</span></div></div>',
541                            arrows: false
542                        });
543                    });
544                }
545            }
546        }
547    };
548
549
550    /* Home, section competizioni, slider mobile */
551    var initCompetitionsMobileSlider = function () {
552
553        if ($('.cc-home-competitions-mobile-slider').length > 0) {
554
555            if (!window.isMobile) {
556
557                if ($('.cc-home-competitions-mobile-slider .slick-slide').length > 0) {
558                    $('.cc-home-competitions-mobile-slider .cc-slider').each(function () {
559                        $(this).slick('unslick');
560                    });
561                }
562
563            } else {
564
565                if ($('.cc-home-competitions-mobile-slider .slick-slide').length == 0) {
566                    $('.cc-home-competitions-mobile-slider .cc-slider').each(function () {
567                        $(this).slick({
568                            lazyLoad: 'progressive',
569                            infinite: true,
570                            autoplay: false,
571                            autoplaySpeed: 5000,
572                            speed: 700,
573                            centerMode: true,
574                            centerPadding: '8%',
575                            slidesToShow: 2,
576                            adaptiveHeight: false,
577                            prevArrow: '<div class="cc-content-arrow cc-content-arrow-left"><div class="cc-svg cc-svg-arrow-caret-left-fit"><span>PrevGallery</span></div></div>',
578                            nextArrow: '<div class="cc-content-arrow cc-content-arrow-right"><div class="cc-svg cc-svg-arrow-caret-right-fit"><span>Next</span></div></div>',
579                            arrows: false,
580                            responsive: [
581                                {
582                                    breakpoint: 1023,
583                                    settings: {
584                                        centerPadding: '3%',
585                                        slidesToShow: 2
586                                    }
587                                },
588                                {
589                                    breakpoint: 767,
590                                    settings: {
591                                        centerPadding: '5%',
592                                        slidesToShow: 1
593                                    }
594                                }
595                            ]
596                        });
597                    });
598                }
599            }
600        }
601    };
602
603    window.refreshSelect = refreshpickerSelect;
604    window.renderSelect = renderPickerSelect;
605    window.clampManager = clampContentManager;
606
607    var horizon = function () {
608        if ($('.horizon-swiper').length > 0) {
609            $('.horizon-swiper').horizonSwiper();
610        }
611    };
612
613    function mediaSize() {
614        if (window.matchMedia('(min-width: 1024px)').matches) {
615            $(document).trigger("desktopMode");
616        } else if (window.matchMedia('(min-width: 768px) and (max-width: 1023px)').matches) {
617            $(document).trigger("tabletMode");
618        } else {
619            $(document).trigger("mobileMode");
620        }
621    }
622    //Cambio il default del caret di selectpicker
623    $.fn.selectpicker.Constructor.DEFAULTS.template.caret = "<div class=\"cc-svg cc-svg-select-arrow-down\"><span></span></div>";
624
625    //Document ready
626    $(function () {
627        // Aggiungo classe sul body per valutare se mobile o desktop
628        $(window).resize(function () {
629            mediaSize();
630            responsiveResize();
631            clampContentManager();
632            syncSearchBars();
633        });
634
635        $(document).on("scroll", function () {
636            mediaSize();
637        });
638
639        //Dopo ogni chiamata ajax
640        $(document).ajaxComplete(function () {
641            clampContentManager();
642            horizon();
643        });
644
645        $(document).on('load', '.cc-wrapper', function () {
646            clampContentManager();
647        });
648        $(document).on("desktopMode", function () {
649            if ($('.cc-wrapper.cc-wrapper-news-detail').length > 0) {
650                var desktopHeaderFixedHeight = 0 + $('.cc-header-desktop .cc-main-header .cc-sticky').height(); /* Altezza Header fisso desktop */
651
652                var actionButtonOffset = $('.cc-news-detail .cc-content-action-buttons').offset().top; /* Calcolo la posizione degli action button della news. INNESTO 2 */
653                var actionButtonOffsetDistance = actionButtonOffset - desktopHeaderFixedHeight - $(window).scrollTop(); /* Countdown EFFETTO 2 */
654                var action_left_top = 0 - actionButtonOffsetDistance; /* Attributo EFFETTO 2 */
655
656                /* EFFETTO 2 */
657                if ((actionButtonOffsetDistance) < 0) {
658                    $('.cc-desktop .cc-content-action-buttons .cc-box').css('top', action_left_top);
659                } else {
660                    $('.cc-desktop .cc-content-action-buttons .cc-box').css('top', '0');
661                }
662
663
664                if ($('.cc-section-news.cc-section-card .cc-content-champion-card .cc-champion-card').length > 0) {
665
666                    var cardSectionChampionOffset = $('.cc-section-news.cc-section-card').offset().top;
667                    var cardSectionChampionOffsetDistance = cardSectionChampionOffset - desktopHeaderFixedHeight - $(window).scrollTop() - 50;
668                    /* Countdown EFFETTO 3 */
669                    var cardSectionChampionTop = 0 - cardSectionChampionOffsetDistance;
670                    /* Attributo EFFETTO 3 */
671                    var cardSectionChampionHeight = $('.cc-section-news.cc-section-card').height();
672                    var cardChampionHeight = $('.cc-section-news.cc-section-card .cc-content-champion-card .cc-champion-card').height();
673                    var maxValue = cardSectionChampionHeight - cardChampionHeight - cardSectionChampionTop - 56;
674
675                    /* EFFETTO 3 */
676                    if ((cardSectionChampionOffsetDistance < 0) && (maxValue > 0)) {
677                        $('.cc-section-news.cc-section-card .cc-content-champion-card .cc-champion-card').css('top', cardSectionChampionTop);
678                    }
679                }
680            }
681        });
682        $(document).on("mobileMode tabletMode", function () {
683            if ($('.cc-wrapper.cc-wrapper-news-detail').length > 0) {
684                /* 1 Pulsanti action in header per dettaglio news */
685                /* 2 Pulsanti action che devono attaccarsi on top in dettaglio news */
686                var mobileHeaderFixedHeight = 0 + $('.cc-header-mobile .cc-main-header .cc-sticky').height(); /* Altezza Header fisso mobile */
687                /* EFFETTO 1 */
688                var newsTitleOffset = $('.cc-news-detail .cc-intro-title-main').offset().top; /* Calcolo la posizione del titolo principale della news. INNESTO 1 */
689                var newsTitleOffsetDistance = newsTitleOffset - mobileHeaderFixedHeight - $(window).scrollTop(); /* Countdown EFFETTO 1 */
690
691                if ((newsTitleOffsetDistance) < 0) {
692                    $('.cc-header-mobile .cc-main-header .cc-main-bar .cc-link-search').fadeOut(50);
693                    $('.cc-header-mobile .cc-main-header .cc-main-bar .cc-link-logo').fadeOut(50);
694                    $('.cc-header-mobile .cc-main-header .cc-main-bar .cc-content-action-buttons').fadeIn(350);
695                } else {
696                    $('.cc-header-mobile .cc-main-header .cc-main-bar .cc-link-search').fadeIn(350);
697                    $('.cc-header-mobile .cc-main-header .cc-main-bar .cc-link-logo').fadeIn(350);
698                    $('.cc-header-mobile .cc-main-header .cc-main-bar .cc-content-action-buttons').fadeOut(50);
699                }
700            }
701        });
702
703        //Abilito il pulsante del search sull'header
704        $(document).on("click", ".cc-header .cc-main-header .cc-link-search", function () {
705            if ($('.cc-header .cc-main-header .cc-find .cc-input-find').filter(":visible").length == 0) {
706                $('.cc-header .cc-main-header .cc-find').fadeIn(200);
707                $('.cc-header .cc-main-header .cc-find .cc-input-find').focus();
708            } else {
709				if($.trim($('input[name=searchterms]').val()) == '') {
710					showPopUpAlert("ko","Attenzione","Impossibile effettuare la ricerca, non è stata indicata alcuna parola chiave");
711					return false;
712				}				
713                $('.cc-find form').filter(":visible").submit();
714            }
715        });
716        $(document).on("click", ".cc-header .cc-main-header .cc-find .cc-svg", function () {
717            $(this).closest('.cc-find').fadeOut(200);
718        });
719
720        $(document).on("chatScrollDown", function () {
721            chatScrollDown();
722        });
723
724        $(document).on("click", '.cc-results .cc-filter-section-title', function () {
725            $('.cc-results .cc-filter-tournament-main').slideToggle();
726        });
727
728        // Inizializzo lo scroll orizzontale
729
730        $(document).scroll(function () {
731            // Abilito lo stecky header (mobile e desktop
732            steackyHeader();
733
734            stickyChangeHome();
735        });
736
737        $(document).on("desktopMode", function () {
738            if ($('.cc-wrapper.cc-wrapper-about').length > 0) {
739                var desktopHeaderFixedHeight = 0 + $('.cc-header-desktop .cc-main-header .cc-sticky').height(); /* Altezza Header fisso desktop */
740                var numberSectionOffset = $('.cc-abouts-main .cc-section-number').offset().top;
741                var numberSectionOffsetDistance = numberSectionOffset - desktopHeaderFixedHeight - $(window).scrollTop() + 130; /* Countdown EFFETTO 3 */
742                var numberSectionTop = 150 - numberSectionOffsetDistance; /* Attributo EFFETTO 3 */
743                var numberSectionMaxHeight = $('.cc-abouts-main').height();
744                var cardChampionHeight = $('.cc-abouts-main .cc-section-number .cc-content-number').height();
745                var maxValue = numberSectionMaxHeight - cardChampionHeight - numberSectionTop - 50;
746
747                /* EFFETTO 3 */
748                if ((numberSectionOffsetDistance < 0) && (maxValue > 0)) {
749                    $('.cc-desktop .cc-abouts-main .cc-section-number .cc-content-number').css('top', numberSectionTop);
750                }
751            }
752        });
753
754        // Pulsante per Aprire gli share
755        $(document).on("click", ".cc-content-action-buttons .cc-box .cc-button-open-share", function () {
756            if (window.matchMedia('(min-width: 991px)').matches) {
757                $(this).parent().find('.cc-content-box-share-left').fadeIn(200);
758            } else {
759                $('.cc-overlay-message.cc-overlay-share').fadeIn(200);
760				$('.cc-content-box-share-left').fadeIn(200);
761				$('.cc-content-box-share-left').addClass("displayBlock");
762            }
763        });
764
765        $(document).on("click", ".cc-header-mobile .cc-content-action-buttons .cc-header-button-share", function () {
766            $('.cc-overlay-message.cc-overlay-share').fadeIn(200);
767			$('.cc-content-box-share-left').fadeIn(200);
768			$('.cc-content-box-share-left').addClass("displayBlock");
769        });
770
771
772
773        // Pulsante per Chiudere gli share
774        $(document).on("click", ".cc-content-action-buttons .cc-box .cc-content-box-share-left .cc-button-close-overlay", function () {
775            $('.cc-content-action-buttons .cc-box .cc-content-box-share-left').fadeOut(200);
776			$('.cc-content-box-share-left').removeClass("displayBlock");
777        });
778
779        // Pulsante per chiudere gli overlay
780        $(document).on("click", ".cc-overlay-message .cc-close-overlay", function () {
781            $('.cc-overlay-message').fadeOut(200);
782        });
783
784
785        // TOP HEADER CROSS PORTAL
786        $(document).on("click", ".cc-header-cross-platform .cc-top-header .cc-link", function () {
787            if ($(this).hasClass('cc-has-child')) {
788                $(this).find('.cc-link-overlay').toggle('fast');
789                $(this).toggleClass('cc-active');
790            }
791        });
792
793        $(document).on("click", ".cc-header-cross-platform .cc-top-header .cc-link.cc-link-world", function () {
794            $('.cc-header-cross-platform .cc-top-header .cc-fit-world').slideToggle('fast');
795            $(this).find('.cc-link-overlay').toggle('fast');
796            $(this).toggleClass('cc-active');
797        });
798
799        $(document).on("click", ".cc-header-cross-platform .cc-top-header .cc-background", function () {
800            $(this).closest('cc-link').removeClass('cc-active');
801            $(this).closest('cc-link-overlay').hide();
802        });
803
804        $(document).on("click", ".cc-wrapper-landing-page .cc-link-info", function () {
805            $('.cc-wrapper-landing-page .cc-section.cc-section-info-overlay').addClass('cc-open');
806        });
807
808        $(document).on("click", ".cc-section.cc-section-info-overlay .cc-info-overlay-close", function () {
809            $(this).closest('.cc-section-info-overlay').removeClass('cc-open');
810        });
811
812
813        //$(document).on("desktopMode", function () {
814        if ($('.cc-datepicker').length > 0) {
815            $('.cc-datepicker').each(function () {
816                $('.cc-datepicker').datepicker({
817                    format: 'dd/mm/yyyy',
818                    language: 'it'
819                });
820            });
821        }
822        //});
823
824
825        var stickyChangeHome = function () {
826
827            if ($('.cc-bar-change-home').length > 0) {
828                $(document).on("tabletMode desktopMode", function () {
829
830                    var mobileHeaderFixedHeight = 0 + $('.cc-header .cc-main-header .cc-sticky').height();
831                    /* Altezza Header fisso mobile */
832
833                    var sectionChangeHomeHeight = $('.cc-section-change-home .cc-content-buttons').height();
834                    var sectionChangeHomeOffset = $('.cc-section-change-home .cc-content-buttons').offset().top;
835                    /* Calcolo la posizione del titolo principale della news. INNESTO 1 */
836                    var sectionChangeHomeOffsetDistance = sectionChangeHomeOffset + sectionChangeHomeHeight - mobileHeaderFixedHeight - $(window).scrollTop();
837                    /* Countdown EFFETTO 1 */
838
839                    if ((sectionChangeHomeOffsetDistance) < 0) {
840                        $('.cc-bar-change-home').addClass('cc-sticky');
841                    } else {
842                        $('.cc-bar-change-home').removeClass('cc-sticky');
843                    }
844                });
845            }
846        };
847
848        var setStickyChangeHome = function () {
849
850            if ($('.cc-bar-change-home').length > 0) {
851
852                var mobileHeaderFixedHeight = 0 + $('.cc-header .cc-main-header .cc-sticky').height();
853                /* Altezza Header fisso mobile */
854
855                var sectionChangeHomeHeight = $('.cc-section-change-home .cc-content-buttons').height();
856                var sectionChangeHomeOffset = $('.cc-section-change-home .cc-content-buttons').offset().top;
857                /* Calcolo la posizione del titolo principale della news. INNESTO 1 */
858                var sectionChangeHomeOffsetDistance = sectionChangeHomeOffset + sectionChangeHomeHeight - mobileHeaderFixedHeight - $(window).scrollTop();
859                /* Countdown EFFETTO 1 */
860
861                if ((sectionChangeHomeOffsetDistance) < 0) {
862                    $('.cc-bar-change-home').addClass('cc-sticky');
863                } else {
864                    $('.cc-bar-change-home').removeClass('cc-sticky');
865                }
866            }
867        };
868
869        window.setStickyChangeHome = setStickyChangeHome;
870
871
872        // Abilito tutte le funzioni mobile menu
873        mobileMenu();
874
875        /* Visual Slider Mobile */
876        visualSliderMobile();
877
878        sponsorSlider();
879
880        /* Set favorite icon */
881        setFavoriteIcon();
882
883        /* Scrolla la chat */
884        chatScrollDown();
885
886        gallerySlider();
887
888        initSectionPlayMobileSlider();
889
890        initPromoCorsoMobileSlider();
891
892        initCompetitionsMobileSlider();
893
894        mediaSize();
895
896        horizon();
897        responsiveResize();
898
899        //Resize all textareas in the page
900        var textareas = $(".cc-textarea-autosize");
901        for (var i = 0; i != textareas.length; ++i) {
902            textareaAutoResize($(textareas[i]));
903        }
904
905
906
907        /*          F E D E R T E N N I S       */
908
909        // Pulsante per accordion
910        $(document).on("click", ".cc-content-accordions .cc-accordion .cc-content-title", function () {
911            $(this).closest('.cc-accordion').find('.cc-content-text').slideToggle('200');
912            $(this).closest('.cc-accordion').toggleClass('cc-open');
913        });
914
915        // Pulsante per filtri
916        $(document).on("click", ".cc-section-filter-group .cc-button-accordion", function () {
917            $(this).closest('.cc-section-filter-group').find('.cc-accordion-content').slideToggle('200');
918            $(this).closest(this).toggleClass('cc-open');
919        });
920
921        /*$('.simple-marquee-container').SimpleMarquee();
922        $(".marquee-1").trigger('mouseenter');
923        $(".marquee-1").trigger('mouseleave');*/
924
925        function getHiddenFieldFromPage(fieldId) {
926            return $("#" + fieldId).val();
927        }
928        function getCookieOptions() {
929            return {
930                // if false, this prevents the popup from showing (useful for giving to control to another piece of code)
931                enabled: true,
932
933                // optional (expecting a HTML element) if passed, the popup is appended to this element. default is `document.body`
934                container: null,
935
936                // defaults cookie options - it is RECOMMENDED to set these values to correspond with your server
937                cookie: {
938                    // This is the name of this cookie - you can ignore this
939                    name: 'cookieconsent_status',
940
941                    // This is the url path that the cookie 'name' belongs to. The cookie can only be read at this location
942                    path: '/',
943
944                    // This is the domain that the cookie 'name' belongs to. The cookie can only be read on this domain.
945                    //  - Guide to cookie domains - http://erik.io/blog/2014/03/04/definitive-guide-to-cookie-domains/
946                    domain: '',
947
948                    // The cookies expire date, specified in days (specify -1 for no expiry)
949                    expiryDays: 365,
950                },
951
952                // these callback hooks are called at certain points in the program execution
953                onPopupOpen: function () { },
954                onPopupClose: function () { },
955                onInitialise: function (status) { },
956                onStatusChange: function (status, chosenBefore) { },
957                onRevokeChoice: function () { },
958
959                // each item defines the inner text for the element that it references
960                content: {
961                    header: getHiddenFieldFromPage("ccbb-title"),
962                    message: getHiddenFieldFromPage("ccbb-text"),
963                    dismiss: 'Ok',
964                    allow: 'Allow cookies',
965                    deny: 'Non Accetto',
966                    link: getHiddenFieldFromPage("ccbb-linktext"),
967                    href: getHiddenFieldFromPage("ccbb-linkurl"),
968                    close: '&#x274c;'
969                },
970
971                // This is the HTML for the elements above. The string {{header}} will be replaced with the equivalent text below.
972                // You can remove "{{header}}" and write the content directly inside the HTML if you want.
973                //
974                //  - ARIA rules suggest to ensure controls are tabbable (so the browser can find the first control),
975                //    and to set the focus to the first interactive control (http://w3c.github.io/aria-in-html/)
976                elements: {
977                    header: '<span class="cc-header">{{header}}</span>&nbsp;',
978                    message: '<span id="cookieconsent:desc" class="cc-message">{{message}}</span>',
979                    messagelink: '<span id="cookieconsent:desc" class="cc-message">{{message}} <a aria-label="learn more about cookies" role=button tabindex="0" class="cc-link" href="{{href}}">{{link}}</a></span>',
980                    dismiss: '<a aria-label="dismiss cookie message" role=button tabindex="0" class="cc-btn cc-dismiss">{{dismiss}}</a>',
981                    allow: '<a aria-label="allow cookies" role=button tabindex="0"  class="cc-btn cc-allow">{{allow}}</a>',
982                    deny: '<a aria-label="deny cookies" role=button tabindex="0" class="cc-btn cc-deny">{{deny}}</a>',
983                    link: '<a aria-label="learn more about cookies" role=button tabindex="0" class="cc-link" href="{{href}}" target="_blank">{{link}}</a>',
984                    close: '<span aria-label="dismiss cookie message" role=button tabindex="0" class="cc-close">{{close}}</span>',
985
986                    //compliance: compliance is also an element, but it is generated by the application, depending on `type` below
987                },
988
989                // The placeholders {{classes}} and {{children}} both get replaced during initialisation:
990                //  - {{classes}} is where additional classes get added
991                //  - {{children}} is where the HTML children are placed
992                window: '<div role="dialog" aria-live="polite" aria-label="cookieconsent" aria-describedby="cookieconsent:desc" id="cc-cookieconsent" class="cc-window {{classes}}"><!--googleoff: all-->{{children}}<!--googleon: all--></div>',
993
994                // This is the html for the revoke button. This only shows up after the user has selected their level of consent
995                // It can be enabled of disabled using the `revokable` option
996                revokeBtn: '<div class="cc-revoke {{classes}}">Cookie Policy</div>',
997
998                // define types of 'compliance' here. '{{value}}' strings in here are linked to `elements`
999                compliance: {
1000                    'info': '<div class="cc-compliance">{{dismiss}}</div>',
1001                    'opt-in': '<div class="cc-compliance cc-highlight">{{dismiss}}{{allow}}</div>',
1002                    'opt-out': '<div class="cc-compliance cc-highlight">{{deny}}{{dismiss}}</div>',
1003                },
1004
1005                // select your type of popup here
1006                type: 'info', // refers to `compliance` (in other words, the buttons that are displayed)
1007
1008                // define layout layouts here
1009                layouts: {
1010                    // the 'block' layout tend to be for square floating popups
1011                    'basic': '{{messagelink}}{{compliance}}',
1012                    'basic-close': '{{messagelink}}{{compliance}}{{close}}',
1013                    'basic-header': '{{header}}{{message}}{{link}}{{compliance}}',
1014
1015                    // add a custom layout here, then add some new css with the class '.cc-layout-my-cool-layout'
1016                    //'my-cool-layout': '<div class="my-special-layout">{{message}}{{compliance}}</div>{{close}}',
1017                },
1018
1019                // default layout (see above)
1020                layout: 'basic',
1021
1022                // this refers to the popup windows position. we currently support:
1023                //  - banner positions: top, bottom
1024                //  - floating positions: top-left, top-right, bottom-left, bottom-right
1025                //
1026                // adds a class `cc-floating` or `cc-banner` which helps when styling
1027                position: 'bottom', // default position is 'bottom'
1028
1029                // Available styles
1030                //    -block (default, no extra classes)
1031                //    -edgeless
1032                //    -classic
1033                // use your own style name and use `.cc-theme-STYLENAME` class in CSS to edit .
1034                // Note: style "wire" is used for the configurator, but has no CSS styles of its own, only palette is used.
1035                theme: 'block',
1036
1037                // The popup is `fixed` by default, but if you want it to be static (inline with the page content), set this to fal
1037se
1038                // Note: by default, we animate the height of the popup from 0 to full size
1039                static: false,
1040
1041                // if you want custom colours, pass them in here. this object should look like this.
1042                // ideally, any custom colours/themes should be created in a separate style sheet, as this is more efficient.
1043                //   {
1044                //     popup: {background: '#000000', text: '#fff', link: '#fff'},
1045                //     button: {background: 'transparent', border: '#f8e71c', text: '#f8e71c'},
1046                //     highlight: {background: '#f8e71c', border: '#f8e71c', text: '#000000'},
1047                //   }
1048                // `highlight` is optional and extends `button`. if it exists, it will apply to the first button
1049                // only background needs to be defined for every element. if not set, other colors can be calculated from it
1050                palette: null,
1051
1052                // Some countries REQUIRE that a user can change their mind. You can configure this yourself.
1053                // Most of the time this should be false, but the `cookieconsent.law` can change this to `true` if it detects that it should
1054                revokable: false,
1055
1056                // if true, the revokable button will tranlate in and out
1057                animateRevokable: true,
1058
1059                // used to disable link on existing layouts
1060                // replaces element messagelink with message and removes content of link
1061                showLink: true,
1062
1063                // set value as scroll range to enable
1064                dismissOnScroll: false,
1065
1066                // set value as time in milliseconds to autodismiss after set time
1067                dismissOnTimeout: false,
1068
1069                // The application automatically decideds whether the popup should open.
1070                // Set this to false to prevent this from happening and to allow you to control the behaviour yourself
1071                autoOpen: true,
1072
1073                // By default the created HTML is automatically appended to the container (which defaults to <body>). You can prevent this behaviour
1074                // by setting this to false, but if you do, you must attach the `element` yourself, which is a public property of the popup instance:
1075                //
1076                //     var instance = cookieconsent.factory(options);
1077                //     document.body.appendChild(instance.element);
1078                //
1079                autoAttach: true,
1080
1081                // simple whitelist/blacklist for pages. specify page by:
1082                //   - using a string : '/index.html'           (matches '/index.html' exactly) OR
1083                //   - using RegExp   : /\/page_[\d]+\.html/    (matched '/page_1.html' and '/page_2.html' etc)
1084                whitelistPage: [],
1085                blacklistPage: [],
1086
1087                // If this is defined, then it is used as the inner html instead of layout. This allows for ultimate customisation.
1088                // Be sure to use the classes `cc-btn` and `cc-allow`, `cc-deny` or `cc-dismiss`. They enable the app to register click
1089                // handlers. You can use other pre-existing classes too. See `src/styles` folder.
1090                overrideHTML: null
1091            };
1092        }
1093        if (window.cookieconsent !== null && window.cookieconsent !== undefined) {
1094            var isPreviewOrExperience = !!(window.Sitecore && window.Sitecore.PageModes);
1095            if (!isPreviewOrExperience) {
1096                //window.cookieconsent.initialise(getCookieOptions());
1097            }
1098        }
1099        function showPopUpAlert(type,title,message) {
1100			var typeText = '<div class="cc-svg cc-svg-purchase-ok"><span>Ok</span></div>';
1101			if(type = 'ko')
1102				typeText = '<div class="cc-svg cc-svg-purchase-ko"><span>Ok</span></div>';
1103            var popuUp = '<div  id="popup" class="cc-overlay cc-overlay-purchase" style="display: block;">' +
1104                '   <div class="cc-overlay-main cc-overlay-main-small"   style="background: white;"  >' +
1105                '      <div class="cc-close-button">' +
1106                '         <div class="cc-svg cc-svg-close-primary-color jq-popup-close"><span>Chiudi</span></div>' +
1107                '      </div>' +
1108                '      <section class="cc-purchase-contents">' +
1109                '         <div class="cc-content-title cc-content-title-feedback">' +
1110                '            <div class="cc-content-icon">' +
1111                               typeText +
1112                '            </div>' +
1113                '            <h1 class="cc-purchase-main-title" style="color:#222225">' + title + '</h1>' +
1114                '            <p class="cc-purchase-subtitle">' + message + '</p>' +
1115                '         </div>' +
1116                '         <div class="cc-content-main-info cc-small-padding-top">' +
1117                '            <div class="cc-content-button"><a href="#" class="cc-button cc-button-primary jq-popup-close">Chiudi</a></div>' +
1118                '         </div>' +
1119                '      </section>' +
1120                '   </div>' +
1121                '</div>';
1122
1123            if ($('.cc-desktop').length > 0) {
1124                $('.cc-desktop').append(popuUp);
1125            } else if ($('.cc-mobile').length > 0) {
1126                $('.cc-mobile').append(popuUp);
1127            }
1128
1129            $(".jq-popup-close").on("click", function () {
1130                $("#popup").remove();
1131            });
1132        }			
1133    });
1134})(jQueryV2);
1135
1136
1137
1138
1139
1140
1141

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.