From a8ddc09cb3d8d8484d1af4c29269f9e700895d26 Mon Sep 17 00:00:00 2001 From: wgroeneveld Date: Mon, 13 Apr 2020 17:16:30 +0200 Subject: [PATCH] hack in an appendChild listener --- static/js/codex.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/static/js/codex.js b/static/js/codex.js index 6fa74bf..cc5cef5 100644 --- a/static/js/codex.js +++ b/static/js/codex.js @@ -69,8 +69,17 @@ $(function() { var hijackAppendChildToExecuteAfter = function(afterFn) { const _appendChild = Node.prototype.appendChild; - Node.prototype.appendChild = function() { + const _insertBefore = Node.prototype.insertBefore; + + Node.prototype.appendChild = function(el) { _appendChild.apply(this, arguments); + console.log('appending ' + el); + afterFn(); + } + + Node.prototype.insertBefore = function(el) { + _insertBefore.apply(this, arguments); + console.log('inserting before ' + el); afterFn(); } }