(function ripplingRecruitingHandlers() { let $container; let $iframe; function createBoardUrl(boardId, locale) { let baseUrl = window.RR_BASE_URL || 'https://ats.rippling.com'; if (locale) { baseUrl += `/${locale}`; } const urlSafeLocation = encodeURIComponent(document.location.href); return `${baseUrl}/embed/${boardId}/jobs?s=${urlSafeLocation}`; } function findContainer() { $container = document.getElementById('rr-job-board'); } function createIframe() { $container.innerHTML = ''; const boardId = $container.dataset.jobBoardId; const locale = $container.dataset.locale; $iframe = document.createElement('iframe'); $iframe.id = 'rr-job-board-iframe'; $iframe.frameBorder = '0'; $iframe.src = createBoardUrl(boardId, locale); $iframe.width = '100%'; $container.appendChild($iframe); } function handleResize(e) { if (e.data.action == 'RR_RESIZE' && $iframe) { const height = e.data.height; $iframe.setAttribute('height', height); } } function attachLocalPageResizeHandler() { const shouldResizeParam = $container.dataset.autoResize; const shouldResize = !shouldResizeParam || shouldResizeParam === 'true'; if (shouldResize) { window.addEventListener('message', handleResize); } } function init() { findContainer(); attachLocalPageResizeHandler(); createIframe(); } findContainer(); if (document.readyState === 'complete' || $container) { init(); } else { window.addEventListener('load', init); } })();