pub / stagit-scripts

Building src.jayvii.de with stagit
git clone https://src.jayvii.de/pub/stagit-scripts.git
Home | Log | Files | Exports | Refs | README | RSS

commit a92b3e63aef4ff36c6aff06453dc61c4510bc883
parent 510493ae91262f5a94783cafb86d499972af2f5a
Author: JayVii <jayvii[AT]posteo[DOT]de>
Date:   Mon,  5 Aug 2024 17:01:51 +0200

feat: minify CSS; fix: copy codeblock

Diffstat:
MMakefile | 15+++++++++++++++
Aassets/index.min.css | 2++
Massets/style.css | 6++++++
Aassets/style.min.css | 2++
Mbin/git_update_repo_html.sh | 2+-
Mhtaccess | 2+-
Mstyle.css | 4++--
7 files changed, 29 insertions(+), 4 deletions(-)

diff --git a/Makefile b/Makefile @@ -10,3 +10,18 @@ git-hook-deploy: --exclude="LICENSE/*" \ --exclude="Makefile" \ --exclude="README" + +# Minify CSS +minify-css: + cat assets/style.css | \ + sed -r ':a; s%(.*)/\*.*\*/%\1%; ta; /\/\*/ !b; N; ba' | \ + tr -d '\t' | \ + tr -d '\n' | \ + tr -s ' ' ' ' | \ + tee assets/style.min.css > /dev/null + cat assets/index.css | \ + sed -r ':a; s%(.*)/\*.*\*/%\1%; ta; /\/\*/ !b; N; ba' | \ + tr -d '\t' | \ + tr -d '\n' | \ + tr -s ' ' ' ' | \ + tee assets/index.min.css > /dev/null diff --git a/assets/index.min.css b/assets/index.min.css @@ -0,0 +1 @@ +:root { --fg1: #dadadb; --fg2: #8d8e8f; --bg1: #1d1e20; --bg2: #2e2e33; --hl1: #8c90d4; --del: #db4325; --add: #006164;}@media (prefers-color-scheme: light) { :root { --fg1: #1e1e1e; --fg2: #8d8e8f; --bg1: #f5f5f5; --bg2: #ffffff; --hl1: #6c71c4; --del: #db4325; --add: #006164; }}address { display: none;}.indexcoldesc { display: none;}body { background-color: var(--bg1); font-family: sans-serif, serif; color: var(--fg1);}h1, h2, h3, h4, h5, h6 { text-align: center;}table { width: 100%; max-width: 1000px; margin-left: auto; margin-right: auto; font-size: 1.25em;}th, td { white-space: nowrap; padding: 0.25em; }a { color: var(--hl1); padding: 5px; border-radius: 5px;}a:hover, a:active { background-color: var(--bg2);}hr { border: 0; border-top: 3px solid var(--fg2); height: 3px;} +\ No newline at end of file diff --git a/assets/style.css b/assets/style.css @@ -137,6 +137,12 @@ pre#blob { color: var(--hl1); } +/* Copy Codeblock Marker */ +.copythis:after { + content: ' \2B73'; + font-size: 125%; +} + /* Code Blocks on Summary Page */ code { font-size: 130%; diff --git a/assets/style.min.css b/assets/style.min.css @@ -0,0 +1 @@ +:root { --max-width: 1280px; --fg1: #dadadb; --fg2: #8d8e8f; --bg1: #1d1e20; --bg2: #2e2e33; --bg3: #04121b; --hl1: #8c90d4; --del: #db4325; --add: #006164; --fg-code: #ebdbb2; --fg-code-co: #777e94; --fg-code-ex: #ff7540; --fg-code-fu: var(--fg-code-ex); --fg-code-bu: var(--fg-code-ex); --fg-code-st: #b8bb26; --fg-code-op: #ff7540;}@media (prefers-color-scheme: light) { :root { --fg1: #1e1e1e; --fg2: #8d8e8f; --bg1: #f5f5f5; --bg2: #ffffff; --bg3: #fafafa; --hl1: #6c71c4; --fg-code: teal; --fg-code-co: #6a737d; --fg-code-ex: #d73a49; --fg-code-fu: var(--fg-code-ex); --fg-code-bu: var(--fg-code-ex); --fg-code-st: #106303; --fg-code-op: #d73a49; }}* { overflow-wrap: break-word; scroll-behavior: smooth;}#content { width: 100%; max-width: var(--max-width); overflow-x: auto; margin-left: auto; margin-right: auto;}#content img { width: auto; height: auto; max-width: 100%;}body { font-family: sans-serif, serif; color: var(--fg1); background-color: var(--bg1);}h1 { font-size: 1.25em;}h2, h3 { font-size: 1.15em;}h4, h5, h6, span.desc { font-size: 1.1em;}h1, h2, h3, h4, h5, h6 { margin: 0;}a { color: var(--hl1);}a:hover { text-decoration: underline;}a.d,a.h,a.i,a.line { text-decoration: none;}.A,span.i,pre > a.i { color: #FFFFFF; background-color: var(--add);}.D,span.d,pre > a.d { color: #FFFFFF; background-color: var(--del);}pre > a.h { color: var(--fg2);}pre#blob { font-family: monospace; font-size: 125%; overflow-x: scroll; background: var(--bg3); color: var(--fg1); border: 1px solid var(--fg2); border-radius: 5px;}#blob > a { color: var(--hl1); border-right: 3px solid #aaa; padding: 0 5px 0 0;}#blob > a:hover { color: var(--hl1);}.copythis:after { content: ' \2B73'; font-size: 125%;}code { font-size: 130%; color: var(--fg-code);}.sourceCode { background-color: var(--bg2); overflow: scroll;}code a { color: var(--fg-code);}code .co { color: var(--fg-code-co);}code .ex { color: var(--fg-code-ex);}code .fu { color: var(--fg-code-fu);}code .bu { color: var(--fg-code-bu);}code .st { color: var(--fg-code-st);}code .op { color: var(--fg-code-op);}td { padding: 0 0.4em;}hr { border: 0; border-top: 3px solid var(--fg2); height: 3px;}pre#description { font-family: sans-serif, serif; white-space: pre-wrap; word-break: keep-all;}body > table:nth-child(1) { margin-left: auto; margin-right: auto; width: 100%; max-width: var(--max-width);}body > table:nth-child(1) > tbody > tr > td:nth-child(1) { display: none;}body > table:nth-child(1) > tbody:nth-child(1) > tr:nth-child(3) > td > a { padding-left: 0.25em; padding-right: 0.25em; padding-top: 0.05em; padding-bottom: 0.1em; border-radius: 3px; background-color: var(--bg2); white-space: nowrap; display: inline-block; margin-top: 2px; margin-bottom: 3px;}body > table:nth-child(1) > tbody:nth-child(1) > tr:nth-child(3) > td { padding-top: 0.25em; padding-bottom: 0.25em; font-size: 110%; visibility: hidden; }body > table:nth-child(1) > tbody:nth-child(1) > tr:nth-child(3) > td > a { visibility: visible !important;}body > table:nth-child(1) > tbody:nth-child(1) > tr:nth-child(3) > td > a:hover,body > table:nth-child(1) > tbody:nth-child(1) > tr:nth-child(3) > td > a.active{ text-decoration: none; background-color: var(--hl1); color: var(--fg1);}body > table:nth-child(1) > tbody:nth-child(1) > tr:nth-child(3) > td > a:hover:before,body > table:nth-child(1) > tbody:nth-child(1) > tr:nth-child(3) > td > a.active:before { background-color: var(--fg1);}body > table:nth-child(1) > tbody:nth-child(1) > tr:nth-child(3) > td > a:before { content: ""; width: 1em; height: 1em; display: inline-block; background-color: var(--hl1); margin-bottom: -0.15em; margin-right: 0.25em;}body > table:nth-child(1) > tbody:nth-child(1) > tr:nth-child(3) > td > a[href$="index.html"]:before { mask: url("/assets/img/home.svg") no-repeat 0% 0%; mask-size: contain;}body > table:nth-child(1) > tbody:nth-child(1) > tr:nth-child(3) > td > a[href$="log.html"]:before { mask: url("/assets/img/git-commit.svg") no-repeat 0% 0%; mask-size: contain;}body > table:nth-child(1) > tbody:nth-child(1) > tr:nth-child(3) > td > a[href$="files.html"]:before { mask: url("/assets/img/folder.svg") no-repeat 0% 0%; mask-size: contain;}body > table:nth-child(1) > tbody:nth-child(1) > tr:nth-child(3) > td > a[href$="exports.html"]:before { mask: url("/assets/img/download.svg") no-repeat 0% 0%; mask-size: contain;}body > table:nth-child(1) > tbody:nth-child(1) > tr:nth-child(3) > td > a[href$="refs.html"]:before { mask: url("/assets/img/git-branch.svg") no-repeat 0% 0%; mask-size: contain;}body > table:nth-child(1) > tbody:nth-child(1) > tr:nth-child(3) > td > a[href$="README.html"]:before,body > table:nth-child(1) > tbody:nth-child(1) > tr:nth-child(3) > td > a[href$="README.md.html"]:before,body > table:nth-child(1) > tbody:nth-child(1) > tr:nth-child(3) > td > a[href$="README.txt.html"]:before,body > table:nth-child(1) > tbody:nth-child(1) > tr:nth-child(3) > td > a[href$="readme.html"]:before,body > table:nth-child(1) > tbody:nth-child(1) > tr:nth-child(3) > td > a[href$="readme.md.html"]:before,body > table:nth-child(1) > tbody:nth-child(1) > tr:nth-child(3) > td > a[href$="readme.txt.html"]:before,body > table:nth-child(1) > tbody:nth-child(1) > tr:nth-child(3) > td > a[href$="Readme.html"]:before,body > table:nth-child(1) > tbody:nth-child(1) > tr:nth-child(3) > td > a[href$="Readme.md.html"]:before,body > table:nth-child(1) > tbody:nth-child(1) > tr:nth-child(3) > td > a[href$="Readme.txt.html"]:before{ mask: url("/assets/img/file-text.svg") no-repeat 0% 0%; mask-size: contain;}body > table:nth-child(1) > tbody:nth-child(1) > tr:nth-child(3) > td > a[href$=".gitmodules.html"]:before { mask: url("/assets/img/share.svg") no-repeat 0% 0%; mask-size: contain;}body > table:nth-child(1) > tbody:nth-child(1) > tr:nth-child(3) > td > a[href$="atom.xml"]:before { mask: url("/assets/img/rss.svg") no-repeat 0% 0%; mask-size: contain;}.activitypoint { color: var(--hl1); font-size: 150%;}#activitylegend { font-size: 0.8em;}span[id*="-12"].activitypoint:after { content:"\0020\007C\0020";}#branches > tr:hover > td,#tags > tr:hover > td,#tags > tr:hover > td,#index > tr:hover > td,#log > tr:hover > td,#files > tr:hover > td{ background-color: var(--bg2);}table#index,table#log,table#branches,table#tags,table#exports,table#files{ width:100%}#index > thead > tr > td,#log > thead > tr > td,#branches > thead > tr > td,#tags > thead > tr > td,#exports > thead > tr > td,#files > thead > tr > td{ display: none;}#index > tbody > tr > td,#log > tbody > tr > td,#branches > tbody > tr > td,#tags > tbody > tr > td,#exports > tbody > tr > td,#files > tbody > tr > td{ display:inline-block; padding: 0; width: 100%; text-align: left;}#index > tbody > tr,#log > tbody > tr,#branches > tbody > tr,#tags > tbody > tr,#exports > tbody > tr,#files > tbody > tr{ width: 100%; background: var(--bg1);}#index > tbody > tr:hover,#log > tbody > tr:hover,#branches > tbody > tr:hover,#tags > tbody > tr:hover,#exports > tbody > tr:hover,#files > tbody > tr:hover{ background: var(--bg2);}#files > tbody > tr > td:nth-child(1) { display: none;}#exports > tbody > tr:nth-child(1) { display: none;}#index > tbody > tr > td:nth-child(1),#log > tbody > tr > td:nth-child(1),#branches > tbody > tr > td:nth-child(1),#tags > tbody > tr > td:nth-child(1),#exports > tbody > tr > td:nth-child(1),#files > tbody > tr > td:nth-child(2){ border-top: 2px solid var(--fg2); padding-top: 5px; font-weight: bold; font-size: 1.1em;}#index > tbody > tr > td:nth-child(5),#log > tbody > tr > td:nth-child(6),#branches > tbody > tr > td:nth-child(3),#tags > tbody > tr > td:nth-child(3),#exports > tbody > tr > td:nth-child(3),#files > tbody > tr > td:nth-child(3) { padding-bottom: 5px;}#index > tbody > tr > td:nth-child(3),#index > tbody > tr > td:nth-child(4),#log > tbody > tr > td:nth-child(3),#log > tbody > tr > td:nth-child(4),#log > tbody > tr > td:nth-child(5),#log > tbody > tr > td:nth-child(6),#branches > tbody > tr > td:nth-child(3),#tags > tbody > tr > td:nth-child(3),#exports > tbody > tr > td:nth-child(2),#exports > tbody > tr > td:nth-child(3),#files > tbody > tr > td:nth-child(3) { font-size: 0.8em;}#index > tbody > tr > td:nth-child(3):before,#log > tbody > tr > td:nth-child(3):before,#branches > tbody > tr > td:nth-child(3):before,#tags > tbody > tr > td:nth-child(3):before{ content: "User: ";}#index > tbody > tr > td:nth-child(4):before,#log > tbody > tr x> td:nth-child(1):before,#branches > tbody > tr > td:nth-child(2):before,#tags > tbody > tr > td:nth-child(2):before{ content: "Last Commit: ";}#log > tbody > tr > td:nth-child(4):before,#exports > tbody > tr > td:nth-child(2):before{ content: "Modified: ";}#log > tbody > tr > td:nth-child(5):before { content: "Added: ";}#log > tbody > tr > td:nth-child(6):before { content: "Removed: ";}#files > tbody > tr > td:nth-child(3):before,#exports > tbody > tr > td:nth-child(3):before{ content: "Size: ";}#log > tbody > tr > td:nth-child(4),#log > tbody > tr > td:nth-child(5),#log > tbody > tr > td:nth-child(6){ width: auto; margin-right: 1em;} +\ No newline at end of file diff --git a/bin/git_update_repo_html.sh b/bin/git_update_repo_html.sh @@ -208,7 +208,7 @@ INJEXP="s/(git\ clone)\ <a href=\"(https:\/\/.*?\.git)\">/<a href='javascript:co find "${1}/${2}/${3}/" -type f -name "*.html" -exec sed -E "${INJEXP}" -i {} \; # Inject copy-codeblock for file previews (needs to be run inside SHELL) -find "${1}/${2}/${3}/file" -type f -name "*.html" -exec sh -c 'sed -E "s/<p>\s*($(basename {} | sed -e 's/\.html$//')\s*\([^\)]*\))\s*<\/p>/<p><a href=\"javascript:copy_to_clipboard(codeblock());>\1 &#11123;<\/a><\/p>/" -i {}' \; +find "${1}/${2}/${3}/file" -type f -name "*.html" -exec sh -c 'sed -E "s/^<p>\s*($(basename {} | sed -e s/\.html$//)\s*\([^\)]*\))\s*<\/p>/<p><a title=\"Copy to Clipboard\" class=\"copythis\" href=\"javascript:copy_to_clipboard(codeblock());\">\1<\/a><\/p>/" -i {}' \; # Mark menu entries as active if page is opened (needs to be run inside SHELL) find "${1}/${2}/${3}/" -type f -name "*.html" -exec sh -c 'sed -E "s/(href=\"[^\"]*$(basename {})\")/\1\ class=\"active\"/g" -i {}' \; diff --git a/htaccess b/htaccess @@ -16,7 +16,7 @@ RedirectMatch 404 ^/url$ RedirectMatch 404 ^/htaccess$ # Style filebrowser -IndexStyleSheet /assets/index.css +IndexStyleSheet /assets/index.min.css # FileTypes: Treat .sha256 as text file AddType text/plain .sha256 diff --git a/style.css b/style.css @@ -1 +1 @@ -assets/style.css -\ No newline at end of file +assets/style.min.css +\ No newline at end of file