From 493ee082efbe0b4ae04ea29f9c53bb1a626ef8a4 Mon Sep 17 00:00:00 2001 From: ROBlNET13 Date: Sat, 14 Dec 2024 22:46:59 +0200 Subject: [PATCH] added zombie fail popup for future update and a commit hash on the main menu Co-authored-by: ClaytonTDM --- .github/workflows/versionfile.yml | 23 +++++++++++++ game/Custom.css | 57 +++++++++++++++++++++++++++++++ game/iframe.html | 30 ++++++++++++++++ game/js/Cfunction.js | 12 ++++++- game/js/Custom.js | 26 ++++++++++++++ v.txt | 1 + 6 files changed, 148 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/versionfile.yml create mode 100644 v.txt diff --git a/.github/workflows/versionfile.yml b/.github/workflows/versionfile.yml new file mode 100644 index 00000000..a7f3d41e --- /dev/null +++ b/.github/workflows/versionfile.yml @@ -0,0 +1,23 @@ +name: Create Version File + +on: [push] + +jobs: + create-version-file: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Create v.txt with commit hash + run: | + echo "${{ github.sha }}" > v.txt + + - name: Commit and push v.txt + run: | + git config user.name github-actions + git config user.email github-actions@github.com + git add v.txt + git commit -m "Add v.txt with commit hash" || exit 0 + git push \ No newline at end of file diff --git a/game/Custom.css b/game/Custom.css index 15f924d8..1a950a63 100644 --- a/game/Custom.css +++ b/game/Custom.css @@ -395,4 +395,61 @@ td { 100% { transform: translateY(-100px); } +} + +#dZombieFail .list div { + position: relative; + width: 100%; +} + +#dZombieFail .button { + position: absolute; + cursor: pointer; + top: 410px; + font-family: 宋体; + color: #f93; + font-size: 24px; + font-weight: 700; +} + +#dZombieFail .button { + left: 150px; + top: 404px; +} + +#dZombieFailAD { + left: 0; + height: 100%; +} + +#dZombieFail { + position: absolute; + left: 233px; + top: 20px; + width: 434px; + display: none; + font-weight: bold; +} + +#dZombieFail .list { + position: absolute; + left: 0; + top: 90px; + z-index: 200; + width: 100%; + text-align: center; +} + +#dZombieFail .list .hidden { + cursor: pointer; + height: 20px; + color: #f93; + font-size: 16px; + line-height: 20px; +} + +#dZombieFail .list .pause { + color: #000; + font-size: 18px; + line-height: 30px; } \ No newline at end of file diff --git a/game/iframe.html b/game/iframe.html index 27f7da74..9a90f343 100644 --- a/game/iframe.html +++ b/game/iframe.html @@ -262,6 +262,36 @@ Back To Game +
+ + + + +
+ +
+
+ +
+
+
+ Back To Game +
+
diff --git a/game/js/Cfunction.js b/game/js/Cfunction.js index 33251853..5d2631b5 100644 --- a/game/js/Cfunction.js +++ b/game/js/Cfunction.js @@ -2756,6 +2756,16 @@ var $User = (function () { ); oSym.Stop(); }), + (GameOverZombies = function (c, a) { + var b = oSym; + StopMusic(); + PlayAudio("losemusic"); + b.Stop(); + //innerText(c, "Speed"); + SetBlock($("dSurface"), $("dZombieFail")); + oSym.Stop(); + }), + (PrepareGrowPlants = function (a) { var b = function () { PlayAudio("readysetplant"); @@ -2908,7 +2918,7 @@ var $User = (function () { document.cookie = a + "=0;"; }), (WordUTF8 = - ''); + ''); (ShowNameDiv = function () { oSym.Start(); diff --git a/game/js/Custom.js b/game/js/Custom.js index ddfbf6ef..24594412 100644 --- a/game/js/Custom.js +++ b/game/js/Custom.js @@ -1,3 +1,29 @@ +function waitForElm(selector) { + return new Promise(resolve => { + if (document.querySelector(selector)) { + return resolve(document.querySelector(selector)); + } + + const observer = new MutationObserver(mutations => { + if (document.querySelector(selector)) { + observer.disconnect(); + resolve(document.querySelector(selector)); + } + }); + + // If you get "parameter 1 is not of type 'Node'" error, see https://stackoverflow.com/a/77855838/492336 + observer.observe(document.body, { + childList: true, + subtree: true + }); + }); +} +// wait for #commit to exist +waitForElm('#commit').then(elm => { + // set the innertext to that of the contents of ../v.txt + fetch('../v.txt').then(response => response.text()).then(text => elm.innerText = text); +}); + const saveWhitelist = [ 1, 2, diff --git a/v.txt b/v.txt new file mode 100644 index 00000000..a2585ed0 --- /dev/null +++ b/v.txt @@ -0,0 +1 @@ +2ef8f974d2f5737be7b75c8948a4771d0f37ee1e \ No newline at end of file