PageSourceSearch

https://www.hays.be/o/hays-desktop-branding-theme/js/main.js?brows…=js&languageId=fr_BE&t=1790123348000

js hays.be collected 2026-10-04 20:46:45 UTC 22,765 bytes, 702 lines download raw bytes

1/*1790123346000*/
2/*1790123346000*/
3AUI().ready(
4
5            /*
6            This function gets loaded when all the HTML, not including the portlets, is
7            loaded.
8            */
9			function() {
10				console.log("ucmLocale----" + ucmLocale);
11				if(ucmLocale !="en-CHN" && ucmLocale!="cn-CHN"){
12					dataLayer.push({
13                        'event':'LiferayVirtualPageview',
14                        'LiferayPageURL': window.location.pathname.concat(window.location.search),
15                        'LiferayPageTitle': document.title
16                        });
17				}
18                        
19            
20            }
21
22
23);
24
25Liferay.Portlet.ready(
26
27	/*
28	This function gets loaded after each and every portlet on the page.
29
30	portletId: the current portlet's id
31	node: the Alloy Node object of the current portlet
32	*/
33
34	function(portletId, node) {
35	}
36);
37
38Liferay.on(
39	'allPortletsReady',
40
41	/*
42	This function gets loaded when everything, including the portlets, is on
43	the page.
44	*/
45
46	function() {
47	}
48);
49
50$( "#closeCookieBanner" ).click(function() {
51  $("#header-msg-wrapper").hide();
52});
53
54
55
56/**
57* Clearable text inputs
58*/
59
60$(".clearable").each(function() {
61  
62  var $inp = $(this).find("input:text"),
63      $cle = $(this).find(".clearable__clear");
64
65  $inp.on("input", function(){
66    $cle.toggle(!!this.value);
67  });
68  
69  $cle.on("touchstart click", function(e) {
70    e.preventDefault();
71    $inp.val("").trigger("input");
72  });
73  
74});
75
76
77
78
79
80function setCookie(cname, cvalue, exdays, domain) {
81    var d = new Date();
82    d.setTime(d.getTime() + (exdays*24*60*60*1000));
83    var expires = "expires="+ d.toUTCString();
84	var domainSet = "domain="+ domain;
85	if(typeof domain === 'undefined' || domain === null){
86		domainSet = "";
87	}
88	document.cookie = cname + "=" + cvalue + "; Secure; SameSite=Lax; " + expires + ";" + domainSet +";path=/";
89}
90
91
92function getCookie(cname) {
93    var name = cname + "=";
94    var decodedCookie = decodeURIComponent(document.cookie);
95    var ca = decodedCookie.split(';');
96    for(var i = 0; i <ca.length; i++) {
97        var c = ca[i];
98        while (c.charAt(0) == ' ') {
99            c = c.substring(1);
100        }
101        if (c.indexOf(name) == 0) {
102            return c.substring(name.length, c.length);
103        }
104    }
105    return "";
106}
107
108
109//console.log("ucmLocale : " + ucmLocale);
110var UCMSiteLanguage = ucmLocale.substr(0, ucmLocale.indexOf("-"));
111var bcookieName = 'bannercookie_'+ UCMSiteLanguage;
112var baseUrl = Liferay.ThemeDisplay.getCDNBaseURL();
113var domainForCookie = baseUrl.substr(baseUrl.indexOf("."));
114//Set cookie for language change
115setCookie("multi_country",ucmLocale,365,domainForCookie);
116
117var banner_display = getCookie(bcookieName);
118				if(banner_display == null || banner_display === '') 
119				{
120					$("#header-msg-wrapper").show();
121					setCookie(bcookieName, 'Y', 10, domainForCookie);				
122				}
123				else
124				{
125					$("#header-msg-wrapper").hide();
126				}
127				
128				
129// Js from Pallavi				
130
131
132function getRecentSearchCookie(cname){
133		
134							var name=cname+"=";
135							var decodedCookie=decodeURIComponent(document.cookie);
136							var ca=decodedCookie.split(';');
137							for(var i=0;i<ca.length;i++){
138							var c=ca[i];
139							while(c.charAt(0)==' '){
140							c=c.substring(1)
141							}
142							if(c.indexOf(name)==0){
143							return c.substring(name.length,c.length)
144							}
145							}
146							return ""
147							}
148							
149$('#browse-exp-btn_job').click(function(){$('#browse-exp_job').fadeIn(400);return!1});
150$('#closeButton').click(function(e){e.preventDefault();this.parentNode.style.display = 'none'; return false});
151
152/*$('#closeButton').addEventListener('click', function(e) {
153    e.preventDefault();
154 this.parentNode.style.display = 'none';
155}, false);*/
156
157
158function HAYSsearchjobshome_search_jobsGCSES(formName, searchURLPartial) {
159	
160	  var jobSearchURL= searchURLPartial;
161	  var locationCountryAppender = '';
162	  var searchForLocation = encodeURIComponent($('#'+formName+'locationToSearch').val());
163	  var qVal = encodeURIComponent($('#'+formName+'q').val());
164
165	  //Code For Web 2.0
166	  var lrLocale = Liferay.ThemeDisplay.getLanguageId();
167	  var headerLinkJobSearchVal = $("#headerLinkJobSearch").val();
168	  var web2MobileURLVal = $("#web2MobileURL").val();
169	  var urlRestructVal = $("#urlRestruct").val();
170      var locationHrefGCS ="";
171      var searchUrl = "";
172
173//if(lrLocale == "en_AU" || lrLocale == "en_NZ" || lrLocale== "ja_JP" || lrLocale == "en_JP" || lrLocale == "en_CN" || lrLocale == "en_TH" || lrLocale== "cn_CN")
174if(urlRestructVal.includes(lrLocale))
175	{
176	 searchUrl = jobSearchURL+"/search/";
177     locationHrefGCS = searchUrl+"?q="+qVal+"&location="+searchForLocation;
178
179      	  }
180      else{
181	   //searchUrl = themeDisplay.getPortalURL()+"/"+headerLinkJobSearchVal;
182	   searchUrl = web2MobileURLVal +"/"+ headerLinkJobSearchVal;
183       locationHrefGCS = searchUrl+"?q="+qVal+"&location="+searchForLocation;
184
185      	  }
186	//  SetCookie("recentSearch",qVal,365);
187	//var searchUrl = jobSearchURL+"/search/";
188	  //var locationHrefGCS = searchUrl+"?q="+qVal+"&location="+searchForLocation;
189	
190	  window.location.href =locationHrefGCS;
191	
192	}		
193
194function includeJQueryAutocompleteForKeywords(formName, formLocale) {
195	
196	 var siteLocale = formLocale; 
197	
198	 if (window.jQuery) {
199	  var sourceRecentHistory = [];
200	
201	  var recentSearchTerm = getRecentSearchCookie("recentSearch");
202	 
203					if(recentSearchTerm != undefined){
204						
205						try {
206							recentSearchTerm = decodeURIComponent(recentSearchTerm);
207						} catch (ex) {
208							//console.log("Error in decoding");
209						}
210						if (recentSearchTerm) {
211							var finalRS = [];
212							finalRS = recentSearchTerm.split("|");
213							sourceRecentHistory = finalRS;
214							//alert('sourceRecentHistory'+sourceRecentHistory);
215							
216						}
217					}
218	
219					var sourceBlank = [];
220					$('#'+formName+'q').autocomplete({
221						minLength:3,
222						source: function(request, response) {
223							
224								if(request.term.length == 0){
225									$(".ui-autocomplete").addClass("history").removeClass("suggestion");
226									response(sourceRecentHistory)
227									}
228								else if (request.term.length >0 && request.term.length < 3){
229									response(sourceBlank)}
230								else{
231									//console.log("hit recorder for GCS");
232									if(formLocale !="en-CHN" && formLocale !="cn-CHN"){
233										dataLayer.push({
234											'event':'googleAutoSuggest',
235											'GCJAutoSuggest':request.term
236										});	
237									}
238									
239									$(".ui-autocomplete").addClass("suggestion").removeClass("history");
240									 $.ajax({
241						                 url : pathContext+"/o/KeywordRest/keywords/"+request.term,
242						                 type : "GET",
243						                    data : {
244						                        limit: 5,
245						                             completionType: 'JOB_TITLE',
246						                             locale: siteLocale
247						                 },
248						                 dataType : "json",
249						                 success : function(data) {
250						                       response(data.list,function(item){
251						                    	   
252						                           return{
253						                                //item
254						                                label: item,
255									        value: item
256						                              //alert("success");
257						                           }
258						                       })
259						                 }, 
260						                 error: function(jqXHR, textStatus, errorThrown){
261                                        $(".ui-autocomplete-loading").removeClass("ui-autocomplete-loading");
262                                        //console.log("error handler!");
263                                        response(sourceBlank)
264                                        //response(sourceRecentHistory);
265										}
266						          });
267								
268									}
269						},
270						minLength: 0,
271						select: function(event, ui) {
272						$('#'+formName+'q').attr('value', ui.item.value); 
273					},
274						open: function() {
275							$(this).removeClass("ui-corner-all").addClass("ui-corner-top");
276						},
277						close: function() {
278							$(this).removeClass("ui-corner-top").addClass("ui-corner-all");
279						}
280						})
281					 .focus(function() {
282							if($(this).val() == ""){
283	                       $(this).autocomplete("search", $(this).val());
284	                       //console.log("inside focus");
285						    }
286				
287							});
288							}
289							else {
290								window.setTimeout(includeJQueryAutocompleteForKeywords, 100);
291							}
292	 
293	 
294						}
295
296
297function includeJQueryAutocompleteForLocations(formName) {
298							
299							 if (window.jQuery) {
300							 
301											var sourceBlank1 = [];
302											$('#'+formName+'locationToSearch').autocomplete({
303												minLength:3,
304												source: function(request, response) {
305														if(request.term.length == 0){
306															//console.log("inside if when term length 0");
307															}
308														else if (request.term.length >0 && request.term.length < 3){
309															response(sourceBlank1)}
310														else{
311															$(".ui-autocomplete").addClass("suggestion").removeClass("history");
312															 $.ajax({
313												                 url : pathContext+"/o/LocationSuggestions/hayslocation/domain/"+domainId+"/"+rowNum+"/"+encodeURI(request.term),
314												                 type : "GET",
315												                 dataType : "json",
316												                 success : function(data) {											                	 
317												                	 var items = [];
318
319												                     $.each( data.results, function(key, val){
320												                         items.push(val.LOCATION_DESC);
321												                     });
322
323												                     //console.log(items);
324												                     response(items);
325												                     
326												                 }, 
327												                 error: function(err){
328												                //console.log("error handler!");
329												                
330												                 }
331												          });
332														
333															}
334												},
335												minLength: 0,
336												select: function(event, ui) {
337												$('#'+formName+'locationToSearch').attr('value', ui.suggestion );
338											},
339												open: function() {
340													$(this).removeClass("ui-corner-all").addClass("ui-corner-top");
341												},
342												close: function() {
343													$(this).removeClass("ui-corner-top").addClass("ui-corner-all");
344												}
345											}).focus(function() {
346							    $(".sample1").addClass("test");
347								$(this).autocomplete("search", $(this).val());});	
348											
349											
350											
351													}
352													else {
353														window.setTimeout(includeJQueryAutocompleteForLocations, 100);
354													}
355							 
356							 
357												}
358
359function HAYSsearchjobsSpecialism_search_jobsGCSES(formName, searchURLPartial, specialismType) {
360	
361	  var jobSearchURL= searchURLPartial;
362	  var lrLocale = Liferay.ThemeDisplay.getLanguageId();
363	  var locationCountryAppender = '';
364	  var searchForLocation = $('#'+formName+'locationToSearch').val();
365	  var qVal = $('#'+formName+'q').val();
366	  var headerLinkJobSearchVal = $("#headerLinkJobSearch").val();
367	  var urlRestructVal = $("#urlRestruct").val();
368	  var searchUrl = "";
369
370      if(urlRestructVal.includes(lrLocale))
371      	{
372
373      	searchUrl = jobSearchURL+"/search/";
374
375      	}
376	  else{
377
378	    searchUrl = themeDisplay.getPortalURL()+"/"+headerLinkJobSearchVal;
379
380        }
381	  var locationHrefGCS = searchUrl+"?q="+qVal+"&location="+searchForLocation;
382
383	  var specialism_exists_checkGCS = $('#'+formName+'x_specialism').val();
384	 
385	  var subSpecialismValJS="";
386	
387	  var specialismCategoryCheck= specialismType;
388	 
389	  if (specialism_exists_checkGCS !=""){
390			if (document.getElementById(formName+"x_search").checked == true ){
391				 if (specialismCategoryCheck === "specialism") {
392					  
393					  locationHrefGCS = locationHrefGCS+"&specialismId="+specialism_exists_checkGCS+"&subSpecialismId="+ subSpecialismValJS;
394				
395				 }
396				  else if (specialismCategoryCheck === "subspecialism"){
397					 
398					  locationHrefGCS = locationHrefGCS+"&specialismId="+subSpecialismValJS+"&subSpecialismId="+ specialism_exists_checkGCS;
399			
400				  }
401				
402				
403				
404			}
405		}
406	
407	  window.location.href =locationHrefGCS;
408}
409
410function HAYSsite_search(formName, searchURL, currFrndlyURL) {
411                var queryText = $('#'+formName+'QueryText').val();
412                if(queryText=='' || queryText==null){
413                 document.getElementById("siteSearchErrorLabel").style.display = "block";
414                }
415                else{
416                var currentLayoutURL = Liferay.ThemeDisplay.getLayoutURL()+"/";
417                var searchHref = currentLayoutURL.replace(currFrndlyURL+"/", searchURL +queryText );
418                //console.log("searchHref::"+searchHref);
419                window.location.href =searchHref;
420                }
421                }
422
423
424
425				//Tanya's code
426				
427
428/*function getCookie(c_name)
429     {
430    var i,x,y,ARRcookies=document.cookie.split(";");
431    //console.log("ARRcookies"+ARRcookies);
432      for (i=0;i<ARRcookies.length;i++)
433      {
434        x=ARRcookies[i].substr(0,ARRcookies[i].indexOf("="));
435        y=ARRcookies[i].substr(ARRcookies[i].indexOf("=")+1);
436        x=x.replace(/^\s+|\s+$/g,"");
437        //console.log("x"+x);
438        if (x==c_name)
439       {
440       return unescape(y);
441       }
442      } 
443     }
444
445var username=getCookie("usrname");
446console.log("++++username----"+decodeURIComponent(escape(username)));
447function functionalityCookie(){ 
448if(window.jQuery && jQuery.ui && jQuery.isReady) 
449{
450//console.log("if loop in functional cookie");
451var showusername = $(".usr-unhidden");
452var hideusername = $(".usr-hidden col-lg-12");
453if (username == null || username.length <= 0 || username === undefined)
454{
455//console.log("nested if  loop in functional cookie");
456showusername.hide();
457hideusername.show();
458}
459else
460{
461//console.log("username"+username);
462//console.log("username++++"+decodeURIComponent(escape(username)));
463var nameOfPerson = decodeURIComponent(escape(username)).replace(/\+/g, ' ');
464//var nameOfPerson = username.replaceAll('+', ' ');   //Name of person
465console.log("username---"+nameOfPerson);
466document.getElementById("user").textContent = nameOfPerson;
467showusername.show();
468$('.usr-hidden').hide();
469
470}
471}
472else 
473				{
474					window.setTimeout(functionalityCookie, 100);
475				}
476
477
478};                                                                             
479functionalityCookie();  
480*/
481
482// code  by Ankush
483
484
485$(document).keypress(function(event){
486var x=document.activeElement.id;
487           var keycode = (event.keyCode ? event.keyCode : event.which);
488            if(keycode == '13'  && (themeDisplay.getPathThemeRoot() == '/o/hays-desktop-branding-theme') ){
489            if (x=='site_searchQueryText') 
490            {
491            document.getElementById("analytic_site_srch_btn").click();
492            }
493            if (x=='home_search_candGCSq') 
494            {
495            document.getElementById("analytic_home_srch_btnGCS").click();
496            }
497            if (x=='home_search_candGCSlocationToSearch') 
498            {
499            document.getElementById("analytic_home_srch_btnGCS").click();
500            }           
501                        if (x=='QueryText') 
502            {
503            document.getElementById("featureEmployerfm").submit();
504            }           
505                        if (x=='specialism_search_candGCSq') 
506            {
507            document.getElementById("HAYSsearchjobsbutton").click();
508            }
509            
510                        if (x=='specialism_search_candGCSlocationToSearch') 
511            {
512            document.getElementById("HAYSsearchjobsbutton").click();
513            }
514                        
515  $("form").submit(function(e){
516        e.preventDefault();
517    });
518            
519            }
520});
521
522
523
524
525
526
527//  nav menu toggle on home page 
528
529 $(document).ready(function(){
530
531    $('.expandable-in-mobile h3').click(function(e) {
532        if ($(this).parents('.expandable-in-mobile').hasClass('active')) {
533            $(this).parents('.expandable-in-mobile').removeClass('active')
534        } else {
535            $(this).parents('.expandable-in-mobile').addClass('active')
536        }
537    });
538    
539    $('.exp-list > li').each(function() {
540        if ($(this).children('ul').length > 0) {
541            $(this).addClass('expandable')
542        }
543    });
544
545    $('.exp-list > li > a').click(function(e) {
546        if ($(this).parent().children('ul').length > 0) {
547            if ($(this).hasClass('active')) {
548                $(this).removeClass('active').next('ul').slideUp(100)
549            } else {
550                $('.exp-list a').removeClass('active');
551                $('.exp-list ul').hide(50);
552                $(this).toggleClass('active').next('ul').slideToggle(100);
553                e.preventDefault()
554            }
555        } else {}
556    });
557
558  $('#toggle-worldwide').click(function(e) {
559       $('#toggle-employer-subNav').removeClass('here');
560       $('body').removeClass('employer-subNav-active');
561       $('#hays-employer-subNav').removeClass('active').slideUp(300);
562       $('#mobile-menu-icon').removeClass('active');
563       if ($(this).hasClass('here')) {
564           $(this).removeClass('here');
565           $('#hays-worldwide').removeClass('active').slideUp(300);
566           $('body').removeClass('worldwide-active');
567           $('.nav-screen-overlay').remove()
568       } else {
569           $(this).addClass('here').parents('#menu').addClass('worldwide-active');
570           $('#hays-worldwide').addClass('active').slideDown(300);
571           $('body').addClass('worldwide-active').append('<div class="nav-screen-overlay"></div>')
572       }
573       e.preventDefault();
574       e.stopPropagation()
575   });
576   var text = $('#toggle-employer-subNav').html();
577   $('#toggle-employer-subNav').html(text + '<i class="icon-sort-down"></i>');
578   $('#toggle-employer-subNav').click(function(e) {
579       $('#toggle-worldwide').removeClass('here');
580       $('body').removeClass('worldwide-active');
581       $('#hays-worldwide').removeClass('active').slideUp(300);
582       $('#mobile-menu-icon').removeClass('active');
583       if ($(this).hasClass('here')) {
584           $(this).removeClass('here');
585           $('#hays-employer-subNav').removeClass('active').slideUp(300);
586           $('body').removeClass('employer-subNav-active');
587           $('.nav-screen-overlay').remove()
588       } else {
589           $(this).addClass('here').parents('#menu').addClass('employer-subNav-active');
590           $('#hays-employer-subNav').addClass('active').slideDown(300);
591           $('body').addClass('employer-subNav-active').append('<div class="nav-screen-overlay"></div>')
592       }
593       e.preventDefault();
594       e.stopPropagation()
595   });
596 $('body, .nav-screen-overlay').click(function(e) {
597        $('#toggle-worldwide').removeClass('here');
598        $('#toggle-employer-subNav').removeClass('here');
599        $('body').removeClass('worldwide-active');
600        $('body').removeClass('mobile-menu-active');
601        $('#hays-worldwide').removeClass('active').slideUp(300);
602        $('#hays-employer-subNav').removeClass('active').slideUp(300);
603        $('#mobile-menu-icon').removeClass('active');
604        $('.nav-screen-overlay').remove()
605    });
606    $('#mobile-menu-icon').click(function(e) {
607        $(this).toggleClass('active');
608        $('body').toggleClass('mobile-menu-active');
609		$('html').toggleClass('no-overflow');
610        e.preventDefault();
611        e.stopPropagation()
612    });
613
614    $('html').click(function() {
615       document.querySelectorAll(".subNavDiv").forEach(function(div) {
616    	  $('#' + div.id).addClass('subNav-hidden').slideUp(300);
617    	});
618    });
619
620    //  search bar on home page in mobile
621
622     $("#mobile-search-icon").click(function(){
623         $("#site-search").slideToggle(500);
624         return false;     
625     });
626	 
627	 if ($('#banner').length) {
628        var stickyHeader = $('#banner').offset().top + 150
629    }
630    var lastScrollTop = 0;
631    $(window).scroll(function(event) {
632        var st = $(this).scrollTop();
633        if (st > lastScrollTop) {
634            $('#banner').removeClass('sticky')
635        } else {
636            if (st > stickyHeader) {
637                $('#banner').addClass('sticky')
638            } else {
639                $('#banner').removeClass('sticky')
640            }
641        }
642        lastScrollTop = st
643    });
644
645 });
646
647 function handleNav(e, id) {
648    document.querySelectorAll(".subNavDiv").forEach(function(div) {
649        let haysSubNav = 'hays-subNav-';
650        if (div.id == haysSubNav + id) {
651            if ($('#' + haysSubNav + id).hasClass('subNav-hidden')) {
652                $('#' + haysSubNav + id).removeClass('subNav-hidden').slideDown(300);
653            } else {
654                $('#' + haysSubNav + id).addClass('subNav-hidden').slideUp(300);
655            }
656        } else {
657            $('#' + div.id).addClass('subNav-hidden').slideUp(300);
658        }
659    });
660    e.preventDefault();
661    e.stopPropagation();
662 }
663
664//Manage Hero area height 
665/* $(document).ready(function(){
666   if($('body').prop('id') != "HaysSearchEntity"){
667       var height=354+$("#hero-area-content #banner-heading").height()-122;
668       $("#hero-area-image").height(height);$("#hero-area").height(height);$("#hero-area-content").height(height);$("#heroAreaCarousel .carousel-inner .aspect-ratio").height(height);
669            }
670});*/
671
672
673
674
675$(document).ready(function(){
676    // This is for Attaching data-senna-off attribute in href to jobportal pages
677    let jobPortalPagesVal = [$("#portalPages").val(),$("#jobPortalPages").val(),$("#jobPortalProfile").val(),$("#jobPortalAccount").val(),$("#jobPortalMyAccount").val(),$("#headerLinkJobSearch").val(),$("#jobPortalLogin").val()].join(",");
678    let projectSContextsArray = jobPortalPagesVal.split(',');
679    $('a').each(function() {
680        let href = $(this).attr('href');
681        if ((href != undefined) && (href != '#') && (href != 'javascript:void(0);')) {
682            for(const element of projectSContextsArray){
683                if (href.indexOf(element) != -1) {
684                    if ($(this).attr("data-senna-off")) {
685                        break;
686                    }
687                    $(this).attr('data-senna-off', 'true');
688                    break;
689                }
690            }
691        }
692    });
693
694    // This is for old home page
695    if(!$('body').hasClass( "HaysSearchEntity")){
696        var height=354+$("#hero-area-content #banner-heading").height()-122;
697        console.log("new height is "+ height);
698        $("#hero-area-image").height(height);$("#hero-area").height(height);$("#hero-area-content").height(height);$("#heroAreaCarousel .carousel-inner .aspect-ratio").height(height);
699    }
700});
701
702

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.