PageSourceSearch

https://www.grsrecruitment.com/wp-content/themes/grstheme/assets/js/search.js?ver=1790342386

js grsrecruitment.com collected 2026-10-05 02:11:18 UTC 4,057 bytes, 123 lines download raw bytes

1"use strict"
2var GRSJobSearch = (function($){
3
4	var run = function(){
5
6		// set dropdowns
7		var $drp = {
8			sector: $('form.grs-job-search #sector-dropdown'),
9			location: $('form.grs-job-search #location-dropdown'),
10			industry: $('form.grs-job-search #industry-dropdown')
11		};
12
13		// set keyword input
14		var $keyword = $('form.grs-job-search input#keyword');
15
16		// init SumoSelect on the following
17		$drp.sector.SumoSelect({ customClass: 'custom-dropdown' });
18		$drp.location.SumoSelect({ customClass: 'custom-dropdown' });
19		$drp.industry.SumoSelect({ customClass: 'custom-dropdown' });
20
21		// sumoSelect hack with having an 'All' option, retaining a smooth functionality
22		// for the end user using the multiple select functionality
23		var previousValuesStore = {
24			sector: [],
25			location: [],
26			industry: []
27		};
28		var sumoSelectAllOptionHack = function(dropdownName){
29			var val = $drp[dropdownName].val();
30			if ( typeof val !== 'undefined' && val !== null && val.length > 0 ){
31				if ( val[0] === "0" && (
32					( previousValuesStore[dropdownName] !== null && previousValuesStore[dropdownName].length > 0 && previousValuesStore[dropdownName][0] !== '0' )
33					|| ( previousValuesStore[dropdownName] !== null && previousValuesStore[dropdownName].length === 0 )
34				)){
35					for ( var y = 0; y < $drp[dropdownName][0].children.length; y++ ){
36						$drp[dropdownName][0].sumo.unSelectItem(y);
37					}
38					// $drp[dropdownName][0].sumo.unSelectAll();
39					$drp[dropdownName][0].sumo.selectItem(0);
40					$drp[dropdownName].val(val.shift());
41				} else {
42					$drp[dropdownName][0].sumo.unSelectItem(0);
43				}
44				previousValuesStore[dropdownName] = $drp[dropdownName].val();
45			}
46		};
47		$drp.sector.parent('div.SumoSelect').children('div.optWrapper').children('ul.options').children('li').on('click', function(e){
48			sumoSelectAllOptionHack('sector');
49		});
50		$drp.location.parent('div.SumoSelect').children('div.optWrapper').children('ul.options').children('li').on('click', function (e) {
51			sumoSelectAllOptionHack('location');
52		});
53		$drp.industry.parent('div.SumoSelect').children('div.optWrapper').children('ul.options').children('li').on('click', function (e) {
54			sumoSelectAllOptionHack('industry');
55		});
56
57
58		// set submit btn
59		var $btn = $('.grs-job-search .btn-search');
60
61		// submission process
62		var process = function(){
63			var values = {
64				keyword: $keyword.val(),
65				sector: $drp.sector.val(),
66				location: $drp.location.val(),
67				industry: $drp.industry.val()
68			};
69
70			var params = {};
71
72			if ( values.keyword !== null && values.keyword.length > 1 ){
73				params['k'] = values.keyword;
74			}
75			
76			if ( values.sector !== null ) {
77				params['sc'] = values.sector.join(',');
78			}
79
80			if ( values.location !== null ) {
81				params['lct'] = values.location.join(',');
82			}
83
84			if ( values.industry !== null ){
85				params['ind'] = values.industry.join(',');
86			}
87
88			var qString = $.param(params).replace(new RegExp('%2C', 'g'), ',');
89
90			if ( qString.length === 0 ) window.location.href = window.location.protocol + '//' + window.location.host + '/vacancies';
91			
92			$btn.html('<i class="fa fa-spinner fa-pulse fa-fw"></i>');
93
94			//window.location.href = window.location.protocol + '//' + window.location.host + '/projects/grs/vacancies?' + qString;
95			if ( window.location.hostname.indexOf('dev.converticomedia.com') > -1 ){
96				window.location.href = window.location.protocol + '//dev.converticomedia.com/projects/grs/vacancies?' + qString;
97			} else {
98				window.location.href = window.location.protocol + '//' + window.location.host + '/vacancies?' + qString;
99			}
100
101		}
102		
103		// submission events
104		$btn.on('click', function(e){
105			process();
106			return false;
107		});
108		$('form.grs-job-search').on('submit', function(e){
109			e.preventDefault();
110			process();
111		});
112
113		// add pagination to the top
114		var paginationHtml = $('.jobs-list .input-pagination.pagination').html();
115		$('#upper-pagination').addClass('input-pagination').addClass('pagination').html(paginationHtml);
116
117	}
118
119	$(document).ready(function(){
120		run();
121	});
122
123})(jQuery);

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.