PageSourceSearch

https://www.mytotalretail.com/wp-content/themes/napco-editorial/js/overlay.js?ver=1785328316

js mytotalretail.com collected 2026-10-01 07:16:22 UTC 3,609 bytes, 134 lines download raw bytes

1jQuery(document).ready(function($) {
2  function find_max_dimensions(parent, children) {
3    var widest = 0;
4    var tallest = 0;
5    var width = 0;
6    var height = 0;
7    var widest_ad_element = false;
8    var tallest_ad_element = false;
9
10    $.each(children, function(i, v) {
11      // find the widest and tallest element
12      parent.find(v).each(function() {
13        width = $(this).width();
14        height = $(this).height();
15
16        if (width > widest) {
17          widest = width;
18          widest_ad_element = $(this);
19        }
20        if (height > tallest) {
21          tallest = height;
22          tallest_ad_element = $(this);
23        }
24      });
25    });
26
27    data = {
28      width: parseInt(widest) + 'px',
29      height: parseInt(tallest) + 'px',
30      widest_ad_element: widest_ad_element,
31      tallest_ad_element: tallest_ad_element
32    }
33
34    return data;
35  }//find_max_dimensions()
36
37  /**
38   * Run the animation to move the overlay from offscreen to center.
39   */
40  window.overlay_animate = function($el, data) {
41    var data = data || {};
42    var defaults = {
43      delay: 2500,
44      speed: 500
45    }
46
47    var data = $.extend(defaults, data);
48
49    //element vars
50    var el_width = $el.width(); //hold this for later
51    var el_top = $el[0].getBoundingClientRect().top;
52    var el_height = $el.outerHeight();
53    var el_bottom = el_top + el_height;
54
55    //window height
56    var win_height = $(window).height();
57
58    //calculate how much to move
59    var pushdown = ((win_height - el_height) / 2) + el_bottom;
60
61    //set to zero in order to animate it
62    $el.width(0);
63
64    //push it down
65    $el.css('margin-top', pushdown + 'px');
66
67    //bring it back up and expand it
68    $el.delay(data.delay).animate({
69      marginTop: +el_top,
70      width: el_width
71    }, data.speed, 'swing');
72
73    //keep it centered on resize
74    $(window).on('resize', function() {
75      $el.css('margin-top', 'auto');
76    });
77  };//$.fn.overlay_animate
78
79
80  //'google_ads_iframe' matches when DFP async tags are running.
81  var $overlay_ad_element = ($('#overlay-modal div[id^="google_ads_iframe_"] iframe').length)
82          ? $('#overlay-modal div[id^="google_ads_iframe_"] iframe').contents().find('.napco-overlay')
83          : $('#overlay-modal .napco-overlay');
84  var i = 20;
85  var t = $('#overlay-counter').text();
86  var closeOverlay = function() {
87    $('#overlay-mask, #overlay-modal').addClass('invisible');
88  };
89  var openOverlay = function() {
90    
91    $('#overlay-mask, #overlay-modal').removeClass('invisible');
92
93    //get the size information
94    dimension_data = find_max_dimensions($overlay_ad_element, ['img', 'object', 'iframe', 'div']);
95
96    //set the modal size
97    $('#overlay-modal, #overlay-modal iframe').css({
98      width: dimension_data.width,
99      height: dimension_data.height
100    });
101
102    //change the modal bg color?
103    custom_bgcolor = $overlay_ad_element.attr('data-bgcolor');
104    if (custom_bgcolor != '') {
105      $('#overlay-mask').css('background', custom_bgcolor);
106    }
107
108    //animate the opening
109    overlay_animate(jQuery("#overlay-modal"), {
110      delay: 10,
111      speed: 1000
112    });
113  };
114
115  //run the interval
116  var iid = setInterval(function() {
117    if (!--i || $overlay_ad_element.length) {
118      clearInterval(iid);
119      if ($overlay_ad_element.length) {
120        setTimeout(function(){
121          openOverlay();
122        }, parseInt($("#overlay-modal").data('delay'))*1000);
123      }
124    }
125  }, 250);
126
127  //close modal controls
128  $('#overlay-close').on('click', closeOverlay);
129  $(document).keyup(function(e) {
130    if (e.keyCode == 27) {
131      closeOverlay();
132    }
133  });
134});

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.