PageSourceSearch

https://www.b9.com.br/assets/js/b9-overlays.js?v=C8YZ0l-etI-vUXBS

js b9.com.br collected 2026-10-02 02:31:02 UTC 1,727 bytes, 44 lines download raw bytes

1/* B9 — Busca + Menu overlays: abrir/fechar via data-action, ESC, lock de scroll.
2   Convive com b9.js (que ainda escuta os mesmos data-action mas aponta para os
3   IDs antigos, agora inexistentes → no-op). */
4(function () {
5  "use strict";
6  var search = document.getElementById("b9-search");
7  var menu = document.getElementById("b9-menu");
8  var input = search ? search.querySelector(".b9search__input") : null;
9  var lastFocus = null;
10
11  function open(ov) {
12    if (!ov) return;
13    lastFocus = document.activeElement;
14    ov.classList.add("is-open");
15    document.body.classList.add("b9-locked");
16    if (ov === search && input) setTimeout(function () { input.focus(); }, 60);
17  }
18  function close(ov) {
19    if (!ov) return;
20    ov.classList.remove("is-open");
21    if (!document.querySelector(".b9ov.is-open")) document.body.classList.remove("b9-locked");
22    if (lastFocus && lastFocus.focus) lastFocus.focus();
23  }
24
25  document.addEventListener("click", function (e) {
26    var btn = e.target.closest("[data-action]");
27    if (btn) {
28      var a = btn.getAttribute("data-action");
29      if (a === "open-search") { e.preventDefault(); open(search); return; }
30      if (a === "open-menu") { e.preventDefault(); open(menu); return; }
31      if (a === "close-search") { e.preventDefault(); close(search); return; }
32      if (a === "close-menu") { e.preventDefault(); close(menu); return; }
33    }
34    if (e.target.classList && e.target.classList.contains("b9ov__scrim")) {
35      var ov = e.target.closest(".b9ov"); if (ov) close(ov);
36    }
37  });
38
39  document.addEventListener("keydown", function (e) {
40    if (e.key === "Escape") {
41      var ov = document.querySelector(".b9ov.is-open"); if (ov) close(ov);
42    }
43  });
44})();

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.