Closed dmitmel closed 4 years ago
It seems that you use a very old version of Highlight.js. I can try updating it and opening a pull request.
It seems like your website works with older versions of HLJS, you just need to update the theme file (includes/zenburn.min.css
) or use one from a CDN.
Anyway, in the meantime I created this little script for GreaseMonkey as a workaround for this issue:
// ==UserScript==
// @name open.gl Highlight.js fix
// @version 1
// @grant none
// @match https://open.gl/*
// @run-at document-start
// ==/UserScript==
// create a dummy Highlight.js object in the global scope, so that scripts that depend on it don't crash
window.eval("var hljs = { initHighlightingOnLoad: () => {} }");
document.addEventListener('readystatechange', () => {
if (document.readyState !== 'interactive') return;
// this code is going to run right after the DOM tree has been parsed
let scriptTags = Array.from(document.getElementsByTagName('script'));
let incorrectScript = scriptTags.find(script => script.src.includes('//yandex.st/highlightjs/6.1/highlight.min.js'));
incorrectScript.parentElement.removeChild(incorrectScript);
let correctScript = document.createElement('script');
correctScript.src = '//cdnjs.cloudflare.com/ajax/libs/highlight.js/7.5/highlight.min.js';
correctScript.setAttribute('onload', 'hljs.initHighlightingOnLoad()');
document.body.appendChild(correctScript);
});
I've fixed the problem by mirroring highlight.js
locally just like the other dependencies.
Thanks!
yandex.st
along with other Yandex domains is blocked in Ukraine. Please use other CDN, for example jsdelivr which is recommended on the download page of Highlight.js:Relevant code is here:
https://github.com/Overv/Open.GL/blob/63b4d7714d7ed68807386b143c1018b2a9bfce71/index.php#L75