From 0cfc1d2cfb7b5c98d243b203a8c99f58e8c1c0a0 Mon Sep 17 00:00:00 2001 From: wgroeneveld Date: Mon, 13 Apr 2020 17:12:32 +0200 Subject: [PATCH] hack in an appendChild listener --- static/js/codex.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/static/js/codex.js b/static/js/codex.js index 1e9c766..6fa74bf 100644 --- a/static/js/codex.js +++ b/static/js/codex.js @@ -67,6 +67,14 @@ $(function() { $('.sidebar-content').css('height', (height + 50) + 'px'); }; + var hijackAppendChildToExecuteAfter = function(afterFn) { + const _appendChild = Node.prototype.appendChild; + Node.prototype.appendChild = function() { + _appendChild.apply(this, arguments); + afterFn(); + } + } + animateActiveGameImagesIfFound(); setSideBarPlatformHeight(); addRandomImageToSideBarMenus(); @@ -75,7 +83,7 @@ $(function() { disableResponsiveImagesForInlineLis(); resizeSidebar(); - // this sucks... But commento is still editing HTML. - setTimeout(resizeSidebar, 2000); + // needed for Commento, no 'official' callback when done provided. + hijackAppendChildToExecuteAfter(resizeSidebar); });