PageSourceSearch

https://visittobago.gov.tt/profiles/tobago/modules/tobago_banner/js/tobago_banner.js?v=8.9.20

js visittobago.gov.tt collected 2026-10-02 10:06:31 UTC 1,622 bytes, 53 lines download raw bytes

1/**
2 * @file
3 * Defines the behavior of the tobago Banner.
4 */
5
6(function ($, Drupal, drupalSettings) {
7
8  "use strict";
9
10  /**
11   * Tobago banner behavior.
12   *
13   * @type {Drupal~behavior}
14   *
15   * @prop {Drupal~behaviorAttach} attach
16   *   If the banner is enabled, check the user's local storage to see if it
17   *   should be displayed to them.
18   */
19  Drupal.behaviors.tobagoBanner = {
20    /**
21     * Attach the tobago banner behavior.
22     *
23     * @param {object} context
24     *   The DOM context.
25     */
26    attach(context) {
27      var settings = drupalSettings.tobagoBanner;
28      var tobagoBanner = Drupal.tobagoBanner;
29
30      // If there's no local storage, bail now.
31      if (tobagoBanner.testForLocalStorage() === false) {
32        return;
33      }
34
35      var bannerLastSavedTime = settings.banner_timestamp;
36      var userLastDismissedTime = tobagoBanner.getUserLastDismissedTime();
37
38      // If the user last dismissed this banner earlier than the time the banner
39      // was last saved, then show the banner.
40      if (tobagoBanner.shouldShowBanner(bannerLastSavedTime, userLastDismissedTime)) {
41        tobagoBanner.attachBannerToBody(settings.banner_text, settings.banner_color, context);
42        tobagoBanner.adjustMessageStyling();
43        // Add the functionality for hiding the banner.
44        $('.tobago-banner__close-button button', context).click(function () {
45          $(this).closest('#tobago-banner').slideUp(200, function () {
46            $(this).remove();
47          });
48          tobagoBanner.setUserLastDismissedTime();
49        });
50      }
51    }
52  };
53}(jQuery, Drupal, drupalSettings));

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.