PageSourceSearch

https://cathnews.com/wp-content/plugins/wp-jobsearch/js/jobsearch-common.js?ver=2.8.8

js cathnews.com collected 2026-10-02 06:04:44 UTC 14,643 bytes, 388 lines download raw bytes

1var jobsearch_common_getJSON = function (url, callback) {
2    var xhr = new XMLHttpRequest();
3    xhr.open('GET', url, true);
4    xhr.responseType = 'json';
5    xhr.onload = function () {
6        var status = xhr.status;
7        if (status === 200) {
8            callback(null, xhr.response);
9        } else {
10            callback(status, xhr.response);
11        }
12    };
13    xhr.send();
14};
15
16
17
18jQuery(document).on('click', '.load_users_field', function (e) {
19    e.preventDefault();
20    var this_id = jQuery(this).data('randid'),
21            loaded = jQuery(this).data('loaded'),
22            custom_field = jQuery('#load_users_field_' + this_id),
23            ajax_url = jobsearch_plugin_vars.ajax_url,
24            force_std = jQuery(this).data('forcestd');
25    if (loaded != true) {
26        jQuery('.load_users_loader_' + this_id).html('<i class="fa fa-refresh fa-spin"></i>');
27        var request = jQuery.ajax({
28            url: ajax_url,
29            method: "POST",
30            data: {
31                force_std: force_std,
32                _nonce: jobsearch_comon_script_vars.nonce,
33                action: 'jobsearch_load_all_users_list_opts',
34            },
35            dataType: "json"
36        });
37
38        request.done(function (response) {
39            if ('undefined' !== typeof response.html) {
40                custom_field.html(response.html);
41                jQuery('.load_users_loader_' + this_id).html('');
42                custom_field.data('loaded', true);
43            }
44        });
45
46        request.fail(function (jqXHR, textStatus) {
47        });
48    }
49    return false;
50
51});
52
53function jobsearch_multicap_all_functions() {
54    var all_elements = jQuery(".g-recaptcha");
55    for (var i = 0; i < all_elements.length; i++) {
56        var id = all_elements[i].getAttribute('id');
57        var site_key = all_elements[i].getAttribute('data-sitekey');
58        if (null != id) {
59            grecaptcha.render(id, {
60                'sitekey': site_key
61            });
62        }
63    }
64}
65
66function jobsearch_captcha_reload(admin_url, captcha_id) {
67    "use strict";
68    var dataString = '&action=jobsearch_captcha_reload&captcha_id=' + captcha_id;
69    jQuery.ajax({
70        type: "POST",
71        url: admin_url,
72        data: dataString,
73        dataType: 'html',
74        success: function (data) {
75            jQuery("#" + captcha_id + "_div").html(data);
76//            jQuery('.g-recaptcha').each(function () {
77//                jQuery(this).find('iframe:first')
78//                        .removeAttr('width')
79//                        .addClass('img-responsive')
80//                        .parent().parent()
81//                        .css({'width': 'auto'});
82//            });
83        }
84    });
85}
86
87window.djangoReCaptcha = {
88    list: [],
89    setup: function () {
90        jQuery('.g-recaptcha').each(function () {
91            var $container = jQuery(this);
92            var config = $container.data();
93
94            alert($container.attr('class'));
95
96            djangoReCaptcha.init($container, config);
97        });
98
99        jQuery(window).on('resize orientationchange', function () {
100            jQuery(djangoReCaptcha.list).each(function (idx, el) {
101                djangoReCaptcha.resize.apply(null, el);
102            });
103        });
104    },
105    init: function ($container, config) {
106        grecaptcha.render($container.get(0), config);
107        var captchaSize, scaleFactor;
108        var $iframe = $container.find('iframe').eq(0);
109
110        $iframe.on('load', function () {
111            $container.addClass('g-recaptcha-initted');
112            captchaSize = captchaSize || {w: $iframe.width() - 2, h: $iframe.height()};
113            djangoReCaptcha.resize($container, captchaSize);
114            djangoReCaptcha.list.push([$container, captchaSize]);
115        });
116    },
117};
118
119window.djangoReCaptchaSetup = window.djangoReCaptcha.setup;
120
121jQuery(document).on('click', '.load-more-team', function () {
122
123    var _this = jQuery(this),
124            total_pages = _this.attr('data-pages'),
125            cur_page = _this.attr('data-page'),
126            this_rand = _this.attr('data-rand'),
127            this_view = _this.attr('data-view'),
128            employer_id = _this.attr('data-id'),
129            class_pref = _this.attr('data-pref'),
130            ajax_url = jobsearch_plugin_vars.ajax_url;
131
132    var team_view = 'default';
133    if ('undefined' !== typeof this_view && this_view != '') {
134        team_view = this_view;
135    }
136
137
138
139    var members_holder = jQuery('#members-holder-' + this_rand);
140    var this_html = _this.html();
141
142    if (!_this.hasClass('jobsearch-loading')) {
143        _this.addClass('jobsearch-loading');
144        _this.html('<i class="fa fa-refresh fa-spin"></i> ' + jobsearch_plugin_vars.loading);
145        var request = jQuery.ajax({
146            url: ajax_url,
147            method: "POST",
148            data: {
149                total_pages: total_pages,
150                cur_page: cur_page,
151                employer_id: employer_id,
152                class_pref: class_pref,
153                team_style: team_view,
154                _nonce: jobsearch_comon_script_vars.nonce,
155                action: 'jobsearch_load_employer_team_next_page',
156            },
157            dataType: "json"
158        });
159
160        request.done(function (response) {
161            if ('undefined' !== typeof response.html && response.html != '') {
162                members_holder.append(response.html);
163                members_holder.find('.new-entries').slideDown().removeClass('new-entries');
164                var current_page = parseInt(cur_page) + 1;
165                _this.attr('data-page', current_page);
166                if (current_page == total_pages) {
167                    _this.hide();
168                }
169            }
170            _this.html(this_html);
171            _this.removeClass('jobsearch-loading');
172        });
173
174        request.fail(function (jqXHR, textStatus) {
175            _this.html(this_html);
176            _this.removeClass('jobsearch-loading');
177        });
178    }
179    return false;
180
181});
182
183jQuery(document).on('click', ".jobsearch-click-btn", function () {
184    var t_tihs = jQuery(this);
185    var filtr_cname = t_tihs.attr('data-cname');
186    var filtr_cval = t_tihs.attr('data-cval');
187    if (filtr_cval == 'close') {
188        filtr_cval = 'open';
189    } else {
190        filtr_cval = 'close';
191    }
192
193
194    t_tihs.parents('.jobsearch-search-filter-toggle').find('.jobsearch-checkbox-toggle').slideToggle("slow", function () {
195        var c_date = new Date();
196        c_date.setTime(c_date.getTime() + (60 * 60 * 1000));
197        var c_expires = "; c_expires=" + c_date.toGMTString();
198        console.info(filtr_cname + "=" + filtr_cval + c_expires + "; path=/");
199        document.cookie = filtr_cname + "=" + filtr_cval + c_expires + "; path=/";
200        //console.info(document.cookie);
201    });
202
203    t_tihs.parents('.jobsearch-search-filter-toggle').toggleClass("jobsearch-remove-padding");
204    return false;
205});
206
207if (jQuery('.jobsearch-mobile-btn').length > 0) {
208    jQuery(document).on('click', '.jobsearch-mobile-btn', function () {
209        jQuery('.jobsearch-mobile-section').slideToggle(1000);
210        jQuery(this).toggleClass("open");
211    });
212}
213
214jQuery(document).on('change', '.jobsearch-depndfield-srchange', function() {
215    var _this = jQuery(this);
216    var field_parent = _this.parents('.jobsearch-depndetfield-con');
217    var field_mid = field_parent.attr('data-mid');
218    var field_type = field_parent.attr('data-ftype');
219    var field_place = field_parent.attr('data-plc');
220    var field_thid = field_parent.attr('data-thid');
221    var is_multi_on = field_parent.attr('data-mism');
222    var selectize_control = field_parent.find('.selectize-control');
223    var selectize_drpdown = selectize_control.find('.selectize-dropdown-content');
224    var slectd_optionval = _this.val();
225    var selctd_selctize_val = selectize_drpdown.find('div[data-value="' + slectd_optionval + '"]');
226    var has_depnd = selctd_selctize_val.attr('data-depend');
227    var opt_id = selctd_selctize_val.attr('data-optid');
228    var all_nextdep_fields = field_parent.nextAll('.jobsearch-deparent-field.deparent-' + field_thid);
229    if (all_nextdep_fields.length > 0) {
230        all_nextdep_fields.each(function() {
231            jQuery(this).remove();
232        });
233    }
234    if (has_depnd == 'true') {
235        field_parent.addClass('disabled-field');
236        field_parent.append('<span class="jobsearch-depfield-loder"><i class="fa fa-refresh fa-spin"></i></span>');
237        var loc_counts_request = jQuery.ajax({
238            url: jobsearch_plugin_vars.ajax_url,
239            method: "POST",
240            data: {
241                opt_id: opt_id,
242                field_mid: field_mid,
243                field_type: field_type,
244                field_plc: field_place,
245                is_multi_on: is_multi_on,
246                _nonce: jobsearch_comon_script_vars.nonce,
247                action: 'jobsearch_get_depend_fields_infront',
248            },
249            dataType: "json"
250        });
251        loc_counts_request.done(function (response) {
252            if (typeof response.html !== undefined) {
253                field_parent.after(response.html);
254            }
255        });
256        loc_counts_request.complete(function () {
257            field_parent.removeClass('disabled-field');
258            field_parent.find('.jobsearch-depfield-loder').remove();
259        });
260    }
261});
262
263jQuery(document).on('change', '.jobsearch-depndfield-mulchange', function() {
264    var _this = jQuery(this);
265    var field_parent = _this.parents('.jobsearch-depndetfield-con');
266    var field_mid = field_parent.attr('data-mid');
267    var field_type = field_parent.attr('data-ftype');
268    var field_place = field_parent.attr('data-plc');
269    var field_thid = field_parent.attr('data-thid');
270    var selectize_drpdown = field_parent.find('.hiden-multiselc-opts');
271    var is_multi_on = field_parent.attr('data-mism');
272    
273    var slectd_optionval = _this.val();
274    
275    var opt_ids = '';
276    if (slectd_optionval.length > 0) {
277        var opt_ids_arr = [];
278        jQuery(slectd_optionval).each(function(index, _this_val) {
279            var selctize_val_div = selectize_drpdown.find('div[data-value="' + _this_val + '"]');
280            if (selctize_val_div.attr('data-depend') == 'true') {
281                opt_ids_arr.push(selctize_val_div.attr('data-optid'));
282            }
283        });
284        if (opt_ids_arr.length > 0) {
285            opt_ids = opt_ids_arr.join(',');
286        }
287    }
288    
289    //
290    var all_nextdep_fields = field_parent.nextAll('.jobsearch-deparent-field.deparent-' + field_thid);
291    if (all_nextdep_fields.length > 0) {
292        all_nextdep_fields.each(function() {
293            jQuery(this).remove();
294        });
295    }
296    
297    if (opt_ids != '') {
298        field_parent.addClass('disabled-field');
299        field_parent.append('<span class="jobsearch-depfield-loder"><i class="fa fa-refresh fa-spin"></i></span>');
300        var loc_counts_request = jQuery.ajax({
301            url: jobsearch_plugin_vars.ajax_url,
302            method: "POST",
303            data: {
304                opt_id: opt_ids,
305                field_mid: field_mid,
306                field_type: field_type,
307                field_plc: field_place,
308                is_multi_on: is_multi_on,
309                _nonce: jobsearch_comon_script_vars.nonce,
310                action: 'jobsearch_get_depend_fields_infront',
311            },
312            dataType: "json"
313        });
314        loc_counts_request.done(function (response) {
315            if (typeof response.html !== undefined) {
316                field_parent.after(response.html);
317            }
318        });
319        loc_counts_request.complete(function () {
320            field_parent.removeClass('disabled-field');
321            field_parent.find('.jobsearch-depfield-loder').remove();
322        });
323    }
324});
325
326jQuery(document).on('change', '.jobsearch-depndfield-rchchange', function() {
327    var _this = jQuery(this);
328    var field_parent = _this.parents('.jobsearch-depndetfield-con');
329    var field_mid = field_parent.attr('data-mid');
330    var field_type = field_parent.attr('data-ftype');
331    var field_place = field_parent.attr('data-plc');
332    var field_thid = field_parent.attr('data-thid');
333    var is_multi_on = field_parent.attr('data-mism');
334    
335    var opt_ids = '';
336    var opt_ids_arr = [];
337    field_parent.find('.jobsearch-depndfield-rchchange').each(function() {
338        if (jQuery(this).is(':checked') && jQuery(this).attr('data-depend') == 'true') {
339            opt_ids_arr.push(jQuery(this).attr('data-optid'));
340        }
341    });
342    if (opt_ids_arr.length > 0) {
343        opt_ids = opt_ids_arr.join(',');
344    }
345    
346    //
347    var all_nextdep_fields = field_parent.nextAll('.jobsearch-deparent-field.deparent-' + field_thid);
348    if (all_nextdep_fields.length > 0) {
349        all_nextdep_fields.each(function() {
350            jQuery(this).remove();
351        });
352    }
353    
354    if (opt_ids != '') {
355        field_parent.addClass('disabled-field');
356        field_parent.append('<span class="jobsearch-depfield-loder"><i class="fa fa-refresh fa-spin"></i></span>');
357        var loc_counts_request = jQuery.ajax({
358            url: jobsearch_plugin_vars.ajax_url,
359            method: "POST",
360            data: {
361                opt_id: opt_ids,
362                field_mid: field_mid,
363                field_type: field_type,
364                field_plc: field_place,
365                is_multi_on: is_multi_on,
366                _nonce: jobsearch_comon_script_vars.nonce,
367                action: 'jobsearch_get_depend_fields_infront',
368            },
369            dataType: "json"
370        });
371        loc_counts_request.done(function (response) {
372            if (typeof response.html !== undefined) {
373                field_parent.after(response.html);
374            }
375        });
376        loc_counts_request.complete(function () {
377            field_parent.removeClass('disabled-field');
378            field_parent.find('.jobsearch-depfield-loder').remove();
379        });
380    }
381});
382
383jQuery(document).on('click', '.show-applyjob-questsbtn', function () {
384    var _this_id = jQuery(this).attr('data-id');
385    var data_html = jQuery('#cand-ansdata-' + _this_id).html();
386    jQuery('#JobSearchModalApplyJobQuests').find('.jobsearch-applyjobans-con').html(data_html);
387    jobsearch_modal_popup_open('JobSearchModalApplyJobQuests');
388});

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.