1(function ($) { 2 "use strict"; 3 $.fn.jobsearch_req_field_loop = function (callback, thisArg) { 4 var me = this; 5 return this.each(function (index, element) { 6 return callback.call(thisArg || element, element, index, me); 7 }); 8 }; 9})(jQuery); 10 11jQuery('#job-sector').find('option').first().val(''); 12jQuery('#job-type').find('option').first().val(''); 13 14jQuery(document).ready(function () { 15 16 var setReqFiled = setInterval(function () { 17 var jobTypeFiled = jQuery('#job-type'); 18 if (jobTypeFiled.length > 0 && jobTypeFiled.hasClass('jobsearch-req-field')) { 19 jobTypeFiled.parent('.jobsearch-profile-select').find('.selectize-control').removeClass('jobsearch-req-field'); 20 jobTypeFiled.parent('.jobsearch-profile-select').find('.selectize-dropdown').removeClass('jobsearch-req-field'); 21 jQuery('#job-type-selectized').removeClass('jobsearch-req-field'); 22 } 23 clearInterval(setReqFiled); 24 }, 1000); 25}); 26 27function jobsearch_validate_form(that) { 28 "use strict"; 29 30 var $ = jQuery; 31 var req_class = 'jobsearch-req-field', 32 _this_form = $(that), 33 form_validity = 'valid'; 34 var errors_counter = 1; 35 36 _this_form.find('input.' + req_class + ',select.' + req_class + ',textarea.' + req_class).jobsearch_req_field_loop(function (element, index, set) { 37 38 var job_desc_max_len = parseInt(jobsearch_posting_vars.desc_len_exceed_num); 39 var eror_str = ''; 40 //console.log($(element).attr('name')); 41 //console.log($(element).val()); 42 if ($(element).val() == '' || $(element).val() == null) { 43 form_validity = 'invalid'; 44 eror_str = jobsearch_posting_vars.blank_field_msg; 45 46 } else if ($(element).attr('id') == 'job_detail') { 47 var field_val = $(element).val(); 48 if (field_val.length > job_desc_max_len) { 49 form_validity = 'invalid'; 50 eror_str = jobsearch_posting_vars.desc_len_exceed_msg; 51 52 } else { 53 $(element).parents('.wp-editor-container').css({"border": "1px solid #eceeef"}); 54 $(element).parents('.form-field-sec').find('.field-error').html(''); 55 } 56 } else if ($(element).attr('name') == 'reg_user_uname') { 57 var field_val = $(element).val(); 58 if (!field_val.match(/^([a-zA-Z0-9_-]+)$/)) { 59 form_validity = 'invalid'; 60 eror_str = 'Username can contain only alphanumeric characters, underscore(_), dash(-).'; 61 } else if (field_val.length > 20 || field_val.length < 3) { 62 form_validity = 'invalid'; 63 eror_str = 'Username length should be between 3 to 20 characters.'; 64 } else { 65 $(element).css({"border": "1px solid #eceeef"}); 66 $(element).parents('.form-field-sec').find('.field-error').html(''); 67 } 68 } else if ($(element).attr('name') == 'reg_user_email') { 69 var field_val = $(element).val(); 70 var email_pattern = new RegExp(/^[+a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,20}$/i); 71 if (field_val == '' || !email_pattern.test(field_val)) { 72 form_validity = 'invalid'; 73 eror_str = 'Please enter proper email address.'; 74 } else { 75 $(element).css({"border": "1px solid #eceeef"}); 76 $(element).parents('.form-field-sec').find('.field-error').html(''); 77 } 78 } else { 79 $(element).css({"border": "1px solid #eceeef"}); 80 if ($(element).parents('.jobsearch-profile-select').length > 0) { 81 $(element).parents('.jobsearch-profile-select').removeAttr('style'); 82 } 83 } 84 85 if (eror_str != '') { 86 //var animate_to = element; 87 if ($(element).parents('.jobsearch-profile-select').length > 0) { 88 element = $(element).parents('.jobsearch-profile-select'); 89 } 90 if ($(element).attr('id') == 'job_detail') { 91 element = $(element).parents('.wp-editor-container'); 92 } 93 if ($(element).hasClass('jobsearch-reqtext-editor')) { 94 element = $(element).parents('.wp-editor-container'); 95 } 96 if ($(element).attr('id') == 'job-type' || $(element).attr('id') == 'job-sector') { 97 element = $(element).parents('.jobsearch-profile-select'); 98 } 99 if ($(element).hasClass('multiselect-req')) { 100 element = $(element).parents('.jobsearch-profile-select'); 101 }
102 $(element).css({"border": "1px solid #ff0000"}); 103 var animate_to = $(element); 104 105 $(element).parents('li').find('.field-error').html(eror_str); 106 107 if (errors_counter == 1) { 108 $('html, body').animate({scrollTop: animate_to.offset().top - 70}, 1000); 109 } 110 111 errors_counter++; 112 } else { 113 if ($(element).attr('id') == 'job-type' || $(element).attr('id') == 'job-sector') { 114 element = $(element).parents('.jobsearch-profile-select'); 115 $(element).removeAttr('style'); 116 } 117 if ($(element).hasClass('multiselect-req')) { 118 element = $(element).parents('.jobsearch-profile-select'); 119 $(element).removeAttr('style'); 120 } 121 } 122 }); 123 124 if (form_validity == 'valid') { 125 // API Locations 126 var locations_type = jobsearch_posting_vars.locations_type; 127 var is_req_apilocs = jobsearch_posting_vars.required_api_locs; 128 var switch_location_fields = jobsearch_posting_vars.switch_location_fields; 129 130 if (locations_type == 'api' && is_req_apilocs == 'yes' && switch_location_fields == 'on') { 131 var api_loc_contry = _this_form.find('select[name="jobsearch_field_location_location1"]'); 132 if (api_loc_contry.length > 0) { 133 var api_locval = api_loc_contry.val(); 134 if (api_locval == '') { 135 api_loc_contry.parent('.jobsearch-profile-select').css({"border": "1px solid #ff0000"}); 136 var animate_to = api_loc_contry.parent('.jobsearch-profile-select'); 137 jQuery('html, body').animate({scrollTop: animate_to.offset().top - 110}, 1000); 138 return false; 139 } else { 140 api_loc_contry.parent('.jobsearch-profile-select').css({"border": "none"}); 141 } 142 } 143 var api_loc_state = _this_form.find('select[name="jobsearch_field_location_location2"]'); 144 if (api_loc_state.length > 0) { 145 var api_locval = api_loc_state.val(); 146 if (api_locval == '') { 147 api_loc_state.parent('.jobsearch-profile-select').css({"border": "1px solid #ff0000"}); 148 var animate_to = api_loc_state.parent('.jobsearch-profile-select'); 149 jQuery('html, body').animate({scrollTop: animate_to.offset().top - 110}, 1000); 150 return false; 151 } else { 152 api_loc_state.parent('.jobsearch-profile-select').css({"border": "none"}); 153 } 154 } 155 var api_loc_cities = _this_form.find('select[name="jobsearch_field_location_location3"]'); 156 if (api_loc_cities.length > 0) { 157 var api_locval = api_loc_cities.val(); 158 if (api_locval == '') { 159 api_loc_cities.parent('.jobsearch-profile-select').css({"border": "1px solid #ff0000"}); 160 var animate_to = api_loc_cities.parent('.jobsearch-profile-select'); 161 jQuery('html, body').animate({scrollTop: animate_to.offset().top - 110}, 1000); 162 return false; 163 } else { 164 api_loc_cities.parent('.jobsearch-profile-select').css({"border": "none"}); 165 } 166 } 167 } 168 // 169 170 var salary_validtion = true; 171 var job_slary_type = jQuery('select[name="job_salary_type"]'); 172 if (job_slary_type.length > 0 && job_slary_type.val() == 'negotiable') { 173 salary_validtion = false; 174 } 175 var salry_main_cont = jQuery('.salary-input-fordev'); 176 if (!salry_main_cont.hasClass('required-field')) { 177 salary_validtion = false; 178 } 179 180 var min_salary_field = jQuery('.min-salary > input[name="job_salary"]'); 181 var max_salary_field = jQuery('.max-salary > input[name="job_max_salary"]'); 182 if (salary_validtion === true && min_salary_field.length > 0 && max_salary_field.length > 0) { 183 var min_salary_fieldval = Number(min_salary_field.val()); 184 var max_salary_fieldval = Number(max_salary_field.val()); 185 //console.log(min_salary_fieldval); 186 if (min_salary_fieldval <= 0) {
187 min_salary_field.css({"border": "1px solid #ff0000"}); 188 var animate_to = min_salary_field; 189 jQuery('html, body').animate({scrollTop: animate_to.offset().top - 70}, 1000); 190 return false; 191 } else if (min_salary_fieldval > 0 && max_salary_fieldval < min_salary_fieldval) { 192 max_salary_field.css({"border": "1px solid #ff0000"}); 193 var animate_to = max_salary_field; 194 jQuery('html, body').animate({scrollTop: animate_to.offset().top - 70}, 1000); 195 return false; 196 } else { 197 max_salary_field.css({"border": "1px solid #eceeef"}); 198 } 199 } 200 201 if (_this_form.find('.cusfield-checkbox-required').find('input[type=checkbox]').length > 0) { 202 var element_to_go = _this_form.find('.cusfield-checkbox-required'); 203 var req_checkboxs = _this_form.find('.cusfield-checkbox-required').find('input[type=checkbox]'); 204 var req_checkbox_err = 1; 205 req_checkboxs.each(function() { 206 if (jQuery(this).is(':checked')) { 207 req_checkbox_err = 0; 208 } 209 }); 210 if (req_checkbox_err == 1) { 211 jQuery(element_to_go).css({"border": "1px solid #ff0000"}); 212 jQuery('html, body').animate({scrollTop: element_to_go.offset().top - 100}, 1000); 213 return false; 214 } else { 215 jQuery(element_to_go).removeAttr('style'); 216 } 217 } 218 219 jQuery('.jobsearch-postjob-btn').addClass('disabled-btn').attr('disabled', 'disabled'); 220 return true; 221 } else { 222 return false; 223 } 224} 225 226jQuery(document).on('change', 'select[name=job_salary_type]', function () { 227 var _this = jQuery(this); 228 var slary_input_con = _this.parents('li').find('.salary-input'); 229 var slary_curncy_con = jQuery('.jobsalary-curency-con'); 230 231 if (_this.val() == 'negotiable') { 232 slary_input_con.hide(); 233 slary_curncy_con.hide(); 234 } else { 235 slary_input_con.removeAttr('style'); 236 slary_curncy_con.removeAttr('style'); 237 } 238}); 239 240jQuery(document).on('submit', 'form#job-posting-form', function () { 241 // For custom upload field 242 243 var $uplod_file_ret = jobsearch_cusfield_validate_attach_field(jQuery(this)); 244 if ($uplod_file_ret == false) { 245 return false; 246 } 247 // 248 var fields_1 = jobsearch_validate_form(jQuery(this)); 249 if (!fields_1) { 250 return false; 251 } 252 var fields_2 = jobsearch_validate_seliz_req_form(jQuery(this)); 253 if (!fields_2) { 254 return false; 255 } 256}); 257 258jQuery(document).on('change', 'select[name="job_salary_currency"]', function () { 259 var _this = jQuery(this); 260 var sel_curr = _this.find(':selected').attr('data-cur'); 261 jQuery('.salary-input').find('span').html(sel_curr); 262}); 263 264function jobsearch_job_attach_files_url(event) { 265 266 if (window.File && window.FileList && window.FileReader) { 267 268 var file_types_str = jobsearch_posting_vars.job_files_mime_types; 269 if (file_types_str != '') { 270 var file_types_array = file_types_str.split('|'); 271 } else { 272 var file_types_array = []; 273 } 274 var file_allow_size = jobsearch_posting_vars.job_files_max_size; 275 var num_files_allow = jobsearch_posting_vars.job_num_files_allow; 276 277 num_files_allow = parseInt(num_files_allow); 278 file_allow_size = parseInt(file_allow_size); 279 280 jQuery('#attach-files-holder').find('.adding-file').remove(); 281 var files = event.target.files; 282 for (var i = 0; i < files.length; i++) { 283 284 var _file = files[i]; 285 var file_type = _file.type; 286 var file_size = _file.size; 287 var file_name = _file.name; 288 289 file_size = parseFloat(file_size / 1024).toFixed(2); 290 291 if (file_size <= file_allow_size) { 292 if (file_types_array.indexOf(file_type) >= 0) { 293 var file_icon = 'fa fa-file-text-o'; 294 if (file_type == 'image/png' || file_type == 'image/jpeg') { 295 file_icon = 'fa fa-file-image-o'; 296 } else if (file_type == 'application/msword' || file_type == 'application/vnd.openxmlformats-officedocument.wordprocessingml.document') { 297 file_icon = 'fa fa-file-word-o'; 298 } else if (file_type == 'application/vnd.ms-excel' || file_type == 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet') { 299 file_icon = 'fa fa-file-excel-o'; 300 } else if (file_type == 'application/pdf') { 301 file_icon = 'fa fa-file-pdf-o'; 302 } 303 304 var rand_number = Math.floor((Math.random() * 99999999) + 1); 305 var ihtml = '\ 306 <div class="jobsearch-column-3 adding-file">\ 307 <div class="file-container">\ 308 <a><i class="' + file_icon + '"></i> ' + file_name + '</a>\ 309 </div>\ 310 </div>'; 311 jQuery('#attach-files-holder').append(ihtml); 312 313 } else { 314 alert(jobsearch_posting_vars.file_type_error); 315 return false; 316 } 317 } else { 318 alert(jobsearch_posting_vars.file_size_error); 319 return false; 320 } 321 322 if (i >= num_files_allow) { 323 break; 324 } 325 } 326 } 327} 328 329jQuery(document).on('click', '.jobsearch-company-gallery .el-remove', function () { 330 var e_target = jQuery(this).parent('li'); 331 e_target.fadeOut('slow', function () { 332 e_target.remove(); 333 });
334}); 335 336jQuery(document).on('change', '#jobsearch_job_apply_type', function () { 337 if (jQuery(this).val() == 'external') { 338 jQuery('#job-apply-external-url').slideDown(); 339 jQuery('#job-apply-by-email').hide(); 340 } else if (jQuery(this).val() == 'with_email') { 341 jQuery('#job-apply-by-email').slideDown(); 342 jQuery('#job-apply-external-url').hide(); 343 } else { 344 jQuery('#job-apply-external-url').hide(); 345 jQuery('#job-apply-by-email').hide(); 346 } 347}); 348 349jQuery(document).on('click', 'input[name="job_package_featured"]', function () { 350 var _this = jQuery(this); 351 if (_this.is(":checked")) { 352 jQuery('input[name="job_package_featured"]').prop('checked', false); 353 _this.prop('checked', true); 354 355 // 356 jQuery('.jobsearch-pkgs-boughtnew').slideUp(); 357 } 358}); 359 360jQuery(document).on('click', 'input[name="job_subs_package"]', function () { 361 var _this = jQuery(this); 362 if (_this.is(":checked")) { 363 jQuery('input[name="job_subs_package"]').prop('checked', false); 364 _this.prop('checked', true); 365 } 366 if (_this.hasClass('with_feature_jobs')) { 367 jQuery('.feat-with-already-purp').slideDown(); 368 } else { 369 jQuery('.feat-with-already-purp').slideUp(); 370 } 371}); 372 373jQuery(document).on('click', 'input[name="job_package_new"]', function () { 374 var _this = jQuery(this); 375 if (_this.is(":checked")) { 376 jQuery('input[name="job_package_new"]').prop('checked', false); 377 _this.prop('checked', true); 378 } 379 if (_this.hasClass('with_feature_jobs')) { 380 jQuery('.feat-with-fresh-npkg').slideDown(); 381 } else { 382 jQuery('.feat-with-fresh-npkg').slideUp(); 383 } 384}); 385 386jQuery(document).on('click', '.jobsearch-repblishin-jobtn', function (e) { 387 e.preventDefault(); 388 var _this = jQuery(this); 389 _this.next('input[name=republishin_job]').val('1'); 390 _this.parents('form').submit(); 391 return false; 392});
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.