| window.addEventListener('message', e => { |
| if (e.source === window && e.data?.prefix === 'TWPT-extrainfo') { |
| switch (e.data?.action) { |
| case 'renderProfileActivityChart': |
| if (typeof window.sc_renderProfileActivityChart !== 'function') { |
| 'extraInfo: window.sc_renderProfileActivityChart is not available.'); |
| let chartEl = document.querySelector( |
| '.scTailwindSharedActivitychartchart[data-twpt-per-forum-chart]'); |
| console.error('extraInfo: couldn\'t find per-forum chart div.'); |
| chartEl.replaceChildren(); |
| window.sc_renderProfileActivityChart( |
| chartEl, e.data?.data, e.data?.metadata, e.data?.chartTitle); |
| 'Action \'' + e.data?.action + |
| '\' unknown to TWPT-extrainfo receiver.'); |