PageSourceSearch

https://lundmortgage.com/templates/10/themes/leadpops/js/supercalc-cta-iframe-lightbox-opener.js?ver=3.1.3

js lundmortgage.com collected 2026-10-06 13:44:37 UTC 2,698 bytes, 98 lines download raw bytes

1
2// requestAnimationFrame polyfill starts here
3(function () {
4    var lastTime = 0;
5    var vendors = ['ms', 'moz', 'webkit', 'o'];
6    for (var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) {
7        window.requestAnimationFrame = window[vendors[x] + 'RequestAnimationFrame'];
8        window.cancelAnimationFrame = window[vendors[x] + 'CancelAnimationFrame'] ||
9            window[vendors[x] + 'CancelRequestAnimationFrame'];
10    }
11    if (!window.requestAnimationFrame)
12        window.requestAnimationFrame = function (callback, element) {
13            var currTime = new Date().getTime();
14            var timeToCall = Math.max(0, 16 - (currTime - lastTime));
15            var id = window.setTimeout(function () {
16                    callback(currTime + timeToCall);
17                },
18                timeToCall);
19            lastTime = currTime + timeToCall;
20            return id;
21        };
22    if (!window.cancelAnimationFrame)
23        window.cancelAnimationFrame = function (id) {
24            clearTimeout(id);
25        };
26}());
27// requestAnimationFrame polyfill ends here
28
29
30jQuery(document).ready(function(){
31    var $ = jQuery;
32
33    if(!window.LP || !LP.initializedIframe) return;
34
35    if(LP.checkMobile()) return;
36
37    var $iframe = $('.lp-supercalc,.cal_iframe');
38
39    if(!$iframe.length) return;
40
41    try{
42        var childIframe = $iframe.get(0).contentWindow;
43
44        if(!childIframe.postMessage) return;
45                   
46    } catch (e){
47        return;
48    }
49    
50
51    var $body = $('body');
52
53    var $element = $('#supercalc-cta-btn-lightbox-link');
54    
55    if(! $element.length){
56        $element = $('<a data-fancybox-iframe="1" id="supercalc-cta-btn-lightbox-link" style="display:none" data-type="iframe" href="javascript:" class="lp_fancybox_iframe"></a>');
57    }
58
59    $body.append($element);
60
61    LP.initializedIframe();
62
63    function messageHandler(e){
64
65        var data = e.data;
66
67        if(data == 'lpSupercalcPingParentListner'){
68            requestAnimationFrame(function (){
69                childIframe.postMessage('lpSupercalcParentListnerPresent', '*');   
70            });
71            return;
72        }
73    
74        var regex = /\s*lpSupercalcParentOpenFunnel\=(.+)/;
75    
76        var match = data.match(regex);
77    
78        if(!match) return;
79    
80        var url = match[1];
81    
82        var domainRegex = /\s*https?\:\/\/([^\/]+)/i;
83    
84        var urlMatch = url.match(domainRegex);
85    
86        if(urlMatch){
87            url = urlMatch[1];
88        }
89    
90        $element.attr('data-src', window.location.origin + '/funnels/' + url);
91
92        $element.trigger('click');
93    }
94
95    window.addEventListener('message', messageHandler);
96});
97
98

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.