var lumesseRequire = (typeof lumesse != 'undefined' && 'require' in lumesse) ? lumesse.require : require; lumesseRequire([ "jquery", "TalentPortalEventBus", "ComponentConfigurationApiFacade", "ComponentTranslationFacade" ], function ($, talentPortalEventBus, configuration, translate) { "use strict"; talentPortalEventBus.subscribe("search-criteria", "rendered", function () { //Home Office added to the end of list setInterval(function () { var lastItem = $("option:contains('Home Office')"); if (lastItem.length) { $(lastItem).appendTo('#LOV27'); } }, 100); //Location select disabled $("#LOV27").attr("disabled", true); $('#LOV26').change(function () { if ($(this).val() != 0) { $("#LOV27").attr("disabled", false); } else { $("#LOV27").attr("disabled", true); } }); // if condition is set to true function will remove all other option than provided function removeOptionFromSelect(name, values, condition) { var counter = 0; var searchChina = setInterval(function () { if($('.form-control[name='+name+'] option').length || counter > 10) { $('.form-control[name='+name+'] option').each(function(index) { if (condition) { if ((values.indexOf($(this).val()) === -1) && (index != 0)) { $(this).attr('disabled', 'disabled').remove() } } else { if ((values.indexOf($(this).val()) > -1)) { $(this).attr('disabled', 'disabled').remove() } } }); clearInterval(searchChina); } counter++; }, 50); } removeOptionFromSelect("ContractType", ["17047"], false); var gaButton = $('#lumesse-general-application-wrapper a'), gaButtonUrl = "https://emea3.recruitmentplatform.com/apply-app/pages/application-form"; gaButton.attr("href", gaButtonUrl + translate.get('extGaParam', "?jobId=P7SFK026203F3VBQB6879LONB-532&langCode=en_US")); var resultsOptions = $("#ResultsperpageFieldLabel").next(); $('#lumesseSearchCriteriaWidget button').appendTo(resultsOptions) }); talentPortalEventBus.subscribe("jobs-list", "rendered", function () { let pathname = window.location.pathname; if(pathname.slice(-1) === '/') { pathname = pathname.substring(0, pathname.length - 1); history.replaceState(null, "", window.location.origin + pathname + window.location.search); } }); } );