mirror of
https://github.com/HeyPuter/browser.js.git
synced 2026-11-13 20:12:38 -10:00
23 lines
770 B
JavaScript
23 lines
770 B
JavaScript
const targetIframe = document.getElementById('target')
|
|
const devtoolsIframe = document.getElementById('devtools')
|
|
|
|
function resetHeight() {
|
|
const targetHeight = Math.floor(window.innerHeight * 0.4)
|
|
targetIframe.style.height = targetHeight + 'px'
|
|
devtoolsIframe.style.height = window.innerHeight - targetHeight + 'px'
|
|
}
|
|
|
|
resetHeight()
|
|
|
|
window.addEventListener('resize', resetHeight)
|
|
|
|
targetIframe.onload = function () {
|
|
targetIframe.contentWindow.devtoolsIframe = devtoolsIframe
|
|
}
|
|
window.addEventListener('message', event => {
|
|
targetIframe.contentWindow.postMessage(event.data, event.origin)
|
|
})
|
|
|
|
const hostOrigin = location.protocol + '//' + location.host
|
|
devtoolsIframe.src = `devtools-frontend/out/Default/gen/front_end/chii_app.html#?embedded=${hostOrigin}`
|