@kolbo/mcp 1.30.6 → 1.30.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/apps/bridge.js +21 -3
package/package.json
CHANGED
package/src/apps/bridge.js
CHANGED
|
@@ -102,10 +102,28 @@ const BRIDGE_JS = `
|
|
|
102
102
|
}
|
|
103
103
|
|
|
104
104
|
var sizeTimer = null;
|
|
105
|
-
|
|
105
|
+
function queueSize(delay) {
|
|
106
106
|
clearTimeout(sizeTimer);
|
|
107
|
-
sizeTimer = setTimeout(notifySize, 120);
|
|
108
|
-
}
|
|
107
|
+
sizeTimer = setTimeout(notifySize, delay || 120);
|
|
108
|
+
}
|
|
109
|
+
new MutationObserver(function () { queueSize(120); })
|
|
110
|
+
.observe(document.documentElement, { childList: true, subtree: true, attributes: true });
|
|
111
|
+
// DOM mutations don't fire when an <img>/<video> finishes loading and reflows
|
|
112
|
+
// the card — without this the host keeps the pre-image height and the card
|
|
113
|
+
// gets an inner scrollbar. ResizeObserver catches every layout change.
|
|
114
|
+
if (window.ResizeObserver) {
|
|
115
|
+
var ro = new ResizeObserver(function () { queueSize(60); });
|
|
116
|
+
ro.observe(document.documentElement);
|
|
117
|
+
ro.observe(document.body);
|
|
118
|
+
var card = document.querySelector('.k-card');
|
|
119
|
+
if (card) ro.observe(card);
|
|
120
|
+
}
|
|
121
|
+
// Belt and suspenders: media load events bubble as capture-phase 'load'.
|
|
122
|
+
document.addEventListener('load', function (e) {
|
|
123
|
+
var t = e.target && e.target.tagName;
|
|
124
|
+
if (t === 'IMG' || t === 'VIDEO') queueSize(60);
|
|
125
|
+
}, true);
|
|
126
|
+
document.addEventListener('loadedmetadata', function () { queueSize(60); }, true);
|
|
109
127
|
|
|
110
128
|
window.kolbo = {
|
|
111
129
|
ready: function (f) { if (initialized) f(hostContext); else readyFns.push(f); },
|