PageSourceSearch

https://andrewowen.net/plugins/infima/js/dropdowns.min.js

js andrewowen.net collected 2026-09-28 12:54:58 UTC 1,009 bytes, 33 lines download raw bytes

1/**
2 * Copyright (c) Facebook, Inc. and its affiliates.
3 *
4 * This source code is licensed under the MIT license found in the
5 * LICENSE file in the root directory of this source tree.
6 */
7
8function dropdowns($elements) {
9  $elements.forEach(($dropdown) => {
10    if ($dropdown.classList.contains('dropdown--hoverable')) {
11      return;
12    }
13
14    const $toggle = $dropdown.querySelector('[data-toggle="dropdown"]');
15    $toggle.addEventListener('click', (e) => {
16      function dismissDropdown() {
17        $toggle.classList.remove('button--active');
18        $dropdown.classList.remove('dropdown--show');
19        document.removeEventListener('click', dismissDropdown);
20      }
21
22      if (!$dropdown.classList.contains('dropdown--show')) {
23        $toggle.classList.add('button--active');
24        $dropdown.classList.add('dropdown--show');
25        setTimeout(() => {
26          document.addEventListener('click', dismissDropdown);
27        }, 0);
28      } else {
29        dismissDropdown();
30      }
31    });
32  });
33}

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.