PageSourceSearch

https://cms.cern/themes/custom/cern-theme/js/anchor-fix.js?tghma4

js cms.cern collected 2026-10-02 03:05:37 UTC 981 bytes, 32 lines download raw bytes

1(function ($, Drupal) {
2  "use strict";
3
4  function offsetAnchor() {
5    if (location.hash.length !== 0) {
6      let scrollHeight = $('header[role="banner"]').height();
7      // toolbar-tray is-active toolbar-tray-horizontal
8      let toolbarTray = $(".toolbar-tray-horizontal.is-active");
9      let adminToolbar = $("#toolbar-bar");
10      let cernToolbar = $("#cern-toolbar");
11
12      // if admin toolbar exists
13      if (adminToolbar.length) {
14        scrollHeight += adminToolbar.height();
15      }
16      // if admin toolbar tray is open
17      if (toolbarTray.length) {
18        scrollHeight += toolbarTray.height();
19      }
20      // if cern toolbar is visible
21      if ($("body").hasClass("sticky-header") === false) {
22        scrollHeight += cernToolbar.height() + 50;
23      }
24
25      window.scrollTo(window.scrollX, window.scrollY - scrollHeight);
26    }
27  }
28  $(window).on("hashchange", () => {
29    offsetAnchor();
30  });
31  window.setTimeout(offsetAnchor, 0);
32})(jQuery, Drupal);

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.