mirror of
https://github.com/plausible/analytics.git
synced 2024-11-30 11:13:22 +03:00
7d37208d52
* Allow custom styles to be passed to embedded iframe * Changelog
21 lines
414 B
JavaScript
21 lines
414 B
JavaScript
import iframeResize from 'iframe-resizer/js/iframeResizer'
|
|
|
|
var iframes = iframeResize({
|
|
heightCalculationMethod: 'taggedElement',
|
|
onInit: onInit
|
|
}, '[plausible-embed]')
|
|
|
|
function onInit() {
|
|
var iframe = iframes[0]
|
|
var styles = iframe.getAttribute('styles')
|
|
|
|
if (styles) {
|
|
iframe.iFrameResizer.sendMessage({
|
|
type: 'load-custom-styles',
|
|
opts: {
|
|
styles: styles
|
|
}
|
|
})
|
|
}
|
|
}
|