';
categoryOptions += line;
jobCatFilter += catLine;
}
jQuery("#category").append(categoryOptions);
jQuery("#collapse-1").append(jobCatFilter);
}
function processCounties(data) {
jQuery('#county').empty();
let countyOptions = '';
let groupOpen = false;
let currentGroup = ' '; // space group is for Nationwide and Outside Of Ireland.
for(let i=0; i' +
(isEnglishLanguage() ? valueEn : valueGa) + '';
}
// One place to create the same HTML
function openGroupOptionLine(valueGa, valueEn){
return '
';
}
function createMultiSelectCounties() {
let noSelectedText = isEnglishLanguage() ? 'Select counties' : 'Roghnaigh contaetha';
let selectedText = isEnglishLanguage() ? '# selected' : '# roghnaithe';
let checkAll = isEnglishLanguage() ? 'Check all' : 'Seiceáil Gach';
let uncheckAll = isEnglishLanguage() ? 'Uncheck all' : 'Díthiceáil Uile';
jQuery("#county").multiselect({
classes: "countySelection",
noneSelectedText: noSelectedText,
selectedText: selectedText,
checkAllText: checkAll,
uncheckAllText: uncheckAll
});
jQuery('#county_ms').attr('role', 'combobox');
jQuery('#county_ms').attr('aria-expanded', false);
jQuery('#county_ms').attr('aria-labelledby', 'countyLabel');
jQuery('#county_ms > span:nth-child(2)').attr('id', 'countyLabel');
jQuery( "ul li a.ui-multiselect-all" ).attr('aria-label', 'Select all counties');
jQuery( "ul li a.ui-multiselect-none" ).attr('aria-label', 'Unselect all counties');
jQuery( "ul li a.ui-multiselect-all" ).attr('role', 'button');
jQuery( "ul li a.ui-multiselect-none" ).attr('role', 'button');
jQuery( "ul.ui-multiselect-optgroup:nth-child(5) > a" ).text("");
jQuery('ul.ui-multiselect-optgroup > a').each(
function( index, value ) {
jQuery(this).attr('role','button');
jQuery(this).attr('tabindex','0');
jQuery(this).attr('aria-label',jQuery(this).text()+' Province. Select/Unselect counties in this province.');
});
jQuery('a.ui-multiselect-close').attr('aria-label','County close button');
jQuery('span.ui-icon.ui-icon-circle-close').text('Close');
jQuery(".ui-multiselect-menu").attr('aria-modal', true);
jQuery(".ui-multiselect-menu").attr('role', 'dialog');
const provinceButtonAction = (event, element) => {
event.preventDefault();
element.click();
element.focus();
};
jQuery('ul.ui-multiselect-optgroup > a').keydown(function (e) {
if(isEnterKey(e) || isSpaceBarKey(e))
provinceButtonAction(e, this);
});
jQuery('ul.ui-multiselect-optgroup > li > label').keydown(function (e) {
const COUNTY_OUTSIDE_IRELAND = 28;
const currentCounty = jQuery(this).find('input').first().val();
if (currentCounty != COUNTY_OUTSIDE_IRELAND)
e.stopPropagation();
});
const countyButtonAction = () => {
let element = jQuery( "#county_ms" );
element.attr('aria-expanded', element.hasClass( "ui-state-active" ));
};
jQuery( "#county_ms, #county_ms > span" ).on( "focus blur keydown click", countyButtonAction );
const countySelectionAction = () => {
setTimeout(function () {
const counties = jQuery('.countySelection input[name="multiselect_county"]:checked').length;
const countyText = 'Currently selected ' + counties + ' counties.';
jQuery(".countySelection a, .countySelection input").attr('aria-label', function( i, val ) {
switch(val) {
case undefined:
return countyText;
default:
return val.includes('Currently selected')
? val.split('Currently selected')[0] + countyText
: val + countyText;
}
});
} , 50);
};
jQuery(".countySelection a, .countySelection input").on("keydown click",countySelectionAction);
countySelectionAction();
const countyExitAction = (event) => {
if (event.key === 'Escape') {
jQuery("#county_ms").focus();
jQuery(".ui-multiselect-close").click();
return;
}
};
jQuery(".countySelection, input[name='multiselect_county']").on("keydown",countyExitAction);
}
function getPathForSearch(){
let lhsIndex = window.location.href.indexOf(window.location.pathname);
let languageCode = isEnglishLanguage() ? '/en/' : '/ga/';
let lhs = window.location.href.substr(0, lhsIndex)+languageCode;
return lhs;
}
function buildAPIURL() {
const apiHost = "https://www.publicjobs.ie/restapi"; return apiHost;
}
function buildCampaignEndpoint() {
const language = isEnglishLanguage() ? "?lang=en" : "?lang=ga";
const cid = getUrlVars()["cid"];
return buildCampaignURL()+cid+language;
}
function buildBookletEndpoint(id) {
return buildCampaignURL()+id +"/booklet";
}
function buildApplyURL(campaignId) {
const applyNowUrl = "https://www.publicjobs.ie/candidateportal/home/applications/apply.do";
const locale = isEnglishLanguage() ? "en":"ga";
return applyNowUrl+ "?id="+campaignId+"&method_changeLocale="+locale+"&submit=Apply+for+position";
}
function translateLabels() {
if(!isEnglishLanguage()){
jQuery("#pj-home-div > h2").html("Aimsigh post poiblí a oireann duit");
jQuery("#jobSearch").html("Cuardach Poist");
jQuery("#jobCat").html("Catagóir Poist");
jQuery("#jobSubcat").html("Fochatagóir Poist");
jQuery("#keyLabel").html("Eochairfhocail");
jQuery("#search").html("Cuardaigh");
jQuery("#search").attr("aria-label","Cuardaigh");
jQuery("#-1").html("Roghnaigh Catagóir Poist");
jQuery("#-2").html("Roghnaigh Fochatagóir");
jQuery("#titleField").html("Teideal an Cheapacháin");
jQuery("#locationField").html("Ionad an Cheapacháin");
jQuery("#employerField").html("Fostóir");
jQuery("#advertisingField").html("Dáta Fógartha");
jQuery("#closingField").html("Dáta deiridh");
jQuery("#keywords").attr("placeholder", "Eochairfhocal");
}
}
function setElementEvents() {
jQuery("#search" ).click(function(e) {
performSearch();
e.preventDefault();
return false;
});
}