Skip to content

Commit

Permalink
Revert aprils fools joke
Browse files Browse the repository at this point in the history
  • Loading branch information
WUOTE committed Apr 2, 2024
1 parent bd354a2 commit e07275a
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 41 deletions.
18 changes: 9 additions & 9 deletions .github/workflows/loop.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
name: Loop cacheKeys workflow
on:
workflow_dispatch:

jobs:
getRepoCacheVars:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
Expand All @@ -15,14 +15,14 @@ jobs:
run: |
PROJECT_NAMES=("ALTERNATE_BIOMES" "APOTHEOSIS" "APOTHEOSIS_NEW_GAME_PLUS" "APOTHEOSIS_TUONELA" "NEW_GAME_PLUS_HD" "NIGHTMARE_HD" "NOITAVANIA" "NOITAVANIA_NEW_GAME_PLUS" "PURGATORY" "REGULAR_LEFT_PW" "REGULAR_MAIN_BRANCH" "REGULAR_MIDDLE" "REGULAR_RIGHT_PW")
# curl get repo variables into $response
response=$(curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.GH_NOITAMAP_VARS_ACCESS }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/acidflow-noita/noitamap/actions/variables)
for name in "${PROJECT_NAMES[@]}"; do
cachekey_value=$(jq '.variables[] | select(.name == "${name}_CACHEKEY") | .value' <<< "$response")
echo "${name}_CACHEKEY=${cachekey_value}"
Expand All @@ -48,7 +48,7 @@ jobs:
modified_on=$(jq -r '.result[0].modified_on' <<< "$response" | date -u -f - +%s)
echo "${var_name}=${project_alias}=${modified_on}" >> $GITHUB_ENV # Use environment variable to pass dynamic value.
}
for name in ${PROJECT_NAMES[@]}; do
CF_PROJECT_NAME=$(echo "$name" | tr '[:upper:]' '[:lower:]' | tr '_' '-')
get_modified_on "$CF_PROJECT_NAME" "$name"
Expand All @@ -69,20 +69,20 @@ jobs:
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/acidflow-noita/noitamap/actions/variables/${var_name}\
-d "{\"name\":\"${var_name}\",\"value\":\"${var_value}\"}"
}
for name in ${PROJECT_NAMES[@]}; do
update_modified_on "$name"
done
- name: Update index.html with new cache keys
run: |
new_keys=$(env | grep _CACHEKEY | sed 's/^[^=]*=//; s/=/":"/; s/^/"/; s/$/",/')
perl -0777 -pi -e "s#<script id=\"cachekeys\">.*?</script>#<script id=\"cachekeys\">const tileCacheKeys = {$new_keys};</script>#s" public/index.html
- name: Commit index.html changes
Expand Down
7 changes: 0 additions & 7 deletions public/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,6 @@ html {
margin-right: 2vw;
}

body.toggle-hidden a#overlayVisibilityToggleButton {
visibility: hidden;
}
body.toggle-hidden div.osOverlayHighlight {
display: none !important; /* overwrite the style="" element */
}

