var jobalert, jobalertAPI = '/config/dice/api.json?path=' + encodeURIComponent('/people/jobAlerts/'+$('#code').val()), emailRegex = new RegExp(/^(?=.{1,100}$)[_A-Za-z0-9-+]+(\.[_A-Za-z0-9-+]+)*@[A-Za-z0-9-]+(\.[A-Za-z0-9-]+)*(\.[A-Za-z]{2,})$/), passRegex = new RegExp(/^.*(?:\d.*[A-Za-z]|[A-Za-z].*\d).*$/),allSkill=''; $(document).ready(function() { testLocale(); registerTracking(); var quickData = JSON.parse(localStorage.getItem("quicksignin")); if (quickData) { signInTracking(); } /* Submitting Password on enter */ $('#mPassword, #mPasswordQuick').keypress(function(e) {if(e.which == 13) {loginSubmit();}}); allSkill = $("#labelskill").text(); if (getCookie('DJV_save')) { saveJob($('#saveBtn')); deleteCookie('DJV_save', '/'); } if (getCookie('DJV_skillflag')) { var sN = $('#skillName').text(); getProfiles(); var found = inArrayCaseInsensitive(sN, skillArray) > -1; if (found) { $('#trendingSkills').hide(); $('#trendingSkillsXs').hide(); $('#presentskills').show(); $('#presentskillsXs').show(); } else { $('#trendingSkills').show(); $('#trendingSkillsXs').show(); $('#presentskillsXs').hide(); $('#presentskills').hide(); addSkill(); } deleteCookie('DJV_skillflag', '/'); } if (getCookie('save_searchPage')) { var savesearchflag = getCookie('save_searchPage'); var ressavesearch = savesearchflag.split(";"); saveJob(ressavesearch[0]); deleteCookie('save_searchPage', '/'); window.location.reload(true); } if (getCookie('save_companyPage')) { var savecompanyflag = getCookie('save_companyPage'); var ressavecompany = savecompanyflag.split(";"); saveCompanyJob(ressavecompany[0]); deleteCookie('save_companyPage', '/'); window.location.reload(true); } if (getCookie('Djv_applyJob')) { var djvapplyflag = getCookie('Djv_applyJob'); if(djvapplyflag) { var applyjob = djvapplyflag.split(";"); sendApply(applyjob[0], applyjob[1]); deleteCookie('Djv_applyJob', '/'); } } }); var keyCode; function clearLoginModalContent() { $('#emailDiv, #emailDivQuick').removeClass('has-error'); $('#emailDiv, #emailDivQuick').removeClass('has-success'); $('#emailSpan, #emailSpanQuick').removeClass('glyphicon-remove'); $('#emailSpan, #emailSpanQuick').removeClass('glyphicon-ok'); $('#passDiv, #passDivQuick').removeClass('has-error'); $('#passDiv, #passDivQuick').removeClass('has-success'); $('#passSpan, #passSpanQuick').removeClass('glyphicon-remove'); $('#passSpan, #passSpanQuick').removeClass('glyphicon-ok'); $('#mEmail').val(''); $('#mPassword').val(''); $('#mEmailQuick').val(''); $('#mPasswordQuick').val(''); $('#emailFeedbackMessage, #emailFeedbackMessageQuick').hide(); $('#passFeedbackMessage, #emailFeedbackMessageQuick').hide(); $('#error-alert, #error-alertQuick').hide(); passwrd = 1; } function generateCookie(sKey, sValue, vEnd, sPath, sDomain, bSecure) { if (!sKey || /^(?:expires|max\-age|path|domain|secure)$/i.test(sKey)) { return false; } var sExpires = ''; if (vEnd) { switch (vEnd.constructor) { case Number: sExpires = vEnd === Infinity ? '; expires=Fri, 31 Dec 9999 23:59:59 GMT' : '; max-age=' + vEnd; break; case String: sExpires = '; expires=' + vEnd; break; case Date: sExpires = '; expires=' + vEnd.toUTCString(); break; } } const cookieData = encodeURIComponent(sKey) + '=' + encodeURIComponent(sValue) + sExpires + (sDomain ? '; domain=' + sDomain : '') + (sPath ? '; path=' + sPath : '') + '; secure; SameSite=none'; document.cookie = cookieData; return true; } function getCookie(sKey) { return decodeURIComponent(document.cookie.replace(new RegExp('(?:(?:^|.*;)\\s*' + encodeURIComponent(sKey).replace(/[\-\.\+\*]/g, '\\$&') + '\\s*\\=\\s*([^;]*).*$)|^.*$'), '$1')) || null; } function deleteCookie(sKey, sPath, sDomain) { if (!sKey) { return false; } document.cookie = encodeURIComponent(sKey) + '=; expires=Thu, 01 Jan 1970 00:00:00 GMT' + ( sDomain ? '; domain=' + sDomain : '') + ( sPath ? '; path=' + sPath : ''); } function redirectURLCookie() { var date = new Date(); date.setTime(date.getTime() + (30 * 24 * 60 * 60 * 1000)); generateCookie('DJV_UNREGISTERED', window.location.href, date, '/'); } function saveButtjobs() { var save = $('#save').val(); var date = new Date(); date.setTime(date.getTime() + (30 * 24 * 60 * 60 * 1000)); generateCookie('DJV_save', save, date, '/'); } function saveskill() { var skillflag = $('#skillflag').val(); var date = new Date(); date.setTime(date.getTime() + (30 * 24 * 60 * 60 * 1000)); generateCookie('DJV_skillflag', skillflag, date, '/'); } function savesearchfun() { var savesearch = $('#savesearch').val(); var date = new Date(); date.setTime(date.getTime() + (30 * 24 * 60 * 60 * 1000)); generateCookie('save_searchPage', savesearch, date, '/'); } function savecompanyfun() { var savesearch = $('#savecompany').val(); var date = new Date(); date.setTime(date.getTime() + (30 * 24 * 60 * 60 * 1000)); generateCookie('save_companyPage', savesearch, date, '/'); } function applyjobfun() { var domain = $('#wwwDomain').val(); var applyURl = ';'+$('#appUrl').val(); $('#applybtn').html("Viewed"); if (domain && applyURl) { var date = new Date(); var applyjobflag = domain + applyURl ; date.setTime(date.getTime() + (30 * 24 * 60 * 60 * 1000)); generateCookie('Djv_applyJob', applyjobflag, date, '/'); } } function savetrendskill() { var trendskill = $('#trendskill').val(); var date = new Date(); date.setTime(date.getTime() + (30 * 24 * 60 * 60 * 1000)); generateCookie('save_trendskillPage', trendskill, date, '/'); } function setPeopleId(peopleId){ $('#pid').val(peopleId); } $('#mEmail, #mEmailQuick').on('blur input paste',emailCheck); $('#mEmail, #mEmailQuick').on(' keyup keydown',getkeyValue); var ctrlDown = false; $(document).keydown(function(e) { if (e.keyCode == 17 ) ctrlDown = true; }).keyup(function(e) { if (e.keyCode == 17 ) ctrlDown = false; }); function emailCheck(e) { var email = $.trim($(this).val()); var finalemail = email.toLowerCase(); $('#error-alert, #error-alertQuick').hide(); if (email && emailRegex.test(finalemail)) { $("#emailDiv, #emailDivQuick").removeClass('has-success').removeClass('has-error'); $("#emailSpan, #emailSpanQuick").removeClass('glyphicon-ok').removeClass('glyphicon-remove'); if (email && emailRegex.test(finalemail)) { $("#emailDiv, #emailDivQuick").addClass('has-success'); $("#emailSpan, #emailSpanQuick").addClass('glyphicon-ok'); $('#emailFeedbackMessage, #emailFeedbackMessageQuick').hide(); } else if (!emailRegex.test(finalemail)) { $("#emailDiv, #emailDivQuick").addClass('has-error'); $("#emailSpan, #emailSpanQuick").addClass('glyphicon-remove'); $('#emailFeedbackMessage, #emailFeedbackMessageQuick').show(); } } else if ((keyCode == 46 || keyCode == 8 || (keyCode == 9 && finalemail.length >=1) ) && !emailRegex.test(finalemail) || (!finalemail && keyCode == 9 ) || (keyCode == 88 && ctrlDown)) { $("#emailDiv, #emailDivQuick").removeClass('has-success'); $("#emailSpan, #emailSpanQuick").removeClass('glyphicon-ok'); $('#emailDiv, #emailDivQuick').addClass('has-error'); $('#emailSpan, #emailSpanQuick').addClass('glyphicon-remove'); $('#emailFeedbackMessage, #emailFeedbackMessageQuick').show(); } } $('#mPassword, #mPasswordQuick').on('keyup keydown', getkeyValue); $('#mPassword, #mPasswordQuick').on('blur input paste', passwordCheck); function getkeyValue(e) { keyCode = e.keyCode; } function passwordCheck(e) { var pass = $.trim($(this).val()); $('#error-alert, #error-alertQuick').hide(); if (pass && pass.length > 7) { $("#passDiv, #passDivQuick").removeClass('has-success').removeClass('has-error'); $("#passSpan, #passSpanQuick").removeClass('glyphicon-ok').removeClass('glyphicon-remove'); if (pass && pass.length > 7 && passRegex.test(pass)) { $("#passDiv, #passDivQuick").addClass('has-success'); $("#passSpan, #passSpanQuick").addClass('glyphicon-ok'); $("#passFeedbackMessage, #passFeedbackMessageQuick").hide(); } else if (!pass || !passRegex.test(pass) || pass.length < 8) { $("#passDiv, #passDivQuick").addClass('has-error'); $("#passSpan, #passSpanQuick").addClass('glyphicon-remove'); $("#passFeedbackMessage, #passFeedbackMessageQuick").show(); } } if ((keyCode == 46 || keyCode == 8 || (keyCode == 9 && pass.length >=1) ) && (!passRegex.test(pass) || pass.length < 8) || (!pass && keyCode == 9)) { $("#passDiv, #passDivQuick").removeClass('has-success'); $("#passSpan, #passSpanQuick").removeClass('glyphicon-ok'); $('#passDiv, #passDivQuick').addClass('has-error'); $('#passSpan, #passSpanQuick').addClass('glyphicon-remove'); $('#passFeedbackMessage, #passFeedbackMessageQuick').show(); } } var domain = $('#wwwDomain').val(), localDomain = $('#localDomain').val(); var applyURl = $('#appUrl').val(); function loginSubmit(googleSignIn) { console.log('Login dialog submit'); var domain = $('#localDomain').val(); var save = $('#save').val(); var skillflag = $('#skillflag').val(); var savesearch = $('#savesearch').val(); var saveCompany = $('#savecompany').val(); var trendskill = $('#trendskill').val(); var careerSkill = $('#careerSkill').val(); var finalEmail = $('#mEmail').val() ? $('#mEmail').val().trim() : $('#mEmailQuick').val() ? $('#mEmailQuick').val().trim() : ""; var finalPassWord = $('#mPassword').val()? $('#mPassword').val().trim() : $('#mPasswordQuick').val() ? $('#mPasswordQuick').val().trim() : ""; $('#error-alert, #error-alertQuick').hide(); if(!finalEmail || !emailRegex.test(finalEmail)) { $("#emailDiv, #emailDivQuick").removeClass('has-success'); $("#emailSpan, #emailSpanQuick").removeClass('glyphicon-ok'); $("#emailDiv, #emailDivQuick").addClass('has-error'); $("#emailSpan, #emailSpanQuick").addClass('glyphicon-remove'); $('#emailFeedbackMessage, #emailFeedbackMessageQuick').show(); return; } if(!finalPassWord || !passRegex.test(finalPassWord) || finalPassWord.length < 8) { $("#passDiv, #passDivQuick").removeClass('has-success'); $("#passSpan, #passSpanQuick").removeClass('glyphicon-ok'); $('#passDiv, #passDivQuick').addClass('has-error'); $('#passSpan, #passSpanQuick').addClass('glyphicon-remove'); $('#passFeedbackMessage, #passFeedbackMessageQuick').show(); return; } var url = "/jobs/seekerLogin.html", email = finalEmail, password = finalPassWord, json = { "email" : (email) ? email.trim() : email, "password" : password }, applyFlag = $('#signBtnId').attr('signedIn'), reportJobModal = $('#signBtnId').attr('reportJobModal'), rateJobModal = $('#signBtnId').attr('rateJobModal'), applyJobModal = $('#signBtnId').attr('signedInForApply'), newWindow = '', rethinkApply = $('#rethinkSupportedProduct').val(); if (googleSignIn) { $("#googleLoaderImg").show(); url = "/jobs/googleLogin.html"; json = { "contact": { "firstName" :$('#r_fname').val(), "lastName" : $('#r_lname').val(), "email": $('#r_email').val() }, "trusted" : { "type" : $('#r_trusted').val() } } } else { $('.icon-loading').removeClass('hidden'); if (finalEmail === '' || finalPassWord === '') { $('#error-alert, #error-alertQuick').html('Please enter an email and/or password.'); $('#error-alert, #error-alertQuick').show(); $('.icon-loading').addClass('hidden'); return; } } $.ajax({ url: window.location.origin ? window.location.origin + url : url, data: JSON.stringify(json), type: "POST", datatype: "json", contentType: 'application/json', //async : false, success: function(res){ res = JSON.parse(res); if (res.thirdPartyValue == 'true' && $('#jobThirdParty').val() != 'true') { createLocalTrackingData(res.peopleId, email); const alert = getCookie('jobAlertLogin'); if(alert !== undefined && alert !== null && alert === 'true') { deleteCookie('jobAlertLogin', '/'); var alertAPI = "/config/dice/api.json?path=/people/"+res.peopleId+ "/jobAlerts"; $.getJSON(alertAPI, function(data) { if (data.items && data.items[0]) { console.log('We have items'); $('#djvatertEmailp').val(data.items[0].email).show(); $('#divemail').removeClass('dice-float-label').addClass('dice-float-label dice-float-label-on'); $('#labEmail').removeClass('lbemail'); $('#djvalertEmail').val(data.items[0].email); } else { console.log("we have no items"); } if (data.totalNumberOfItems ==5) { console.log('We have 5 items'); $('.alert_footer').hide(); $('#DJVmyModalLabel').html('Manage your alerts'); $('.alert_body').html('
You may only create 5 alerts. Click here to manage your alerts.
'); } djvpostJobAlter(res.peopleId); setTimeout(function() { window.location.reload(true); }, 1000); }).fail(function() { var peopleAPI = "/config/dice/api.json?path=/people/"+res.peopleId; $.getJSON(peopleAPI, function(data) { if (data.contact.email) { $('#djvatertEmailp').val(data.contact.email).show(); $('#divemail').removeClass('dice-float-label').addClass('dice-float-label dice-float-label-on'); $('#labEmail').removeClass('lbemail'); $('#djvalertEmail').val(data.contact.email); } }); window.location.reload(true); return; }); } else { window.location.reload(true); } return; } if (applyFlag && !rethinkApply) { newWindow = window.open(); } trackSignIn(); if(googleSignIn && (res.message == "Trusted user. Please go ahead." || res.message == "User is Authenticated!" || res.message == "trustedTechpro" || res.message == "Registration Successful!")) { $('#applyModal').modal('hide'); createLocalTrackingData(res.peopleId, email); if(res.peopleId && $('#hideButtonStatus').val() == "clicked") { $('#applyModal').modal('hide'); $('#easySignInRegister').modal('hide'); setCookie('tgViewedBtn'+res.peopleId, "true" , 24 * 60 * 60 *1, '/'); window.location.reload(true); return; } //Setting REPORT_COOKIE true to Open Report Modal if (reportJobModal) { setCookie('REPORT_JOB', true, 24 * 60 * 60 *1, '/');// to Open ReportJOB MODAL } //Setting RATE_COOKIE true to Open RATE Modal if (rateJobModal) { setCookie('RATE_JOB', true, 24 * 60 * 60 *1, '/');// to Open RATE_JOB MODAL } //Setting APPLY_JOB true to Open APPLY_JOB Modal if (applyJobModal) { setCookie('APPLY_JOB', true, 24 * 60 * 60 *1, '/');// to Open APPLY_JOB MODAL } // redirectURLCookie(); $('#applyModal').modal('hide'); $('#easySignInRegister').modal('hide'); if (applyFlag && !rethinkApply) { if (applyURl.indexOf('http') == -1) { applyURl = 'http://' + applyURl; } newWindow.location = window.location.protocol + '//' + domain + '/jobs/detail/apply/url?url=' + encodeURIComponent(applyURl); applyjobfun(); } else if (applyFlag && rethinkApply) { getPeopleDataForQuicklogin(res.peopleId); return; } if (save == 'true') { saveButtjobs(); } if (skillflag == 'true') { saveskill(); } if (savesearch) { var ressavesearch = savesearch.split(";"); if (ressavesearch[1] == 'true') { savesearchfun(); } } if (saveCompany) { var ressavecompany = saveCompany.split(";"); if (ressavecompany[1] == 'true') { savecompanyfun(); } } if (trendskill) { var savetrendingskill = trendskill.split(";"); if (savetrendingskill[2] == 'true') { savetrendskill(); } } window.location.reload(true); } else if (res.message != 'User is Authenticated!') { if (applyFlag && !rethinkApply) { newWindow.close(); } $('.icon-loading').addClass('hidden'); $("#googleLoaderImg").hide(); if (res.message == 'Customer is Authenticated') { var customerErrorMsg = $("#employerSigninErrorMsg").val(); $('#error-alert, #error-alertQuick').html(customerErrorMsg); } else { $('#error-alert, #error-alertQuick').html(res.message); } $('#error-alert, #error-alertQuick').show(); $("#emailDiv, #emailDivQuick").removeClass('has-success'); $("#emailSpan, #emailSpanQuick").removeClass('glyphicon-ok'); $("#emailDiv, #emailDivQuick").addClass('has-error'); $("#emailSpan, #emailSpanQuick").addClass('glyphicon-remove'); $("#passDiv, #passDivQuick").removeClass('has-success'); $("#passSpan, #passSpanQuick").removeClass('glyphicon-ok'); $('#passDiv, #passDivQuick').addClass('has-error'); $('#passSpan, #passSpanQuick').addClass('glyphicon-remove'); return ; } else { createLocalTrackingData(res.peopleId, email); if (res.peopleId && $('#hideButtonStatus').val() == "clicked") { $('#applyModal').modal('hide'); $('#easySignInRegister').modal('hide'); setCookie('tgViewedBtn' + res.peopleId, "true", 24 * 60 * 60 * 1, '/'); window.location.reload(true); return; } //Setting REPORT_COOKIE true to Open Report Modal if (reportJobModal) { setCookie('REPORT_JOB', true, 24 * 60 * 60 * 1, '/');// to Open ReportJOB MODAL } //Setting RATE_COOKIE true to Open RATE Modal if (rateJobModal) { setCookie('RATE_JOB', true, 24 * 60 * 60 * 1, '/');// to Open RATE_JOB MODAL } //Setting APPLY_JOB true to Open APPLY_JOB Modal if (applyJobModal) { setCookie('APPLY_JOB', true, 24 * 60 * 60 * 1, '/');// to Open APPLY_JOB MODAL } redirectURLCookie(); $('#applyModal').modal('hide'); $('#easySignInRegister').modal('hide'); if (applyFlag && !rethinkApply) { if (applyURl.indexOf('http') == -1) { applyURl = 'http://' + applyURl; } newWindow.location = window.location.protocol + '//' + domain + '/jobs/detail/apply/url?url=' + encodeURIComponent(applyURl); applyjobfun(); } else if (applyFlag && rethinkApply) { $('#easySignInRegister').modal('hide'); getPeopleDataForQuicklogin(res.peopleId); return; } if (save == 'true') { saveButtjobs(); } if (skillflag == 'true') { saveskill(); } if (savesearch) { var ressavesearch = savesearch.split(";"); if (ressavesearch[1] == 'true') { savesearchfun(); } } if (saveCompany) { var ressavecompany = saveCompany.split(";"); if (ressavecompany[1] == 'true') { savecompanyfun(); } } if (trendskill) { var savetrendingskill = trendskill.split(";"); if (savetrendingskill[2] == 'true') { savetrendskill(); } } if (careerSkill) { setPeopleId(res.peopleId); } if(window.location.pathname.indexOf('salary-calculator') > -1) { window.location.href = '/dashboard'; } else { window.location.reload(true); } } }, error: function(res) { $('.icon-loading').addClass('hidden'); $("#googleLoaderImg").hide(); if (applyFlag && !rethinkApply) { newWindow.close(); } console.log("error in log-in "); } }); } function getPeopleDataForQuicklogin(pid) { try{ if (pid && pid.length > 0) { var peopleAPI = "/config/dice/api.json?path=/people/"+pid; $.getJSON(peopleAPI, function(data) { var fullName = data.contact.firstName + " " + data.contact.lastName; if (data.contact.firstName && data.contact.lastName) { $('#name-1').val(fullName); $('#name-3').val(fullName); $('#peopleFirstname').val(data.contact.firstName); $('#peopleLastname').val(data.contact.lastName); } if (data.contact.email) { $('#peopleEmailAddress').val(data.contact.email); } }).always(function() { postRethinkCandidate($('#localDomain').val()); }); } } catch(e) { console.log('Error in getting people data after Quicklogin'); } } function createLocalTrackingData(pid, email, pageName) { if (!pageName ||!ssdl || !ssdl.page || !ssdl.page.pageName) pageName = document.querySelector("meta[name='ompagename']") ? document.querySelector("meta[name='ompagename']").getAttribute("content") : ssdl.page.pageName; else pageName = ssdl.page.pageName; var quicksigninObj = { email: email, page_name: pageName, user_id: pid } if (!localStorage.getItem("quicksignin")) { localStorage.setItem("quicksignin", JSON.stringify(quicksigninObj)); } } function signInTracking() { var quickData = JSON.parse(localStorage.getItem("quicksignin")); if (quickData) { if(window.ssdl && window.ssdl.trackEvent) { window.ssdl.trackEvent({ 'action': 'sitelogin', 'data': { 'event': 'User Login', 'user_id': quickData.user_id, 'page_name': quickData.page_name, 'user_email' : quickData.email } }); localStorage.removeItem("quicksignin"); } } } function registerTracking() { var quickregObj = JSON.parse(localStorage.getItem("quickregistration")); if (quickregObj) { window.ssdl.trackEvent({ 'action': 'site_registration', 'data': { 'event': 'User Registration', 'user_id': $("#pid").val(), 'registration_type' : 'tech pro', 'page_name': quickregObj.page_name, 'user_email': quickregObj.email, 'registration_location' : 'quick registration' } }); localStorage.removeItem("quickregistration"); } } function trackSignIn() { try { _satellite.track('sitelogin'); } catch (ignore) { console.log('ignore - sitelogin'); } } function hackEarthTakeTest(count,hackWin) { if(hackWin) { var hackerWindow = hackWin; } else { var hackerWindow = window.open(); } $('#hackerEarth_success_modal').modal('hide'); $('#questionair_offcc_success-modal').modal('show'); $('#applybtn-2').html('Applied'); $('#applybtn-2').addClass('disabled'); $('.applySec').find('button.apply').html('Applied'); $('.applySec').find('button.apply').addClass('disabled'); var peopleId = $("#pid").val(); var skillName = $('#hSkill').text().toLowerCase(); if (typeof(count) == 'string' && count.indexOf('applied') != '-1') { skillName = count.substring(7); count = 1; } var count = count; var hdata = {}; hdata.skill = skillName.replace(/^\s*|\s*$/g,'').split(/\s*,\s*/); hdata.email = true; var domain = $("#localDomain").val(); var url = "/config/dice/api.json?path="+encodeURIComponent('/people/'+peopleId+'/assess'); if (count < 3) { $.ajax({ type: "POST", url: url, datatype: "json", contentType: "application/json", data: JSON.stringify(hdata) }) .done(function(data) { $("#hackerEarthModal").modal('hide'); count = 3; var jsonStorage = {}, hackEarthStorage = []; jsonStorage[hdata.skill] = data.href; if (localStorage.getItem("hackerEarth"+peopleId)) { hackEarthStorage = JSON.parse(localStorage.getItem("hackerEarth"+peopleId)); } hackEarthStorage.push(jsonStorage); localStorage.setItem("hackerEarth"+peopleId,JSON.stringify(hackEarthStorage)); if(data.href == 'TESTTAKEN') { hackerWindow.location = window.location.protocol + '//' + domain + "/dashboard/assessment?redirect=assessments?site='dice'"; // <- This is what makes it open in a new window. } else { hackerWindow.location = window.location.protocol + '//' + domain + '/dashboard/assessment?redirect=redirectThirdParty?url=' + encodeURIComponent(data.href); window.location.href = "/dashboard/assessments?site='dice'"; } }) .fail(function(jqXHR, textStatus, errorThrown) { hackerWindow.close(); count++; hackEarthTakeTest(count,hackerWindow); }); } else { hackerWindow.close(); $('#hackbtn').hide(); $('#trenSkillHTML > p').hide(); $(".hackErrorMsg").show(); $('.hack-av-margin').hide(); setTimeout(function () { $('#hackerEarthModal').modal('hide'); $('#hackerEarthModalCompany').modal('hide'); $('#hackbtn').show(); $('#trenSkillHTML > p').show(); $('.hackclosebtn').show(); $('.hack-av-margin').show(); $(".hackErrorMsg").hide(); window.location.reload(true); }, 7000); } } function testLocale() { var techproLocale = getCookie('techproLocale'); var searchableCountries = $('#psc').val(); var acessAllow=$('#acessAllowPopUp').val(); var peopleId = $("#pid").val(); var skipCrossAccess = getCookie('skip_cross_access_'+peopleId); var crossAccessSkipButton = $('#crossAccessSkipButton').val(); try { if ((!acessAllow || acessAllow == "true") && (crossAccessSkipButton && (!skipCrossAccess || skipCrossAccess != 'true')) && ((searchableCountries || (!searchableCountries && (!techproLocale || techproLocale.split("_")[1].toUpperCase() == 'GB'))) && (searchableCountries && techproLocale && searchableCountries.toUpperCase() != techproLocale.split("_")[1].toUpperCase())|| (!techproLocale && searchableCountries && searchableCountries.toUpperCase() == 'GB'))) { $('#invalidLocale').modal('show'); if (techproLocale && techproLocale.split("_")[1] == "GB") { $('#invalidLocaleTitle').text("You're browsing Dice UK") $('#continue').text('Continue to Dice UK'); $('#return').text('Return to Dice US'); } else { $('#invalidLocaleTitle').text("You're browsing Dice US") $('#continue').text('Continue to Dice US'); $('#return').text('Return to Dice UK'); } } } catch (e){ //do nothing } } function logoutForInvalidLocale() { $.ajax({ url: window.location.origin + '/jobs/seekerLogout.html', type: 'POST', datatype: 'json', contentType: 'application/json', cache: false, success: function(response){ window.location.reload(); }, error: function(res) { console.log("ERROR while logging out"); } }); } function returnToPreviousLocale() { $.ajax({ url: window.location.origin +'/jobs/seekerLogout.html', type: 'POST', datatype: 'json', contentType: 'application/json', cache: false, success: function(response){ var techproLocale = getCookie('techproLocale'); if(techproLocale && techproLocale.split("_")[1] == "GB"){ window.location.href = "http://"+$('#diceMainDomainUS').val()+"/jobs"; } else { window.location.href = "http://"+$('#diceMainDomainUK').val()+"/jobs"; } }, error: function(res) { console.log("ERROR while logging out"); } }); } function skipCrossAccess(){ var peopleId = $("#pid").val(); setCookie('skip_cross_access_'+peopleId, true, 24 * 60 * 60 *1, '/');// For hiding cross locale popup }