Updated dependencies to use Git modules, Updated build script, Improved wedge

Update .gitignore, .gitmodules, and 6 more files...
This commit is contained in:
2023-12-20 01:59:26 +01:00
parent 44a05eb73a
commit f84e5ddfa3
8 changed files with 49 additions and 35 deletions

2
.gitignore vendored
View File

@@ -9,8 +9,6 @@ package-lock.json
resources/DecimalJs/
resources/DecimalJsLight/
resources/FontAwesomePro/
resources/HighlightJS/
resources/GliderJs/
resources/PlotlyJs/
# Compiled Stuff

3
.gitmodules vendored
View File

@@ -1,3 +1,6 @@
[submodule "resources/SplideJs"]
path = resources/SplideJs
url = https://github.com/Splidejs/splide.git
[submodule "resources/HighlightJS"]
path = resources/HighlightJS
url = https://github.com/highlightjs/highlight.js.git

View File

@@ -15,7 +15,7 @@ if(basename(__FILE__) == basename($_SERVER["SCRIPT_FILENAME"])) {
<link rel="stylesheet" href="/resources/NibblePoker/css/nibblepoker.min.css?v=1">
<?php
if($enable_code_highlight) {
echo('<link href="/resources/HighlightJS/11.6.0/styles/atom-one-dark.min.css" rel="stylesheet"/>');
echo('<link href="/resources/HighlightJS/src/styles/atom-one-dark.min.css" rel="stylesheet"/>');
}
if($enable_gallery) {
echo('<link href="/resources/SplideJs/dist/css/splide.min.css" rel="stylesheet"/>');

View File

@@ -10,8 +10,7 @@ if($enable_gallery) {
}
if($enable_code_highlight) {
echo('<script src="/resources/HighlightJS/11.6.0/highlight.min.js"></script>');
echo('<script src="/resources/HighlightJS/11.6.0/languages/csharp.min.js"></script>');
echo('<script src="/resources/HighlightJS/highlight.min.js"></script>');
}
?>
<script src="/resources/NibblePoker/js/nibblepoker.min.js"></script>

View File

@@ -776,7 +776,7 @@ class ComposerElement {
}
if($this->codeCopyable) {
$htmlCode .= '<div class="wedge wedge-tr primary js-code-copy border border-t-0 border-r-0 rbl-m p-xxxs px-xs wedge-shadow">';
$htmlCode .= '<div class="wedge wedge-tr primary js-code-copy border border-t-0 border-r-0 rbl-m p-xxxs px-xs wedge-shadow" hidden>';
$htmlCode .= '<i class="fad fa-copy"></i> ' . localize("common.action.copy");
$htmlCode .= '</div>';
}

View File

@@ -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

1
resources/HighlightJS Submodule

Submodule resources/HighlightJS added at f47103d4f1

View File

@@ -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)");
});