PageSourceSearch

https://www.madhurta.in/wp-content/plugins/careerfy-framework/js/careerfy-common.js?ver=10.4.4

js madhurta.in collected 2026-10-04 20:03:20 UTC 15,736 bytes, 433 lines download raw bytes

1var $ = jQuery;
2
3jQuery(document).on('click', '.careerfy-ct-form', function (e) {
4    e.preventDefault();
5    var this_id = $(this).data('id'),
6        msg_form = $('#ct-form-' + this_id),
7        ajax_url = msg_form.data('ajax-url'),
8        msg_con = msg_form.find('.careerfy-ct-msg'),
9        msg_name = msg_form.find('input[name="u_name"]'),
10        msg_email = msg_form.find('input[name="u_email"]'),
11        msg_subject = msg_form.find('input[name="u_subject"]'),
12        msg_phone = msg_form.find('input[name="u_number"]'),
13        msg_type = msg_form.find('input[name="u_type"]'),
14        msg_txt = msg_form.find('textarea[name="u_msg"]'),
15        error = 0;
16
17    var email_pattern = new RegExp(/^[+a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/i);
18
19    if (msg_name.val() == '') {
20        error = 1;
21        msg_name.css({"border": "1px solid #ff0000"});
22    } else {
23        msg_name.css({"border": "1px solid #d3dade"});
24    }
25
26    if (msg_subject.val() == '') {
27        error = 1;
28        msg_subject.css({"border": "1px solid #ff0000"});
29    } else {
30        msg_subject.css({"border": "1px solid #d3dade"});
31    }
32
33    if (msg_email.val() == '') {
34        error = 1;
35        msg_email.css({"border": "1px solid #ff0000"});
36    } else {
37        if (!email_pattern.test(msg_email.val())) {
38            error = 1;
39            msg_email.css({"border": "1px solid #ff0000"});
40        } else {
41            msg_email.css({"border": "1px solid #d3dade"});
42        }
43    }
44
45    if (msg_txt.val() == '') {
46        error = 1;
47        msg_txt.css({"border": "1px solid #ff0000"});
48    } else {
49        msg_txt.css({"border": "1px solid #d3dade"});
50    }
51
52    if (error == 0) {
53        msg_con.html('<i class="fa fa-refresh fa-spin"></i>');
54
55        var request = $.ajax({
56            url: ajax_url,
57            method: "POST",
58            data: {
59                u_name: msg_name.val(),
60                u_email: msg_email.val(),
61                u_subject: msg_subject.val(),
62                u_phone: msg_phone.val(),
63                u_msg: msg_txt.val(),
64                u_type: msg_type.val(),
65                action: 'careerfy_contact_form_submit',
66            },
67            dataType: "json"
68        });
69
70        request.done(function (response) {
71            if (typeof response.msg !== 'undefined') {
72                msg_name.val('');
73                msg_email.val('');
74                msg_subject.val('');
75                msg_phone.val('');
76                msg_txt.val('');
77                msg_con.html(response.msg);
78            } else {
79                msg_con.html(careerfy_framework_vars.error_msg);
80            }
81        });
82
83        request.fail(function (jqXHR, textStatus) {
84            msg_con.html(careerfy_framework_vars.error_msg);
85        });
86    }
87
88    return false;
89});
90
91jQuery(document).on('click', '.careerfy-blog-post-like-btn', function () {
92
93    'use strict';
94    var _this = jQuery(this);
95    var this_id = _this.attr('data-id');
96    var icon_class = 'fa fa-heart-o';
97    var icon_fill_class = 'fa fa-heart';
98    var this_loader = _this.find('i');
99    var this_counter = _this.find('span');
100    this_loader.attr('class', 'fa fa-refresh fa-spin');
101
102    var request = $.ajax({
103        url: careerfy_funnc_vars.ajax_url,
104        method: "POST",
105        data: {
106            post_id: this_id,
107            action: 'careerfy_post_likes_count',
108        },
109        dataType: "json"
110    });
111    request.done(function (response) {
112        if (typeof response.counter !== 'undefined' && response.counter != '') {
113
114            this_counter.html(response.counter);
115        }
116        _this.find('i').attr('class', icon_fill_class);
117    });
118    request.fail(function (jqXHR, textStatus) {
119        _this.find('i').attr('class', icon_class);
120    });
121});
122
123jQuery(document).on('click', '.careerfy-post-like-btn', function () {
124
125    'use strict';
126    var _this = jQuery(this);
127    var this_id = _this.attr('data-id');
128    var icon_class = 'fa fa-heart-o';
129    var icon_fill_class = 'fa fa-heart';
130    var this_loader = _this.find('i');
131    var this_counter = _this.find('span');
132    this_loader.attr('class', 'fa fa-refresh fa-spin');
133
134    var request = $.ajax({
135        url: careerfy_funnc_vars.ajax_url,
136        method: "POST",
137        data: {
138            post_id: this_id,
139            action: 'careerfy_post_likes_count',
140        },
141        dataType: "json"
142    });
143    request.done(function (response) {
144        if (typeof response.counter !== 'undefined' && response.counter != '') {
145            this_counter.html(response.counter);
146        }
147        _this.removeAttr('class');
148        _this.find('i').attr('class', icon_fill_class);
149    });
150    request.fail(function (jqXHR, textStatus) {
151        _this.find('i').attr('class', icon_class);
152    });
153});
154
155jQuery(document).on('click', '#employer-detail2-tabs li', function () {
156    jQuery('#employer-detail2-tabs > li').removeClass('active');
157    jQuery(this).addClass('active');
158});
159
160jQuery(document).on('click', '#careerfy-detail5-tabs li', function () {
161    jQuery('#careerfy-detail5-tabs > li').removeClass('active');
162    jQuery(this).addClass('active');
163});
164
165jQuery(document).on('click', '.careerfy-post-dislike-btn', function () {
166    'use strict';
167    var _this = jQuery(this);
168    var this_id = _this.attr('data-id');
169    var icon_class = 'fa fa-thumbs-o-up';
170    var icon_fill_class = 'fa fa-thumbs-up';
171    var this_loader = _this.find('i');
172    var this_counter = _this.find('span');
173    this_loader.attr('class', 'fa fa-refresh fa-spin');
174    var request = $.ajax({
175        url: careerfy_funnc_vars.ajax_url,
176        method: "POST",
177        data: {
178            post_id: this_id,
179            action: 'careerfy_post_dislikes_count',
180        },
181        dataType: "json"
182    });
183
184    request.done(function (response) {
185        if (typeof response.counter !== 'undefined' && response.counter != '') {
186            this_counter.html(response.counter);
187        }
188        _this.removeAttr('class');
189        _this.find('i').attr('class', icon_fill_class);
190    });
191
192    request.fail(function (jqXHR, textStatus) {
193        _this.find('i').attr('class', icon_class);
194    });
195});
196
197jQuery(document).on('click', '.user-type-btn-sign-up', function () {
198    'use strict';
199    var _this = jQuery(this),
200        this_type = _this.attr('data-type'),
201        this_id = $(this).data('id'),
202        registration_form = $('#registration-form-' + this_id);
203    this_type == 'jobsearch_employer' ? registration_form.find('input[name=pt_user_role]').val('').val('jobsearch_employer') : registration_form.find('input[name=pt_user_role]').val('').val('jobsearch_candidate');
204
205});
206
207if (jQuery('.careerfy-candidate .careerfy-candidate-style8-wrapper').length > 0) {
208    jQuery(document).on('click', '.careerfy-candidate .careerfy-candidate-style8-wrapper', function (event) {
209        var _this = jQuery(this);
210        var this_target = jQuery(event.target);
211        var this_target_obj = this_target.get(0);
212        var dest_go_to = _this.find('.careerfy-candidate-style8-box1 > a');
213
214        if (this_target.is('a') || this_target.parent('a').length > 0 || this_target_obj.parentNode == null) {
215            //do nothing
216        } else {
217            window.location.href = dest_go_to.attr('href');
218        }
219    });
220}
221
222jQuery(document).on('click', '.sign-up-form-submit', function (e) {
223    e.preventDefault();
224
225    var _this = jQuery(this),
226        this_id = _this.data('id'),
227        registration_form = jQuery('#registration-form-' + this_id),
228        pt_user_fullname = registration_form.find('input[name=pt_user_fullname]'),
229        pt_user_email = registration_form.find('input[name=pt_user_email]'),
230        pt_user_pass = registration_form.find('input[name=pt_user_pass]'),
231        pt_user_cpass = registration_form.find('input[name=pt_user_cpass]'),
232        pt_user_fname = registration_form.find('input[name=pt_user_fname]'),
233        pt_user_lname = registration_form.find('input[name=pt_user_lname]'),
234        pt_user_role = registration_form.find('input[name=pt_user_role]'),
235        pt_user_organization = registration_form.find('input[name=pt_user_organization]'),
236        msg_con = registration_form.find('.registration-errors'),
237        loader_con = registration_form.find('.form-loader');
238
239    _form_error = false;
240
241    if (pt_user_fullname.length > 0) {
242        if (pt_user_fullname.val() == '') {
243            _form_error = true;
244            pt_user_fullname.css({border: '1px solid #ff0000'});
245        } else {
246            pt_user_fullname.css({border: '1px solid #efefef'});
247        }
248    }
249    pt_user_organization.val(pt_user_fullname.val());
250
251    var user_name = pt_user_fullname.val().split(" ");
252    pt_user_fname.val(user_name[0]);
253    pt_user_lname.val(user_name[1]);
254
255    if (pt_user_email.length > 0) {
256        if (pt_user_email.val() == '') {
257            _form_error = true;
258            pt_user_email.css({border: '1px solid #ff0000'});
259        } else {
260            pt_user_email.css({border: '1px solid #efefef'});
261        }
262    }
263
264    if (pt_user_pass.length > 0) {
265        if (pt_user_pass.val() == '') {
266            _form_error = true;
267            pt_user_pass.css({border: '1px solid #ff0000'});
268        } else {
269            pt_user_pass.css({border: '1px solid #efefef'});
270        }
271    }
272
273    pt_user_cpass.val(pt_user_pass.val());
274
275    if (!_form_error) {
276        var button = $(this).find('button');
277        var btn_html = button.html();
278        //button.html('loading');
279        msg_con.hide();
280        _this.addClass('disabled-btn');
281        _this.attr('disabled', 'disabled');
282        loader_con.show();
283        loader_con.html('<i class="fa fa-refresh fa-spin"></i>');
284
285
286        var reg_ser_form = $('#registration-form-' + this_id)[0];
287        var formData = new FormData(reg_ser_form);
288        var request = $.ajax({
289            url: jobsearch_login_register_common_vars.ajax_url,
290            method: "POST",
291            processData: false,
292            contentType: false,
293            data: formData,
294            dataType: "json"
295        });
296        request.done(function (response) {
297            if (typeof response.message !== 'undefined') {
298                msg_con.html(response.message);
299                msg_con.slideDown('slow');
300                button.html(btn_html);
301                _this.removeClass('disabled-btn');
302                _this.removeAttr('disabled');
303
304                if (typeof response.error !== 'undefined' && response.error == true) {
305                    loader_con.hide();
306                    loader_con.html('');
307                    return false;
308                }
309
310                if (typeof response.redirect !== 'undefined') {
311                    window.location.href = response.redirect;
312                }
313            }
314        });
315        request.fail(function (jqXHR, textStatus) {
316            _this.removeClass('disabled-btn');
317            _this.removeAttr('disabled');
318            loader_con.hide();
319            loader_con.html('');
320        });
321    }
322})
323
324
325
326// Initialize MixItUp
327document.addEventListener('DOMContentLoaded', function() {
328    // Check if the element exists
329    var containerEl = document.querySelector('.careerfy-animated-filter-list');
330
331    if (containerEl) {
332        // If the element exists, initialize MixItUp
333        var mixer = mixitup(containerEl, {
334            selectors: {
335                target: '.element-item' // The selector for the items to be filtered
336            },
337            animation: {
338                duration: 300 // Optional: Set animation duration in milliseconds
339            }
340        });
341
342        // Bind filter button click events
343        document.querySelectorAll('.filters-button-group a').forEach(function (button) {
344            button.addEventListener('click', function () {
345                var filterValue = this.getAttribute('data-filter');
346                if (mixer) {
347                    mixer.filter(filterValue); // Apply the filter
348                }
349            });
350        });
351
352        // Toggle active class on filter buttons
353        document.querySelectorAll('.filters-button-group a').forEach(function (button) {
354            button.addEventListener('click', function () {
355                document.querySelectorAll('.filters-button-group a').forEach(function (btn) {
356                    btn.classList.remove('is-checked');
357                });
358                this.classList.add('is-checked');
359            });
360        });
361
362    }
363});
364
365
366/* ---------------------------------------------------------------
367 * Cache-friendly post views / likes / dislikes.
368 * Runs on the front-end where careerfy_frame_post_acts_btns() has
369 * emitted <ul class="post-acts" data-careerfy-post-acts="POST_ID">.
370 * --------------------------------------------------------------- */
371(function () {
372    'use strict';
373    if (typeof jQuery === 'undefined') { return; }
374    function readCookie(name) {
375        var nameEq = name + '=';
376        var cookies = document.cookie ? document.cookie.split('; ') : [];
377        for (var i = 0; i < cookies.length; i++) {
378            if (cookies[i].indexOf(nameEq) === 0) {
379                return decodeURIComponent(cookies[i].substring(nameEq.length));
380            }
381        }
382        return '';
383    }
384    function applyCookieState(root) {
385        var postId = root.getAttribute('data-careerfy-post-acts');
386        if (!postId) { return; }
387        var $root = jQuery(root);
388        if (readCookie('careerfy_post_likes' + postId)) {
389            var $btn = $root.find('.careerfy-post-like-btn');
390            $btn.removeAttr('href').removeClass('careerfy-post-like-btn');
391            $btn.find('i').attr('class', 'fa fa-heart');
392        }
393        if (readCookie('careerfy_post_dislikes' + postId)) {
394            var $dbtn = $root.find('.careerfy-post-dislike-btn');
395            $dbtn.removeAttr('href').removeClass('careerfy-post-dislike-btn');
396            $dbtn.find('i').attr('class', 'fa fa-thumbs-up');
397        }
398    }
399    function trackView(root) {
400        var postId = parseInt(root.getAttribute('data-careerfy-post-acts'), 10);
401        if (!postId || readCookie('careerfy_post_views_count' + postId)) { return; }
402        if (!window.careerfy_funnc_vars || !window.careerfy_funnc_vars.ajax_url) { return; }
403        var send = function (nonce) {
404            jQuery.ajax({
405                url: window.careerfy_funnc_vars.ajax_url,
406                method: 'POST',
407                cache: false,
408                data: {
409                    action: 'careerfy_post_view_track',
410                    post_id: postId,
411                    nonce: nonce || ''
412                },
413                dataType: 'json',
414                success: function (resp) {
415                    if (resp && typeof resp.counter !== 'undefined') {
416                        jQuery(root).find('.careerfy-post-views-count').text(resp.counter);
417                    }
418                }
419            });
420        };
421        if (window.careerfyCacheCompat && typeof window.careerfyCacheCompat.getNonce === 'function') {
422            window.careerfyCacheCompat.getNonce('careerfy_post_view_track', send);
423        } else {
424            send('');
425        }
426    }
427    jQuery(function () {
428        document.querySelectorAll('[data-careerfy-post-acts]').forEach(function (el) {
429            applyCookieState(el);
430            trackView(el);
431        });
432    });
433})();

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.