PageSourceSearch

https://hshelpinghand.com/wp-content/plugins/wp-jobsearch/js/jobsearch-plugin.js?ver=1.8.3

js hshelpinghand.com collected 2026-10-04 21:58:56 UTC 83,392 bytes, 2,125 lines download raw bytes

1(function ($) {
2    $.fn.jobsearch_seliz_req_field_loop = function (callback, thisArg) {
3        var me = this;
4        return this.each(function (index, element) {
5            return callback.call(thisArg || element, element, index, me);
6        });
7    };
8})(jQuery);
9
10function jobsearch_validate_seliz_req_form(that) {
11    var req_class = 'selectize-req-field',
12        _this_form = jQuery(that),
13        form_validity = 'valid';
14    var errors_counter = 1;
15    _this_form.find('select.' + req_class).jobsearch_seliz_req_field_loop(function (element, index, set) {
16        var ret_err = '0';
17        if (jQuery(element).val() == '') {
18            form_validity = 'invalid';
19            ret_err = '1';
20        } else {
21            jQuery(element).parents('.jobsearch-profile-select').css({"border": "none"});
22        }
23
24        if (ret_err == '1') {
25            jQuery(element).parents('.jobsearch-profile-select').css({"border": "1px solid #ff0000"});
26            var animate_to = jQuery(element).parents('.jobsearch-profile-select');
27
28            if (errors_counter == 1) {
29                jQuery('html, body').animate({scrollTop: animate_to.offset().top - 70}, 1000);
30            }
31
32            errors_counter++;
33        }
34    });
35    if (form_validity == 'valid') {
36        return true;
37    } else {
38        return false;
39    }
40}
41
42function jobsearch_validate_cprofile_req_form(that) {
43    var req_class = 'jobsearch-cpreq-field',
44        _this_form = jQuery(that),
45        form_validity = 'valid';
46    var errors_counter = 1;
47    _this_form.find('.' + req_class).jobsearch_seliz_req_field_loop(function (element, index, set) {
48        var ret_err = '0';
49        if (jQuery(element).val() == '' || jQuery(element).val() == null) {
50            form_validity = 'invalid';
51            ret_err = '1';
52        } else {
53            jQuery(element).css({"border": "1px solid #eceeef"});
54        }
55
56        if (ret_err == '1') {
57            if ($(element).hasClass('multiselect-req')) {
58                element = $(element).parents('.jobsearch-profile-select');
59            }
60            jQuery(element).css({"border": "1px solid #ff0000"});
61            var animate_to = jQuery(element);
62
63            if (errors_counter == 1) {
64                jQuery('html, body').animate({scrollTop: animate_to.offset().top - 70}, 1000);
65            }
66
67            errors_counter++;
68        } else {
69            if ($(element).hasClass('multiselect-req')) {
70                element = $(element).parents('.jobsearch-profile-select');
71                $(element).removeAttr('style');
72            }
73        }
74    });
75    if (form_validity == 'valid') {
76        return true;
77    } else {
78        return false;
79    }
80}
81
82var jobsearch_custm_getJSON = function (url, callback) {
83    var xhr = new XMLHttpRequest();
84    xhr.open('GET', url, true);
85    xhr.responseType = 'json';
86    xhr.onload = function () {
87        var status = xhr.status;
88        if (status === 200) {
89            callback(null, xhr.response);
90        } else {
91            callback(status, xhr.response);
92        }
93    };
94    xhr.send();
95};
96
97function jobsearch_get_date_to_num_str(date) {
98    var ext_date = date.toLocaleDateString("en-US");
99    var ext_date_arr = ext_date.split('/');
100    
101    var date_whole_str = date;
102    if (ext_date_arr.length == 3) {
103        var date_str = ext_date_arr[1];
104        var month_str = ext_date_arr[0];
105        var year_str = ext_date_arr[2];
106        
107        var date_w = parseInt(date_str) > 9 ? date_str : '0' + date_str;
108        var month_w = parseInt(month_str) > 9 ? month_str : '0' + month_str;
109        
110        date_whole_str = date_w + '-' + month_w + '-' + year_str;
111    } 
112    
113    return date_whole_str;
114}
115
116jQuery(document).on('click', '.jobsearch-top-searchbar input[type="submit"]', function () {
117    var select_sector = jQuery('.jobsearch-top-searchbar select[name="sector_cat"]');
118    var filter_selectd_sec = jQuery('input[name="sector_cat"]:checked');
119    if (select_sector.length > 0 && filter_selectd_sec.length > 0) {
120        if (select_sector.val() != '') {
121            filter_selectd_sec.prop('checked', false);
122        }
123    }
124});
125
126function jobsearch_cusfield_validate_attach_field(con_form) {
127    var att_error = 0;
128    var attach_file = con_form.find('input[type="file"]');
129
130    jQuery(attach_file).each(function (elem, index) {
131        var _this_file = jQuery(this);
132        if (_this_file.val() == '' && _this_file.hasClass('jobsearch-cusfieldatt-req')) {
133            att_error = 1;
134            _this_file.parent('.jobsearch-fileUpload').css({"border": "1p
134x solid #ff0000"});
135        } else {
136            _this_file.parent('.jobsearch-fileUpload').css({"border": "none"});
137        }
138        if (att_error == 1) {
139            jQuery('html, body').animate({scrollTop: _this_file.parent('.jobsearch-fileUpload').offset().top - 130}, 1000);
140            return false;
141        }
142    });
143    if (att_error == 0) {
144        return true;
145    } else {
146        return false;
147    }
148}
149
150jQuery(document).on('submit', 'form#employer-profilesetings-form', function () {
151    var this_form = jQuery(this);
152    var phone_field = this_form.find('input[name="user_phone"]');
153    if (phone_field.hasClass('phone-input-error')) {
154        jQuery('html, body').animate({scrollTop: phone_field.offset().top - 130}, 1000);
155        return false;
156    }
157    // API Locations
158    var locations_type = jobsearch_plugin_vars.locations_type;
159    var is_req_apilocs = jobsearch_plugin_vars.required_api_locs;
160
161    if (locations_type == 'api' && is_req_apilocs == 'yes') {
162        var api_loc_contry = jQuery('select[name="jobsearch_field_location_location1"]');
163        if (api_loc_contry.length > 0) {
164            var api_locval = api_loc_contry.val();
165            if (api_locval == '') {
166                api_loc_contry.parent('.jobsearch-profile-select').css({"border": "1px solid #ff0000"});
167                var animate_to = api_loc_contry.parent('.jobsearch-profile-select');
168                jQuery('html, body').animate({scrollTop: animate_to.offset().top - 110}, 1000);
169                return false;
170            } else {
171                api_loc_contry.parent('.jobsearch-profile-select').css({"border": "none"});
172            }
173        }
174        var api_loc_state = jQuery('select[name="jobsearch_field_location_location2"]');
175        if (api_loc_state.length > 0) {
176            var api_locval = api_loc_state.val();
177            if (api_locval == '') {
178                api_loc_state.parent('.jobsearch-profile-select').css({"border": "1px solid #ff0000"});
179                var animate_to = api_loc_state.parent('.jobsearch-profile-select');
180                jQuery('html, body').animate({scrollTop: animate_to.offset().top - 110}, 1000);
181                return false;
182            } else {
183                api_loc_state.parent('.jobsearch-profile-select').css({"border": "none"});
184            }
185        }
186        var api_loc_cities = jQuery('select[name="jobsearch_field_location_location3"]');
187        if (api_loc_cities.length > 0) {
188            var api_locval = api_loc_cities.val();
189            if (api_locval == '') {
190                api_loc_cities.parent('.jobsearch-profile-select').css({"border": "1px solid #ff0000"});
191                var animate_to = api_loc_cities.parent('.jobsearch-profile-select');
192                jQuery('html, body').animate({scrollTop: animate_to.offset().top - 110}, 1000);
193                return false;
194            } else {
195                api_loc_cities.parent('.jobsearch-profile-select').css({"border": "none"});
196            }
197        }
198    }
199    //
200
201    var user_sector_field = jQuery('select[name^="user_sector"]');
202    if (user_sector_field.length > 0 && user_sector_field.hasClass('profile-req-field')) {
203        var user_sector_val = user_sector_field.val();
204        if (user_sector_val == '') {
205            user_sector_field.parent('.jobsearch-profile-select').css({"border": "1px solid #ff0000"});
206            var animate_to = user_sector_field.parent('.jobsearch-profile-select');
207            jQuery('html, body').animate({scrollTop: animate_to.offset().top - 110}, 1000);
208            return false;
209        } else {
210            user_sector_field.parent('.jobsearch-profile-select').removeAttr('style');
211        }
212    }
213
214    var editor_text_field = jQuery('.jobsearch-reqtext-editor');
215    if (editor_text_field.length > 0) {
216        var text_editr_err = false;
217        editor_text_field.each(function () {
218            var _this_field = jQuery(this);
219            var element_to_err = jQuery(_this_field).parents('.wp-editor-container');
220            if (_this_field.val() == '') {
221                text_editr_err = element_to_err;
222                jQuery(element_to_err).css({"border": "1px solid #ff0000"});
223            } else {
224                jQuery(element_to_err).removeAttr('style');
225            }
226        });
227        if (text_editr_err !== false) {
228            jQuery('html, body').animate({scrollTop: text_editr_err.offset().top - 70}, 1000);
229            return false;
230        }
231    }
232
233    if (this_form.find('.cusfield-checkbox-required').find('input[type=checkbox]').length > 0) {
234        var element_to_go = this_form.find('.cusfield-checkbox-required');
235        var req_checkboxs = this_form.find('.cusfield-checkbox-required').find('input[type=checkbox]');
236        var req_checkbox_err = 1;
237        req_checkboxs.each(function () {
238            if (jQuery(this).is(':checked')) {
239                req_checkbox_err = 0;
240            }
241        });
242        if (req_checkbox_err == 1) {
243            jQuery(element_to_go).css({"border": "1px solid #ff0000"});
244            jQuery('html, body').animate({scrollTop: element_to_go.offset().top - 100}, 1000);
245            return false;
246        } else {
247            jQuery(element_to_go).removeAttr('style');
248        }
249    }
250
251    // For custom upload field
252    var $uplod_file_ret = jobsearch_cusfield_validate_attach_field(jQuery(this));
253    if ($uplod_file_ret == false) {
254        return false;
255    }
256    //
257    var fields_1 = jobsearch_validate_cprofile_req_form(jQuery(this));
258    if (!fields_1) {
259        return false;
260    }
261    var fields_2 = jobsearch_validate_seliz_req_form(jQuery(this));
262    if (!fields_2) {
263        return false;
264    }
265});
266
267jQuery(document).on('submit', 'form#candidate-profilesetings-form', function () {
268    var this_form = jQuery(this);
269    var phone_field = this_form.find('input[name="user_phone"]');
270    if (phone_field.hasClass('phone-input-error')) {
271        jQuery('html, body').animate({scrollTop: phone_field.offset().top - 130}, 1000);
272        return false;
273    }
274    // API Locations
275    var locations_type = jobsearch_plugin_vars.locations_type;
276    var is_req_apilocs = jobsearch_plugin_vars.required_api_locs;
277
278    if (locations_type == 'api' && is_req_apilocs == 'yes') {
279        var api_loc_contry = jQuery('select[name="jobsearch_field_location_location1"]');
280        if (api_loc_contry.length > 0) {
281            var api_locval = api_loc_contry.val();
282            if (api_locval == '') {
283                api_loc_contry.parent('.jobsearch-profile-select').css({"border": "1px solid #ff0000"});
284                var animate_to = api_loc_contry.parent('.jobsearch-profile-select');
285                jQuery('html, body').animate({scrollTop: animate_to.offset().top - 110}, 1000);
286                return false;
287            } else {
288                api_loc_contry.parent('.jobsearch-profile-select').css({"border": "none"});
289            }
290        }
291        var api_loc_state = jQuery('select[name="jobsearch_field_location_location2"]');
292        if (api_loc_state.length > 0) {
293            var api_locval = api_loc_state.val();
294            if (api_locval == '') {
295                api_loc_state.parent('.jobsearch-profile-select').css({"border": "1px solid #ff0000"});
296                var animate_to = api_loc_state.parent('.jobsearch-profile-select');
297                jQuery('html, body').animate({scrollTop: animate_to.offset().top - 110}, 1000);
298                return false;
299            } else {
300                api_loc_state.parent('.jobsearch-profile-select').css({"border": "none"});
301            }
302        }
303        var api_loc_cities = jQuery('select[name="jobsearch_field_location_location3"]');
304        if (api_loc_cities.length > 0) {
305            var api_locval = api_loc_cities.val();
306            if (api_locval == '') {
307                api_loc_cities.parent('.jobsearch-profile-select').css({"border": "1px solid #ff0000"});
308                var animate_to = api_loc_cities.parent('.jobsearch-profile-select');
309                jQuery('html, body').animate({scrollTop: animate_to.offset().top - 110}, 1000);
310                return false;
311            } else {
312                api_loc_cities.parent('.jobsearch-profile-select').css({"border": "none"});
313            }
314        }
315    }
316    //
317
318    var user_sector_field = jQuery('select[name^="user_sector"]');
319    if (user_sector_field.length > 0 && user_sector_field.hasClass('profile-req-field')) {
320        var user_sector_val = user_sector_field.val();
321        if (user_sector_val == '') {
322            user_sector_field.parent('.jobsearch-profile-select').css({"border": "1p
322x solid #ff0000"});
323            var animate_to = user_sector_field.parent('.jobsearch-profile-select');
324            jQuery('html, body').animate({scrollTop: animate_to.offset().top - 110}, 1000);
325            return false;
326        } else {
327            user_sector_field.parent('.jobsearch-profile-select').removeAttr('style');
328        }
329    }
330
331    var editor_text_field = jQuery('.jobsearch-reqtext-editor');
332    if (editor_text_field.length > 0) {
333        var text_editr_err = false;
334        editor_text_field.each(function () {
335            var _this_field = jQuery(this);
336            var element_to_err = jQuery(_this_field).parents('.wp-editor-container');
337            if (_this_field.val() == '') {
338                text_editr_err = element_to_err;
339                jQuery(element_to_err).css({"border": "1px solid #ff0000"});
340            } else {
341                jQuery(element_to_err).removeAttr('style');
342            }
343        });
344        if (text_editr_err !== false) {
345            jQuery('html, body').animate({scrollTop: text_editr_err.offset().top - 70}, 1000);
346            return false;
347        }
348    }
349
350    if (this_form.find('.cusfield-checkbox-required').find('input[type=checkbox]').length > 0) {
351        var element_to_go = this_form.find('.cusfield-checkbox-required');
352        var req_checkboxs = this_form.find('.cusfield-checkbox-required').find('input[type=checkbox]');
353        var req_checkbox_err = 1;
354        req_checkboxs.each(function () {
355            if (jQuery(this).is(':checked')) {
356                req_checkbox_err = 0;
357            }
358        });
359        if (req_checkbox_err == 1) {
360            jQuery(element_to_go).css({"border": "1px solid #ff0000"});
361            jQuery('html, body').animate({scrollTop: element_to_go.offset().top - 100}, 1000);
362            return false;
363        } else {
364            jQuery(element_to_go).removeAttr('style');
365        }
366    }
367
368    // For custom upload field
369    var $uplod_file_ret = jobsearch_cusfield_validate_attach_field(jQuery(this));
370    if ($uplod_file_ret == false) {
371        return false;
372    }
373    //
374    var fields_1 = jobsearch_validate_cprofile_req_form(jQuery(this));
375    if (!fields_1) {
376        return false;
377    }
378    var fields_2 = jobsearch_validate_seliz_req_form(jQuery(this));
379    if (!fields_2) {
380        return false;
381    }
382});
383
384jQuery(function () {
385    if (jQuery('.jobsearch-tooltipcon').length > 0) {
386        jQuery('.jobsearch-tooltipcon').tooltip();
387    }
388});
389
390jQuery(document).on('click', '.jobsearch-activcode-popupbtn', function () {
391    jQuery('.jobsearch-modal').removeClass('fade-in').addClass('fade');
392    jQuery('body').removeClass('jobsearch-modal-active');
393    jobsearch_modal_popup_open('JobSearchModalAccountActivationForm');
394});
395
396jQuery(document).on('click', '.user-activeacc-submit-btn', function (e) {
397    e.preventDefault();
398    var this_form = jQuery('#jobsearch_uaccont_aprov_form');
399    var this_loader = this_form.find('.loader-box');
400    var this_msg_con = this_form.find('.message-opbox');
401
402    var activ_code = this_form.find('input[name="activ_code"]');
403    var user_email = this_form.find('input[name="user_email"]');
404
405    var error = 0;
406    if (activ_code.val() == '') {
407        error = 1;
408        activ_code.css({"border": "1px solid #ff0000"});
409    } else {
410        activ_code.css({"border": "1px solid #d3dade"});
411    }
412
413    if (error == 0) {
414
415        this_msg_con.hide();
416        this_loader.html('<i class="fa fa-refresh fa-spin"></i>');
417        var request = jQuery.ajax({
418            url: jobsearch_plugin_vars.ajax_url,
419            method: "POST",
420            data: {
421                active_code: activ_code.val(),
422                user_email: user_email.val(),
423                action: 'jobsearch_activememb_accont_by_activation_url',
424            },
425            dataType: "json"
426        });
427
428        request.done(function (response) {
429            var msg_before = '';
430            var msg_after = '';
431            if (typeof response.error !== 'undefined') {
432                if (response.error == '1') {
433                    msg_before = '<div class="alert alert-danger"><i class="fa fa-times"></i> ';
434                    msg_after = '</div>';
435                } else if (response.error == '0') {
436                    msg_before = '<div class="alert alert-success"><i class="fa fa-check"></i> ';
437                    msg_after = '</div>';
438                }
439            }
440            if (typeof response.msg !== 'undefined') {
441                this_msg_con.html(msg_before + response.msg + msg_after);
442                this_msg_con.slideDown();
443                //if (typeof response.error !== 'undefined' && response.error == '0') {
444                //    this_form.find('ul.email-fields-list').slideUp();
445                //}
446                if (typeof response.redirect !== 'undefined') {
447                    window.location.href = response.redirect;
448                    return false;
449                }
450            } else {
451                this_msg_con.html(jobsearch_plugin_vars.error_msg);
452            }
453            this_loader.html('');
454
455        });
456
457        request.fail(function (jqXHR, textStatus) {
458            this_loader.html(jobsearch_plugin_vars.error_msg);
459        });
460    }
461});
462
463jQuery(document).on('click', '.jobsearch-candidatesh-opopupbtn', function () {
464    var _this_id = jQuery(this).attr('data-id');
465    jobsearch_modal_popup_open('JobSearchModalCandShPopup' + _this_id);
466});
467
468jQuery(document).on('click', '.div-to-scroll', function () {
469
470    var trag_todiv = jQuery(this).attr('data-target');
471    jQuery('html, body').animate({
472        scrollTop: jQuery('#' + trag_todiv).offset().top - 200
473    }, 1000);
474});
475
476var location_box = jQuery('input.srch_autogeo_location');
477
478function JobsearchGetClientLocation() {
479    if (navigator.geolocation) {
480        navigator.geolocation.getCurrentPosition(JobsearchShowClientPosition);
481    } else {
482        console.log("Geolocation is not supported by this browser.");
483    }
484}
485
486function JobsearchShowClientPosition(position) {
487    var lat = position.coords.latitude;
488    var lng = position.coords.longitude;
489
490    if (lat != '' && lng != '') {
491        var location_ajax_box = jQuery('.jobsearch_searchloc_div .jobsearch_search_location_field');
492        var icon_classs = jQuery('.geolction-btn').find('i').attr('class');
493        var pos = {
494            lat: lat,
495            lng: lng
496        };
497        jQuery('.geolction-btn').find('i').attr('class', 'fa fa-refresh fa-spin');
498        var dataString = "lat=" + pos.lat + "&lng=" + pos.lng + "&action=jobsearch_get_location_with_latlng";
499        jQuery.ajax({
500            type: "POST",
501            url: jobsearch_plugin_vars.ajax_url,
502            data: dataString,
503            dataType: "json",
504            success: function (response) {
505                if (location_box.length > 0) {
506                    location_box.val(response.address);
507                }
508                if (location_ajax_box.length > 0) {
509                    location_ajax_box.val(response.address);
510                }
511                jQuery('.geolction-btn').find('i').attr('class', icon_classs);
512                if (typeof jobsearch_listing_dataobj !== 'undefined') {
513                    var locMapType = jobsearch_plugin_vars.locmap_type;
514                    if (locMapType == 'mapbox') {
515                        var mapCordsToFly = [lng, lat];
516                        jobsearch_listing_map.flyTo({
517                            center: mapCordsToFly,
518                        });
519                    } else {
520                        jobsearch_listing_map.setCenter(pos);
521                    }
522                }
523            }
524        });
525    }
526}
527
528jQuery(document).ready(function () {
529
530    if (location_box.length > 0) {
531        //JobsearchGetClientLocation();
532    }
533    jQuery("body").fitVids();
534});
535
536jQuery(document).on('submit', 'form', function (er) {
537    var this_form = jQuery(this);
538    if (this_form.find('input[type="checkbox"][name="terms_cond_check"]').length > 0) {
539        var checkbox = this_form.find('input[type="checkbox"][name="terms_cond_check"]');
540        if (!checkbox.is(":checked")) {
541            er.preventDefault();
542            alert(jobsearch_plugin_vars.accpt_terms_cond);
543            var form_allow_subtn = setInterval(function () {
544                this_form.find('input[type=submit]').removeAttr('disabled');
545                this_form.find('input[type=submit]').removeClass('disabled-btn');
546                clearInterval(form_allow_subtn);
547            }, 500);
548            return false;
549        }
550    }
551});
552
553function jobsearch_accept_terms_cond_pop(this_form) {
554    if (this_form.find('input[type="checkbox"][name="terms_cond_check"]').length > 0) {
555        var checkbox = this_form.find('input[type="checkbox"][name="terms_cond_check"]');
556        if (!checkbox.is(":checked")) {
557            alert(jobsearch_plugin_vars.accpt_terms_cond);
558            return 'no';
559        }
560    }
561    return 'yes';
562}
563
564jQuery('#user-sector').find('option').first().val('');
565jQuery('#user-sector').attr('placeholder', jobsearch_plugin_vars.select_sector);
566jQuery('#job-sector').attr('placeholder', jobsearch_plugin_vars.select_sector);
567
568jQuery(window).on('load', function () {
569
570});
571
572jQuery(document).on('click', '.show-toggle-filter-list', function () {
573    var _this = jQuery(this);
574    var more_txt = jobsearch_plugin_vars.see_more_txt;
575    var less_txt = jobsearch_plugin_vars.see_less_txt;
576
577    if (_this.hasClass('jobsearch-loadmore-locations')) {
578
579        var this_loader = _this.find('.loc-filter-loder');
580        var this_appender = _this.parent('.jobsearch-checkbox-toggle').find('>ul');
581        var this_pnm = parseInt(_this.attr('data-pnum'));
582        var this_tpgs = parseInt(_this.attr('data-tpgs'));
583        var this_order = _this.attr('data-order');
584        var this_orderby = _this.attr('data-orderby');
585
586        var this_ptye = _this.attr('data-ptype');
587
588        var this_rid = _this.attr('data-rid');
589        var this_cousw = _this.attr('data-cousw');
590
591        var q_args_json = jQuery('input[name="loc_count_qargs_' + this_rid + '"]').val();
592
593        var to_action = 'jobsearch_load_more_filter_locs_to_list';
594        if (typeof this_ptye !== 'undefined' && this_ptye == 'employer') {
595            to_action = 'jobsearch_load_more_filter_emp_locs_to_list';
596        }
597
598        this_loader.html('<i class="fa fa-refresh fa-spin"></i>');
599
600        var request = jQuery.ajax({
601            url: jobsearch_plugin_vars.ajax_url,
602            method: "POST",
603            data: {
604                page_num: this_pnm,
605                t_pgs: this_tpgs,
606                param_rid: this_rid,
607                q_agrs: q_args_json,
608                param_cousw: this_cousw,
609                order: this_order,
610                orderby: this_orderby,
611                action: to_action,
612            },
613            dataType: "json"
614        });
615
616        request.done(function (response) {
617            if (typeof response.list !== 'undefined' && response.list != '') {
618                //
619                this_appender.append(response.list);
620                if (this_pnm < this_tpgs) {
621                    _this.attr('data-pnum', (this_pnm + 1));
622                } else {
623                    _this.remove();
624                }
625            }
626            this_loader.html('');
627        });
628
629        request.fail(function (jqXHR, textStatus) {
630            this_loader.html('');
631        });
632        return false;
633    }
634
635    var etarget = _this.prev('ul').find('li.filter-more-fields');
636    if (etarget.hasClass('f_showing')) {
637        etarget.hide();
638        _this.html(more_txt);
639        etarget.removeClass('f_showing');
640    } else {
641        etarget.show();
642        _this.html(less_txt);
643        etarget.addClass('f_showing');
644    }
645});
646
647function jobsearch_animate_slidein_open(target) {
648    jQuery('#' + target).removeClass('fade').addClass('fade-in');
649    jQuery('body').addClass('jobsearch-modal-active');
650}
651
652function jobsearch_modal_popup_open(target) {
653    jQuery('#' + target).removeClass('fade').addClass('fade-in');
654    jQuery('body').addClass('jobsearch-modal-active');
655}
656
657jQuery(document).on('click', '.jobsearch-modal .modal-close', function () {
658    jQuery('.jobsearch-modal').removeClass('fade-in').addClass('fade');
659    jQuery('body').removeClass('jobsearch-modal-active');
660});
661
662jQuery('.jobsearch-modal').on('click', function (e) {
663    //
664    var is_close = true;
665    var this_dom = e.target;
666    var thisdom_obj = jQuery(this_dom);
667    if (thisdom_obj.parents('.modal-box-area').length > 0) {
668        if (thisdom_obj.parent('.modal-close').length > 0) {
669            //console.log('close');
670        } else {
671            is_close = false;
672        }
673    }
674    // for calendar fix
675    if (thisdom_obj.hasClass('picker-day')) {
676        is_close = false;
677    }
678    // for selectize multi select remove button compatibility
679    if (thisdom_obj.parent('.item').length > 0 && thisdom_obj.hasClass('remove')) {
680        is_close = false;
681    }
682    if (is_close === true) {
683        jQuery('.jobsearch-modal').removeClass('fade-in').addClass('fade');
684        jQuery('body').removeClass('jobsearch-modal-active');
685    }
686});
687
688//for login popup
689jQuery(document).on('click', '.jobsearch-open-signin-tab', function () {
690    var _this = jQuery(this);
691    jobsearch_modal_popup_open('JobSearchModalLogin');
692    jQuery('.reg-tologin-btn').trigger('click');
693    // for redirect url
694    var login_form = jQuery('#JobSearchModalLogin').find('form[id^="login-form-"]');
695    if (_this.hasClass('jobsearch-wredirct-url')) {
696        var wredirct_url = _this.attr('data-wredircto');
697        var redrct_hiden_field = login_form.find('input[name="jobsearch_wredirct_url"]');
698        if (redrct_hiden_field.length > 0) {
699            redrct_hiden_field.remove();
700        }
701        login_form.append('<input type="hidden" name="jobsearch_wredirct_url" value="' + wredirct_url + '">');
702    } else {
703        var redrct_hiden_field = login_form.find('input[name="jobsearch_wredirct_url"]');
704        if (redrct_hiden_field.length > 0) {
705            redrct_hiden_field.remove();
706        }
707    }
708
709    // for packages
710    if (_this.hasClass('jobsearch-pkg-bouybtn')) {
711        var extra_login_info = [];
712        var this_pkg_id = _this.attr('data-id');
713
714        extra_login_info.push('buying_pkg');
715        extra_login_info.push(this_pkg_id);
716        if (typeof _this.attr('data-pinfo') !== 'undefined' && _this.attr('data-pinfo') != '') {
717            extra_login_info.push(_this.attr('data-pinfo'));
718        }
719
720        extra_login_info = extra_login_info.join('|');
721        var pkginfo_hiden_field = login_form.find('input[name="extra_login_params"]');
722        if (pkginfo_hiden_field.length > 0) {
723            pkginfo_hiden_field.remove();
724        }
725        login_form.append('<input type="hidden" name="extra_login_params" value="' + extra_login_info + '">');
726    } else {
727        var pkginfo_hiden_field = login_form.find('input[name="extra_login_params"]');
728        if (pkginfo_hiden_field.length > 0) {
729            pkginfo_hiden_field.remove();
730        }
731    }
732});
733
734//for register popup
735jQuery(document).on('click', '.jobsearch-open-register-tab', function () {
736
737    var _this = jQuery(this);
738    jobsearch_modal_popup_open('JobSearchModalLogin');
739    jQuery('.register-form').trigger('click');
740
741    var login_form = jQuery('#JobSearchModalLogin').find('form[id^="login-form-"]');
742    var register_form = jQuery('#JobSearchModalLogin').find('form[id^="registration-form-"]');
743
744    if (_this.hasClass('company-register-tab')) {
745        register_form.find('.user-type-chose-btn[data-type="jobsearch_employer"]').trigger('click');
746    }
747
748    // for redirect url
749    var redrct_hiden_field = login_form.find('input[name="jobsearch_wredirct_url"]');
750    if (redrct_hiden_field.length > 0) {
751        redrct_hiden_field.remove();
752    }
753
754    // for packages
755    var pkginfo_hiden_field = login_form.find('input[name="extra_login_params"]');
756    if (pkginfo_hiden_field.length > 0) {
757        pkginfo_hiden_field.remove();
758    }
759});
760
761//for email popup
762jQuery(document).on('click', '.jobsearch-send-email-popup-btn', function () {
763    jobsearch_modal_popup_open('JobSearchSendEmailModal');
764});
765
766jQuery(document).on('click', '.employer-followin-btnaction', function () {
767    var _this = jQuery(this);
768    var this_id = _this.attr('data-id');
769    var label_bfr = _this.attr('data-beforelbl');
770    var label_aftr = _this.attr('data-afterlbl');
771
772    if (!_this.hasClass('ajax-loading')) {
773        _this.addClass('ajax-loading');
774        _this.html('<i class="fa fa-refresh fa-spin"></i>');
775        var request = jQuery.ajax({
776            url: jobsearch_plugin_vars.ajax_url,
777            method: "POST",
778            data: {
779                emp_id: this_id,
780                label_bfr: label_bfr,
781                label_aftr: label_aftr,
782                action: 'jobsearch_add_employer_followin_to_list',
783            },
784            dataType: "json"
785        });
786        request.done(function (response) {
787            _this.html(response.label);
788            _this.removeClass('ajax-loading');
789        });
790
791        request.fail(function (jqXHR, textStatus) {
792            _this.html(label_bfr);
793            _this.removeClass('ajax-loading');
794        });
795    }
796});
797
798jQuery(document).on('click', '.jobsearch-add-resume-to-list', function () {
799    var _this = jQuery(this);
800    var this_id = _this.attr('data-id');
801    var download_cv = _this.attr('data-download');
802    var data_style = _this.attr('data-style');
803    var this_loader = data_style != undefined && data_style == "true" ? jQuery(this).parent("figure").parent(".careerfy-candidate-style8-wrapper").find(".resume-loding-msg") : jQuery(this).next('.resume-loding-msg');
804
805    this_loader.show();
806    if (data_style != undefined && data_style == "true") {
807        _this.html('<i class="fa fa-refresh fa-spin"></i>');
808    } else {
809        this_loader.html('<i class="fa fa-refresh fa-spin"></i>');
810    }
811    var request = jQuery.ajax({
812        url: jobsearch_plugin_vars.ajax_url,
813        method: "POST",
814        data: {
815            candidate_id: this_id,
816            download_cv: download_cv,
817            action: 'jobsearch_add_employer_resume_to_list',
818        },
819        dataType: "json"
820    });
821
822    request.done(function (response) {
823        if (typeof response.error !== 'undefined' && response.error == '1') {
824            _this.find('i').removeClass().addClass('fa fa-heart');
825            this_loader.html(response.msg);
826            setTimeout(function () {
827                this_loader.slideUp(800);
828            }, 3000);
829            if (typeof response.pop_html !== undefined) {
830                jQuery('body').append(response.pop_html);
831            }
832            return false;
833        }
834        if (typeof response.dbn !== 'undefined' && response.dbn != '') {
835            _this.hide();
836            _this.parent('.shortlisting-user-btn').hide();
837            _this.parent('.shortlisting-user-btn').html(response.dbn).slideDown();
838            if (typeof response.pop_html !== undefined) {
839                jQuery('body').append(response.pop_html);
840            }
841            return false;
842        }
843        if (typeof response.msg !== 'undefined' && response.msg != '') {
844            this_loader.html(response.msg);
845            _this.html('<i class="jobsearch-icon jobsearch-add-list"></i> ' + jobsearch_plugin_vars.shortlisted_str);
846            _this.removeClass('jobsearch-add-resume-to-list');
847        }
848        window.location.reload();
849    });
850
851    request.fail(function (jqXHR, textStatus) {
852        this_loader.html(jobsearch_plugin_vars.error_msg);
853    });
854});
855
856jQuery(document).on('click', '.jobsearch-svcand-withtyp-tolist', function () {
857    var _this = jQuery(this);
858    var this_id = _this.attr('data-id');
859    var this_loader = jQuery(this).next('.resume-loding-msg');
860
861    var type_selected = _this.parents('#usercand-shrtlistsecs-' + this_id).find('select[name^="shrtlist_type"]').val();
862
863    this_loader.html('<i class="fa fa-refresh fa-spin"></i>');
864    var request = jQuery.ajax({
865        url: jobsearch_plugin_vars.ajax_url,
866        method: "POST",
867        data: {
868            candidate_id: this_id,
869            type_selected: type_selected,
870            action: 'jobsearch_add_employer_resume_to_list',
871        },
872        dataType: "json"
873    });
874
875    request.done(function (response) {
876        if (typeof response.error !== 'undefined' && response.error == '1') {
877            //
878            this_loader.html(response.msg);
879            return false;
880        }
881        if (typeof response.msg !== 'undefined' && response.msg != '') {
882            this_loader.html(response.msg);
883            _this.html('<i class="jobsearch-icon jobsearch-add-list"></i> ' + jobsearch_plugin_vars.shortlisted_str);
884            _this.removeClass('jobsearch-svcand-withtyp-tolist');
885            window.location.reload(true);
886        }
887    });
888
889    request.fail(function (jqXHR, textStatus) {
890        this_loader.html(jobsearch_plugin_vars.error_msg);
891    });
892});
893
894jQuery(document).on('click', '.jobsearch-updcand-withtyp-tolist', function () {
895    var _this = jQuery(this);
896    var this_id = _this.attr('data-id');
897    var this_loader = jQuery(this).next('.resume-loding-msg');
898
899    var type_selected = _this.parents('#usercand-shrtlistsecs-' + this_id).find('select[name^="shrtlist_type"]').val();
900
901    this_loader.html('<i class="fa fa-refresh fa-spin"></i>');
902    var request = jQuery.ajax({
903        url: jobsearch_plugin_vars.ajax_url,
904        method: "POST",
905        data: {
906            candidate_id: this_id,
907            type_selected: type_selected,
908            action: 'jobsearch_upd_employer_resume_to_list',
909        },
910        dataType: "json"
911    });
912
913    request.done(function (response) {
914        if (typeof response.error !== 'undefined' && response.error == '1') {
915            //
916            this_loader.html(response.msg);
917            return false;
918        }
919        if (typeof response.msg !== 'undefined' && response.msg != '') {
920            this_loader.html(response.msg);
921            _this.html('<i class="jobsearch-icon jobsearch-add-list"></i> ' + jobsearch_plugin_vars.shortlisted_str);
922            _this.removeClass('jobsearch-svcand-withtyp-tolist');
923            window.location.reload(true);
924        }
925    });
926
927    request.fail(function (jqXHR, textStatus) {
928        this_loader.html(jobsearch_plugin_vars.error_msg);
929    });
930});
931
932jQuery(document).on('click', '.jobsearch-candidate-ct-form', function (e) {
933    e.preventDefault();
934    var this_id = jQuery(this).data('id'),
935        msg_form = jQuery('#ct-form-' + this_id),
936        ajax_url = jobsearch_plugin_vars.ajax_url,
937        msg_con = msg_form.find('.jobsearch-ct-msg'),
938        msg_name = msg_form.find('input[name="u_name"]'),
939        msg_email = msg_form.find('input[name="u_email"]'),
940        msg_phone = msg_form.find('input[name="u_number"]'),
941        msg_txt = msg_form.find('textarea[name="u_msg"]'),
942        user_id = msg_form.attr('data-uid'),
943        error = 0;
944
945    var cand_ser_form = jQuery('#ct-form-' + this_id)[0];
946
947    var get_terr_val = jobsearch_accept_terms_cond_pop(msg_form);
948    if (get_terr_val != 'yes') {
949        return false;
950    }
951
952    if (msg_form.find('.jobsearch-open-signin-tab').length > 0) {
953        msg_form.find('.jobsearch-open-signin-tab').trigger('click');
954        return false;
955    }
956
957    var email_pattern = new RegExp(/^[+a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,20}$/i);
958
959    if (msg_name.val() == '') {
960        error = 1;
961        msg_name.css({"border": "1px solid #ff0000"});
962    } else {
963        msg_name.css({"border": "1px solid #efefef"});
964    }
965
966    if (msg_email.val() == '') {
967        error = 1;
968        msg_email.css({"border": "1px solid #ff0000"});
969    } else {
970        if (!email_pattern.test(msg_email.val())) {
971            error = 1;
972            msg_email.css({"border": "1px solid #ff0000"});
973        } else {
974            msg_email.css({"border": "1px solid #efefef"});
975        }
976    }
977
978    if (msg_txt.val() == '') {
979        error = 1;
980        msg_txt.css({"border": "1px solid #ff0000"});
981    } else {
982        msg_txt.css({"border": "1px solid #efefef"});
983    }
984
985    if (error == 0) {
986        var formData = new FormData(cand_ser_form);
987
988        formData.append("u_candidate_id", user_id);
989        formData.append("action", 'jobsearch_candidate_contact_form_submit');
990
991        msg_con.html('<em class="fa fa-refresh fa-spin"></em>');
992        msg_con.show();
993
994        var request = jQuery.ajax({
995            url: ajax_url,
996            method: "POST",
997            processData: false,
998            contentType: false,
999            data: formData,
1000            dataType: "json"
1001        });
1002
1003        request.done(function (response) {
1004            if (typeof response.msg !== 'undefined') {
1005                msg_name.val('');
1006                msg_email.val('');
1007                msg_phone.val('');
1008                msg_txt.val('');
1009                msg_con.html(response.msg);
1010            } else {
1011                msg_con.html(jobsearch_plugin_vars.error_msg);
1012            }
1013        });
1014
1015        request.fail(function (jqXHR, textStatus) {
1016            msg_con.html(jobsearch_plugin_vars.error_msg);
1017        });
1018    }
1019
1020    return false;
1021});
1022
1023jQuery(document).on('click', '.jobsearch-employer-ct-form', function (e) {
1024    e.preventDefault();
1025    var this_id = jQuery(this).data('id'),
1026        msg_form = jQuery('#ct-form-' + this_id),
1027        ajax_url = jobsearch_plugin_vars.ajax_url,
1028        msg_con = msg_form.find('.jobsearch-ct-msg'),
1029        msg_name = msg_form.find('input[name="u_name"]'),
1030        msg_email = msg_form.find('input[name="u_email"]'),
1031        msg_phone = msg_form.find('input[name="u_number"]'),
1032        msg_txt = msg_form.find('textarea[name="u_msg"]'),
1033        user_id = msg_form.attr('data-uid'),
1034        error = 0;
1035
1036    var emp_ser_form = jQuery('#ct-form-' + this_id)[0];
1037
1038    var get_terr_val = jobsearch_accept_terms_cond_pop(msg_form);
1039    if (get_terr_val != 'yes') {
1040        return false;
1041    }
1042
1043    if (msg_form.find('.jobsearch-open-signin-tab').length > 0) {
1044        msg_form.find('.jobsearch-open-signin-tab').trigger('click');
1045        return false;
1046    }
1047
1048    var email_pattern = new RegExp(/^[+a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,20}$/i);
1049
1050    if (msg_name.val() == '') {
1051        error = 1;
1052        msg_name.css({"border": "1px solid #ff0000"});
1053    } else {
1054        msg_name.css({"border": "1px solid #efefef"});
1055    }
1056
1057    if (msg_email.val() == '') {
1058        error = 1;
1059        msg_email.css({"border": "1px solid #ff0000"});
1060    } else {
1061        if (!email_pattern.test(msg_email.val())) {
1062            error = 1;
1063            msg_email.css({"border": "1px solid #ff0000"});
1064        } else {
1065            msg_email.css({"border": "1px solid #efefef"});
1066        }
1067    }
1068
1069    if (msg_txt.val() == '') {
1070        error = 1;
1071        msg_txt.css({"border": "1px solid #ff0000"});
1072    } else {
1073        msg_txt.css({"border": "1px solid #efefef"});
1074    }
1075
1076    if (error == 0) {
1077
1078        var formData = new FormData(emp_ser_form);
1079
1080        formData.append("u_employer_id", user_id);
1081        formData.append("action", 'jobsearch_employer_contact_form_submit');
1082
1083        msg_con.html('<em class="fa fa-refresh fa-spin"></em>');
1084        msg_con.show();
1085
1086        var request = jQuery.ajax({
1087            url: ajax_url,
1088            method: "POST",
1089            processData: false,
1090            contentType: false,
1091            data: formData,
1092            dataType: "json"
1093        });
1094
1095        request.done(function (response) {
1096            if (typeof response.msg !== 'undefined') {
1097                msg_name.val('');
1098                msg_email.val('');
1099                msg_phone.val('');
1100                msg_txt.val('');
1101                msg_con.html(response.msg);
1102            } else {
1103                msg_con.html(jobsearch_plugin_vars.error_msg);
1104            }
1105        });
1106
1107        request.fail(function (jqXHR, textStatus) {
1108            msg_con.html(jobsearch_plugin_vars.error_msg);
1109        });
1110    }
1111
1112    return false;
1113});
1114
1115jQuery(document).on('click', '.send-job-email-btn', function () {
1116    jQuery('form#jobsearch_send_to_email_form').submit();
1117});
1118
1119jQuery('form#jobsearch_send_to_email_form').on('submit', function (e) {
1120    e.preventDefault();
1121    var _form = jQuery(this);
1122    var submit_btn = _form.find('.send-job-email-btn');
1123    var msg_con = _form.find('.send-email-msg-box');
1124    var loader_con = _form.find('.send-email-loader-box');
1125    var uemail = _form.find('input[name="send_email_to"]');
1126    var usubject = _form.find('input[name="send_email_subject"]');
1127    var msg = _form.find('textarea[name="send_email_content"]');
1128    var form_data = _form.serialize();
1129
1130    var get_terr_val = jobsearch_accept_terms_cond_pop(_form);
1131    if (get_terr_val != 'yes') {
1132        return false;
1133    }
1134
1135    var email_pattern = new RegExp(/^[+a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,20}$/i);
1136
1137    var e_error = 0;
1138    if (msg.val() == '') {
1139        msg.css({"border": "1px solid #ff0000"});
1140        e_error = 1;
1141    }
1142    if (uemail.val() == '' || !email_pattern.test(uemail.val())) {
1143        uemail.css({"border": "1px solid #ff0000"});
1144        e_error = 1;
1145    }
1146    if (usubject.val() == '') {
1147        usubject.css({"border": "1px solid #ff0000"});
1148        e_error = 1;
1149    }
1150
1151    if (e_error == 1) {
1152        return false;
1153    }
1154
1155    if (!submit_btn.hasClass('jobsearch-loading')) {
1156        msg.css({"border": "1px solid #eceeef"});
1157        uemail.css({"border": "1px solid #eceeef"});
1158        usubject.css({"border": "1px solid #eceeef"});
1159        //
1160        submit_btn.addClass('jobsearch-loading');
1161        msg_con.hide();
1162        loader_con.show();
1163        loader_con.html('<i class="fa fa-refresh fa-spin"></i>');
1164        var request = jQuery.ajax({
1165            url: jobsearch_plugin_vars.ajax_url,
1166            method: "POST",
1167            data: form_data,
1168            dataType: "json"
1169        });
1170
1171        request.done(function (response) {
1172            if ('undefined' !== typeof response.msg && response.msg != '') {
1173                msg_con.html(response.msg);
1174                msg_con.slideDown();
1175            }
1176            if ('undefined' !== typeof response.error && response.error == '1') {
1177                msg_con.removeClass('alert-success').addClass('alert-danger');
1178            } else {
1179                msg_con.removeClass('alert-danger').addClass('alert-success');
1180            }
1181            submit_btn.removeClass('jobsearch-loading');
1182            loader_con.hide();
1183            loader_con.html('');
1184        });
1185
1186        request.fail(function (jqXHR, textStatus) {
1187            submit_btn.removeClass('jobsearch-loading');
1188            loader_con.hide();
1189            loader_con.html('');
1190        });
1191    }
1192
1193    return false;
1194});
1195
1196function jobsearchReplaceAll(str, find, replace) {
1197    return str.replace(new RegExp(find, 'g'), replace);
1198}
1199
1200jQuery(document).on('click', '.jobsearch-applyjob-fb-btn', function () {
1201    var _this = jQuery(this);
1202    var this_id = _this.attr('data-id');
1203    var this_loader = _this.find('i');
1204
1205    var this_msg_con = _this.parents('ul').next('.apply-msg');
1206
1207    this_loader.attr('class', 'fa fa-refresh fa-spin');
1208    var request = jQuery.ajax({
1209        url: jobsearch_plugin_vars.ajax_url,
1210        method: "POST",
1211        data: {
1212            job_id: this_id,
1213            action: 'jobsearch_applying_job_with_facebook',
1214        },
1215        dataType: "json"
1216    });
1217
1218    request.done(function (response) {
1219
1220        if (typeof response.msg !== 'undefined' && response.msg != '') {
1221            this_loader.attr('class', 'jobsearch-icon jobsearch-facebook-logo-1');
1222            this_msg_con.html(response.msg);
1223            this_msg_con.show();
1224            return false;
1225        }
1226        if (typeof response.redirect_url !== 'undefined' && response.redirect_url != '') {
1227            var red_url = jobsearchReplaceAll(response.redirect_url, '#038;', '');
1228            window.location.href = red_url;
1229        } else {
1230            this_loader.attr('class', 'jobsearch-icon jobsearch-facebook-logo-1');
1231        }
1232    });
1233
1234    request.fail(function (jqXHR, textStatus) {
1235        this_loader.attr('class', 'jobsearch-icon jobsearch-facebook-logo-1');
1236    });
1237});
1238
1239jQuery(document).on('click', '.jobsearch-applyjob-linkedin-btn', function () {
1240    var _this = jQuery(this);
1241    var this_id = _this.attr('data-id');
1242    var this_loader = _this.find('i');
1243
1244    var this_msg_con = _this.parents('ul').next('.apply-msg');
1245
1246    this_loader.attr('class', 'fa fa-refresh fa-spin');
1247    var request = jQuery.ajax({
1248        url: jobsearch_plugin_vars.ajax_url,
1249        method: "POST",
1250        data: {
1251            job_id: this_id,
1252            action: 'jobsearch_applying_job_with_linkedin',
1253        },
1254        dataType: "json"
1255    });
1256
1257    request.done(function (response) {
1258
1259        if (typeof response.msg !== 'undefined' && response.msg != '') {
1260            this_loader.attr('class', 'jobsearch-icon jobsearch-linkedin-logo');
1261            this_msg_con.html(response.msg);
1262            this_msg_con.show();
1263            return false;
1264        }
1265        if (typeof response.redirect_url !== 'undefined' && response.redirect_url != '') {
1266            var red_url = jobsearchReplaceAll(response.redirect_url, '#038;', '');
1267            window.location.href = red_url;
1268        } else {
1269            this_loader.attr('class', 'jobsearch-icon jobsearch-linkedin-logo');
1270        }
1271    });
1272
1273    request.fail(function (jqXHR, textStatus) {
1274        this_loader.attr('class', 'jobsearch-icon jobsearch-linkedin-logo');
1275    });
1276});
1277
1278jQuery(document).on('click', '.jobsearch-applyjob-google-btn', function () {
1279    var _this = jQuery(this);
1280    var this_id = _this.attr('data-id');
1281    var this_loader = _this.find('i');
1282
1283    var this_msg_con = _this.parents('ul').next('.apply-msg');
1284
1285    this_loader.attr('class', 'fa fa-refresh fa-spin');
1286    var request = jQuery.ajax({
1287        url: jobsearch_plugin_vars.ajax_url,
1288        method: "POST",
1289        data: {
1290            job_id: this_id,
1291            action: 'jobsearch_applying_job_with_google',
1292        },
1293        dataType: "json"
1294    });
1295
1296    request.done(function (response) {
1297
1298        if (typeof response.msg !== 'undefined' && response.msg != '') {
1299            this_loader.attr('class', 'fa fa-google-plus');
1300            this_msg_con.html(response.msg);
1301            this_msg_con.show();
1302            return false;
1303        }
1304        if (typeof response.redirect_url !== 'undefined' && response.redirect_url != '') {
1305            var red_url = jobsearchReplaceAll(response.redirect_url, '#038;', '');
1306            window.location.href = red_url;
1307        } else {
1308            this_loader.attr('class', 'fa fa-google-plus');
1309        }
1310    });
1311
1312    request.fail(function (jqXHR, textStatus) {
1313        this_loader.attr('class', 'fa fa-google-plus');
1314    });
1315});
1316
1317jQuery(document).on('click', '.employer-access-btn', function () {
1318    jQuery('.employer-access-msg').slideDown();
1319});
1320//for Download resume shortlist popup
1321jQuery(document).on('click', '.jobsearch-open-dloadres-popup', function () {
1322    var _this_id = jQuery(this).attr('data-id');
1323    jobsearch_modal_popup_open('JobSearchDLoadResModal' + _this_id);
1324});
1325
1326//
1327//
1328jQuery('.location_location1').on('change', function (e) {
1329    e.preventDefault();
1330    var this_id = jQuery(this).data('randid'),
1331        nextfieldelement = jQuery(this).data('nextfieldelement'),
1332        nextfieldval = jQuery(this).data('nextfieldval'),
1333        ajax_url = jobsearch_plugin_vars.ajax_url,
1334        location_location1 = jQuery('#location_location1_' + this_id),
1335        location_location2 = jQuery('#location_location2_' + this_id);
1336    jQuery('.location_location2_' + this_id).html('<i class="fa fa-refresh fa-spin"></i>');
1337    var request = jQuery.ajax({
1338        url: ajax_url,
1339        method: "POST",
1340        data: {
1341            location_location: location_location1.val(),
1342            nextfieldelement: nextfieldelement,
1343            nextfieldval: nextfieldval,
1344            action: 'jobsearch_location_load_location2_data',
1345        },
1346        dataType: "json"
1347    });
1348
1349    request.done(function (response) {
1350        if ('undefined' !== typeof response.html) {
1351            location_location2.html(response.html);
1352            jQuery('.location_location2_' + this_id).html('');
1353            if (nextfieldval != '') {
1354                jQuery('.location_location2').trigger('change');
1355            }
1356        }
1357    });
1358
1359    request.fail(function (jqXHR, textStatus) {
1360    });
1361    return false;
1362
1363});
1364
1365jQuery('.location_location2').on('change', function (e) {
1366    e.preventDefault();
1367    var this_id = jQuery(this).data('randid'),
1368        nextfieldelement = jQuery(this).data('nextfieldelement'),
1369        nextfieldval = jQuery(this).data('nextfieldval'),
1370        ajax_url = jobsearch_plugin_vars.ajax_url,
1371        location_location2 = jQuery('#location_location2_' + this_id),
1372        location_location3 = jQuery('#location_location3_' + this_id);
1373    jQuery('.location_location3_' + this_id).html('<i class="fa fa-refresh fa-spin"></i>');
1374    var request = jQuery.ajax({
1375        url: ajax_url,
1376        method: "POST",
1377        data: {
1378            location_location: location_location2.val(),
1379            nextfieldelement: nextfieldelement,
1380            nextfieldval: nextfieldval,
1381            action: 'jobsearch_location_load_location2_data',
1382        },
1383        dataType: "json"
1384    });
1385
1386    request.done(function (response) {
1387        if ('undefined' !== typeof response.html) {
1388            location_location3.html(response.html);
1389            jQuery('.location_location3_' + this_id).html('');
1390            if (nextfieldval != '') {
1391                jQuery('.location_location3').trigger('change');
1392            }
1393        }
1394    });
1395
1396    request.fail(function (jqXHR, textStatus) {
1397    });
1398    return false;
1399
1400});
1401
1402jQuery('.location_location3').on('change', function (e) {
1403    e.preventDefault();
1404    var this_id = jQuery(this).data('randid'),
1405        nextfieldelement = jQuery(this).data('nextfieldelement'),
1406        nextfieldval = jQuery(this).data('nextfieldval'),
1407        ajax_url = jobsearch_plugin_vars.ajax_url,
1408        location_location3 = jQuery('#location_location3_' + this_id),
1409        location_location4 = jQuery('#location_location4_' + this_id);
1410    jQuery('.location_location4_' + this_id).html('<i class="fa fa-refresh fa-spin"></i>');
1411    var request = jQuery.ajax({
1412        url: ajax_url,
1413        method: "POST",
1414        data: {
1415            location_location: location_location3.val(),
1416            nextfieldelement: nextfieldelement,
1417            nextfieldval: nextfieldval,
1418            action: 'jobsearch_location_load_location2_data',
1419        },
1420        dataType: "json"
1421    });
1422
1423    request.done(function (response) {
1424        if ('undefined' !== typeof response.html) {
1425            location_location4.html(response.html);
1426            jQuery('.location_location4_' + this_id).html('');
1427        }
1428    });
1429
1430    request.fail(function (jqXHR, textStatus) {
1431    });
1432    return false;
1433
1434});
1435
1436
1437jQuery('.location_location1_ccus').on('change', function (e) {
1438    e.preventDefault();
1439    var this_id = jQuery(this).attr('data-randid'),
1440        nextfieldelement = jQuery(this).attr('data-nextfieldelement'),
1441        nextfieldval = jQuery(this).attr('data-nextfieldval'),
1442        ajax_url = jobsearch_plugin_vars.ajax_url,
1443        location_location1 = jQuery('#location_location1_' + this_id),
1444        location_location2 = jQuery('#location_location2_cus_' + this_i
1444d);
1445    jQuery('.location_location2_' + this_id).html('<i class="fa fa-refresh fa-spin"></i>');
1446    var request = jQuery.ajax({
1447        url: ajax_url,
1448        method: "POST",
1449        data: {
1450            randid: this_id,
1451            location_location: location_location1.val(),
1452            nextfieldelement: nextfieldelement,
1453            nextfieldval: nextfieldval,
1454            action: 'jobsearch_location_load_cusloc2_data',
1455        },
1456        dataType: "json"
1457    });
1458
1459    request.done(function (response) {
1460        if ('undefined' !== typeof response.html) {
1461            location_location2.html(response.html);
1462            location_location2.find('select').selectize();
1463            jQuery('.location_location2_' + this_id).html('');
1464            if (nextfieldval != '') {
1465                jQuery('.location_location2').trigger('change');
1466            }
1467        }
1468    });
1469
1470    request.fail(function (jqXHR, textStatus) {
1471    });
1472    return false;
1473});
1474
1475if (jQuery('.jobsearch-employer-list .jobsearch-table-layer').length > 0) {
1476    jQuery(document).on('click', '.jobsearch-employer-list .jobsearch-table-layer', function (event) {
1477        var _this = jQuery(this);
1478        var this_target = jQuery(event.target);
1479        if (this_target.is('a') || this_target.parent('a').length > 0) {
1480            // do nothing
1481        } else {
1482            var dest_go_to = _this.find('h2 > a');
1483            window.location.href = dest_go_to.attr('href');
1484        }
1485    });
1486}
1487
1488if (jQuery('.careerfy-employer-grid .careerfy-employer-grid-wrap').length > 0) {
1489    jQuery(document).on('click', '.careerfy-employer-grid .careerfy-employer-grid-wrap', function (event) {
1490        var _this = jQuery(this);
1491        var this_target = jQuery(event.target);
1492        if (this_target.is('a') || this_target.parent('a').length > 0) {
1493            // do nothing
1494        } else {
1495            var dest_go_to = _this.find('h2 > a');
1496            window.location.href = dest_go_to.attr('href');
1497        }
1498    });
1499}
1500
1501jQuery(document).on('click', '#jobsearch-jobadvserach-submit', function (ev) {
1502    ev.preventDefault();
1503    var _thisForm = jQuery(this).parents('form');
1504    _thisForm.find('.jobsearch-search-filter-wrap').find('input').removeAttr('name');
1505    var formToSubmit = setInterval(function () {
1506        var lubricForm = _thisForm.find('input,select,textarea');
1507
1508        jQuery.each(lubricForm, function () {
1509            var thisFieldObj = jQuery(this);
1510            if (typeof thisFieldObj.attr('name') !== 'undefined') {
1511                console.info(thisFieldObj);
1512                var thisFieldName = thisFieldObj.attr('name');
1513                if (thisFieldObj.val() == ''
1514                    || thisFieldName.indexOf("alert-") != -1
1515                    || thisFieldName.indexOf("loc_count_qargs") != -1
1516                    || thisFieldName.indexOf("alerts-") != -1) {
1517                    thisFieldObj.removeAttr('name');
1518                }
1519            }
1520        });
1521        _thisForm.submit();
1522        clearInterval(formToSubmit);
1523    }, 1000);
1524});
1525
1526function jobsearch_js_find_in_array(ar, val) {
1527    if (ar.length > 0) {
1528        for (var i = 0, len = ar.length; i < len; i++) {
1529            if (ar[i] == val) {
1530                return i;
1531            }
1532        }
1533    }
1534    return -1;
1535}
1536
1537jQuery(document).on('keyup', '.jobsearch_chk_passfield', function () {
1538    var _this = jQuery(this);
1539    var parent_form = _this.parents('form');
1540    var _this_classes = 'jobsearch_chk_passfield';
1541    var chk_msg_con = _this.next('.passlenth-chk-msg');
1542    var chkmsg_con_classes = 'passlenth-chk-msg';
1543    var pass_val = _this.val();
1544
1545    var acptable_pass_strnths = jobsearch_plugin_vars.acptable_pass_strnth;
1546    acptable_pass_strnths = jQuery.parseJSON(acptable_pass_strnths);
1547
1548    if (acptable_pass_strnths.length < 1) {
1549        parent_form.find('.jobsearch-regpass-frmbtn').removeClass('jobsearch-disable-btn');
1550        parent_form.find('.jobsearch-regpass-frmbtn').removeAttr('disabled');
1551        return -1;
1552    }
1553
1554    var short_pass_msg = jobsearch_plugin_vars.pass_length_short;
1555    var bad_pass_msg = jobsearch_plugin_vars.pass_length_med;
1556    var good_pass_msg = jobsearch_plugin_vars.pass_length_good;
1557    var strong_pass_msg = jobsearch_plugin_vars.pass_length_strng;
1558
1559    if (pass_val == '') {
1560        chk_msg_con.css({display: 'none'});
1561        chk_msg_con.attr('class', chkmsg_con_classes);
1562        chk_msg_con.html('');
1563        _this.attr('class', _this_classes);
1564        if (!parent_form.find('.jobsearch-regpass-frmbtn').hasClass('jobsearch-disable-btn')) {
1565            parent_form.find('.jobsearch-regpass-frmbtn').addClass('jobsearch-disable-btn');
1566        }
1567        parent_form.find('.jobsearch-regpass-frmbtn').prop('disabled', true);
1568        return false;
1569    }
1570    var blacklistArray = ["querty", "password", "P@ssword1", "132", "123"];
1571    blacklistArray = blacklistArray.concat(wp.passwordStrength.userInputBlacklist());
1572
1573    var pass_strength = wp.passwordStrength.meter(pass_val, blacklistArray);
1574
1575    switch (pass_strength) {
1576        case 0 :
1577            chk_msg_con.css({display: 'inline-block'});
1578            chk_msg_con.attr('class', chkmsg_con_classes + ' jobsearch-vweakp
1578ass');
1579            _this.attr('class', _this_classes + ' jobsearch-vweakpass');
1580            chk_msg_con.html(short_pass_msg);
1581            if (jobsearch_js_find_in_array(acptable_pass_strnths, 'very_weak') !== -1) {
1582                parent_form.find('.jobsearch-regpass-frmbtn').removeClass('jobsearch-disable-btn');
1583                parent_form.find('.jobsearch-regpass-frmbtn').removeAttr('disabled');
1584            } else {
1585                if (!parent_form.find('.jobsearch-regpass-frmbtn').hasClass('jobsearch-disable-btn')) {
1586                    parent_form.find('.jobsearch-regpass-frmbtn').addClass('jobsearch-disable-btn');
1587                }
1588                parent_form.find('.jobsearch-regpass-frmbtn').prop('disabled', true);
1589            }
1590            break;
1591        case 1 :
1592            chk_msg_con.css({display: 'inline-block'});
1593            chk_msg_con.attr('class', chkmsg_con_classes + ' jobsearch-weakpass');
1594            _this.attr('class', _this_classes + ' jobsearch-weakpass');
1595            chk_msg_con.html(bad_pass_msg);
1596            if (jobsearch_js_find_in_array(acptable_pass_strnths, 'weak') !== -1) {
1597                parent_form.find('.jobsearch-regpass-frmbtn').removeClass('jobsearch-disable-btn');
1598                parent_form.find('.jobsearch-regpass-frmbtn').removeAttr('disabled');
1599            } else {
1600                if (!parent_form.find('.jobsearch-regpass-frmbtn').hasClass('jobsearch-disable-btn')) {
1601                    parent_form.find('.jobsearch-regpass-frmbtn').addClass('jobsearch-disable-btn');
1602                }
1603                parent_form.find('.jobsearch-regpass-frmbtn').prop('disabled', true);
1604            }
1605            break;
1606        case 2 :
1607            chk_msg_con.css({display: 'inline-block'});
1608            chk_msg_con.attr('class', chkmsg_con_classes + ' jobsearch-weakpass');
1609            _this.attr('class', _this_classes + ' jobsearch-weakpass');
1610            chk_msg_con.html(bad_pass_msg);
1611            if (jobsearch_js_find_in_array(acptable_pass_strnths, 'weak') !== -1) {
1612                parent_form.find('.jobsearch-regpass-frmbtn').removeClass('jobsearch-disable-btn');
1613                parent_form.find('.jobsearch-regpass-frmbtn').removeAttr('disabled');
1614            } else {
1615                if (!parent_form.find('.jobsearch-regpass-frmbtn').hasClass('jobsearch-disable-btn')) {
1616                    parent_form.find('.jobsearch-regpass-frmbtn').addClass('jobsearch-disable-btn');
1617                }
1618                parent_form.find('.jobsearch-regpass-frmbtn').prop('disabled', true);
1619            }
1620            break;
1621        case 3 :
1622            chk_msg_con.css({display: 'inline-block'});
1623            chk_msg_con.attr('class', chkmsg_con_classes + ' jobsearch-mediumpass');
1624            _this.attr('class', _this_classes + ' jobsearch-mediumpass');
1625            chk_msg_con.html(good_pass_msg);
1626            if (jobsearch_js_find_in_array(acptable_pass_strnths, 'medium') !== -1) {
1627                parent_form.find('.jobsearch-regpass-frmbtn').removeClass('jobsearch-disable-btn');
1628                parent_form.find('.jobsearch-regpass-frmbtn').removeAttr('disabled');
1629            } else {
1630                if (!parent_form.find('.jobsearch-regpass-frmbtn').hasClass('jobsearch-disable-btn')) {
1631                    parent_form.find('.jobsearch-regpass-frmbtn').addClass('jobsearch-disable-btn');
1632                }
1633                parent_form.find('.jobsearch-regpass-frmbtn').prop('disabled', true);
1634            }
1635            break;
1636        case 4 :
1637            chk_msg_con.css({display: 'inline-block'});
1638            chk_msg_con.attr('class', chkmsg_con_classes + ' jobsearch-strongpass');
1639            _this.attr('class', _this_classes + ' jobsearch-strongpass');
1640            chk_msg_con.html(strong_pass_msg);
1641            if (jobsearch_js_find_in_array(acptable_pass_strnths, 'strong') !== -1) {
1642                parent_form.find('.jobsearch-regpass-frmbtn').removeClass('jobsearch-disable-btn');
1643                parent_form.find('.jobsearch-regpass-frmbtn').removeAttr('disabled');
1644            } else {
1645                if (!parent_form.find('.jobsearch-regpass-frmbtn').hasClass('jobsearch-disable-btn')) {
1646                    parent_form.find('.jobsearch-regpass-frmbtn').addClass('jobsearch-disable-btn');
1647                }
1648                parent_form.find('.jobsearch-regpass-frmbtn').prop('disabled', true);
1649            }
1650            break;
1651        case 5 :
1652            chk_msg_con.css({display: 'inline-block'});
1653            chk_msg_con.attr('class', chkmsg_con_classes + ' jobsearch-shortpass');
1654            _this.attr('class', _this_classes + ' jobsearch-shortpass');
1655            chk_msg_con.html(short_pass_msg);
1656            if (!parent_form.find('.jobsearch-regpass-frmbtn').hasClass('jobsearch-disable-btn')) {
1657                parent_form.find('.jobsearch-regpass-frmbtn').addClass('jobsearch-disable-btn');
1658            }
1659            parent_form.find('.jobsearch-regpass-frmbtn').prop('disabled', true);
1660            break;
1661    }
1662});
1663
1664jQuery(document).on('change', '.filter_location_location1', function (e) {
1665    e.preventDefault();
1666    var this_id = jQuery(this).data('randid'),
1667        nextfieldelement = jQuery(this).data('nextfieldelement'),
1668        nextfieldval = jQuery(this).data('nextfieldval'),
1669        ajax_url = jobsearch_plugin_vars.ajax_url,
1670        location_location1 = jQuery('#location_location1_' + this_id),
1671        location_location2 = jQuery('#location_location2_' + this_id);
1672    jQuery('.location_location2_' + this_id).html('<i class="fa fa-refresh fa-spin"></i>');
1673
1674    var request = jQuery.ajax({
1675        url: ajax_url,
1676        method: "POST",
1677        data: {
1678            location_location: location_location1.val(),
1679            nextfieldelement: nextfieldelement,
1680            nextfieldval: nextfieldval,
1681            action: 'jobsearch_location_load_location2_data',
1682        },
1683        dataType: "json"
1684    });
1685
1686    request.done(function (response) {
1687        if ('undefined' !== typeof response.html) {
1688            if (jQuery('.location_location2_selectize').length > 0) {
1689                if (jQuery('.location_location2_selectize').hasClass('location2_selectize_ajax')) {
1690                    jQuery('.location2_selectize_ajax').selectize()[0].selectize.destroy();
1691                }
1692            }
1693            location_location2.html(response.html);
1694            if (typeof location_location2.parent('.jobsearch-profile-select').find('.selectize-control') !== 'undefined') {
1695                location_location2.parent('.jobsearch-profile-select').find('.selectize-control').remove();
1696                location_location2.removeAttr('style');
1697                location_location2.removeAttr('tabindex');
1698                location_location2.removeClass('location2_selectize_ajax');
1699                location_location2.removeClass('selectized');
1700            }
1701            jQuery('.location_location2_' + this_id).html('');
1702            if (nextfieldval != '') {
1703                jQuery('.location_location2').trigger('change');
1704            }
1705            //
1706            if (jQuery('.location_location2_selectize').length > 0) {
1707                if (!jQuery('.location_location2_selectize').hasClass('location2_selectize_ajax')) {
1708                    jQuery('.location_location2_selectize').addClass('location2_selectize_ajax');
1709
1710                    jQuery('.location2_selectize_ajax').selectize({
1711                        //allowEmptyOption: true,
1712                    });
1713                }
1714            }
1715
1716            //
1717            if (jQuery('.location_location3_selectize').length > 0) {
1718                if (jQuery('.location_location2_selectize').val() == '') {
1719                    jQuery('.location_location2_selectize').trigger('change');
1720                }
1721            }
1722        }
1723    });
1724
1725    request.fail(function (jqXHR, textStatus) {
1726    });
1727    return false;
1728
1729});
1730
1731jQuery(document).on('change', '.filter_location_location2', function (e) {
1732    e.preventDefault();
1733    var this_id = jQuery(this).data('randid'),
1734        nextfieldelement = jQuery(this).data('nextfieldelement'),
1735        nextfieldval = jQuery(this).data('nextfieldval'),
1736        ajax_url = jobsearch_plugin_vars.ajax_url,
1737        location_location2 = jQuery('#location_location2_' + this_id),
1738        location_location3 = jQuery('#location_location3_' + this_id);
1739    jQuery('.location_location3_' + this_id).html('<i class="fa fa-refresh fa-spin"></i>');
1740
1741    var request = jQuery.ajax({
1742        url: ajax_url,
1743        method: "POST",
1744        data: {
1745            location_location: location_location2.val(),
1746            nextfieldelement: nextfieldelement,
1747            nextfieldval: nextfieldval,
1748            action: 'jobsearch_location_load_location2_data',
1749        },
1750        dataType: "json"
1751    });
1752
1753    request.done(function (response) {
1754        if ('undefined' !== typeof response.html) {
1755            if (jQuery('.location_location3_selectize').length > 0) {
1756                if (jQuery('.location_location3_selectize').hasClass('location3_selectize_ajax')) {
1757                    jQuery('.location3_selectize_ajax').selectize()[0].selectize.destroy();
1758                }
1759            }
1760            location_location3.html(response.html);
1761            if (typeof location_location3.parent('.jobsearch-profile-select').find('.selectize-control') !== 'undefined') {
1762                location_location3.parent('.jobsearch-profile-select').find('.selectize-control').remove();
1763                location_location3.removeAttr('style');
1764                location_location3.removeAttr('tabindex');
1765                location_location3.removeClass('location3_selectize_ajax');
1766                location_location3.removeClass('selectized');
1767            }
1768            jQuery('.location_location3_' + this_id).html('');
1769            if (nextfieldval != '') {
1770                jQuery('.location_location3').trigger('change');
1771            }
1772            //
1773            if (jQuery('.location_location3_selectize').length > 0) {
1774                if (!jQuery('.location_location3_selectize').hasClass('location3_selectize_ajax')) {
1775                    jQuery('.location_location3_selectize').addClass('location3_selectize_ajax');
1776
1777                    jQuery('.location3_selectize_ajax').selectize({
1778                        //allowEmptyOption: true,
1779                    });
1780                }
1781            }
1782
1783            //
1784            if (jQuery('.location_location4_selectize').length > 0) {
1785                if (jQuery('.location_location3_selectize').val() == '') {
1786                    jQuery('.location_location3_selectize').trigger('change');
1787                }
1788            }
1789        }
1790    });
1791
1792    request.fail(function (jqXHR, textStatus) {
1793    });
1794    return false;
1795
1796});
1797
1798jQuery(document).on('change', '.filter_location_location3', function (e) {
1799    e.preventDefault();
1800    var this_id = jQuery(this).data('randid'),
1801        nextfieldelement = jQuery(this).data('nextfieldelement'),
1802        nextfieldval = jQuery(this).data('nextfieldval'),
1803        ajax_url = jobsearch_plugin_vars.ajax_url,
1804        location_location3 = jQuery('#location_location3_' + this_id),
1805        location_location4 = jQuery('#location_location4_' + this_id);
1806    jQuery('.location_location4_' + this_id).html('<i class="fa fa-refresh fa-spin"></i>');
1807
1808    var request = jQuery.ajax({
1809        url: ajax_url,
1810        method: "POST",
1811        data: {
1812            location_location: location_location3.val(),
1813            nextfieldelement: nextfieldelement,
1814            nextfieldval: nextfieldval,
1815            action: 'jobsearch_location_load_location2_data',
1816        },
1817        dataType: "json"
1818    });
1819
1820    request.done(function (response) {
1821        if ('undefined' !== typeof response.html) {
1822            if (jQuery('.location_location4_selectize').length > 0) {
1823                if (jQuery('.location_location4_selectize').hasClass('location4_selectize_ajax')) {
1824                    jQuery('.location4_selectize_ajax').selectize()[0].selectize.destroy();
1825                }
1826            }
1827            location_location4.html(response.html);
1828            if (typeof location_location4.parent('.jobsearch-profile-select').find('.selectize-control') !== 'undefined') {
1829                location_location4.parent('.jobsearch-profile-select').find('.selectize-control').remove();
1830                location_location4.removeAttr('style');
1831                location_location4.removeAttr('tabindex');
1832                location_location4.removeClass('location4_selectize_ajax');
1833                location_location4.removeClass('selectized');
1834            }
1835            jQuery('.location_location4_' + this_id).html('');
1836            //
1837            if (jQuery('.location_location4_selectize').length > 0) {
1838                if (!jQuery('.location_location4_selectize').hasClass('location4_selectize_ajax')) {
1839                    jQuery('.location_location4_selectize').addClass('location4_selectize_ajax');
1840
1841                    jQuery('.location4_selectize_ajax').selectize({
1842                        //allowEmptyOption: true,
1843                    });
1844                }
1845            }
1846        }
1847    });
1848
1849    request.fail(function (jqXHR, textStatus) {
1850    });
1851    return false;
1852
1853});
1854
1855jQuery('.lodmore-empactjobs-btn').on('click', function (e) {
1856    e.preventDefault();
1857    var _this = jQuery(this),
1858        this_id = _this.attr('data-id'),
1859        total_pages = _this.attr('data-tpages'),
1860        page_num = _this.attr('data-gtopage'),
1861        this_html = _this.html(),
1862        appender_con = jQuery('.jobsearch-empdetail-activejobs > ul');
1863    if (!_this.hasClass('ajax-loadin')) {
1864        _this.addClass('ajax-loadin');
1865        _this.html(this_html + ' <i class="fa fa-refresh fa-spin"></i>');
1866
1867        total_pages = parseInt(total_pages);
1868        page_num = parseInt(page_num);
1869        var request = jQuery.ajax({
1870            url: jobsearch_plugin_vars.ajax_url,
1871            method: "POST",
1872            data: {
1873                emp_id: this_id,
1874                page_num: page_num,
1875                action: 'jobsearch_load_more_actemp_jobs_det',
1876            },
1877            dataType: "json"
1878        });
1879
1880        request.done(function (response) {
1881            if ('undefined' !== typeof response.html) {
1882                page_num += 1;
1883                _this.attr('data-gtopage', page_num);
1884                if (page_num > total_pages) {
1885                    _this.parent('div').hide();
1886                }
1887                appender_con.append(response.html);
1888            }
1889            _this.html(this_html);
1890            _this.removeClass('ajax-loadin');
1891        });
1892
1893        request.fail(function (jqXHR, textStatus) {
1894            _this.html(this_html);
1895            _this.removeClass('ajax-loadin');
1896        });
1897    }
1898    return false;
1899
1900});
1901
1902function jobsearch_upload_cand_cover_letter_file(input, this_id) {
1903
1904    if (input.files && input.files[0]) {
1905
1906        var loader_con = jQuery('#jobsearch-upload-cover-' + this_id).find('.fileUpLoader');
1907
1908        var cv_file = input.files[0];
1909        var file_size = cv_file.size;
1910        var file_type = cv_file.type;
1911        var file_name = cv_file.name;
1912
1913        var allowed_types = jobsearch_plugin_vars.coverdoc_file_types;
1914
1915        file_size = parseFloat(file_size / 1024).toFixed(2);
1916        var filesize_allow = jobsearch_plugin_vars.coverfile_size_allow;
1917        filesize_allow = parseInt(filesize_allow);
1918
1919        if (file_size <= filesize_allow) {
1920            if (allowed_types.indexOf(file_type) >= 0) {
1921                loader_con.html('<i class="fa fa-refresh fa-spin"></i>');
1922                var formData = new FormData();
1923                formData.append('candidate_cover_file', cv_file);
1924                formData.append('action', 'jobsearch_dashboard_uploding_candidate_cover_file');
1925                console.info(formData);
1926                var request = jQuery.ajax({
1927                    url: jobsearch_plugin_vars.ajax_url,
1928                    method: "POST",
1929                    data: formData,
1930                    processData: false,
1931                    contentType: false,
1932                    dataType: "json"
1933                });
1934                request.done(function (response) {
1935                    if (typeof response.err_msg !== 'undefined' && response.err_msg != '') {
1936                        loader_con.html(response.err_msg);
1937                        return false;
1938                    }
1939                    if (typeof response.filehtml !== 'undefined' && response.filehtml != '') {
1940                        jQuery('#com-file-holder').html(response.filehtml);
1941                        jQuery('#com-file-holder').find('.jobsearch-cv-manager-list').slideDown();
1942                    }
1943                    loader_con.html('');
1944                });
1945
1946                request.fail(function (jqXHR, textStatus) {
1947                    loader_con.html(jobsearch_plugin_vars.error_msg);
1948                });
1949            } else {
1950                alert(jobsearch_plugin_vars.cover_file_types);
1951            }
1952
1953        } else {
1954            alert(jobsearch_plugin_vars.coverfile_size_err);
1955        }
1956    }
1957}
1958
1959jQuery(document).on('change', 'input[name="candidate_cover_file"]', function () {
1960    var this_id = jQuery(this).attr('data-id');
1961    jobsearch_upload_cand_cover_letter_file(this, this_id);
1962});
1963
1964function jobsearch_upload_cand_aply_cover_letter(input, this_id) {
1965
1966    if (input.files && input.files[0]) {
1967
1968        var loader_con = jQuery('#jobsearch-upload-cover-' + this_i
1968d).find('.fileUpLoader');
1969
1970        var cv_file = input.files[0];
1971        var file_size = cv_file.size;
1972        var file_type = cv_file.type;
1973        var file_name = cv_file.name;
1974
1975        var allowed_types = jobsearch_plugin_vars.coverdoc_file_types;
1976
1977        file_size = parseFloat(file_size / 1024).toFixed(2);
1978        var filesize_allow = jobsearch_plugin_vars.coverfile_size_allow;
1979        filesize_allow = parseInt(filesize_allow);
1980
1981        if (file_size <= filesize_allow) {
1982            if (allowed_types.indexOf(file_type) >= 0) {
1983                loader_con.html('<i class="fa fa-refresh fa-spin"></i>');
1984                var formData = new FormData();
1985                formData.append('candidate_apply_cover', cv_file);
1986                formData.append('action', 'jobsearch_aplyjob_uplodin_candidate_cover_file');
1987                console.info(formData);
1988                var request = jQuery.ajax({
1989                    url: jobsearch_plugin_vars.ajax_url,
1990                    method: "POST",
1991                    data: formData,
1992                    processData: false,
1993                    contentType: false,
1994                    dataType: "json"
1995                });
1996                request.done(function (response) {
1997                    if (typeof response.err_msg !== 'undefined' && response.err_msg != '') {
1998                        loader_con.html(response.err_msg);
1999                        return false;
2000                    }
2001                    if (typeof response.filehtml !== 'undefined' && response.filehtml != '') {
2002                        jQuery('#cover-uploded-' + this_id).html(response.filehtml);
2003                            jQuery('#cover-uploded-' + this_id).slideDown();
2004                    }
2005                    loader_con.html('');
2006                });
2007
2008                request.fail(function (jqXHR, textStatus) {
2009                    loader_con.html(jobsearch_plugin_vars.error_msg);
2010                });
2011            } else {
2012                alert(jobsearch_plugin_vars.cover_file_types);
2013            }
2014
2015        } else {
2016            alert(jobsearch_plugin_vars.coverfile_size_err);
2017        }
2018    }
2019}
2020
2021jQuery(document).on('change', 'input[name="candidate_apply_cover"]', function () {
2022    var this_id = jQuery(this).attr('data-id');
2023    jobsearch_upload_cand_aply_cover_letter(this, this_id);
2024});
2025
2026jQuery(document).on('click', '.jobsearch-deluser-coverfile', function () {
2027    var _this = jQuery(this);
2028    var this_id = _this.attr('data-id');
2029    if (this_id != '') {
2030        var conf = confirm(jobsearch_plugin_vars.are_you_sure);
2031        if (conf) {
2032            _this.find('i').attr('class', 'fa fa-refresh fa-spin');
2033            var request = jQuery.ajax({
2034                url: jobsearch_plugin_vars.ajax_url,
2035                method: "POST",
2036                data: {
2037                    'attach_id': this_id,
2038                    'action': 'jobsearch_act_user_coverletr_delete',
2039                },
2040                dataType: "json"
2041            });
2042
2043            request.done(function (response) {
2044                if (typeof response.err_msg !== 'undefined' && response.err_msg != '') {
2045                    _this.find('i').removeAttr('class').html(response.err_msg);
2046                    return false;
2047                }
2048                _this.parents('.jobsearch-cv-manager-list').slideUp();
2049                window.location.reload();
2050            });
2051
2052            request.fail(function (jqXHR, textStatus) {
2053                _this.find('i').attr('class', 'jobsearch-icon jobsearch-rubbish');
2054            });
2055        }
2056    }
2057});
2058
2059jQuery(document).on('change', '.jobsearch-cusfield-checkbox input[type=checkbox]', function () {
2060    var _this = jQuery(this);
2061    var this_parent = _this.parents('.jobsearch-cusfield-checkbox');
2062    var max_options = this_parent.attr('data-mop');
2063
2064    max_options = parseInt(max_options);
2065    if (max_options > 0) {
2066        var chkbox_options = this_parent.find('input[type=checkbox]');
2067        var checkd_err_alrt = false;
2068        var checkd_counts = 0;
2069        chkbox_options.each(function () {
2070            var this_option = jQuery(this);
2071            if (this_option.is(':checked')) {
2072                checkd_counts++;
2073            }
2074            if (checkd_counts > max_options) {
2075                this_option.prop('checked', false);
2076                checkd_err_alrt = true;
2077            }
2078        });
2079        if (checkd_err_alrt === true) {
2080            alert(this_parent.attr('data-maxerr'));
2081        }
2082    }
2083});
2084
2085jQuery(document).on('change', '.jobsearch-select-style select,.jobsearch-select-style input', function() {
2086    jQuery('#jobsearch-jobadvserach-submit').trigger('click');
2087});
2088
2089jQuery('.jobsearch-toggle-dashmenu').click(function () {
2090    if (!jQuery('.careerfy-mobile-hdr-sidebar').hasClass('animate-menu-open')) {
2091        jQuery('.careerfy-inmobile-itemsgen').hide();
2092        jQuery('.jobsearch-mobile-dashmenu').removeAttr('style');
2093    }
2094    jQuery('.careerfy-mobile-hdr-sidebar').toggleClass('animate-menu-open');
2095});
2096
2097jQuery('.mobile-usernotifics-btn').click(function () {
2098    if (!jQuery('.careerfy-mobile-hdr-sidebar').hasClass('animate-menu-open')) {
2099        jQuery('.careerfy-inmobile-itemsgen').hide();
2100        jQuery('.jobsearch-mobile-notificsdet').removeAttr('style');
2101    }
2102    jQuery('.careerfy-mobile-hdr-sidebar').toggleClass('animate-menu-open');
2103});
2104
2105if (jQuery('.jobsearch-checkbox-toggle .jobsearch-checkbox').length > 0) {
2106    var jobsearch_filter_ulists = jQuery('.jobsearch-checkbox-toggle .jobsearch-checkbox');
2107    jobsearch_filter_ulists.each(function () {
2108        var filters_list = jQuery(this).find('>li');
2109        if (filters_list.length > 0) {
2110            filters_list.each(function (index, elem) {
2111                var this_litm = jQuery(this);
2112                if (index < 6) {
2113                    if (this_litm.hasClass('filter-more-fields')) {
2114                        this_litm.removeClass('filter-more-fields');
2115                    }
2116                } else {
2117                    if (!this_litm.hasClass('filter-more-fields')) {
2118                        this_litm.addClass('filter-more-fields');
2119                    }
2120                }
2121            });
2122        }
2123    });
2124}
2125

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.