hack in an appendChild listener
This commit is contained in:
parent
cd1767ba1b
commit
5ccb8518e9
|
@ -67,20 +67,14 @@ $(function() {
|
||||||
$('.sidebar-content').css('height', (height + 50) + 'px');
|
$('.sidebar-content').css('height', (height + 50) + 'px');
|
||||||
};
|
};
|
||||||
|
|
||||||
var hijackAppendChildToExecuteAfter = function(afterFn) {
|
var hijackAppendChildToExecuteAfter = function(afterFn, elId) {
|
||||||
const _appendChild = Node.prototype.appendChild;
|
const _appendChild = Node.prototype.appendChild;
|
||||||
const _replaceChild = Node.prototype.replaceChild;
|
|
||||||
|
|
||||||
Node.prototype.appendChild = function(el) {
|
Node.prototype.appendChild = function(el) {
|
||||||
_appendChild.apply(this, arguments);
|
_appendChild.apply(this, arguments);
|
||||||
console.log('appending ' + el);
|
if(el.id === elId) {
|
||||||
afterFn();
|
setTimeout(afterFn, 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
Node.prototype.replaceChild = function(el) {
|
|
||||||
_replaceChild.apply(this, arguments);
|
|
||||||
console.log('replacing ' + el);
|
|
||||||
afterFn();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,6 +87,6 @@ $(function() {
|
||||||
resizeSidebar();
|
resizeSidebar();
|
||||||
|
|
||||||
// needed for Commento, no 'official' callback when done provided.
|
// needed for Commento, no 'official' callback when done provided.
|
||||||
hijackAppendChildToExecuteAfter(resizeSidebar);
|
hijackAppendChildToExecuteAfter(resizeSidebar, 'commento-footer');
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue