Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: remove unused tags at ci time #48

Merged
merged 3 commits into from
May 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions assets/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ let loading = load([
"../index.css?" + document.querySelector('script[src*="index.js"]').src.split('?').pop(),
]);

// remove all default inline styles
document.querySelectorAll('style').forEach((el) => el.remove())

// wait for the page to fully load
document.addEventListener('DOMContentLoaded', main)

Expand Down Expand Up @@ -66,11 +63,15 @@ function configureIncrementalButton() {
}

function configureSelectFix() {
document.getElementById('files').addEventListener('change', (e) => {
let files = document.getElementById('files')

files.addEventListener('change', (e) => {
document.querySelectorAll('.file').forEach((el) => el.style.display = 'none')
window.scrollTo(0, 0)
setTimeout(() => document.getElementById(e.target.value).style.display = 'block', 1)
window.requestAnimationFrame(() => document.getElementById(e.target.value).style.display = 'block')
})

files.dispatchEvent(new Event('change'))
}

function configureTheme() {
Expand Down
4 changes: 3 additions & 1 deletion scripts/push.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,12 @@ cp "${GITHUB_ACTION_PATH}"/assets/* .
hash=$(cat index.css index.js | md5sum | awk '{print $1}')

for file in "revisions/${REVISION}.html" "revisions/${REVISION}-inc.html"; do
ex -sc '%s/<\/style>/<\/style>\r\t\t<script src="..\/index.js?'"${hash}"'"><\/script>/' -c 'x' "${file}"
ex -sc '%s/\n\t\t<style>\_.\{-}<\/style>//' -c 'x' "${file}"
ex -sc '%s/\n\t<script>\_.\{-}<\/script>//' -c 'x' "${file}"
ex -sc '%s/<title>/<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" \/>\r\t\t<title>/' -c 'x' "${file}"
ex -sc '%s/<title>/<meta http-equiv="Pragma" content="no-cache" \/>\r\t\t<title>/' -c 'x' "${file}"
ex -sc '%s/<title>/<meta http-equiv="Expires" content="0" \/>\r\t\t<title>/' -c 'x' "${file}"
ex -sc '%s/<\/title>/<\/title>\r\t\t<script src="..\/index.js?'"${hash}"'"><\/script>/' -c 'x' "${file}"
done

# if we are on the main branch, copy files to main.*
Expand Down
Loading