';
}
diff --git a/compile.bat b/compile.bat
index 7aa7f47..79c1bb0 100644
--- a/compile.bat
+++ b/compile.bat
@@ -74,6 +74,23 @@ echo ^> resources\DecimalJsLight\2.5.1\decimal.mjs
call "%~dp0node_modules\.bin\terser" decimal.mjs -c -m --toplevel -o decimal.min.mjs
popd
+:libs-highlightjs
+echo Handling HighlightJS
+pushd %CD%
+cd %~dp0\resources\HighlightJS\
+echo ^> Clearing old files
+del /Q /S /F highlight.js 2> nul 1> nul
+del /Q /S /F highlight.min.js 2> nul 1> nul
+echo ^> Installing dependencies
+call npm install > nul
+echo ^> Building for browsers
+node tools/build.js -t browser sql php c cpp vbnet java yaml css scss bash ini python shell dockerfile cmake purebasic csharp 1> nul
+echo ^> Moving final files
+robocopy %CD%\build %CD% highlight.js highlight.min.js 1> nul
+echo ^> Minifying used CSS files
+call "%~dp0node_modules\.bin\sass" src/styles/atom-one-dark.css:src/styles/atom-one-dark.min.css -q --style compressed
+popd
+
:libs-end
goto end
diff --git a/resources/HighlightJS b/resources/HighlightJS
new file mode 160000
index 0000000..f47103d
--- /dev/null
+++ b/resources/HighlightJS
@@ -0,0 +1 @@
+Subproject commit f47103d4f1ac1592c56904574d1fbf5bf2475605
diff --git a/resources/NibblePoker/js/nibblepoker-code.js b/resources/NibblePoker/js/nibblepoker-code.js
index a9fdab2..1490843 100644
--- a/resources/NibblePoker/js/nibblepoker-code.js
+++ b/resources/NibblePoker/js/nibblepoker-code.js
@@ -1,31 +1,29 @@
-// Highlights the code blocks when included on a page.
-// This command is separated in its own file since highlight.js isn't on every page and because I can't use JS
-// in a script element without using an external .js file.
-Array.from(document.getElementsByClassName("code")).forEach(eCodeContainer => {
- let language = null;
-
- eCodeContainer.classList.forEach(cCodeContainer => {
- if(cCodeContainer.startsWith("language-")) {
- language = cCodeContainer;
- }
- });
-
- if(language !== null) {
- Array.from(eCodeContainer.children).forEach(eCodeLine => {
- if(eCodeLine.classList.contains("code-line")) {
- eCodeLine.classList.add(language);
- hljs.highlightElement(eCodeLine);
+document.addEventListener("DOMContentLoaded", () => {
+ // Highlights the code blocks when included on a page.
+ // This command is separated in its own file since highlight.js isn't on every page and because I can't use JS
+ // in a script element without using an external .js file.
+ Array.from(document.getElementsByClassName("code")).forEach(eCodeContainer => {
+ let language = null;
+
+ eCodeContainer.classList.forEach(cCodeContainer => {
+ if(cCodeContainer.startsWith("language-")) {
+ language = cCodeContainer;
}
});
- }
-});
+
+ if(language !== null) {
+ Array.from(eCodeContainer.children).forEach(eCodeLine => {
+ if(eCodeLine.classList.contains("code-line")) {
+ eCodeLine.classList.add(language);
+ hljs.highlightElement(eCodeLine);
+ }
+ });
+ }
+ });
-// Adding the action to copy the code to elements with the "js-code-copy" class.
-// The search works by searching the closest parent with the "code" class or that is a "code" element, and then
-// reading each of its children with the "code-line" class.
-document.addEventListener("DOMContentLoaded", () => {
- //let codeCopyButtonCount = 0;
-
+ // Adding the action to copy the code to elements with the "js-code-copy" class.
+ // The search works by searching the closest parent with the "code" class or that is a "code" element, and then
+ // reading each of its children with the "code-line" class.
Array.from(document.getElementsByClassName("js-code-copy")).forEach(eCodeCopyButton => {
let eParentCodeBlock = eCodeCopyButton;
@@ -46,10 +44,8 @@ document.addEventListener("DOMContentLoaded", () => {
eCodeCopyButton.onclick = function() {
navigator.clipboard.writeText(code);
};
+
+ eCodeCopyButton.hidden = false;
}
-
- //codeCopyButtonCount++;
});
-
- //console.debug("Added code copying to " + codeCopyButtonCount + " button(s)");
});
\ No newline at end of file