Render Component with JavaScript.

This commit is contained in:
2023-06-21 21:46:31 +03:00
parent 80464a61d7
commit 010154797a
2 changed files with 9874 additions and 16 deletions
+38 -1
View File
@@ -1 +1,38 @@
window.initBlock=function(e="",n="",o){document.querySelectorAll(n).forEach((e=>o(e)))},function(){let e;function n(n){const o=document.querySelector("body > main").scrollHeight;if(e===o)return;e=o,window.parent.postMessage("resize:"+JSON.stringify({height:e}),"*")}n(),new ResizeObserver(n).observe(document.body)}(); window.initBlock = initBlock;
// Blocks Initialization.
function initBlock(blockName = '', selector = '', cb) {
document.querySelectorAll(selector).forEach((el) => cb(el));
}
// Scrollbars / Frame resizes notifications.
(function () {
let height;
handleHeightChange(); // Initial frame's height setup.
setupResizeListener(); // Listen to frame's height changes.
///
function setupResizeListener() {
const resizeObserver = new ResizeObserver(handleHeightChange);
resizeObserver.observe(document.body);
}
function handleHeightChange(entries) {
const updatedHeight = getCurrentHeight();
if (height === updatedHeight) {
return;
}
const RESIZE_CODE = 'resize:';
height = updatedHeight;
window.parent.postMessage(RESIZE_CODE + JSON.stringify({height}), '*');
}
function getCurrentHeight() {
return document.querySelector('body > main').scrollHeight;
}
})();
//# sourceMappingURL=frame-index.min.js.map
+9836 -15
View File
File diff suppressed because one or more lines are too long