Job Description
`); let grid = columnOne.querySelector('.job-grid'); let allTokens = Array.from(columnOne.querySelectorAll('.joblayouttoken')); // - 1. CAPTURE VARIABLES FOR BUSINESS RULES - let jobLocationValue = ""; let countryRegionValue = ""; let regionValue = ""; let ipeLevelValue = null; let employeeGroupValue = ""; // - INTERNAL USER VALIDATION VIA CUSTOM PLUGIN - // Reads global flags injected by the authentication plugin let pluginWindowCheck = !!window.isSFInternalUser; let pluginSessionCheck = sessionStorage.getItem('SF_Internal_User') === 'true'; let isInternalPortal = pluginWindowCheck || pluginSessionCheck; // Iterate through all tokens to capture their values before manipulating the DOM allTokens.forEach(el => { let labelEl = el.querySelector('.joblayouttoken-label'); if (!labelEl) return; let labelText = labelEl.innerText; let propId = generatePropertyId(labelText); let valueEl = el.querySelector('.rtltextaligneligible'); let valueText = valueEl ? valueEl.textContent.trim() : ""; if (propId === "JobLocation") { jobLocationValue = valueText; } else if (propId === "CountryRegion") { countryRegionValue = valueText; } else if (propId === "Region") { regionValue = valueText; } else if (propId === "IPELevel") { let match = valueText.match(/\d+/); if (match) ipeLevelValue = parseInt(match[0], 10); } else if (propId === "EmployeeGroup") { employeeGroupValue = valueText.toLowerCase(); } }); // - 2. BUSINESS RULES VALIDATION - let isSalaryPaid = employeeGroupValue.includes('salary'); let isIpeValid = ipeLevelValue !== null && ipeLevelValue <= 61; // Normalize locations for matching let fullLocationLower = (jobLocationValue + " " + countryRegionValue).toLowerCase(); let isUSJob = fullLocationLower.includes("usa") || fullLocationLower.includes("united states"); let allowedUSStates = ["california", "colorado", "delaware", "hawaii", "illinois", "maryland", "massachusetts", "minnesota", "nevada", "new jersey", "new york", "vermont", "washington", "d.c."]; let allowedUSAbbr = ["ca", "co", "de", "hi", "il", "md", "ma", "mn", "nv", "nj", "ny", "vt", "wa", "dc"]; let allowedGlobalCountries = ["austria", "slovakia", "lithuania", "latvia", "canada"]; // Salary Range Visibility Rule let isSalaryLocationValid = false; if (isUSJob) { let hasFullStateName = allowedUSStates.some(state => fullLocationLower.includes(state)); let hasStateAbbr = allowedUSAbbr.some(abbr => { let regex = new RegExp(`\\b${abbr}\\b`); return regex.test(fullLocationLower); }); isSalaryLocationValid = hasFullStateName || hasStateAbbr; } else { isSalaryLocationValid = allowedGlobalCountries.some(country => fullLocationLower.includes(country)); } // Job Level Visibility Rule (Legacy locations + EER Region) let allowedJobLevelLocations = ["austria", "slovakia", "lithuania", "latvia"]; let isJobLevelLocationValid = allowedJobLevelLocations.some(loc => fullLocationLower.includes(loc)); let isEERRegion = regionValue.toUpperCase().trim() === "EER"; // Final flags to determine if the fields should be shown let showSalaryRange = isSalaryLocationValid && isIpeValid && isSalaryPaid; let showJobLevel = (isJobLevelLocationValid || isEERRegion) && isIpeValid && isSalaryPaid && isInternalPortal; // - 3. TOKEN PROCESSING AND DISPLAY - let keepAddingToGrid = true; allTokens.forEach(el => { // Stop adding elements to the grid once the job description starts if (!keepAddingToGrid || el.querySelector('[itemprop="description"]')) { return; } let labelEl = el.querySelector('.joblayouttoken-label'); if (labelEl) { let labelText = labelEl.innerText; let customPropertyid = generatePropertyId(labelText); // - ABSOLUTE REMOVAL OF LOGIC-ONLY TOKENS - if ( customPropertyid === "EmployeeGroup" || customPropertyid === "CountryRegion" || customPropertyid === "Region" || customPropertyid === "IPELevel" ) { el.style.display = 'none'; // Force visual hiding el.remove(); // Remove from DOM return; } // - APPLY VISIBILITY BUSINESS FILTERS - if (customPropertyid === "SalaryRange" && !showSalaryRange) { el.style.display = 'none'; el.remove(); return; } if (customPropertyid === "JobLevel" && !showJobLevel) { el.style.display = 'none'; el.remove(); return; } // Cosmetic adjustment for short labels if (labelText.includes("(Short)")) { labelEl.innerText = labelText.replace(/\(Short\)/g, "(s)"); } // Append custom icons based on the mapped property ID let elType = labelEl.nextElementSibling; if (elType) { let icon = ''; let iconUrl = ''; switch (customPropertyid) { case 'JobLocation': icon = 'glyphicon-map-marker'; break; case 'BusinessUnit': icon = 'glyphicon-briefcase'; break; case 'JobCategory': icon = 'glyphicon-dashboard'; break; case 'EmploymentType': icon = 'glyphicon-star-empty'; break; case 'ReqID': icon = 'glyphicon-calendar'; break; case 'WorkLocationType': icon = 'glyphicon-paste'; break; case 'JobLevel': iconUrl = 'https://rmkcdn.successfactors.com/ef55fddb/b4cf3492-3cb2-4e29-a914-3.png'; break; case 'SalaryRange': iconUrl = 'https://rmkcdn.successfactors.com/ef55fddb/3bd06ab1-e5dc-4e72-abcb-3.png'; break; case 'TAPartner': iconUrl = 'https://rmkcdn.successfactors.com/ef55fddb/66a66419-f8c9-4f0e-b94a-6.png'; break; default: icon = ''; } let iconHtml = ''; if (icon) { iconHtml = ``; } else if (iconUrl) { iconHtml = ``; } labelEl.parentElement.insertAdjacentHTML('beforebegin', `
${iconHtml}
`); let wrapper = el.querySelector(`.job-token-${customPropertyid}-wrapper`); wrapper.appendChild(labelEl.parentElement); // Clean up empty text nodes let emptySibling = document.querySelector(`.job-token-${customPropertyid}-wrapper`).nextSibling; if(emptySibling && emptySibling.nodeType === 3) emptySibling.remove(); } // Flag to stop processing grid items when TA Partner is reached if (customPropertyid === "TAPartner") { keepAddingToGrid = false; } } grid.appendChild(el); }); } }); /** * Robust Mapping Function * Scans the label for keywords, effectively bypassing any issues caused by translations. */ function generatePropertyId(jobLayoutTokenLabel) { let normalized = jobLayoutTokenLabel.toLowerCase(); // Helper function to search for keywords regardless of formatting or active language const contains = (arr) => arr.some(keyword => normalized.includes(keyword)); if (contains(["employee group"])) return "EmployeeGroup"; if (contains(["ipe level", "ipe"])) return "IPELevel"; // Order matters: 'country' will correctly match 'country/region' if (contains(["country", "land", "país", "pays", "paese", "kraj", "krajina"])) return "CountryRegion"; if (contains(["region", "región", "région", "регион", "地区"])) return "Region"; if (contains(["posting job location", "job location", "jobsted", "arbeitsort", "ubicación", "site de l’emploi", "lokalizacja", "местоположение", "miesto", "职位地点", "sede di lavoro"])) return "JobLocation"; if (contains(["salary range", "recruitment salary", "løninterval", "gehaltsspanne", "przedział wynagrodzenia", "fourchette", "rango salarial", "mzdové rozpätie", "lønramme", "диапазон зарплаты"])) return "SalaryRange"; if (contains(["posting job level", "job level", "jobniveau", "joblevel", "nivel del puesto", "niveau du poste", "poziom stanowiska", "уровень должности", "úroveň pozície"])) return "JobLevel"; if (contains(["employment type", "ansættelse", "beschäftigungsart", "tipo de emprego", "type d’emploi", "rodzaj zatrudnienia", "тип занятости", "typ pracovného pomeru", "员工类型", "tipologia di impiego", "tipo de empleo"])) return "EmploymentType"; if (contains(["work location type", "arbejdsstedstype", "arbeitsmodell", "tipo de ubicacion", "emplacement de travail", "miejsca pracy", "формат работы", "výkonu práce", "工作地点类型", "modalità di lavoro"])) return "WorkLocationType"; if (contains(["job category", "jobkategori", "stellenkategorie", "categoría", "catégorie", "kategoria", "категория должности", "kategória", "职位类别", "area professionale"])) return "JobCategory"; if (contains(["business unit", "segment", "segmento", "firmaenhed", "unternehmenseinheit", "jednostka biznesowa", "сегмент", "业务板块"])) return "BusinessUnit"; if (contains(["req id", "rek-id", "kennung", "id de solicitud", "identifiant de la demande", "identyfikator", "идентификатор", "id pracovní pozície", "需求 id", "identifikačné", "id posizione", "requisition id", "stellen-id"])) return "ReqID"; if (contains(["ta partner", "partenaire ta"])) return "TAPartner"; // Default fallback if no keywords are matched return jobLayoutTokenLabel.replace(/[\s:\(\)\]\[]/g,''); } //]]>