PageSourceSearch

https://www.iisd.org/themes/custom/iisd/assets/js/header-social.js?tm2q5n

js iisd.org collected 2026-10-01 08:37:52 UTC 1,254 bytes, 50 lines download raw bytes

1/**
2 * Header social
3 */
4(function ($, Drupal,once) {
5
6  'use strict';
7
8  Drupal.behaviors.headerSocial = {
9    attach: function (context, settings) {
10      const $headerSocial = $(once('header-social', '.js-header-social', context));
11      const $showButton = $(once('header-social-open', '.js-header-social-open', context));
12      const $closeButton = $(once('header-social-close', '.js-header-social-close', context));
13
14      $showButton.on('click', (e) => {
15        e.preventDefault();
16
17        toggleOpen(e);
18      });
19
20      $closeButton.on('click', (e) => {
21        e.preventDefault();
22
23        toggleClose(e);
24      });
25
26      // Escape Key
27      $(document).keyup((e) => {
28        if (e.keyCode === 27) {
29          toggleClose(e);
30        }
31      });
32
33      function toggleOpen(e) {
34        e.preventDefault();
35        const $elem = $(e.currentTarget);
36
37        $elem.toggleClass('is-clicked');
38        $headerSocial.toggleClass('is-visible').removeClass('is-closed');
39      }
40
41      function toggleClose(e) {
42        if ($showButton.hasClass('is-clicked')) {
43          $headerSocial.addClass('is-closed').removeClass('is-visible');
44          $showButton.removeClass('is-clicked').focus();
45        }
46      }
47
48    }
49  };
50})(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.