'; }, footer: function(data) { messageObject.text("Suggestions are available, use up and down arrow keys to navigate"); } }, source: bloodhoundNOCTitle.ttAdapter() }).on('typeahead:open', function(evt) { messageObject.text("Type to get suggestions"); }).on('typeahead:select', function(evt, item) { populateinputNOCTitle(item); messageObject.text( "You have selected, ‘{0}’".format( displaykeyNOCTitle(item) ) ); }).on('typeahead:change', function(evt, item) { t1 = inputObject.val(); if (t1!=selectedObjectText) { messageObject.text(""); clearinputNOCTitle(); //console.log('clear title'); } }).on('typeahead:autocomplete', function(evt, item) { populateinputNOCTitle(item); messageObject.text( "You have selected, ‘{0}’".format( displaykeyNOCTitle(item) ) ); }).on('typeahead:render', function(evt, item,c,d) { if (typeof(item) != 'undefined') { messageObject.text("Suggestions are available, use up and down arrow keys to navigate"); } }).on('typeahead:close', function(evt) { var inputvalue = inputObject.typeahead('val'); if (bloodhoundNOCTitle.remote.transport._cache.list.head) { var firstdoc = bloodhoundNOCTitle.remote.transport._cache.list.head.val.response.docs[0]; } if ( typeof(selectedObjectText) != 'undefined' && selectedObjectText.length > 0 ) { //console.log('Selected: '+selectedObjectText); messageObject.text( "You have selected, ‘{0}’".format(selectedObjectText) ); } else if ( typeof(inputvalue) != 'undefined' && inputvalue.length > 0 && typeof(firstdoc) != 'undefined' && typeof(firstdoc) !== null) { //console.log('No selection then select the first docs: '+inputvalue); // no selection then select the first docs var firstitem = { title:firstdoc.title, noc_code:firstdoc.noc_code, id_en:firstdoc.noc_job_english_title_id, id_fr:firstdoc.noc_job_french_title_id, id:firstdoc.noc_job_title_concordance_id, title_en:firstdoc.title, title_fr:firstdoc.french_title }; inputObject.val(displaykeyNOCTitle(firstitem)); inputObject.typeahead('val',firstitem.title); populateinputNOCTitle(firstitem); messageObject.text( "You have selected, ‘{0}’".format(displaykeyNOCTitle(firstitem)) );	} else { messageObject.text(""); validSelection(); } }); }; function initJobTitleSuggestObject() { $('div.ta-jobtitlesuggest').each( function(i,obj) { new taJobtitleSuggestFunctionsV2(obj); }); } if ($(".modify-job-wb-tabs").length) {	$(document).on("wb-ready.wb", initJobTitleSuggestObject); } else { $(document).ready(initJobTitleSuggestObject); } //]]> Filters'); if (!$('.command-result-filter-overlay').hasClass('options')) { $(this).html(' Filters'); } else { $(this).html(' Options'); } localStorage.setItem('functionResultFilter', 'disabled'); } else if (localStorage.getItem('functionResultFilter') === 'disabled' ) { //console.log('functionResultFilter DISABLED'); $('.command-result-filter-overlay').removeClass('active').attr('aria-expanded','true');; $('.results-content').addClass('filter-hide').removeClass('filter-visible'); //$('.command-result-filter-overlay').html(' Filters'); /* if (!$('.command-result-filter-overlay').hasClass('options')) { $(this).html(' Filters'); } else { $(this).html(' Options'); } */ } // Sort by if (localStorage.getItem('functionSortBy') === null) { //First time user //console.log('sort null'); resetSortBy(); } else { if (localStorage.getItem('functionSortBy') === 'active' ) { activateSortBy(); //console.log('sort active'); } else if (localStorage.getItem('functionSortBy') === 'disabled' ) { if (!$('#header-search').hasClass('search-visible')) { resetSortBy(); //$('#cityPostalCodeSpecial').removeClass('wb-inv'); } //console.log('sort disabled'); } } } setTimeout(filterTaller, 300); } //Desktop if ($('.results-filter-button-overlay').css('position') === 'relative') { //console.log('Desktop mode on!'); if (localStorage) { if (localStorage.getItem('functionResultFilter') === null) { //First time user localStorage.setItem('functionResultFilter', 'active'); showFilter(); } else { if (localStorage.getItem('functionResultFilter') === 'active' ) { //console.log('filter active!'); showFilter(); } else if (localStorage.getItem('functionResultFilter') === 'disabled' ) { //console.log('filter inactive!'); showFilter(); } } // Sort by if (localStorage.getItem('functionSortBy') === null) { //First time user resetSortBy(); } else { if (localStorage.getItem('functionSortBy') === 'active' ) { resetSortBy(); } else if (localStorage.getItem('functionSortBy') === 'disabled' ) { resetSortBy(); } } if (!$('#header-search').hasClass('search-visible')) { //console.log('ok header offf'); //$('#cityPostalCodeSpecial').addClass('wb-inv'); } } else { $('.results-content').addClass('filter-visible').removeClass('filter-hide'); $('.results-list-wrapper').removeClass('col-md-12').addClass('col-md-9'); // Sort by resetSortBy(); } resetSortBy(); resetSearchOverlay(); setTimeout(filterTaller, 300); //showFilter(); } if ($('.results-content').hasClass('filter-hide')) { //console.log('filter-hide'); $("#results-filter-wrapper").addClass("invisible"); } else if ($('.results-content').hasClass('filter-visible')) { //console.log('filter-visible'); $("#results-filter-wrapper").removeClass("invisible"); } } //Mobile - Search Overlay Button $('.command-search-overlay').click( function(e) { //console.log('search mobile CLICK'); $("body").toggleClass("noScroll"); $('#header-search').toggleClass('search-visible'); $('main').toggleClass('search-visible'); $('.command-search-overlay').toggleClass('active'); $('.command-search-overlay').toggleClass('btn-primary btn-default'); resetSortBy(); if ($('#header-search').hasClass("search-visible")) {	//$('#cityPostalCodeSpecial').removeClass('wb-inv'); if ($('#searchString').length) { $('#searchString').focus();	} /* if ($('#searchStringPseudo').length) { $('#searchStringPseudo').focus();	} */ $('.results-filter-button-overlay, .search-input-content').addClass('noBorder'); //console.log('search mobile SHOW!'); $(this).find('.text').text("Close"); $(this).find('.far').removeClass('fa-search').addClass('fa-times'); } else { if (!$('#cityPostalCodeSpecial').hasClass('wb-inv')) { //console.log('huh'); $('#cityPostalCodeSpecial').addClass('wb-inv'); } $('.results-filter-button-overlay, .search-input-content').removeClass('noBorder'); //console.log('search mobile HIDE!'); $(this).find('.text').text("Search"); $(this).find('.far').removeClass('fa-times').addClass('fa-search'); } //$('html, body').animate({ scrollTop: $('#jobSearchBar').offset().top }, '500'); return false; //e.preventDefault(); }); //Activate Filter $('.command-result-filter-overlay').click( function(){ var filterButton = $(this); resetSearchOverlay(); resetSortBy(); $(this).toggleClass('active'); if ($(this).hasClass('active')) { sessionStorage.scrollTop = $(window).scrollTop(); //console.log('Scroll position: '+$(window).scrollTop()); } $('.results-content').toggleClass('filter-visible filter-hide'); if ($('.command-result-sortby-overlay').hasClass("active")) { $('.results-filter-button-overlay').addClass('noBorder'); } else { $('.results-filter-button-overlay').removeClass('noBorder'); } if ($('.results-content').hasClass('filter-visible')) { $(this).attr('aria-expanded','true'); //console.log('Display Filter!'); $('.skip-to-filters').show(); if ($('.results-filter-button-overlay').css('position') === 'fixed') { if ($(this).parent('.results-filter-button-overlay')) { //console.log('mobile go to filter top'); $('html, body').animate({ scrollTop: $('#results-filter-wrapper').offset().top }, 'fast'); } } if (localStorage) { //console.log('LS functionResultFilter active'); localStorage.setItem('functionResultFilter', 'active'); } } else if ($('.results-content').hasClass('filter-hide')) { $(this).attr('aria-expanded','false'); $('.skip-to-filters').hide(); if ($('.results-filter-button-overlay').css('position') === 'fixed') { if ($(this).parent('.results-filter-button-overlay')) { //console.log('!No filter - mobile go to result top'); if (sessionStorage.scrollTop != "undefined") { $(window).scrollTop(sessionStorage.scrollTop); //console.log('Old scroll position: '+$(window).scrollTop()); } //$('html, body').animate({ scrollTop: $('#results-list-content').offset().top }, 'fast'); } } if (localStorage) { //console.log('LS functionResultFilter disabled'); localStorage.setItem('functionResultFilter', 'disabled'); } }	setTimeout(function(){ if ($('.results-content').hasClass('filter-hide')) { $("#results-filter-wrapper").addClass("invisible"); } else if ($('.results-content').hasClass('filter-visible')) { $("#results-filter-wrapper").removeClass("invisible"); } }, 200); $('.results-list-wrapper').removeClass('noanim'); $('.results-list-wrapper').toggleClass('col-md-12 col-md-9'); setTimeout(filterTaller, 300); }); //Activate Sort By $('.command-result-sortby-overlay').click( function() { resetSearchOverlay(); $('main').toggleClass('sortby-visible');	$('.command-result-sortby-overlay').toggleClass('active'); if ($('.command-result-sortby-overlay').hasClass("active")) { if ($('.results-sortby-group').css('display') === 'none') { //console.log('.results-sortby-group is currently hidden'); //console.log('.results-sortby-group SHOW!'); localStorage.setItem('functionSortBy', 'active'); $('.results-filter-button-overlay').addClass('noBorder'); $('.results-sortby-group').addClass('sortby-group-visible'); } } else { if ($('.results-sortby-group').css('display') === 'block') { //console.log('.results-sortby-group HIDE!'); localStorage.setItem('functionSortBy', 'disabled'); $('.results-filter-button-overlay').removeClass('noBorder'); $('.results-sortby-group').removeClass('sortby-group-visible'); } } }); $('.results-sortby-group a.btn').click( function() { localStorage.setItem('functionSortBy', 'disabled'); }); $('.overlay').click( function() { if ($(this).css('visibility') === 'visible') { resetSearchOverlay(); resetSortBy(); } }); //Toggle Filter List - Check if filter list is visible or hidden var filterNum = 0; function checkToggleFilterList() { var allids = []; //$('div.results-filter-content section').find('ul.list-group').hide(); $('div.results-filter-content section').find('.list-group').not('.stay-open').addClass('close'); $('div.results-filter-content section h3').not('.nonActive').attr({"tabindex":"0", "aria-expanded": "false", "aria-haspopup":"true", "data-toggle":"dropdown"}).remove('.toggleFilterList').append(' Filters'); var hasLooped = false; //Generate IDs for Filter List sections if(!hasLooped){ $('div.results-filter-content section').each(function(){ //console.log('how many categories?'); filterNum++; var newID='filterList'+filterNum; $(this).attr('id',newID); $(this).val(filterNum); //Set local storage if ($(this).children('h3').attr('aria-expanded') == 'true') {	var ids = $(this).map(function() { return this.id; }).get().join(); allids.push(ids); //console.log('open: '+JSON.stringify(allids)); if (localStorage) { localStorage.setItem("open", JSON.stringify(allids)); } } else if ($(this).children('h3').attr('aria-expanded') == 'false') { var ids = $(this).map(function() { return this.id; }).get().join(); allids.push(ids); //console.log('open: '+JSON.stringify(allids)); if (localStorage) { localStorage.removeItem("remove", JSON.stringify(allids)); } } if (localStorage) { if (localStorage.getItem('open') === null) { //console.log('First time user'); allids = []; var defaultListFilter = ['filterList1']; localStorage.setItem('open', JSON.stringify(defaultListFilter)); if ($('#'+defaultListFilter.join(', #')).find('.list-group').hasClass('close')) { $(this).find('.list-group').toggleClass('close open'); $(this).find('h3').not('.nonActive').attr({"tabindex":"0", "aria-expanded": "true", "aria-haspopup":"true", "data-toggle":"dropdown"}).find('.toggleFilterList').html(' Hide filters'); } } else { var openFilterList = localStorage.getItem("open"); openFilterListId = jQuery.parseJSON(openFilterList); openFilters = $('#'+openFilterListId.join(', #')); if ($(openFilters).find('.list-group').hasClass('close')) { $(this).find('.list-group').toggleClass('close open'); } if ($(openFilters).find('.list-group').hasClass('open')) { if ($(openFilters).find('h3').has('span.fa.fa-plus').length) { $(this).find('h3').attr({"tabindex":"0", "aria-expanded": "true", "aria-haspopup":"true", "data-toggle":"dropdown"}).find('.toggleFilterList').html(' Hide filters');	} } hasLooped = true; } } else { //console.log('no localstorage'); allids = []; var defaultListFilter = ['filterList1','filterList2','filterList3','filterList4','filterList5','filterList6','filterList7','filterList8','filterList9','filterList10','filterList11','filterList12','filterList13']; if ($('#'+defaultListFilter.join(', #')).find('.list-group').hasClass('close')) { $(this).find('.list-group').toggleClass('close open'); $(this).find('h3').attr({"tabindex":"0", "aria-expanded": "true", "aria-haspopup":"true", "data-toggle":"dropdown"}).find('.toggleFilterList').html(' Hide filters'); } } }); } } checkToggleFilterList(); //Toggle Filter List - Click function $('div.results-filter-content section h3').not('.nonActive').click( function(event) { toggleFilterList($(this)); }); //Toggle Filter List - Keyboard function $('div.results-filter-content section h3').not('.nonActive').keydown( function(event) { // Enter key if (event.keyCode == 13) { toggleFilterList($(this));	} setTimeout(filterTaller, 0); }); //Toggle Filter List - Function function toggleFilterList(thisObj) { var allids = []; //thisObj.closest('section').find('ul.list-group').toggle(); if (thisObj.closest('section').find('.list-group').hasClass('open')) { //console.log('close it!'); thisObj.closest('section').find('.list-group').toggleClass('open close'); setTimeout(filterTaller, 300); } else if (thisObj.closest('section').find('.list-group').hasClass('close')) { //console.log('open it!'); thisObj.closest('section').find('.list-group').toggleClass('close open'); } else if (thisObj.closest('section').find('.list-group').hasClass('stay-open')) { thisObj.closest('section').find('.list-group').addClass('open'); } else { //console.log('open it anyways!'); thisObj.closest('section').find('.list-group').addClass('open'); } //filterTaller; setTimeout(filterTaller, 300);	//Hidden //if (thisObj.closest('section').find('ul.list-group').is(':hidden')) { if (thisObj.closest('section').find('.list-group').hasClass('close')) { thisObj.attr({ "aria-expanded": "false" }); thisObj.find('span.toggleFilterList').html(' Filters'); var filterSectionId = thisObj.parent().attr('id'); //console.log('You closed: '+filterSectionId); if (localStorage) { if(!localStorage.getItem("open")){ localStorage.setItem("open", "[]"); } var allids = JSON.parse(localStorage.getItem('open')); for (i=0;iHide filters'); var filterSectionId = thisObj.parent().attr('id'); //console.log('You opened: '+filterSectionId); if (localStorage) { if (localStorage.getItem('open') === null) { allids = []; } else { if(!localStorage.getItem("open")){ localStorage.setItem("open", "[]"); } allids = JSON.parse(localStorage.getItem('open'));	} } var exist = false; for(var i = 0; i < allids.length; i++) if(allids[i] == filterSectionId) { exist = true; break; } if (!exist) { allids.push(filterSectionId); if (localStorage) { localStorage.setItem('open', JSON.stringify(allids)); //console.log('Current Open Set: '+JSON.stringify(allids)); } } else { return false; } } } setTimeout(filterTaller, 300); //Reset for Input Ranger Slider $('#jobSearchResultsJobSearchForm').submit( function(){ if (localStorage) { localStorage.setItem('functionSearchSubmit', 'true'); } }); //Input Ranger Slider Ouput Events if (localStorage) { if(!localStorage.getItem("functionRangeSliderOuputValue")){ var id,val; } else { if(!localStorage.getItem("functionSearchSubmit")){ //var id = localStorage.getItem('functionRangeSliderOuputID'); //var val = localStorage.getItem('functionRangeSliderOuputValue'); //$('#'+id).val(val); //Rely on JSF param var id,val; } else { if(localStorage.getItem("functionSearchSubmit") === 'true'){ localStorage.removeItem("functionRangeSliderOuputValue"); localStorage.removeItem("functionSearchSubmit"); } } } } //Input Range event $("input[type='range']").on('input change',function(e) { /* var as1 = $(e.target).attr('data-sign1'); var as2 = $(e.target).attr('data-sign2'); */ var id = $(e.target).attr('id'); var form = $(e.target).parents('form:first'); var output = form.find('.output'); var value = parseFloat($(e.target).val()); updateRangeSliderOuput(output,id,value); //console.log('range input change!'); //alert('range input change!'); }); $("input[type='range']").change(); /* $("input[type='range']").on('keypress',function(e) { var id1 = $(e.target).attr('id'); var val1 = $(e.target).val(); //alert(val1); updateRangeSliderOuput(id1,val1); }); $("input[type='range']").change(); */ var timeoutHandler = window.setTimeout(function() {;},1); $('a.decrease.range-slider-button').click(function(e) {	var form = $(e.target).parents('form:first');	var output = form.find('.output'); var slider = form.find("input[type='range']"); var step = parseFloat(slider.attr('step')); var minvalue = parseInt(slider.attr('min')); var value = parseFloat(slider.val()); value = value-step if (valuemaxvalue) { value=maxvalue; } slider.val(value); updateRangeSliderOuput(output,slider.attr('id'),value); //slider.change(); window.clearTimeout(timeoutHandler); timeoutHandler = setTimeout(function(){ form.submit(); //slider.focus(); }, 2000); }); //Input Range Slider function function updateRangeSliderOuput(output,id,val) { //console.log('slider function'); var value,label,details; //alert("ID " + id + " Value " + val); //Distance radius control if (id === "dist") { var details = 'kilometers: selected distance'; var label = 'Current distance of '; var value = ''+val.toLocaleString('en-CA')+''; //var display_value = ''+val+''; } /* else if (id === "salary") { var details = 'thousand dollars is chosen'; var label = 'Current annual salary of'; } */ if (localStorage) { //console.log('Function SAVED the values!'); localStorage.setItem('functionRangeSliderOuputValue', val); localStorage.setItem('functionRangeSliderOuputID', id); } //console.log('value: '+val); //Update display label //$('span[class="output amount-dist"]').html(value); output.text(val.toLocaleString('en-CA')); } $('input[type=range]').on('mouseup touchend', function(e) { var form = $(e.target).parents('form'); window.clearTimeout(timeoutHandler); timeoutHandler = setTimeout(function(){ form.submit(); }, 1000); }); $('input[type=range]').on('keyup', function(e) { var key = e.which; // Enter key if( (key == 13) ) { $(e.target).parents('form').submit(); return false; } return false; }); //Floating label $('.float-input').on('focus blur change', function (e) { $(this).parents('.related-group').prev('label.control-label').find('.label').removeClass('focus-error').toggleClass('focus', (e.type === 'focus' || this.value.length > 0 )); if($(this).val()!=""){ console.log('value'); $(this).parents('.related-group').prev('label.control-label').find('.label').removeClass('focus-error').addClass('focus', (e.type === 'focus' || this.value.length > 0 )); } else { console.log('empty'); } }).trigger('focus blur change'); $('.float-input').on('focus blur change'); //event tracking for search $('#search-module').submit(function(e){ var label = []; //console.log(label); //check what the advanced search is about if($("#searchString").val()) label.push("Keyword"); if($("#pcode").val()) label.push("Job Number"); var flg = document.getElementsByName('flg'); for (var i = 0, length = flg.length; i < length; i++) { if (flg[i].checked) { label.push("Language"); break; } } var fper = document.getElementsByName("fper"); for (var i = 0, length = fper.length; i < length; i++) { if (fper[i].checked) { label.push("Period of Employment"); break; } } var fter = document.getElementsByName("fter"); for (var i = 0, length = fter.length; i < length; i++) { if (fter[i].checked) { label.push("Job Type"); break; } } var fss = document.getElementsByName("fss"); for (var i = 0, length = fss.length; i < length; i++) { if (fss[i].checked) { label.push("Education Level"); break; } } var fsrc = document.getElementsByName('fsrc'); for (var i = 0, length = fsrc.length; i < length; i++) { if (fsrc[i].checked) { label.push("Federal Jobs Filter"); break; } } var fjsf = document.getElementsByName('fjsf'); if(fjsf[0].checked) label.push("Student Job Filter"); var fet = document.getElementsByName('fet'); if(fet[0].checked) label.push("Non-Placement Agency Filter"); //var fgff = document.getElementsByName('fgff'); //if(fgff[0].checked) label.push("Government Funded Jobs Filter"); var fprov = document.getElementsByName("fprov"); for (var i = 0, length = fprov.length; i < length; i++) { if (fprov[i].checked) { label.push("PTs and Regions"); break; } } var fcat = document.getElementsByName("fcat"); for (var i = 0, length = fcat.length; i < length; i++) { if (fcat[i].checked) { label.push("Job Categories"); break; } } if($("select[name=fn]").val()) label.push("Job Titles"); //format result (always +',' to keep things as they are since the error was made at the begining...) var results = ''; for(var i=0,len=label.length;i resultBox) { //console.log('filter box is taller: '+filterBox+' result box is: '+resultBox); $('section.results-content').height(filterBox); } } if (resultBox > filterBox) { //console.log('result box is taller: '+resultBox+' filter box is: '+filterBox); $('section.results-content').css('height','auto'); } } else if ($('section.results-content').hasClass('filter-hide')) { //console.log('no filter box'); $('section.results-content').css('height','auto'); } } } //}); $(document).on( "wb-ready.wb-details", "summary", function( event ) { $('details summary').click( function() { setTimeout(filterTaller, 0); }); function filterTaller() { var filterBox = $('.results-filter-wrapper').height(); var resultBox = $('.results-list-content').height(); if ($('section.results-content').hasClass('filter-visible')) { if ($('.results-filter-button-overlay').css('position') === 'relative') {	if (filterBox > resultBox) { //console.log('filter box is taller: '+filterBox); $('section.results-content').height(filterBox); } } if (resultBox > filterBox) { //console.log('result box is taller: '+resultBox); $('section.results-content').css('height','auto'); } } else if ($('section.results-content').hasClass('filter-hide')) { //console.log('no filter box'); $('section.results-content').css('height','auto'); } } setTimeout(filterTaller, 300); }); function saveJob(data,jobid) { //console.log('fetch'); var thisJobID = $("input[name='jobid'][value="+jobid+"]"); var thisJobIDfav = thisJobID.nextAll('.favourite'); //console.log('element ID: '+thisJobIDfav); if (data.status === 'begin') { //Start loading animation //console.log('begin'); $(thisJobIDfav).addClass('working'); } else if (data.status === 'complete') { //console.log('complete'); //End loading animation $(thisJobIDfav).removeClass('working'); /* $(thisJobIDfav).addClass('done').one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function(){ $(thisJobIDfav).removeClass('done'); console.log('finito!'); }); */ } else if (data.status === 'success') { //console.log('Done!'); } } // favourite actions function setLoginRedirectURIFavourite(e) { //var form = $('#loginForm'); var jobid = $(e).attr("data-jobid"); var redirect = '/jobsearch/addfavourite/'+jobid; //var inputredirectURI = form.find('#loginForm\\:input-redirectURI'); //inputredirectURI.val(redirect); // Save data to sessionStorage sessionStorage.removeItem('loginRedirectURI'); sessionStorage.setItem('loginRedirectURI', redirect); //console.log('Redirect: '+redirect); } function removeArticle(e) { var article = $(e).parents('article'); article.remove(); } function toggleFavourite(e) { $(e).addClass('working'); var callingmethod = 'PUT'; if ( $(e).hasClass('saved') ) { callingmethod = 'DELETE'; } //requestObject.lang = document.documentElement.lang; $.ajax({ url: '/jbaction/FavouriteJob/'+$(e).data('jobid'), type: callingmethod, dataType: 'json', success: function(data,status) { if ($(e).hasClass('saved')) { $(e).removeClass('saved'); $(e).html('Favourite'); } else { $(e).addClass('saved'); $(e).html('Favourited'); } // $(e).removeClass('working'); }, error: function( jqXHR,status) {	$(e).removeClass('working'); if (jqXHR.status==401) { setLoginRedirectURIFavourite(e); var redirect = '/login'; window.location.href = redirect; }	else if (jqXHR.status==403) { // redirect intructions var redirect = window.location.pathname; setLoginRedirectURI(redirect); // redirect var redirect = '/reg/instructions'; window.location.href = parenturl; }	}, complete: function(jqXHR,status) { $(e).removeClass('working'); } }); } $(document).click(function(event) { if($('#recent-search').hasClass("show")) { $('#recent-search').removeClass('show'); $("#toggleRecentSearch").removeClass('active'); //console.log('remove show'); } }); /* function toggleFavourite(e) { $(e).addClass('working'); var requestObject = new Object(); requestObject.job2Id = $(e).data("jobid"); requestObject.jsJobId = $(e).data("jobid"); requestObject.applied = 'false'; if ( $(e).hasClass('saved') ) { requestObject.methodName = 'removeFavoriteJob'; } else { requestObject.methodName = 'addFavoriteJob'; } requestObject.lang = document.documentElement.lang; $.ajax({ url: '/jobbankservlet', type: 'POST', dataType: 'json', data: { methodName : requestObject.methodName, jsJobId: $(e).data('jobid') }, success: function(data,status) { if ($(e).hasClass('saved')) { $(e).removeClass('saved'); $(e).html('Favourite'); } else { $(e).addClass('saved'); $(e).html('Favourited'); } $(e).removeClass('working'); }, error: function( jqXHR,status) {	$(e).removeClass('working'); if (jqXHR.status==401) { setLoginRedirectURIFavourite(e); var redirect = '/login'; window.location.href = redirect; }	else if (jqXHR.status==403) { // redirect intructions var redirect = window.location.pathname; setLoginRedirectURI(redirect); // redirect var redirect = '/reg/instructions'; window.location.href = parenturl; }	}, complete: function(jqXHR,status) { jqXHR; } }); } */ //]]>