PageSourceSearch

https://deannaminich.com/wp-content/plugins/infusionsoft-official-…/js/infusion.js?ver=1.0

js deannaminich.com collected 2026-10-02 07:05:06 UTC 9,553 bytes, 212 lines download raw bytes

1(function($) {
2    //setup some variables to use throughout
3    var isSticky = ($('.inf_infusionsoft_infusionbar').hasClass('stickytop')) ? true : false;
4    var isStickyStuck = ($('.inf_infusionsoft_infusionbar').hasClass('stickytop_stick')) ? true : false;
5    var infusion_displayed = jQuery('.inf_infusionsoft_infusionbar').length;
6    var infusion_timedelay = jQuery('.inf_infusionsoft_infusionbar.inf_infusionsoft_infusionbar_trigger_auto').data('delay');
7    var delay = '' !== infusion_timedelay ? infusion_timedelay * 1000 : 500;
8    var submit_remove = $('.inf_infusionsoft_redirect_page').data('submit_remove');
9    var $body = $('body');
10
11    if(isSticky == true){
12        $(window).on('scroll', function(){
13            if($(window).scrollTop() > 0){
14                $('.inf_infusionsoft_infusionbar').addClass('stickytop_stick');
15                $('.inf_infusionsoft_infusionbar').removeClass('stickytop');
16                if(infusion.admin_bar) {
17                    $('.inf_infusionsoft_infusionbar').css('margin-top', '32px');
18                }
19            }else{
20                $('.inf_infusionsoft_infusionbar').removeClass('stickytop_stick');
21                $('.inf_infusionsoft_infusionbar').addClass('stickytop');
22                if(infusion.admin_bar) {
23                    $('.inf_infusionsoft_infusionbar').css('margin-top', '0px');
24                }
25            }
26        });
27    }
28
29    /*---------------------------------------
30    ------------Adding heights for bar-------
31    -----------------------------------------*/
32    $(window).on('load', function () {
33        //set inital heights
34        load_delay = delay + 500;
35	//need to delay as if we don't and the bar has a delay we end up with a negative margin
36        setTimeout(function(){
37            new_height = $('.inf_infusionsoft_infusionbar').height();
38            infusion_add_padding(new_height);
39        }, load_delay);
40        replicate_text_color(delay);
41        var text_height = $('.inf_infusionsoft_infusionbar_form_header').height();
42        infusion_responsive_css(text_height);
43    });
44    
45    $(window).resize(function() {
46        new_height = $('.inf_infusionsoft_infusionbar').height();
47        infusion_add_padding(new_height);
48        var text_height = $('.inf_infusionsoft_infusionbar_form_header').height();
49        infusion_responsive_css(text_height);
50    });
51
52    function infusion_add_padding(height){
53        $('body').attr('data-inf_height', height);
54        /*---fixed header heights----*/
55        var header = $('header');
56        if($(header).css('position') == 'fixed' || $(header).css('position') == 'absolute'){
57            $(header).css('margin-top', height);
58            $(header).attr('data-infusion_height', height);
59        }
60
61        jQuery('body').children().each(function(){
62            var this_el = jQuery(this);
63            if (jQuery(this_el).css('position') == 'fixed' || jQuery(this_el).css('position') == 'absolute' ) {
64                if(!jQuery(this_el).hasClass('inf_infusionsoft_infusionbar') && jQuery(this_el).attr('id') != 'wpadminbar') {
65                    var current_padding_top_el = jQuery(this_el).css('padding-top');
66                    var new_padding_el = parseInt(current_padding_top_el.replace('px', '')) + height;
67                    jQuery(this_el).css('padding-top', height);
68                    jQuery(this_el).attr('data-infusion_height', height);
69                }
70            }
71        });
72        $('.sticky_adminbar_push').css('height', '32');
73    }
74
75    /*------------------------------------------
76     ------------removing heights for bar-------
77     ------------------------------------------*/
78
79    // triggers for closing infusion
80    jQuery('.inf_infusionsoft_redirect_page').on('click', function () {
81        var submit_remove = $('.inf_infusionsoft_redirect_page').data('submit_remove');//will be true of false to pass into remove padding to keep bar from being removed
82        if(submit_remove == true) {
83            setTimeout(
84                function () {
85                    console.log('here');
86                    infusion_remove_padding(true);
87                }, 400); //use set timeout as it is used the other closing functions
88        }
89    });
90
91    jQuery('.inf_infusionsoft_infusionbar .inf_infusionsoft_close_button').on('click', function () {
92        setTimeout(
93            function(){
94                infusion_remove_padding(true, true);
95            }, 400); //use set timeout as it is used the other closing functions
96    });
97
98    //scroll trigger to remove padding
99    if(isSticky == false) {
100        jQuery(window).scroll(function () {
101            inf_scroll_height = $('.inf_infusionsoft_infusionbar').height();
102            var scroll = $(window).scrollTop();
103            if (scroll >= inf_scroll_height) {
104                infusion_remove_padding(false);
105            } else {
106                infusion_add_padding(inf_scroll_height);
107            }
108        });
109    }
110
111    function infusion_remove_padding(remove_bar, closebtn){
112        height = $('.inf_infusionsoft_infusionbar').height(); //get height of bar
113        if( $('.infusion_consent_form') && $('.consent_error').is(":visible") ){
114            consent_height = $('.infusion_consent_form').height();
115            height = height - consent_height;
116        }
117        if( $('.consent_error') && $('.consent_error').is(":visible") ){
118            consent_error_height = $('.consent_error').height();
119            console.log(consent_error_height);
120            height = height - consent_error_height;
121        }
122        var removebar = (remove_bar == false ? false : true);
123        var header = $('header');
124        if($(header).data('infusion_height')){
125            var current_height = $(header).data('infusion_height');
126            $(header).css('margin-top', current_height - height);
127        }
128        $('.sticky_adminbar_push').css('height', '0');
129
130        $("[data-infusion_height]").each(function(){
131            var padding_to_remove = jQuery(this).data('infusion_height');
132            var current_padding = jQuery(this).css('padding-top');
133            var new_padding_el = parseInt(current_padding.replace('px', '')) - padding_to_remove;
134            $(this).css('padding-top', new_padding_el);
135        });
136
137        if(removebar == true) {
138            var redirectUrl = $('.inf_infusionsoft_submit_subscription').data('redirect_url');
139            if (!redirectUrl) { //dont want to remove if they have a redirect setup with a timer as we want the form to stick around
140                $('.inf_infusionsoft_infusionbar').remove();
141            }
142        }
143        if(closebtn ==  true){
144            $('.inf_infusionsoft_infusionbar').remove();
145        }
146    }
147
148    function replicate_text_color(delay){
149        //loop through any infusion on the page and set the color appropriately if text color has been changed in the admin editor
150        //only happens on btns as links
151        setTimeout(function(delay){
152            $('.inf_infusionsoft_infusionbar').each(function(){
153                var this_el = jQuery(this);
154                var button = jQuery(this_el).find('button'); //find our button on this form
155                var btnAsLink = jQuery(button).attr('class').match(/btnaslink/); //make sure button has link class
156                if(btnAsLink && btnAsLink.index > 0) { //if the result index from match is > 0 then we can change it, if not we won't.
157                    var barTextEl = jQuery(this_el.find('.inf_infusionsoft_form_text p span'));
158                    var textColor = barTextEl.css('color');
159                    if (textColor) {
160                        var buttonText = jQuery(this_el.find('.inf_infusionsoft_button_text'));
161                        jQuery(buttonText).attr('style', 'color: ' + textColor + ' !important; text-decoration: underline !important');
162                    }else{
163                        $('.inf_infusionsoft_button_text').attr('style', 'text-decoration: underline !important');
164                    }
165                }
166            });
167        }, delay);
168    }
169
170
171
172    /*------------------------------------------
173     -----fix css for bar on window resize------
174     ------------------------------------------*/
175
176    function infusion_responsive_css(height){
177        if(height > 50){
178            $('.inf_infusionsoft_infusionbar .inf_infusionsoft_form_text p').addClass('infusion_form_responsive');
179        }else if(height <= 50){
180            $('.inf_infusionsoft_infusionbar .inf_infusionsoft_form_text p').removeClass('infusion_form_responsive');
181        }
182    }
183
184
185    /*------------------------------------------
186     -----consent for infusion------
187     ------------------------------------------*/
188    if('.infusion_consent_form') {
189        $(".inf_infusionsoft_infusionbar_input input").keyup(function () {
190            if($(this).val().length > 0) {
191                if ($('.infusion_consent_form').hasClass('infusion_consent_closed')) {
192                    $('.infusion_consent_form').removeClass('infusion_consent_closed');
193                    $('.infusion_consent_form').addClass('infusion_consent');
194                }
195            }else{
196                $('.infusion_consent_form').removeClass('infusion_consent');
197                $('.infusion_consent_form').addClass('infusion_consent_closed');
198            }
199        });
200    }
201
202    $body.on('click', '.infusion_consent_form .accept_consent', function(){
203        if($('.infusion_consent_form .accept_consent').prop('checked')){
204            $('.consent_error').hide();
205        }
206    });
207})( jQuery );
208
209
210
211
212

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.