PageSourceSearch

https://smartmechatronics.de/wp-content/plugins/subscribe-to-unlock/js/stu-frontend.js?ver=2.0.6

js smartmechatronics.de collected 2026-10-05 04:53:24 UTC 10,270 bytes, 249 lines download raw bytes

1jQuery(document).ready(function ($) {
2    "use strict";
3    var countdown_timer = '';
4
5    function stu_setCookie(cname, cvalue, exdays) {
6        var d = new Date();
7        d.setTime(d.getTime() + parseFloat(exdays));
8        var expires = "expires=" + d.toUTCString();
9        document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/";
10        return true;
11    }
12
13    function stu_getCookie(cname) {
14        var name = cname + "=";
15        var decodedCookie = decodeURIComponent(document.cookie);
16        var ca = decodedCookie.split(';');
17        for (var i = 0; i < ca.length; i++) {
18            var c = ca[i];
19            while (c.charAt(0) == ' ') {
20                c = c.substring(1);
21            }
22            if (c.indexOf(name) == 0) {
23                return c.substring(name.length, c.length);
24            }
25        }
26        return "";
27    }
28
29    function closePageLockPopup() {
30        if ($('.stu-countdown-popup').length > 0 || $('.stu-delay-popup').length > 0 || $('.stu-popup-innerwrap ').length > 0) {
31            $('.stu-popup-innerwrap').fadeOut(500);
32        }
33    }
34
35    function unlock_by_js() {
36        if ($('.stu-popup-innerwrap').length > 0 && stu_getCookie('stu_unlock_check') == 'yes') {
37            $('.stu-popup-innerwrap').remove();
38        }
39        if ($('.stu-lock-content').length > 0 && stu_getCookie('stu_unlock_check') == 'yes') {
40            $('.stu-lock-content').show();
41        }
42        if ($('.stu-blur-overlay').length > 0 && stu_getCookie('stu_unlock_check') == 'yes') {
43            $('.stu-blur-overlay').remove();
44            $('.stu-content-locked').removeClass('stu-content-locked');
45        }
46    }
47    /**
48    * Scrolls to the first error of the form
49    *
50    */
51    function stu_scroll_to_error(form) {
52        form.find('.stu-error-highlight').each(function () {
53            var in_selector = $(this);
54            $('html,body').animate({
55                scrollTop: in_selector.closest('div').offset().top - 150
56            },
57                'slow');
58            return false;
59
60        });
61
62    }
63    /**
64     * Form Submission
65     * 
66     * @since 1.0.0
67     */
68    $('body').on('submit', '.stu-subscription-form', function (e) {
69        e.preventDefault();
70        var selector = $(this);
71        var form_alias = $(this).data('form-alias');
72        var form_data = $(this).serialize();
73        var expiration_time = $(this).data('expiration-time')
74        $.ajax({
75            type: 'post',
76            url: stu_frontend_obj.ajax_url,
77            data: {
78                form_data: form_data,
79                _wpnonce: stu_frontend_obj.ajax_nonce,
80                action: 'stu_form_process_action',
81                form_alias: form_alias
82            },
83            beforeSend: function (xhr) {
84                selector.find('.stu-form-message').slideUp(500);
85                selector.find('.stu-form-loader-wraper').show();
86            },
87            success: function (res) {
88                selector.find('.stu-form-loader-wraper').hide();
89                res = $.parseJSON(res);
90                if (res.status == 200) {
91                    selector[0].reset();
92                    if (selector.find('#g-recaptcha-response').length > 0) {
93                        grecaptcha.reset();
94                    }
95                    if (res.verification_type != 'none') {
96                        if (res.verification_type == 'link') {
97                            selector.find('.stu-form-message').removeClass('stu-error').addClass('stu-success').html('<span>' + res.message + '</span>').slideDown(500);
98                        } else {
99                            selector.hide();
100                            selector.parent().find('.stu-unlock-form-wrap').show().data('unlock-key', res.unlock_key);
101                        }
102                    } else {
103                        selector.closest('.stu-main-outer-wrap').find('.stu-blur-overlay').fadeOut(200, function () {
104                            selector.closest('.stu-main-outer-wrap').removeClass('stu-content-locked').addClass('stu-content-unlocked');
105                            if (!selector.closest('.stu-main-outer-wrap').find('.stu-lock-content').is(':visible')) {
106
107                                selector.closest('.stu-main-outer-wrap').find('.stu-lock-content').show();
108                            }
109                            stu_setCookie('stu_unlock_check', 'yes', expiration_time);
110                            closePageLockPopup();
111                            $(this).remove();
112                        });
113                    }
114                } else {
115                    /*
116                    selector.find('.stu-form-message').removeClass('stu-success').addClass('stu-error').html('<span>' + res.message + '</span>').slideDown(500);
117                    */
118                    selector.find('.stu-form-message').removeClass('stu-success').addClass('stu-error').html(res.message).slideDown(500);
119                    selector.animate({ scrollTop: selector.prop("scrollHeight") }, 1000);
120                    if (res.data.error_keys) {
121                        var error_keys = res.data.error_keys;
122                        for (var i = 0; i <= error_keys.length; i++) {
123                            selector.find('*[data-field-key="' + error_keys[i] + '"]').addClass('stu-error-highlight');
124                            setTimeout(function () {
125                                stu_scroll_to_error(selector);
126                                if (selector.find('#g-recaptcha-response').length > 0) {
127                                    grecaptcha.reset();
128                                }
129                            }, 1000);
130
131                        }
132                    }
133                }
134            }
135        });
136    });
137
138    $('body').on('click', '.stu-unlock-button', function () {
139        var selector = $(this);
140        var unlock_key = $(this).closest('.stu-unlock-form-wrap').data('unlock-key');
141        var unlock_code = $(this).closest('.stu-unlock-form-wrap').find('.stu-unlock-code-field').val();
142        var form_alias = $(this).closest('.stu-form-wrap').find('.stu-subscription-form').data('form-alias');
143        var expiration_time = $(this).closest('.stu-form-wrap').find('.stu-subscription-form').data('expiration-time');
144
145        unlock_code = unlock_code.trim();
146        if (unlock_key == unlock_code) {
147            $(this).closest('.stu-main-outer-wrap').find('.stu-blur-overlay').fadeOut(500, function () {
148                selector.closest('.stu-main-outer-wrap').removeClass('stu-content-locked').addClass('stu-content-unlocked');
149                if (!selector.closest('.stu-main-outer-wrap').find('.stu-lock-content').is(':visible')) {
150
151                    selector.closest('.stu-main-outer-wrap').find('.stu-lock-content').show();
152                }
153                stu_setCookie('stu_unlock_check', 'yes', expiration_time);
154                closePageLockPopup();
155                $.ajax({
156                    type: 'post',
157                    url: stu_frontend_obj.ajax_url,
158                    data: {
159                        unlock_key: unlock_key,
160                        _wpnonce: stu_frontend_obj.ajax_nonce,
161                        action: 'stu_verify_status_action',
162                        form_alias: form_alias
163                    },
164                    success: function (res) {
165
166                    }
167                });
168                $(this).remove();
169            });
170        } else {
171            $(this).next('.stu-unlock-error-message').show();
172        }
173    });
174
175    /**
176     * 
177     * Seconds countdown timer
178     */
179    if ($('.stu-countdown-popup').length > 0) {
180        countdown_timer = setInterval(function () {
181            var seconds = $('.stu-countdown-number').html();
182            var new_second = seconds - 1;
183            if (new_second == 0) {
184                clearInterval(countdown_timer);
185                closePageLockPopup();
186            } else {
187                $('.stu-countdown-number').html(new_second);
188            }
189        }, 1000);
190    }
191    var disable_site_wide_unlock = stu_frontend_obj.disable_site_wide_unlock;
192
193    if (disable_site_wide_unlock == 0) {
194
195        unlock_by_js();
196
197    } else {
198        var unlock_data = stu_getCookie('stu_unlock_data');
199        if (unlock_data != '') {
200            unlock_data = $.parseJSON(unlock_data);
201            $('.stu-popup-innerwrap').each(function () {
202                var form_alias = $(this).data('form-alias');
203                if (unlock_data[form_alias] && unlock_data[form_alias]['unlock_check'] == 'yes') {
204                    $(this).remove();
205                } else {
206
207                }
208            });
209            $('.stu-main-outer-wrap').each(function () {
210                var form_alias = $(this).data('form-alias');
211                if (unlock_data[form_alias] && unlock_data[form_alias]['unlock_check'] == 'yes') {
212                    $(this).find('.stu-blur-overlay').remove();
213                    $(this).find('.stu-lock-content').show();
214                    $(this).removeClass('stu-content-locked');
215                } else {
216
217                }
218            });
219        } else {
220            unlock_by_js();
221        }
222    }
223    /**
224     * Popup with delay
225     */
226    if (stu_getCookie('stu_unlock_check') != 'yes') {
227        if ($('.stu-delay-popup').length > 0) {
228            var timeout = $('.stu-delay-popup').data('delay-time');
229            if (timeout == 0) {
230                $('.stu-popup-innerwrap').fadeIn(500);
231            } else {
232                setTimeout(function () {
233                    $('.stu-popup-innerwrap').fadeIn(500);
234                }, timeout * 1000);
235            }
236        }
237    }
238
239    $(document).on('focus', '.stu-front-datepicker', function () {
240        $(this).datepicker({
241            todayHighlight: true,
242            format: $(this).data('date-format'),
243            autoclose: true
244        })
245    });
246    $('body').on('click', '.stu-error-highlight', function () {
247        $(this).removeClass('stu-error-highlight');
248    });
249});

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.