PageSourceSearch

https://www.injury.com/modules/custom/injury_com/injury_com_blocks/js/branding.js?tmdxxj

js injury.com collected 2026-10-08 12:01:05 UTC 2,325 bytes, 69 lines download raw bytes

1(function ($, Drupal, drupalSettings, once, Cookies) {
2  Drupal.behaviors.ftpBlocksBranding = {
3    attach: function attach(context, settings) {
4      once('branding-processed', 'header', context).forEach(function (header) {
5        // First check if this branding swap is enabled.
6        const enabled = drupalSettings.brandingSwap.enabled;
7        if (!enabled) {
8          return;
9        }
10
11        let userRegion = Cookies.get('ureg');
12
13        if (userRegion === undefined) {
14          const url = 'https://www.forthepeople.com/cdn-loc';
15          fetch(url)
16            .then((resp) => resp.json())
17            .then(function (data) {
18
19              // Set region as a cookie.
20              Cookies.set('ureg', data["client.geo.region"]);
21            })
22            .catch(function (error) {
23              // If there was an error fetching user location, do nothing.
24              console.log(error);
25            });
26
27        }
28
29        const allowAllRegions = drupalSettings.brandingSwap.allowAllRegions;
30        const allowedRegions = drupalSettings.brandingSwap.allowedRegions;
31
32        if (allowAllRegions) {
33          // Provide some useful info to the console.
34          console.log('Branding swap enabled for ALL locations');
35          // Target the logos.
36          const defaultLogo = $('.logo-default')
37          const altLogo = $('.logo-mm-pa')
38
39          defaultLogo.addClass('d-none');
40          altLogo.removeClass('d-none');
41        }
42
43        userRegion = Cookies.get('ureg');
44
45        if (!allowAllRegions && userRegion !== undefined) {
46          console.log('Branding swap enabled for one or more locations', allowedRegions);
47
48          // Target the logos.
49          const defaultLogo = $('.logo-default')
50          const altLogo = $('.logo-mm-pa')
51
52          // Check if the user region is in the allow list of regions.
53          if ($.inArray(userRegion, allowedRegions) !== -1) {
54            // Swap logos, but only if theres a logo to swap.
55            if (altLogo.length != 0) {
56              defaultLogo.addClass('d-none');
57              altLogo.removeClass('d-none');
58            }
59            else {
60              console.log('Alt branding logo not found, nothing to swap')
61            }
62          }
63
64        }
65      })
66    }
67  };
68
69})(jQuery, Drupal, drupalSettings, once, window.Cookies);

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.