PageSourceSearch

https://apis.ac.uk/themes/custom/ceh/js/ceh-custom.js?v=1.x

js apis.ac.uk collected 2026-10-02 14:41:45 UTC 2,028 bytes, 66 lines download raw bytes

1(function ($, Drupal, once) {
2  /**
3   * Behavior to implement responsive image in header.
4   */
5  Drupal.behaviors.cehResponsiveImgBillboard = {
6    attach: function (context, settings) {
7      $(once('.image-billboard.with-image-bg','.background img cehResponsiveImgBillboard',context)).each(function () {
8        var $wrapper = $('.image-billboard.with-image-bg'),
9            $bgWrapper = $wrapper.find('.background'),
10            $img,
11            $imgSrc;
12        if ($wrapper.length && $bgWrapper.length) {
13          $img = $bgWrapper.find('img');
14          if ($img.length) {
15            $imgSrc = $img.attr('src');
16            $bgWrapper.css('backgroundImage', 'url(' + $imgSrc + ')').addClass('js-ceh-bg-image');
17          }
18        }
19      });
20    }
21  };
22
23  /**
24   * Behavior to clean empty tags inserted by editors in content.
25   */
26  Drupal.behaviors.cehEmptyPCleaner = {
27    attach: function (context, settings) {
28      $('p, span, a, li, h1, h2, h3, h4, h5, h6').filter(function(){
29        return this.innerHTML == ' ';
30      }).remove();
31    }
32  };
33
34  /**
35   * Behaviors to use the keyboard with the main menu.
36   */
37  Drupal.behaviors.cehAccessibilityMainMenu = {
38    attach: function (context, settings) {
39      const menu_links = $(".menu", ".masthead").find("a");
40      const topLevelLinks = $(".menu-link", ".masthead");
41      const leafLinks = $(".leaf-link", ".masthead");
42
43      topLevelLinks.each(function() {
44        $(this).on("focus", function() {
45          topLevelLinks.parent().removeClass('focus');
46          $(this).parent().addClass("focus");
47        });
48      });
49
50      $(menu_links).each(function() {
51        $(this).on("focus", function() {
52          menu_links.removeClass("focus-link");
53          $(this).addClass("focus-link");
54        });
55      });
56
57      leafLinks.each(function() {
58        // just remove opened dropdowns.
59        $(this).on("focus", function() {
60          topLevelLinks.parent().removeClass('focus');
61        });
62      });
63    }
64  };
65
66})(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.