PageSourceSearch

https://www.fondationlaposte.org/themes/custom/laposte/src/js/scripts.js?tl03bw

js fondationlaposte.org collected 2026-10-02 07:51:41 UTC 3,655 bytes, 114 lines download raw bytes

1(function ($, Drupal, once) {
2  Drupal.behaviors.main_menu = {
3    attach: function (context, settings) {
4      const menu = $(context).find('.menu--sub');
5
6      once('main-menu-link', 'span.menu-link.has-children', context).forEach(function (element) {
7        $(element).on('click focus', function () {
8          const target = $(this).next();
9          if (target.is(':hidden')) {
10            menu.hide();
11            target.stop(true, true).slideDown('normal');
12          } else {
13            target.stop(true, true).slideUp('normal');
14          }
15        });
16      });
17
18      $('span.menu-link.is-active', context).next().stop(true, true).slideDown('normal');
19    }
20  };
21
22  Drupal.behaviors.action_list = {
23    attach: function (context, settings) {
24      const triggers = once('action-list-trigger', '.trigger', context);
25      triggers.forEach(function (trigger) {
26        $(trigger).on('click focus', function () {
27          const actionContent = $(this).siblings('.item__content');
28          if (actionContent.is(':hidden')) {
29            actionContent.stop(true, true).slideDown('normal');
30          } else {
31            actionContent.stop(true, true).slideUp('normal');
32          }
33        });
34      });
35    }
36  };
37
38  Drupal.behaviors.system_messages = {
39    attach: function (context, settings) {
40      const triggers = $(context).find('.alert__close');
41      triggers.on('click focus', function () {
42        $(this).parent().remove();
43      });
44    }
45  };
46
47  Drupal.behaviors.nav_button = {
48    attach: function (context, settings) {
49      if (!('querySelector' in document && 'addEventListener' in window)) {
50        return;
51      }
52      document.documentElement.classList.add('js-enabled');
53
54      const buttons = once('nav-button-toggle', '.toggle', context);
55      buttons.forEach(function (button) {
56        $(button).on('click', function (e) {
57          const target = document.querySelector($(this).data('target'));
58          $(this).toggleClass('is-active');
59          $(target).toggleClass('is-opened');
60          e.preventDefault();
61        });
62      });
63    }
64  };
65
66  Drupal.behaviors.newsletter = {
67    attach: function (context, settings) {
68      window.EMAIL_INVALID_MESSAGE = window.SMS_INVALID_MESSAGE = 'Information incorrecte. Veuillez réessayer.';
69      window.REQUIRED_ERROR_MESSAGE = 'Ce champ doit être rempli.';
70      window.GENERIC_INVALID_MESSAGE = 'Information incorrecte. Veuillez réessayer.';
71
72      const buttons = once('newsletter-form-call', '.form-call', context);
73      buttons.forEach(function (button) {
74        $(button).on('click focus', function () {
75          const target = document.querySelector($(this).data('target'));
76          $(this).toggle();
77          $(target).toggle();
78        });
79      });
80    }
81  };
82
83  Drupal.behaviors.svgPolyfill = {
84    attach: function (context, settings) {
85      const isIE = drupalSettings.browserStatus.isIE;
86      if (isIE) {
87        svg4everybody();
88      }
89    }
90  };
91
92  Drupal.behaviors.external_links = {
93    attach: function (context, settings) {
94      once('external-links', context.links).forEach(function (link) {
95        if (link.hostname !== window.location.hostname) {
96          $(link).attr('target', '_blank');
97        }
98      });
99    }
100  };
101
102  Drupal.behaviors.print_link = {
103    attach: function (context, settings) {
104      const targets = once('print-link', "a[title='Imprimer']", context);
105      targets.forEach(function (target) {
106        $(target).removeAttr('target').on('click', function (e) {
107          $('#main').show();
108          window.print();
109          e.preventDefault();
110        });
111      });
112    }
113  };
114})(jQuery, Drupal, once);

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.