PageSourceSearch

https://www.indikaenergy.co.id/wp-content/plugins/wpcf7-redirect/b…/wpcf7-redirect-frontend-script.js?ver=1.1

js indikaenergy.co.id collected 2026-10-02 16:42:32 UTC 8,164 bytes, 203 lines download raw bytes

1var wpcf7_redirect;
2
3(function ($) {
4    function Wpcf7_redirect() {
5        this.init = function () {
6            this.wpcf7_redirect_mailsent_handler();
7        };
8
9        this.wpcf7_redirect_mailsent_handler = function () {
10
11            document.addEventListener('wpcf7mailsent', function (event) {
12
13                var form = $(event.target);
14
15                $(document.body).trigger('wpcf7r-mailsent', [event]);
16
17                if (typeof event.detail.apiResponse != 'undefined' && event.detail.apiResponse) {
18                    var apiResponse = event.detail.apiResponse;
19                    var actionDelay = 0;
20
21                    //handle api response
22                    if (typeof apiResponse.api_url_request != 'undefined' && apiResponse.api_url_request) {
23                        wpcf7_redirect.handle_api_action(apiResponse.api_url_request);
24                    }
25
26                    //handle api response
27                    if (typeof apiResponse.api_json_xml_request != 'undefined' && apiResponse.api_json_xml_request) {
28                        wpcf7_redirect.handle_api_action(apiResponse.api_json_xml_request);
29                    }
30
31                    //handle fire javascript action
32                    if (typeof apiResponse.FireScript != 'undefined' && apiResponse.FireScript) {
33                        actionDelay = typeof apiResponse.FireScript.delay_redirect != 'undefined' ? apiResponse.FireScript.delay_redirect : actionDelay;
34                        window.setTimeout(function () {
35                            wpcf7_redirect.handle_javascript_action(apiResponse.FireScript);
36                        }, actionDelay);
37                    }
38
39                    //catch and handle popup action
40                    if (typeof apiResponse.popup != 'undefined' && apiResponse.popup) {
41                        wpcf7_redirect.handle_popups(apiResponse.popup);
42                    }
43
44                    //catch redirect to paypal
45                    if (typeof apiResponse.redirect_to_paypal != 'undefined' && apiResponse.redirect_to_paypal) {
46                        actionDelay = typeof apiResponse.redirect_to_paypal.delay_redirect != 'undefined' ? apiResponse.redirect_to_paypal.delay_redirect : actionDelay;
47                        window.setTimeout(function () {
48                            wpcf7_redirect.handle_redirect_action(apiResponse.redirect_to_paypal);
49                        }, actionDelay);
50                    }
51
52                    //catch redirect action
53                    if (typeof apiResponse.redirect != 'undefined' && apiResponse.redirect) {
54                        actionDelay = typeof apiResponse.redirect.delay_redirect != 'undefined' ? apiResponse.redirect.delay_redirect : actionDelay;
55                        window.setTimeout(function () {
56                            wpcf7_redirect.handle_redirect_action(apiResponse.redirect);
57                        }, actionDelay);
58                    }
59                }
60            }, false);
61
62            document.addEventListener('wpcf7invalid', function (event) {
63
64                var form = $(event.target);
65
66                $(document.body).trigger('wpcf7r-invalid', [event]);
67
68                if (typeof event.detail.apiResponse != 'undefined' && event.detail.apiResponse) {
69                    response = event.detail.apiResponse;
70                    if (response.invalidFields) {
71                        //support for multistep by ninja
72                        wpcf7_redirect.ninja_multistep_mov_to_invalid_tab(event, response);
73                    }
74                }
75            });
76        };
77
78        this.handle_popups = function (popups) {
79
80            $(document.body).trigger('wpcf7r-before-open-popup', [event]);
81
82            $.each(popups, function (k, popup) {
83
84                var $new_elem = $(popup['popup-template']);
85
86                $(document.body).append($new_elem);
87                $(document.body).addClass(popup['template-name']);
88
89                window.setTimeout(function () {
90                    $(document.body).addClass('modal-popup-open');
91                    $new_elem.addClass('is-open');
92                }, 1000);
93
94                $new_elem.find('.close-button').on('click', function () {
95
96                    $new_elem.removeClass('is-open').addClass('fade');
97
98                    $(document.body).removeClass('modal-popup-open');
99
100                    window.setTimeout(function () {
101                        $('.wpcf7r-modal').remove();
102                        $(document.body).trigger('wpcf7r-popup-removed', [$new_elem]);
103                    }, 4000);
104                });
105
106                $(document.body).trigger('wpcf7r-popup-appended', [$new_elem]);
107            });
108
109        }
110
111        this.handle_api_action = function (send_to_api_result, request) {
112
113            $.each(send_to_api_result, function (k, v) {
114                if (!v.result_javascript) {
115                    return;
116                }
117                response = typeof v.api_response != 'undefined' ? v.api_response : '';
118                request = typeof v.request != 'undefined' ? v.request : '';
119                eval(v.result_javascript);
120            });
121        };
122
123        this.ninja_multistep_mov_to_invalid_tab = function (event, response) {
124
125            if ($('.fieldset-cf7mls-wrapper').length) {
126                var form = $(event.target);
127                var first_invalid_field = response.invalidFields[0];
128                var parent_step = $(first_invalid_field.into).parents('fieldset');
129
130                form.find('.fieldset-cf7mls').removeClass('cf7mls_current_fs');
131                parent_step.addClass('cf7mls_current_fs').removeClass('cf7mls_back_fs');
132                if (form.find('.cf7mls_progress_bar').length) {
133                    form.find('.cf7mls_progress_bar li').eq(form.find("fieldset.fieldset-cf7mls").index(previous_fs)).addClass("current");
134                    form.find('.cf7mls_progress_bar li').eq(form.find("fieldset.fieldset-cf7mls").index(current_fs)).removeClass("active current");
135                }
136            }
137        }
138
139        this.handle_redirect_action = function (redirect) {
140
141            $(document.body).trigger('wpcf7r-handle_redirect_action', [redirect]);
142
143            $.each(redirect, function (k, v) {
144                var delay = typeof v.delay != 'undefined' && v.delay ? v.delay : '';
145
146                delay = delay * 1000;
147
148                window.setTimeout(function (v) {
149                    var redirect_url = typeof v.redirect_url != 'undefined' && v.redirect_url ? v.redirect_url : '';
150                    var type = typeof v.type != 'undefined' && v.type ? v.type : '';
151
152                    if (typeof v.form != 'undefined' && v.form) {
153                        $('body').append(v.form);
154                        $('#cf7r-result-form').submit();
155                    } else {
156
157                        if (redirect_url && type == 'redirect') {
158                            window.location = redirect_url;
159                        } else if (redirect_url && type == 'new_tab') {
160                            window.open(redirect_url);
161                        }
162                    }
163                }, delay, v);
164
165            });
166
167        };
168
169        this.handle_javascript_action = function (scripts) {
170
171            $(document.body).trigger('wpcf7r-handle_javascript_action', [scripts]);
172
173            $.each(scripts, function (k, script) {
174                eval(script); //not using user input
175            });
176
177        };
178
179        this.htmlspecialchars_decode = function (string) {
180
181            var map = {
182                '&': '&',
183                '&': "&",
184                '&lt;': '<',
185                '&gt;': '>',
186                '&quot;': '"',
187                '&#039;': "'",
188                '&#8217;': "’",
189                '&#8216;': "‘",
190                '&#8211;': "–",
191                '&#8212;': "—",
192                '&#8230;': "…",
193                '&#8221;': '”'
194            };
195
196            return string.replace(/\&[\w\d\#]{2,5}\;/g, function (m) { return map[m]; });
197        };
198
199        this.init();
200    }
201    
202    wpcf7_redirect = new Wpcf7_redirect();
203})(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.