| Line 1: |
Line 1: |
| − | mw.loader.load("https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.11.1/highlight.min.js"); | + | mw.loader.load( |
| − | mw.loader.load("https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.11.1/styles/default.min.css", "text/css"); | + | "https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js" |
| | + | ); |
| | + | mw.loader.load( |
| | + | "https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/default.min.css", |
| | + | "text/css" |
| | + | ); |
| | | | |
| − | $(function () {
| + | mw.loader.using([], function () { |
| − | hljs.configure({ | + | // Wait until highlight.js is actually available |
| − | cssSelector: 'pre[class*="language-"]'
| + | function initHighlight() { |
| − | });
| + | if (typeof hljs !== "undefined") { |
| − | hljs.highlightAll();
| + | hljs.configure({ |
| | + | cssSelector: 'pre[class*="language-"]' |
| | + | }); |
| | + | hljs.highlightAll(); |
| | + | } else { |
| | + | // try again shortly |
| | + | setTimeout(initHighlight, 50); |
| | + | } |
| | + | } |
| | + | |
| | + | initHighlight(); |
| | }); | | }); |