PageSourceSearch

https://www.mta.info/themes/custom/bootstrap_mta/js/external_site.js?tlqoj8

js mta.info collected 2026-09-24 07:51:38 UTC 2,646 bytes, 94 lines download raw bytes

1(function ($, Drupal) {
2  'use strict';
3
4  var defaults = {
5    screenWidth: $(window).width(),
6    breakpoints: {
7      mobile: 767,
8      tablet: 959
9    }
10  };
11
12  function bindEvents() {
13    loadResponsiveImage();
14    loadSubmenus();
15    translate();
16  }
17
18  function loadResponsiveImage() {
19    if (navigator.userAgent.search("MSIE") >= 0 ||
20          (!(window.ActiveXObject) && "ActiveXObject" in window) ||
21          navigator.userAgent.indexOf("Edge") >= 0 ||
22          (navigator.userAgent.search("Safari") >= 0 && navigator.userAgent.search("Chrome") < 0) ||
23            navigator.userAgent.search("Opera") >= 0) {
24      //code goes here
25      var arrayPictures = $('body').find('picture');
26      changeImage(arrayPictures);
27
28      $(window).resize(function() {
29        defaults.screenWidth = $(window).width();
30        changeImage(arrayPictures);
31      });
32    }
33
34    function changeImage(arrayPictures) {
35      if (defaults.screenWidth <= defaults.breakpoints.mobile) {
36        loadNewImage(arrayPictures, 'imgMobile');
37
38      } else if (defaults.screenWidth <= defaults.breakpoints.tablet) {
39        loadNewImage(arrayPictures, 'imgTablet');
40
41      } else {
42        loadNewImage(arrayPictures, 'imgDesktop');
43      }
44    }
45
46    function loadNewImage(arrayPictures, target) {
47      $.each(arrayPictures, function() {
48        var imgBox = $(this).find('img');
49
50        imgBox.attr('src', imgBox.data(target));
51      });
52    }
53  }
54
55  function loadSubmenus() {
56    $('.wrapper-menu .dropdown').on('click', function() {
57      if (defaults.screenWidth > defaults.breakpoints.tablet) {
58        $(this).find('.bg-submenu').css('height', $(this).find('.dropdown-menu').css('height'));
59      } else {
60        $('.bg-submenu-mobile').css('height', $('.menu.nav').css('height'));
61      }
62    });
63  }
64
65  function translate() {
66    $('body').on('DOMSubtreeModified', '#google_translate_element2', function(){
67      if($('#goog-gt-tt').length > 0) {
68        $('#goog-gt-tt').remove();
69      }
70    });
71  }
72
73  Drupal.behaviors.mtaExternalSite = {
74    attach: function(context, settings) {
75      var externalLinks = $('a.mta-external-site'),
76          textExternal = '';
77
78      $.each(externalLinks, function() {
79        var $this = $(this);
80
81        if ($this.find('.link-title').length > 0) {
82          textExternal = $this.find('.link-title').text();
83        } else {
84          textExternal = $this.text();
85        }
86
87        $this.attr('aria-label', 'Click to open a confirmation modal to open link ' + textExternal + ' in a new tab').attr('aria-hidden', false).attr('role', 'button');
88      });
89
90      bindEvents();
91    }
92  }
93
94}(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.