summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--js/colors.js2
-rw-r--r--js/katex-opts.js14
-rw-r--r--js/toggle.js2
-rw-r--r--nix/build.nix14
-rw-r--r--nix/fontawesome.nix1
5 files changed, 27 insertions, 6 deletions
diff --git a/js/colors.js b/js/colors.js
index 158ad52..2cc6a18 100644
--- a/js/colors.js
+++ b/js/colors.js
@@ -1,4 +1,4 @@
-// @license http://www.wtfpl.net/txt/copying/" WTFPL
+// @license "http://www.wtfpl.net/txt/copying/" WTFPL
if ( localStorage.getItem("color-mode") === "dark" ||
( !localStorage.getItem("color-mode") && window.matchMedia('(prefers-color-scheme: dark)').matches )
diff --git a/js/katex-opts.js b/js/katex-opts.js
new file mode 100644
index 0000000..4909687
--- /dev/null
+++ b/js/katex-opts.js
@@ -0,0 +1,14 @@
+// @license "http://www.wtfpl.net/txt/copying/" WTFPL
+
+document.addEventListener("DOMContentLoaded", function() {
+ renderMathInElement(document.body, {
+ delimiters: [
+ { left: "$$", right: "$$", display: true },
+ { left: "\\[", right: "\\]", display: true },
+ { left: "$", right: "$", display: false },
+ { left: "\\(", right: "\\)", display: false },
+ ]
+ });
+});
+
+// @license-end
diff --git a/js/toggle.js b/js/toggle.js
index 884e0bf..46e4b6a 100644
--- a/js/toggle.js
+++ b/js/toggle.js
@@ -1,4 +1,4 @@
-// @license http://www.wtfpl.net/txt/copying/" WTFPL
+// @license "http://www.wtfpl.net/txt/copying/" WTFPL
function toggle(divid) {
var cont = document.getElementById(divid);
diff --git a/nix/build.nix b/nix/build.nix
index e3b6f5f..0711760 100644
--- a/nix/build.nix
+++ b/nix/build.nix
@@ -1,14 +1,16 @@
-{ stdenvNoCC, buildAssets, nodePackages, fontawesome, ... }:
+{ stdenvNoCC, buildAssets, nodePackages, fontawesome, haskellPackages, haskell, ... }:
stdenvNoCC.mkDerivation (finalAttrs: {
pname = "www-assets";
- src = buildins.path {
+ version = "0.1.0.0";
+ src = builtins.path {
path = ../.;
name = "assets";
};
nativeBuildInputs = [
buildAssets
nodePackages.katex
- fontaweoms
+ fontawesome
+ (haskell.lib.compose.justStaticExecutables haskellPackages.hjsmin)
];
phases = "installPhase";
@@ -17,6 +19,10 @@ stdenvNoCC.mkDerivation (finalAttrs: {
# javascript
cp -r $src/js $out/js
+ chmod +rwx $out/js
+ for x in $out/js/*.js; do
+ hjsmin -i "$x" -o "''${x%.js}.min.js"
+ done
# fontawesome
mkdir -p $out/fontawesome
@@ -25,5 +31,5 @@ stdenvNoCC.mkDerivation (finalAttrs: {
# katex
cp -r ${nodePackages.katex}/lib/node_modules/katex/dist $out/katex
- ''
+ '';
})
diff --git a/nix/fontawesome.nix b/nix/fontawesome.nix
index e824ace..6ac893f 100644
--- a/nix/fontawesome.nix
+++ b/nix/fontawesome.nix
@@ -5,6 +5,7 @@ in (fetchFromGitHub {
owner = "FortAwesome";
repo = "Font-Awesome";
rev = version;
+ hash = "sha256-MaJG96kYj8ukJVyqOTDpkHH/eWr/ZlbVKk9AvJM7ub4=";
}) // {
inherit version;
}