var loadRecruitoWidgets; loadRecruitoWidgets = () => { const widgets = {}; window.addEventListener('message', ({ source, data = {} } = {}) => { const widget = widgets[data.id]; if (!widget || data.type !== 'recruito-widget-resize') { return; } if (widget.getAttribute('fixedHeight')) { return; } widget.height = data.height; }); [...document.getElementsByClassName('recruito-widget')].forEach(element => { element.childNodes.forEach(n => n && n.remove()); const iframe = document.createElement('iframe'); const companyId = element.getAttribute('data-company-id'); const type = element.getAttribute('data-type'); const theme = element.getAttribute('data-theme') || 'light'; iframe.src = 'https://recruito.io/widget/' + type + '/' + companyId + '?theme=' + theme; const width = element.getAttribute('data-width') || '100%'; iframe.width = width; const minReviewCount = element.getAttribute('data-min-review-count'); if (minReviewCount) { iframe.src += '&minReviewCount=' + minReviewCount; } const id = String(Math.random()).substring(2); iframe.name = id; const definedHeight = element.getAttribute('data-height') || '100%'; const height = definedHeight; iframe.height = height; iframe.title = 'Recruito'; iframe.scrolling = 'no'; iframe.frameborder = '0'; if (definedHeight.indexOf('px') !== -1) { iframe.setAttribute('fixedHeight', true); } iframe.style = 'position: relative; width: ' + width + '; border-style: none; display: block; overflow: hidden;' element.appendChild(iframe); widgets[id] = iframe; }); }; switch (document.readyState) { case 'complete': case 'interactive': loadRecruitoWidgets(); break; default: document.addEventListener('DOMContentLoaded', loadRecruitoWidgets); }