.loadingIndicator {
margin-bottom: 1vw;
margin-left: 1vw;
Expand Down
22 changes: 11 additions & 11 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
</div>
<nav class="navbar nav bg-body-tertiary nav-wrapper navbar-dark bg-dark fixed-top">
<div class="container-fluid">
<a class="navbar-brand" href="#" onclick="goHome();"><img id="bald" src="/assets/nooverlay.png" alt="April's Fools"
<a class="navbar-brand" href="#" onclick="goHome();"><img src="/assets/NoitamapLogo.png" alt="Noitamap Logo"
class="d-inline-block align-text-middle" /><span id="currentMapName">Noita
map</span></a>
<a id="overlayVisibilityToggleButton" tabindex="0" class="btn btn-outline-info text-nowrap"
Expand Down Expand Up @@ -117,19 +117,19 @@ <h5 class="offcanvas-title" id="offcanvasDarkNavbarLabel">Available maps</h5>
</div>
</div>
<script id="cachekeys">const tileCacheKeys = {
"regular-middle.acidflow.stream": "1711832204",
"purgatory.acidflow.stream": "1711948957",
"noitavania-new-game-plus.acidflow.stream": "1711831834",
"apotheosis-tuonela.acidflow.stream": "1711831560",
"regular-left-pw.acidflow.stream": "1711832069",
"regular-right-pw.acidflow.stream": "1711832278",
"nightmare-hd.acidflow.stream": "1711831682",
"new-game-plus-hd.acidflow.stream": "1711831587",
"regular-main-branch.acidflow.stream": "1711832235",
"purgatory.acidflow.stream": "1711832003",
"apotheosis.acidflow.stream": "1711831489",
"apotheosis-new-game-plus.acidflow.stream": "1711831522",
"noitavania.acidflow.stream": "1711831797",
"noitavania-new-game-plus.acidflow.stream": "1711831834",
"regular-middle.acidflow.stream": "1711832204",
"alternate-biomes.acidflow.stream": "1711831441",
"apotheosis-tuonela.acidflow.stream": "1711831560"
"regular-main-branch.acidflow.stream": "1711832235",
"noitavania.acidflow.stream": "1711831797",
"regular-right-pw.acidflow.stream": "1711832278",
"apotheosis.acidflow.stream": "1711831489",
"new-game-plus-hd.acidflow.stream": "1711831587",
"nightmare-hd.acidflow.stream": "1711831682",
};</script>
<script src="js/script.js"></script>
</body>
Expand Down
50 changes: 36 additions & 14 deletions public/js/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,9 @@ function changeMap(tileSource) {
os.addTiledImage({ tileSource: tileSources[0][1] });
os.addTiledImage({ tileSource: tileSources[0][2] });
os.forceRedraw();
document.querySelector("body").removeAttribute("class");
document.getElementById(
"overlayVisibilityToggleButton"
).style.visibility = "visible";

break;
case 1:
Expand All @@ -159,7 +161,9 @@ function changeMap(tileSource) {
// os.addTiledImage({ tileSource: tileSources[1][1] });
// os.addTiledImage({ tileSource: tileSources[1][2] });
os.forceRedraw();
document.querySelector("body").setAttribute("class", "toggle-hidden");
document.getElementById(
"overlayVisibilityToggleButton"
).style.visibility = "hidden";
break;
case 2:
updatedUrlParams.set("map", "new-game-plus");
Expand All @@ -168,7 +172,9 @@ function changeMap(tileSource) {
// os.addTiledImage({ tileSource: tileSources[2][1] });
// os.addTiledImage({ tileSource: tileSources[2][2] });
os.forceRedraw();
document.querySelector("body").setAttribute("class", "toggle-hidden");
document.getElementById(
"overlayVisibilityToggleButton"
).style.visibility = "hidden";
break;
case 3:
updatedUrlParams.set("map", "regular-main-branch");
Expand All @@ -177,7 +183,9 @@ function changeMap(tileSource) {
// os.addTiledImage({ tileSource: tileSources[3][1] });
// os.addTiledImage({ tileSource: tileSources[3][2] });
os.forceRedraw();
document.querySelector("body").setAttribute("class", "toggle-hidden");
document.getElementById(
"overlayVisibilityToggleButton"
).style.visibility = "hidden";
break;
case 4:
updatedUrlParams.set("map", "purgatory");
Expand All @@ -186,7 +194,9 @@ function changeMap(tileSource) {
// os.addTiledImage({ tileSource: tileSources[4][1] });
// os.addTiledImage({ tileSource: tileSources[4][2] });
os.forceRedraw();
document.querySelector("body").setAttribute("class", "toggle-hidden");
document.getElementById(
"overlayVisibilityToggleButton"
).style.visibility = "hidden";
break;
case 5:
updatedUrlParams.set("map", "apotheosis");
Expand All @@ -195,7 +205,9 @@ function changeMap(tileSource) {
// os.addTiledImage({ tileSource: tileSources[5][1] });
// os.addTiledImage({ tileSource: tileSources[5][2] });
os.forceRedraw();
document.querySelector("body").setAttribute("class", "toggle-hidden");
document.getElementById(
"overlayVisibilityToggleButton"
).style.visibility = "hidden";
break;
case 6:
updatedUrlParams.set("map", "apotheosis-new-game-plus");
Expand All @@ -204,7 +216,9 @@ function changeMap(tileSource) {
// os.addTiledImage({ tileSource: tileSources[6][1] });
// os.addTiledImage({ tileSource: tileSources[6][2] });
os.forceRedraw();
document.querySelector("body").setAttribute("class", "toggle-hidden");
document.getElementById(
"overlayVisibilityToggleButton"
).style.visibility = "hidden";
break;
case 7:
updatedUrlParams.set("map", "noitavania");
Expand All @@ -213,7 +227,9 @@ function changeMap(tileSource) {
// os.addTiledImage({ tileSource: tileSources[7][1] });
// os.addTiledImage({ tileSource: tileSources[7][2] });
os.forceRedraw();
document.querySelector("body").setAttribute("class", "toggle-hidden");
document.getElementById(
"overlayVisibilityToggleButton"
).style.visibility = "hidden";
break;
case 8:
updatedUrlParams.set("map", "noitavania-new-game-plus");
Expand All @@ -222,7 +238,9 @@ function changeMap(tileSource) {
// os.addTiledImage({ tileSource: tileSources[8][1] });
// os.addTiledImage({ tileSource: tileSources[8][2] });
os.forceRedraw();
document.querySelector("body").setAttribute("class", "toggle-hidden");
document.getElementById(
"overlayVisibilityToggleButton"
).style.visibility = "hidden";
break;
case 9:
updatedUrlParams.set("map", "alternate-biomes");
Expand All @@ -231,7 +249,9 @@ function changeMap(tileSource) {
// os.addTiledImage({ tileSource: tileSources[9][1] });
// os.addTiledImage({ tileSource: tileSources[9][2] });
os.forceRedraw();
document.querySelector("body").setAttribute("class", "toggle-hidden");
document.getElementById(
"overlayVisibilityToggleButton"
).style.visibility = "hidden";
break;
case 10:
updatedUrlParams.set("map", "apotheosis-tuonela");
Expand All @@ -240,7 +260,9 @@ function changeMap(tileSource) {
// os.addTiledImage({ tileSource: tileSources[10][1] });
// os.addTiledImage({ tileSource: tileSources[10][2] });
os.forceRedraw();
document.querySelector("body").setAttribute("class", "toggle-hidden");
document.getElementById(
"overlayVisibilityToggleButton"
).style.visibility = "hidden";
break;
default:
updatedUrlParams.set("map", "regular");
Expand All @@ -250,7 +272,9 @@ function changeMap(tileSource) {
os.addTiledImage({ tileSource: tileSources[0][2] });
os.forceRedraw();

document.querySelector("body").setAttribute("class", "toggle-hidden");
document.getElementById(
"overlayVisibilityToggleButton"
).style.visibility = "visible";
break;
}
window.history.replaceState(null, "", "?" + updatedUrlParams.toString());
Expand Down Expand Up @@ -659,7 +683,6 @@ document
Array.from(allOverlays).forEach((overlay) => {
os.removeOverlay(overlay.id);
});
document.getElementById("bald").src = "/assets/nooverlay.png";
// Todo -- fix this to make overlays work with other maps
} else if (currentMapURLFromOverlaysToggle === "regular") {
overlayTexts.forEach(({ id, text, x, y, width, height }) => {
Expand All @@ -674,7 +697,6 @@ document
const hue = Math.floor(Math.random() * 360);
e.style.backgroundColor = `hsla(${hue}, 60%, 50%, 0.401)`;
});
document.getElementById("bald").src = "/assets/overlay.png";
}
overlaysState = !overlaysState;
});
Expand Down

0 comments on commit e07275a

Please sign in to comment.