From 0629c045a5c783193327a715a4bc0b50fbc8c407 Mon Sep 17 00:00:00 2001 From: hfauche Date: Thu, 6 Jan 2022 13:46:37 +0100 Subject: [PATCH] Fix slowliness at page load highlight code in modal at modal opening --- scripts.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts.js b/scripts.js index 3d48ae9..ddce178 100644 --- a/scripts.js +++ b/scripts.js @@ -1,5 +1,5 @@ $(document).ready(function() { - $('.page-header pre code, .top-resource-description pre code, .modal-body pre code').each(function(i, block) { + $('.page-header pre code, .top-resource-description pre code').each(function(i, block) { hljs.highlightBlock(block); }); @@ -17,6 +17,9 @@ $(document).ready(function() { // do we have such element + is it a modal? --> show it if (element.length && element.hasClass('modal')) { + element.find('pre code').each(function(i, block) { + hljs.highlightBlock(block); + }); element.modal('show'); } });