PageSourceSearch

https://subrosapi.com/wp-admin/admin-ajax.php?action=firedrum_public_modal_js&ver=1.72&ver=1.72

js subrosapi.com collected 2026-09-29 08:58:12 UTC 4,474 bytes, 114 lines download raw bytes

1( function($) {
2    function retrieve_modal_forms(retry_count) {
3        $.ajax( 'https://subrosapi.com/wp-admin/admin-ajax.php', {
4            method: 'POST',
5            data: {
6                action: 'firedrum_get_modal_forms'
7            },
8            success: function(data, textStatus, jqXHR) {
9                if ( data.forms ) {
10                    $( function() {
11                        initialize_modal_forms( data.forms, $( '#firedrum_modal_template' ).html() );
12                    } );
13                }
14            },
15            error: function(jqXHR, textStatus, errorThrown) {
16                if ( --retry_count >= 0) {
17                    retrieve_modal_forms( retry_count );
18                } else {
19                    initialization_complete();
20                }
21            }
22        } );
23    }
24
25    function initialize_modal_forms(forms, template) {
26        for ( var i = 0; i < forms.length; i++ ) {
27            var form = forms[i];
28            if ( parseInt( form.cookie_duration, 10 ) === 0 || typeof $.cookie( 'firedrum_modal_' + form.id ) === 'undefined' ) {
29                var pageCtx = window.firedrum_page_context || {};
30                switch ( form.location ) {
31                    case 'everywhere':
32                        initialize_modal_form( form, $( template ) );
33                        break;
34                    case 'front_page':
35                        if ( pageCtx.is_front_page ) {
36                            initialize_modal_form( form, $( template ) );
37                        }
38                        break;
39                    case 'specific_pages':
40                        if ( pageCtx.page_id && form.location_page_ids && form.location_page_ids.indexOf( String( pageCtx.page_id ) ) !== -1 ) {
41                            initialize_modal_form( form, $( template ) );
42                        }
43                        break;
44                    case 'woocommerce':
45                        if ( $( document.body ).hasClass( 'woocommerce' ) ) {
46                            initialize_modal_form( form, $( template ) );
47                        }
48                        break;
49                }
50            }
51        }
52
53        initialization_complete();
54    }
55
56    function initialize_modal_form(form, $template) {
57        $( $template[0] ).attr( {
58            'id': 'firedrum_modal_form_' + form.id,
59            'data-modal-id': form.id
60        } ).append( form.content );
61
62        $( document.body ).append( $template );
63
64        switch ( form.trigger ) {
65            case 'immediately':
66                open_modal( form.id, form.cookie_duration );
67                break;
68            case 'delayed':
69                setTimeout( open_modal.bind( undefined, form.id, form.cookie_duration ), form.trigger_delay * 1000 );
70                break;
71            case 'exit-intent':
72                $( document ).on( 'mouseleave', exit_intent_handler.bind( undefined, form.id, form.cookie_duration ) );
73                break;
74            case 'scroll':
75                var scrollTarget = parseInt( form.trigger_scroll_percent, 10 ) || 50;
76                $( window ).on( 'scroll.firedrum_modal_' + form.id, function() {
77                    var scrolled = ( $( window ).scrollTop() / ( $( document ).height() - $( window ).height() ) ) * 100;
78                    if ( scrolled >= scrollTarget ) {
79                        $( window ).off( 'scroll.firedrum_modal_' + form.id );
80                        open_modal( form.id, form.cookie_duration );
81                    }
82                } );
83                break;
84            default:
85                break;
86        }
87    }
88
89    function exit_intent_handler(formID, cookieDuration, event) {
90        if ( event.clientY < 0 ) {
91            open_modal( formID, cookieDuration );
92        }
93    }
94
95    function open_modal(formID, cookieDuration) {
96        var duration = parseInt( cookieDuration, 10 );
97        if ( duration > 0 ) {
98            $.cookie( 'firedrum_modal_' + formID, '1', { path: '/', expires: duration } );
99        }
100
101        $.magnificPopup.open( {
102            items: {
103                src: '#firedrum_modal_form_' + formID,
104                type: 'inline'
105            }
106        } );
107    }
108
109    function initialization_complete() {
110        $( document.body ).trigger( 'firedrum:modals_initialized' );
111    }
112
113    retrieve_modal_forms( 3 );
114} )( jQuery );

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.