PageSourceSearch

https://www.tangermed.ma/wp-content/themes/tmsa/assets/js/main.js?ver=0.13488200%201790971806

js tangermed.ma collected 2026-10-02 20:10:38 UTC 43,975 bytes, 1,302 lines download raw bytes

1let currentLang = $('html').attr("lang").substring(0, 2);
2let owlRtl = currentLang === "ar" ? true : false;
3
4$(document).ready(function () {
5    // laoder video HP
6    setTimeout(function () {
7        $('.header-video-background').addClass('loaded');
8    }, 1000);
9
10    // On click search bar
11    $('.searchbar').on('click', function () {
12        $('#toggleSearch').slideToggle(300);
13        $('.togglesearch input[type="text"]').focus();
14    });
15    $('.close-search--1').on('click', function () { // close search bar
16        $('#toggleSearch').slideUp(300);
17    });
18
19    $("#form-recherche-hp").validate();
20
21    // Odd / Even background section
22    const $bg_wrapper = $('.wrapper-bg');
23
24    $bg_wrapper.each(function () {
25        const _this = $(this),
26            $child = _this.children('div');
27
28        $child.odd().addClass('bg-blue'); // add class bg to odd child
29        $child.first().addClass('bg-blue'); // add class to first element : title
30        $('.wrapper-bg').even().addClass('even');
31        $('.wrapper-bg:not(.even)').each(function () {
32            $(this).children('div').removeClass('bg-blue'); //reset children class
33            if ($('.wrapper-bg.even > div:last-child').hasClass('bg-blue')) { // check if previous wrapper has blue on last element
34                $(this).children('div').even().addClass('bg-blue');
35                $(this).children('div').first().removeClass('bg-blue');
36            } else {
37                $(this).children('div').odd().addClass('bg-blue');
38            }
39        })
40    });
41
42    // HP - bloc video parallax
43    $(window).scroll(function (e) {
44        if ($('.header-video').length) { parallax(); }
45        if ($('.pro-int').length) { parallax_int(); }
46        if ($('.header-img-banner').length) { parallax_banner(); }
47    });
48
49    function parallax() {
50        var scrolled = $(window).scrollTop();
51        $('.header-video-background').css('bottom', -(scrolled * 0.04) + 'rem');
52        $('.header-video-background iframe').css('bottom', -(scrolled * -0.005) + 'rem');
53        $('#form-recherche-hp').css('top', -(scrolled * 0.005) + 'rem');
54        //$('.block-banner h1').css('top', -(scrolled * -0.02) + 'rem');
55        $('.header-video-background iframe').css('opacity', 1 - (scrolled * .00175));
56    }
57    function parallax_int() {
58        var oTop_pro = $(".pro-int").offset().top;
59        var oTop = oTop_pro - window.innerHeight;
60        var scrolled_pro = $(window).scrollTop() - oTop;
61        if ($(window).scrollTop() > oTop) {
62            $('.bg-image').css('bottom', -(scrolled_pro * 0.04) + 'rem');
63            $('.bg-image img').css('bottom', -(scrolled_pro * -0.005) + 'rem');
64            //$('.block-banner h1').css('top', -(scrolled * -0.02) + 'rem');
65            //$('.banner-wrap img, .block-banner h1').css('opacity', 1 - (scrolled * .00175));
66        }
67    }
68    function parallax_banner() {
69        var scrolled_ban = $(window).scrollTop();
70        $('.header-img-banner img').css('bottom', -(scrolled_ban * 0.04) + 'rem');
71        $('.header-img-banner img').css('opacity', 1 - (scrolled_ban * .00175));
72        $('.header-img-banner h1').css('top', -(scrolled_ban * -0.02) + 'rem');
73    }
74
75    // add animate on click accordion to section
76    $('.accordion-flush .accordion-item .accordion-button').on('click', function (event) {
77        event.preventDefault();
78        let _this = $(this);
79
80        setTimeout(function () {
81            $('html, body').animate({
82                scrollTop: _this.parent().offset().top - 100
83            }, 500);
84        }, 500);
85
86    });
87
88    // Tabs hover Animation
89    // initialize
90    if (window.matchMedia("(min-width: 767px)").matches) {
91        $(document)
92            .find('nav .primary-main-menu').each(function initialize() {
93                const $container = $(this);
94                $container.append('<div class="tabs-underline"></div>');
95                const $active = $container.find('[class*="current-menu-"]').first();
96                const $underline = $container.find('.tabs-underline');
97
98                if ($active.length) {
99                    const left = $active.position().left;
100                    const width = $active.outerWidth();
101                    $underline.css({ left, width });
102                }
103            });
104
105        $("nav .primary-main-menu > .menu-item").on({
106            mouseenter: function () {
107                //Mouse Enter
108                const $this = $(this);
109                const $parent = $this.parent();
110                const $container = $parent.closest('.primary-main-menu');
111                const $underline = $container.find('.tabs-underline');
112
113                const left = $this.position().left;
114                const width = $this.outerWidth();
115
116                $("nav .primary-main-menu > .menu-item").removeClass('is-hovered');
117                $this.addClass('is-hovered');
118                $underline.css({ left, width });
119            },
120            mouseleave: function () {
121                //Mouse Leave
122                const $this = $(this);
123                const $container = $this.closest('.primary-main-menu');
124                const $active = $container.find('[class*="current-menu-"]').first();
125                const $underline = $container.find('.tabs-underline');
126
127                if ($active.length) {
128                    const left = $active.position().left;
129                    const width = $active.outerWidth();
130
131                    $active.addClass('is-hovered');
132                    $underline.css({ left, width });
133                } else {
134                    $underline.removeAttr("style");
135                }
136            }
137        });
138    }
139
140    // Add aria-label and role to button owl nav(prev,next)
141    function update_nav_buttons_accessibility() {
142        $('.owl-prev, .owl-next').attr({
143            'role': 'button',
144            'aria-label': function () {
145                return $(this).hasClass('owl-prev') ? 'Previous' : 'Next';
146            }
147        });
148    }
149
150    $('.slider-logistic').owlCarousel({
151        rtl: owlRtl,
152        loop: true,
153        nav: false,
154        dots: false,
155        items: 3,
156        navText: ['<i class="fa fa-chevron-left"></i>', '<i class="fa fa-chevron-right"></i>'],
157        onInitialized: update_nav_buttons_accessibility,
158        onTranslated: update_nav_buttons_accessibility,
159        autoplay: false,
160        autoplayTimeout: 5000,
161        autoplayHoverPause: true,
162        margin: 0,
163        responsiveClass: true,
164        responsive: {
165            0: {
166                items: 1.1
167            },
168            768: {
169                items: 2.1,
170
171            },
172            991: {
173                items: 3,
174            }
175        }
176    });
177
178    $('.partners-carousel').owlCarousel({
179        rtl: owlRtl,
180        loop: true,
181        nav: false,
182        dots: true,
183        items: 9,
184        autoplay: true,
185        autoplayTimeout: 5000,
186        autoplayHoverPause: true,
187        margin: 0,
188        responsiveClass: true,
189        responsive: {
190            0: {
191                items: 1
192            },
193            768: {
194                items: 2,
195            },
196            991: {
197                items: 3,
198            }
199        }
200    });
201
202    $('#digitCarousel').owlCarousel({
203        rtl: owlRtl,
204        loop: true,
205        nav: true,
206        items: 1,
207        dots: false,
208        navClass: ['carousel-prev', 'carousel-next'],
209        navText: ['<i class="fa fa-chevron-left"></i>', '<i class="fa fa-chevron-right"></i>'],
210        navContainerClass: 'digit-carousel-nav',
211        onInitialized: update_nav_buttons_accessibility,
212        onTranslated: update_nav_buttons_accessibility,
213        responsiveClass: true,
214        autoHeight: true,
215        responsive: {
216            0: {
217                items: 1
218            },
219            768: {
220                items: 1,
221            },
222            991: {
223                items: 1,
224            }
225        }
226    });
227
228    $('.slider-industries , .slider-services').owlCarousel({
229        rtl: owlRtl,
230        loop: true,
231        nav: true,
232        dots: false,
233        items: 3,
234        margin: 15,
235        navText: ['<i class="fa fa-chevron-left"></i>', '<i class="fa fa-chevron-right"></i>'],
236        onInitialized: update_nav_buttons_accessibility,
237        onTranslated: update_nav_buttons_accessibility,
238        autoplay: false,
239        autoplayTimeout: 5000,
240        autoplayHoverPause: true,
241        responsiveClass: true,
242        responsive: {
243            0: {
244                items: 1.1
245            },
246            768: {
247                items: 2.1,
248            },
249            991: {
250                items: 3,
251            }
252        }
253    });
254
255    $('.util_carousel').owlCarousel({
256        rtl: owlRtl,
257        loop: false,
258        nav: true,
259        dots: false,
260        items: 1,
261        margin: 15,
262        navText: ['<i class="fa fa-chevron-left"></i>', '<i class="fa fa-chevron-right"></i>'],
263        onInitialized: update_nav_buttons_accessibility,
264        onTranslated: update_nav_buttons_accessibility,
265        autoplay: false,
266        autoplayTimeout: 5000,
267        autoplayHoverPause: true,
268        /*responsiveClass: true,
269        responsive: {
270            0: {
271                items: 1.1
272            },
273            768: {
274                items: 1,
275            },
276            991: {
277                items: 1,
278            }
279        }*/
280    });
281
282    $('.news-col-mobile ,.slider-logistic-mobile , .slider-decouvrir-plus-mobile ,.slider-read-actu-mobile, .slider-success-mobile').owlCarousel({
283        rtl: owlRtl,
284        loop: true,
285        nav: false,
286        dots: false,
287        items: 3,
288        margin: 15,
289        navText: ['<i class="fa fa-chevron-left"></i>', '<i class="fa fa-chevron-right"></i>'],
290        onInitialized: update_nav_buttons_accessibility,
291        onTranslated: update_nav_buttons_accessibility,
292        autoplay: false,
293        autoplayTimeout: 5000,
294        autoplayHoverPause: true,
295        responsiveClass: true,
296        autoHeight: true,
297        responsive: {
298            0: {
299                items: 1.1
300            },
301            768: {
302                items: 2.1,
303            }
304        }
305    });
306
307    $(' .slider-proces-recrut-mobile , .slider-areo-mobile , .slider-chiffres-cles-mobile').owlCarousel({
308        rtl: owlRtl,
309        loop: true,
310        nav: true,
311        dots: false,
312        items: 1,
313        margin: 0,
314        navText: ['<i class="fa fa-chevron-left"></i>', '<i class="fa fa-chevron-right"></i>'],
315        onInitialized: update_nav_buttons_accessibility,
316        onTranslated: update_nav_buttons_accessibility,
317        autoplay: false,
318        autoplayTimeout: 5000,
319        autoplayHoverPause: true,
320        responsiveClass: true,
321        autoHeight: true,
322        stagePadding: 0,
323        responsive: {
324            0: {
325                items: 1
326            },
327            768: {
328                items: 2,
329            }
330        }
331    });
332
333    $('.slider-axes-d-engagements, .slider-geographique-ports').owlCarousel({
334        rtl: owlRtl,
335        loop: true,
336        nav: true,
337        dots: false,
338        items: 1,
339        margin: 0,
340        navText: ['<i class="fa fa-chevron-left"></i>', '<i class="fa fa-chevron-right"></i>'],
341        onInitialized: update_nav_buttons_accessibility,
342        onTranslated: update_nav_buttons_accessibility,
343        autoplay: false,
344        autoplayTimeout: 5000,
345        autoplayHoverPause: true,
346        responsiveClass: true,
347        autoHeight: true,
348        responsive: {
349            0: {
350                items: 1
351            },
352            768: {
353                items: 1,
354            }
355        }
356    });
357
358    $('.silder-temoignages').owlCarousel({
359        rtl: owlRtl,
360        loop: false,
361        nav: true,
362        dots: false,
363        items: 1,
364        margin: 0,
365        navText: ['<i class="fa fa-chevron-left"></i>', '<i class="fa fa-chevron-right"></i>'],
366        onInitialized: update_nav_buttons_accessibility,
367        onTranslated: update_nav_buttons_accessibility,
368        autoplay: false,
369        autoplayTimeout: 5000,
370        autoplayHoverPause: true,
371        navContainerClass: 'digit-carousel-nav',
372        navClass: ['carousel-prev', 'carousel-next'],
373        responsiveClass: true,
374        responsive: {
375            0: {
376                items: 1
377            },
378            768: {
379                items: 1,
380            },
381            991: {
382                items: 1,
383            }
384        }
385    });
386
387    // carousel stories
388    $('.slider-list-stories , .slider-list-stories-filterd').owlCarousel({
389        rtl: owlRtl,
390        loop: false,
391        nav: true,
392        items: 3,
393        dots: false,
394        margin: 35,
395        navText: ['<i class="fa fa-chevron-left"></i>', '<i class="fa fa-chevron-right"></i>'],
396        onInitialized: update_nav_buttons_accessibility,
397        onTranslated: update_nav_buttons_accessibility,
398        responsiveClass: true,
399        responsive: {
400            0: {
401                items: 1,
402                margin: 0
403            },
404            768: {
405                items: 2,
406                margin: 35
407            },
408            991: {
409                items: 3,
410            }
411        }
412    });
413
414
415    if ($(window).width() <= 991) {
416
417        $('#carousel-project-int, #inby-slider , #carousel-key-figures').addClass('owl-carousel');
418
419        $('#carousel-project-int').owlCarousel({
420            rtl: owlRtl,
421            loop: true,
422            items: 1,
423            nav: true,
424            dots: false,
425            margin: 15,
426            navText: ['<i class="fa fa-chevron-left"></i>', '<i class="fa fa-chevron-right"></i>'],
427            onInitialized: update_nav_buttons_accessibility,
428            onTranslated: update_nav_buttons_accessibility,
429            responsive: {
430                0: {
431                    items: 1
432                },
433                768: {
434                    items: 2,
435
436                },
437                991: {
438                    items: 3,
439
440                }
441            }
442        });
443
444        $('#inby-slider').owlCarousel({
445            rtl: owlRtl,
446            loop: true,
447            items: 1,
448            navText: ['<i class="fa fa-chevron-left"></i>', '<i class="fa fa-chevron-right"></i>'],
449            onInitialized: update_nav_buttons_accessibility,
450            onTranslated: update_nav_buttons_accessibility,
451            nav: true,
452            margin: 15,
453            responsive: {
454                0: {
455                    items: 1.1
456                },
457                768: {
458                    items: 2,
459
460                },
461                991: {
462                    items: 3,
463
464                }
465            }
466        });
467        $('#carousel-key-figures').owlCarousel({
468            rtl: owlRtl,
469            loop: true,
470            items: 1,
471            navText: ['<i class="fa fa-chevron-left"></i>', '<i class="fa fa-chevron-right"></i>'],
472            onInitialized: update_nav_buttons_accessibility,
473            onTranslated: update_nav_buttons_accessibility,
474            nav: true,
475            dots: false,
476            responsive: {
477                0: {
478                    items: 1
479                },
480                768: {
481                    items: 2,
482
483                },
484                991: {
485                    items: 3,
486
487                }
488            }
489        });
490
491
492        if ($(".slider-poles-operationnels .item").length > 3) {
493            $('.slider-poles-operationnels').owlCarousel({
494                rtl: owlRtl,
495                loop: true,
496                nav: true,
497                dots: false,
498                items: 3,
499                navText: ['<i class="fa fa-chevron-left"></i>', '<i class="fa fa-chevron-right"></i>'],
500                onInitialized: update_nav_buttons_accessibility,
501                onTranslated: update_nav_buttons_accessibility,
502                margin: 0,
503                responsive: {
504                    0: {
505                        margin: 8,
506                        items: 1
507                    },
508                    768: {
509                        items: 2,
510                    },
511                    991: {
512                        items: 3,
513                    }
514                }
515            });
516
517        }
518    } else {
519        $('#carousel-project-int , #inby-slider , #carousel-key-figures').removeClass('owl-carousel');
520        $('#carousel-project-int , #inby-slider , #carousel-key-figures').owlCarousel('destroy');
521    }
522
523    // project int
524    $('#img-1').addClass('active');
525    $('.round-btn').on("mouseover", function () {
526        // console.log($(this).attr('id').split('-')[1]);
527        let id_bg = $(this).attr('id').split('-')[1];
528        $('.bg-image:not(#img-' + id_bg + ')').removeClass('active');
529        $('#img-' + id_bg).addClass('active');
530    });
531
532    $('.round-btn').on("click", function () {
533        let id = $(this).attr('id').split('-')[1];
534        $('#tab-' + id).addClass('active');
535        $('#tab-' + id + ' .overlay .container').fadeIn(300);
536        $("#tab-" + id).addClass("zindex-add");
537        $('.bg-div:not(#tab-' + id + ')').removeClass('active');
538        $('#row-tabs').fadeOut(500);
539
540        $(".bg-div").addClass("zindex-add");
541        $(".close-over").css({ "opacity": "1" }).fadeIn(800);
542    });
543
544
545
546    $(".close-overlay-div").on("click", function () {
547        $(".close-over").css({ "opacity": "0" });
548        $("#row-tabs").fadeIn(500);
549        $(".bg-div .overlay .container").fadeOut(500);
550        $('.bg-div').removeClass("active zindex-add");
551    });
552
553
554
555    // menu scondaire
556    $('.menu-top-menu-container #primary-menu .menu-item').hover(function () {
557
558        let subMenu = $(this).children('.sub-menu');
559
560        if (subMenu) {
561            if (subMenu.offset().left < 0) {
562
563                subMenu.css('left', '150px')
564            }
565            else if (subMenu.offset().left + subMenu.width() > window.innerWidth) {
566
567                subMenu.css('left', window.innerWidth - subMenu.width() - 150 + 'px')
568            }
569            else {
570                subMenu.css('left', '73%')
571
572            }
573        }
574    });
575
576    //$('.sans-lien > a').removeAttr("href");
577
578    $('.companies-presentation-img-parent.popup-btn').each(function () {
579        $(this).on("click", function () {
580            $(this).next('.modal').appendTo("body").modal('show');
581        })
582    })
583
584
585    // add padding in last page in responsive
586    if ($('.read-actu-mobile').length) {
587        $(".decouvrir-plus-mobile").css("padding-bottom", "60px");
588    } else {
589        if (window.innerWidth <= 767) {
590            $(".decouvrir-plus-mobile").css("padding-bottom", "120px");
591        } else {
592            $(".decouvrir-plus-mobile").css("padding-bottom", "140px");
593        }
594
595    }
596
597    // setting box cadre travail proces
598    $('.cadre-travail-content .proces .proces-img-box:first-child').addClass('active');
599    $('.proces-img-box').on({
600        mouseenter: function () {
601            //Mouse Enter
602            const _this = $(this);
603            const _title = $('.proces-detail-title');
604            const _txt = $('.proces-detail-txt');
605
606            $('.proces-img-box').removeClass('active');
607            _this.addClass('active');
608
609            _title.animate({ 'opacity': 0 }, 200, function () {
610                $(this).text(_this.data('title')).animate({ 'opacity': 1 }, 200);
611            });
612            _txt.animate({ 'opacity': 0 }, 200, function () {
613                $(this).text(_this.data('txt')).animate({ 'opacity': 1 }, 200);
614            });
615
616        }
617    })
618
619});
620
621
622
623var a = 0;
624var b = 0;
625
626$(window).scroll(function () {
627    // add fixed to menu on scroll
628    if (window.innerWidth >= 991) {
629        if ($(window).scrollTop() > 53) {
630            $('nav.main-menu').addClass('fixed');
631            $("header .header-img-banner").css('top', '0px');
632        }
633        else {
634            $('nav.main-menu').removeClass('fixed');
635            $("header .header-img-banner").css('top', '-97px');
636        }
637    }
638
639    // setting chiffres cles logistique portuaire and pole industriel
640    // if ($('.chiffres-cles').length || $('.chiffres-cles-mobile').length || $('.key-figures').length) {
641
642
643    //     if ($('.chiffres-cles').length || $('.chiffres-cles-mobile').length) {
644    //         var testTop = $('.chiffres-cles , .chiffres-cles-mobile').offset().top - 150;
645    //     }
646    //     if ($('.key-figures').length) {
647    //         var testTop = $(' .key-figures').offset().top - 750;
648    //     }
649
650    //     console.log($(window).scrollTop());
651
652    //     var oTop = $(window).scrollTop() - testTop;
653
654    //     if (a == 0 && $(window).scrollTop() >= testTop) {
655
656
657
658    //         $('.chiffres-cles .chiffre-nb , .chiffres-cles-mobile .span-count, .key-figures .key-figures__content .number').each(function () {
659
660    //             var $this = $(this),
661    //                 countTo = $this.attr('data-count');
662    //             console.log(countTo);
663    //             $({
664    //                 countNum: $this.text()
665    //             }).animate({
666    //                 countNum: countTo,
667    //             },
668
669    //                 {
670    //                     duration: 3000,
671    //                     easing: 'linear',
672    //                     step: function () {
673    //                         $this.text(commaSeparateNumber(Math.floor(this.countNum)));
674    //                     },
675    //                     complete: function () {
676    //                         $this.text(commaSeparateNumber(this.countNum));
677    //                     }
678
679    //                 });
680    //         });
681    //         counted = 1;
682    //         function commaSeparateNumber(val) {
683    //             while (/(\d+)(\d{3})/.test(val.toString())) {
684    //                 val = val.toString().replace(/(\d+)(\d{3})/, '$1' + ' ' + '$2');
685    //             }
686    //             return val;
687    //         }
688    //         a = 1;
689    //     }
690    // }
691
692});
693
694
695
696$(document).ready(function () {
697
698    // format links , inputs , headings , dates
699    let links = $('a.discover-banner,  a.btn-all-news, .btn-appliquer > a , link-detail.a', 'pluto-light a , a.btn-all-el');
700    Object.values(links).forEach(link => {
701        if (link.textContent) {
702            link.textContent = link.textContent.trim().charAt(0).toUpperCase() + link.textContent.trim().slice(1);
703        }
704    });
705
706    let inputs = $('#form-newsletter-ap input[id="submit-newsletter"],input[class="btn-appliquer"],#form-contact input[type="submit"] ');
707    Object.values(inputs).forEach(input => {
708        if (input.value) {
709            input.value = input.value.trim().charAt(0).toUpperCase() + input.value.trim().slice(1);
710        }
711    });
712
713    let headings = $('.learn-more h2 , .read-actu h2 , .decouvrir-plus-mobile h2 , .read-actu-mobile h2');
714    Object.values(headings).forEach(heading => {
715        if (heading.textContent) {
716            heading.textContent = heading.textContent.trim().charAt(0).toUpperCase() + heading.textContent.trim().slice(1).toLowerCase();
717        }
718    });
719
720    let dates = $('span.newsletter-date');
721    Object.values(dates).forEach(d => {
722        if (d.textContent) {
723            d.textContent = d.textContent.trim().charAt(0).toUpperCase() + d.textContent.trim().slice(1).toLowerCase();
724        }
725    });
726
727    // menu parncipal and  menu secondaire
728    let icon = "<span class='glyphicon glyphicon-menu-down pull-right glyphicon-menu-up' aria-hidden='true'><i class='fa fa-chevron-down'></i></span>";
729
730    // append icon chevron to item menu 
731    $('.list-unstyled li.list-product-cat a.dropdown-toggle').append(icon);
732
733    $('.list li.list-product-cat').click(function (e) {
734
735        let id = $(this).attr('id');
736
737        // default setting menu (remove and add class )
738        $(`.list-unstyled li.list-product-cat > ul `).removeClass('dropdown-menu');
739        $(`.list-unstyled li.list-product-cat > ul`).addClass('list list-unstyled list-product-subnav');
740
741        // hide all lists
742        $(`.list-unstyled li:not(#${id}).list-product-cat  ul`).hide();
743        $(`.list-unstyled li:not(#${id}).list-product-cat > a`).removeClass('hover-color-mobile');
744        $(`.list-unstyled li:not(#${id}).list-product-cat > a span.glyphicon`).removeClass('revert-icon');
745
746        // open current list
747        $(`.list-unstyled li#${id}.list-product-cat > a`).toggleClass('hover-color-mobile');
748        $(`.list-unstyled li#${id}.list-product-cat > a span.glyphicon`).toggleClass('revert-icon');
749        $(`.list-unstyled li#${id}.list-product-cat > ul`).slideToggle();
750    });
751
752
753    // prevent default first element on click
754    $('.primary-main-menu-mobile li.list-product-cat > a').each(function () {
755        $(this).click(function (e) {
756            if ($(this).hasClass("dropdown-toggle")) {
757                e.preventDefault();
758            }
759        });
760    });
761
762    // prevent default first element on click
763    $('.primary-menu-mobile li.list-product-cat > a').each(function () {
764        $(this).click(function (e) {
765            if ($(this).hasClass("dropdown-toggle")) {
766                e.preventDefault();
767            }
768        });
769    });
770
771    // clone modal body and footer and append to model
772    $(`.open-modal-video-temoignage,
773    .open-modal-video-service, 
774    .open-modal-video-rse,
775    .open-modal-video-storie,
776    .open-modal-video-demarche-rse,
777    .open-modal-videotheque
778    `).on("click", function () {
779        let dataModalBody = $(this).find(".data-modal-body").html();
780        let dataModalFooter = $(this).find(".data-modal-footer").html();
781        if (dataModalBody && dataModalFooter) {
782            $(".modal-video .modal-body").empty();
783            $(".modal-video .modal-footer").empty();
784            $(".modal-video .modal-body").append(dataModalBody);
785            $(".modal-video .modal-footer").append(dataModalFooter);
786        }
787
788        $(".modal-video").modal('show');
789    });
790
791    $(".open-modal-video-media").on("click", function () {
792        $(".modal-media-video").modal('show');
793    });
794
795
796    // autoplay video success story
797    $(".modal").on('show.bs.modal', function () {
798        let iframe = $(this).find("iframe");
799        let iframeSrc = iframe.attr("iframe-src");
800        if (iframeSrc) {
801            iframe.attr("src", iframeSrc);
802        }
803
804    });
805
806    $(".modal").on('hidden.bs.modal', function () {
807        let iframe = $(this).find("iframe");
808        let iframeSrc = iframe.attr("iframe-src");
809        if (iframeSrc) {
810            iframe.attr("src", "");
811        }
812    });
813
814    // toggel Tab sticky
815    $(".open-tabs-sticky").click(function (e) {
816        e.preventDefault();
817
818        if ($(".tab-sticky").hasClass("sticky-fade-out")) {
819            $(".tab-sticky").removeClass("sticky-fade-out");
820            $(this).find(".open-sticky").hide();
821            $(this).find(".close-sticky").show();
822        } else {
823            $(".tab-sticky").addClass("sticky-fade-out");
824            $(".social-network , .bottom-panel-phone").addClass("sticky-animate-translate");
825            $(this).find(".open-sticky").show();
826            $(this).find(".close-sticky").hide();
827
828        }
829    });
830
831    // handle showing sticky buttons social media and phone
832    $(".open-social-network , .open-panel-phone").each(function () {
833        $(this).click(function (e) {
834            e.preventDefault();
835            let currentClass = $(this).attr("class");
836            if (currentClass === "open-social-network") {
837                $(".social-network").toggleClass("sticky-animate-translate");
838                if (!$(".bottom-panel-phone").hasClass("sticky-animate-translate")) {
839                    $(".bottom-panel-phone").addClass("sticky-animate-translate");
840                }
841            } else {
842                $(".bottom-panel-phone").toggleClass("sticky-animate-translate");
843                if (!$(".social-network").hasClass("sticky-animate-translate")) {
844                    $(".social-network").addClass("sticky-animate-translate");
845                }
846            }
847        })
848
849    });
850
851    // toggel box industries
852    $(".partenaires-tanger-med .row").each(function () {
853        $(this).on("click", function () {
854            if ($(this).hasClass("toggle-collapsed-ptm")) {
855                $(this).removeClass("toggle-collapsed-ptm");
856                $(".partenaires-tanger-med  .list-partenaires-info").addClass("d-none");
857                $(".partenaires-tanger-med  .partenaire-flesh-img-close").attr("style", "display:none");
858                $(".partenaires-tanger-med  .partenaire-flesh-img-open").attr("style", "display:block");
859
860
861            } else {
862                $(".partenaires-tanger-med .row").removeClass("toggle-collapsed-ptm");
863                $(this).addClass("toggle-collapsed-ptm");
864
865                $(".partenaires-tanger-med .list-partenaires-info").removeClass("d-none");
866                $(".partenaires-tanger-med .row.toggle-collapsed-ptm .partenaire-flesh-img-close").attr("style", "display:block");
867                $(".partenaires-tanger-med .row.toggle-collapsed-ptm .partenaire-flesh-img-open").attr("style", "display:none");
868            }
869        });
870    });
871
872
873    // toggel conference timeline mobile
874    $(".conference-timeline-mobile .see-outer").click(function () {
875        $(".conference-timeline-mobile .row.element-conference-timeline").toggleClass("d-none");
876
877        let textShowMore = currentLang === 'fr' ? 'Afficher plus' : currentLang === 'en' ? 'Show more' : 'قراءة المزيد';
878        let textShowLess = currentLang === 'fr' ? 'Afficher moins' : currentLang === 'en' ? 'Show less' : 'عرض أقل';
879
880        if ($(".conference-timeline-mobile .row.element-conference-timeline").hasClass("d-none")) {
881            $(this).children("span").text(textShowMore);
882        }
883        else {
884            $(this).children("span").text(textShowLess);
885        }
886    });
887
888
889    // partenaires
890    $(".partenaires .tab-figure").each(function () {
891        $(this).click(function () {
892            var dataFilter = $(this).attr("data-filter");
893            $(".partenaires .container-partenaires").removeClass("active-liste-partenaires");
894            $(`.partenaires .container-partenaires.${dataFilter}`).addClass("active-liste-partenaires");
895
896            $(".partenaires .tab-figure").removeClass("active-tab-figure");
897            $(this).addClass("active-tab-figure");
898
899            $(".partenaires .tab-figure .tab-figure-flesh-close").attr("style", "display:none");
900            $(".tab-figure .tab-figure-flesh-open").attr("style", "display:block");
901
902            $(".partenaires .tab-figure.active-tab-figure  .tab-figure-flesh-close").attr("style", "display:block");
903            $(".partenaires .tab-figure.active-tab-figure  .tab-figure-flesh-open").attr("style", "display:none");
904        });
905    });
906
907
908    $(".see-liste-partenaires").click(function () {
909        var dataIndex = $(this).attr("data-index");
910        var dataShowMore = $(this).attr("data-show-more");
911        var dataShowLless = $(this).attr("data-show-less");
912        if ($(`.partenaires .tab-partenaire-${dataIndex} .liste-partenaires .partenaire.hide`).hasClass("d-none")) {
913            $(`.partenaires .tab-partenaire-${dataIndex} .liste-partenaires .partenaire.hide`).removeClass("d-none");
914            $(this).children().text(dataShowLless);
915        } else {
916            $(`.partenaires .tab-partenaire-${dataIndex} .liste-partenaires .partenaire.hide`).addClass("d-none");
917            $(this).children().text(dataShowMore);
918        }
919
920    });
921
922
923    // navigation choose links
924    $('#site-switcher , #menu-choose-links').mouseover(function () {
925        $("#menu-choose-links").css("opacity", "1");
926        $("#menu-choose-links").css("visibility", "visible");
927        $("#menu-choose-links").css("transition", "opacity 0.4s ease-in-out");
928    });
929
930    $('#site-switcher , #menu-choose-links').mouseout(function () {
931        $("#menu-choose-links").css("opacity", "0");
932        $("#menu-choose-links").css("visibility", "hidden");
933        $("#menu-choose-links").css("transition", "opacity 0.4s ease-in-out");
934
935    });
936
937
938    // toggel list switch lang
939    $("#main-menu-responsive .dropdown-lang").click(function () {
940        $("#main-menu-responsive #list-ex-lang").toggleClass("toggel-list-lang")
941    });
942
943    // scroll to bloc by parms bloc id
944    const queryString = new URLSearchParams(window.location.search);
945    if (queryString.has('bloc-id')) {
946        let bloc_id = queryString.get("bloc-id");
947        let bloc = document.getElementById(bloc_id);
948        bloc.scrollIntoView({ behavior: "smooth", block: "center", inline: "nearest" });
949        e.preventDefault();
950    }
951
952
953    let sliderListStories = $(".slider-list-stories");
954    let sliderListStoriesFilterd = $(".slider-list-stories-filterd");
955
956
957    // handel selected tab industry on lodedd
958    if (queryString.has('tab-filter')) {
959        let tabFilter = queryString.get('tab-filter');
960        if (tabFilter === "industry-ss") {
961            handelCarouselStories(tabFilter)
962            sliderListStories.removeClass("is-lodded");
963            sliderListStoriesFilterd.addClass("is-lodded");
964            $(".list-stories .tabs-filter span").removeClass("active");
965            $(".list-stories .tabs-filter span:nth-child(2)").addClass("active")
966        }
967    }
968
969    // filter list-stories
970    $(".list-stories .tabs-filter span").each(function () {
971        $(this).click(function () {
972            $(".tabs-filter span").removeClass("active")
973            sliderListStories.removeClass("is-lodded");
974            sliderListStoriesFilterd.removeClass("is-lodded");
975            $(this).addClass('active');
976            let tabFilter = $(this).data("filter");
977            if (tabFilter != "all") {
978                handelCarouselStories(tabFilter);
979                sliderListStoriesFilterd.addClass("is-lodded");
980            } else {
981                sliderListStories.addClass("is-lodded");
982            }
983
984        })
985    });
986
987    // clone items album image and show modal
988    $(".image-album-container .album-container").each(function () {
989        $(this).on("click", function () {
990            $(".receiver-album-images").empty();
991            let carousel = $(this).find('.my-slides-data').html();
992            $(".receiver-album-images").append(carousel);
993
994            var slideIndex = 1;
995
996            // handel  slides images library
997            function handelSlidesImagesLibrary(n) {
998                var i;
999                let slides = $('.receiver-album-images .my-slides');
1000                if (n > slides.length) {
1001                    slideIndex = 1
1002                }
1003                if (n < 1) {
1004                    slideIndex = slides.length
1005                }
1006                for (i = 0; i < slides.length; i++) {
1007                    slides[i].style.display = "none";
1008                }
1009                slides[slideIndex - 1].style.display = "block";
1010                let sourceImage = slides[slideIndex - 1].getAttribute('src-image');
1011                let titreImage = slides[slideIndex - 1].getAttribute('title-image');
1012
1013
1014                $('.title-album-images').html(titreImage);
1015                $('.float-right .addthis_toolbox a').attr("href", sourceImage);
1016                $('.float-right .addthis_toolbox a').attr("title", titreImage);
1017            }
1018
1019
1020            $('.prev').click(function () {
1021                handelSlidesImagesLibrary(slideIndex += -1);
1022            });
1023
1024            $('.next').click(function () {
1025                handelSlidesImagesLibrary(slideIndex += 1);
1026            });
1027
1028            handelSlidesImagesLibrary(slideIndex);
1029            $(".modal-album-images").modal('show');
1030
1031        });
1032    });
1033
1034    // toggle videotheque => hide rest articles
1035    $(".wrapper-videotheque article:lt(4)").wrapAll("<div class='row videos-shown active'></div>");
1036    $(".wrapper-videotheque .videos-shown ~ article").wrapAll("<div class='row videos-hidden' style='display: none'></div>");
1037
1038    const showLess = $('.btn-toggel-videos').data('text');
1039    const showMore = $('.btn-toggel-videos').text();
1040
1041    $('.btn-toggel-videos').on('click', function () {
1042        let _this = $(this);
1043
1044        _this.text(function (i, text) {
1045            return text === showMore ? showLess : showMore;
1046        })
1047        _this.toggleClass('active');
1048        $('.videos-shown').toggleClass('active');
1049        $('.videos-hidden').slideToggle("slow");
1050    });
1051
1052
1053    // add filename to span input file
1054    $('input[type="file"]').each(function () {
1055
1056        $(this).change(function (e) {
1057
1058            let fileName = e.target.files[0].name;
1059            let parent = $(this).closest('.form-group');
1060            let span = parent.find('.label-form-file').children('span:first').stop(true, true);
1061            span.text(fileName);
1062
1063        });
1064    });
1065
1066    // remove seconed images
1067    $(".section-engagements noscript").remove();
1068
1069
1070    // get years on change thematique documentation
1071    $(".doc-main-content select[name='thematique']").change(function () {
1072
1073        let data = {
1074            thematique: $(this).val(),
1075        };
1076
1077        $.ajax({
1078            url: '/wp-json/docs/v1/years',
1079            type: 'GET',
1080            data: data,
1081            dataType: 'json',
1082            success: function (response) {
1083
1084                if (response.data) {
1085
1086                    let results = response.data;
1087                    let label;
1088
1089                    if (currentLang === 'fr') {
1090                        label = 'Année';
1091                    }
1092                    if (currentLang === 'en' || currentLang === 'ar') {
1093                        label = 'Year';
1094                    }
1095
1096                    let options = `<option value="">${label}</option>`;
1097
1098                    results.map(function (opt) {
1099                        options += `<option value="${opt}">${opt}</option>`;
1100                    })
1101
1102                    $('.doc-main-content select[name="date"]').html(options);
1103                }
1104
1105            },
1106            error: function (xhr, status, error) {
1107                console.log(error);
1108            }
1109        });
1110
1111    });
1112
1113    // override message popup on submit success newsletter
1114    document.addEventListener('wpcf7mailsent', function (event) {
1115
1116        let pid = event.detail.apiResponse.popup_id;
1117        if (pid != null && pid != '') {
1118
1119            if (window.location.pathname.startsWith("/en/"))
1120                title = "Your newsletter subscription has been successfully completed.";
1121
1122            swal({
1123                title: `<span>${title}</span>`
1124            })
1125        }
1126
1127    }, false);
1128
1129
1130    if (currentLang === 'en') {
1131        $('#cookie-law-info-bar .cli-bar-message a').attr('href', '/en/terms-of-use/');
1132    }
1133
1134    // handel Carouse clone and remove
1135    function handelCarouselStories(tabFilter) {
1136
1137        // remove all items in carousel
1138        let length = $(".slider-list-stories-filterd").children(".owl-stage-outer").children(".owl-stage").children(".owl-item").length
1139        if (length) {
1140            for (var i = 0; i < length; i++) {
1141                $(".slider-list-stories-filterd").trigger("remove.owl.carousel", [i])
1142                    .trigger("refresh.owl.carousel");
1143            }
1144        }
1145
1146        // add items on carousel
1147        $(`.slider-list-stories .item.${tabFilter}`).clone().each(function () {
1148            let currentElement = $(this);
1149            $(".slider-list-stories-filterd").trigger("add.owl.carousel", [currentElement]).trigger("refresh.owl.carousel");
1150        })
1151
1152        // open modal
1153        $(".list-stories").find(".open-modal-video-storie").on("click", function () {
1154            let dataModalBody = $(this).find(".data-modal-body").html();
1155            let dataModalFooter = $(this).find(".data-modal-footer").html();
1156            $(".modal-video .modal-body").empty();
1157            $(".modal-video .modal-footer ").empty();
1158            $(".modal-video .modal-body").append(dataModalBody);
1159            $(".modal-video .modal-footer").append(dataModalFooter);
1160            $(".modal-video").modal('show');
1161        })
1162    }
1163
1164});
1165
1166
1167// open menu mobile
1168function openMainMenuMobile() {
1169    $('#menu-mobile').css('width', '100%');
1170    $('#sticky-menu-bottom').removeClass('d-none');
1171}
1172
1173// close menu mobile
1174function closeMainMenuMobile() {
1175    $('#menu-mobile').css('width', '0%');
1176    $('#sticky-menu-bottom').addClass('d-none');
1177}
1178
1179// open or close our web sites
1180function openOrCloseOurWebsites() {
1181    $('#our-websites').toggleClass('w-100');
1182    $("#main-menu-responsive .sticky-menu-bottom .fa.fa-chevron-down").toggleClass('is-open');
1183    if ($('#main-menu-responsive .sticky-menu-bottom .fa.fa-chevron-down').hasClass('is-open')) {
1184        $('#main-menu-responsive .sticky-menu-bottom .fa.fa-chevron-down').css({ transform: "rotate(180deg)" });
1185    }
1186    else {
1187        $('#main-menu-responsive .sticky-menu-bottom .fa.fa-chevron-down').css({ transform: "rotate(0deg)" });
1188    }
1189}
1190
1191// close our web sites and menu
1192function closeNavAndOurWebSite() {
1193    $('#menu-mobile').css('width', '0%');
1194    $('#our-websites').removeClass('w-100');
1195    $('#main-menu-responsive .sticky-menu-bottom .fa.fa-chevron-down').css({ transform: "rotate(0deg)" });
1196    $('#sticky-menu-bottom').toggleClass('d-none');
1197}
1198
1199// handel slider geographique ports
1200function handelSliderGeoPor(i) {
1201    var owl = $('.slider-geographique-ports');
1202    owl.trigger('to.owl.carousel', [i]);
1203    owl.trigger('refresh.owl.carousel');
1204
1205    let image_port = $(`.img-port-${i + 1}`).attr("alt");
1206
1207
1208    $('area').hover(function () {
1209        $('#area-tooltip').html('<p>' + image_port + '</p>');
1210        $('#area-tooltip').show();
1211    }, function () {
1212        $('#area-tooltip').hide();
1213    });
1214
1215    $('area').mousemove(function (e) {
1216        var offsetX = -220,
1217            offsetY = -15;
1218        $('#area-tooltip').offset({ left: e.pageX + offsetX, top: e.pageY + offsetY });
1219    });
1220}
1221
1222
1223
1224$(document).ready(function () {
1225
1226    // Clone the original navbar element
1227    var clonedNav = $('.nav-governance').clone();
1228    clonedNav.addClass('-nav-sticky');
1229    clonedNav.insertAfter('.nav-governance');
1230
1231    // Add '-active' class to the first <li> element within the 'nav-governance'
1232    $(".nav-governance li:first-child").addClass('-active');
1233
1234    // Smooth scrolling
1235    $(".nav-governance a").on("click", function (e) {
1236        e.preventDefault();
1237        var target = $(this).attr("href");
1238        $("html, body").animate({
1239            scrollTop: $(target).offset().top - 50
1240        }, 800);
1241    });
1242
1243    // Define a jQuery plugin to check if an element is in the viewport
1244    $.fn.isInViewport = function () {
1245        let elementTop = $(this).offset().top;
1246        let elementBottom = elementTop + $(this).outerHeight();
1247
1248        let viewportTop = $(window).scrollTop();
1249        let viewportBottom = viewportTop + $(window).height();
1250
1251        return elementBottom > viewportTop && elementTop < viewportBottom;
1252    };
1253
1254    $(window).on('scroll', function (e) {
1255        e.preventDefault();
1256
1257        $('.section-conseil-gov').each(function () {
1258            const sectionId = $(this).attr('id');
1259
1260            if ($(this).isInViewport()) {
1261
1262                $(".nav-governance li").removeClass('-active');
1263                $(".nav-governance li").find("a[href='#" + sectionId + "']").parent().addClass("-active");
1264            }
1265        });
1266
1267        var scrollPosition = $(this).scrollTop();
1268        var navGovernance = $("nav.nav-governance:first-child");
1269        var navSticky = $(".nav-governance.-nav-sticky");
1270
1271        // If the scroll position is greater than or equal to 400 pixels
1272        if (scrollPosition >= 400) {
1273            navSticky.addClass("-nav-active");
1274            navGovernance.slideUp();
1275        } else {
1276            navSticky.removeClass("-nav-active");
1277            navGovernance.slideDown();
1278
1279        }
1280
1281
1282    });
1283
1284    
1285    const $headerCells = $('.actualite-detail-main-content table tbody tr:first-child td');
1286
1287    $('.actualite-detail-main-content tbody tr:nth-child(n+2)').each(function() {
1288        $(this).find('td').each(function(index) {
1289            $(this).attr('data-label', $headerCells.eq(index).text().trim());
1290        });
1291    });
1292    
1293});
1294
1295
1296
1297
1298
1299
1300
1301
1302

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.