From b2a29e2b135f800b191eed88bd67b17a6cb2aa31 Mon Sep 17 00:00:00 2001 From: Saud Fatayerji Date: Thu, 4 May 2023 00:07:51 +0300 Subject: [PATCH] Restyled the sign page and cleaned up code in various places. --- .gitignore | 4 +- src/main/resources/static/css/general.css | 5 + src/main/resources/static/js/game.js | 65 +- .../templates/convert/file-to-pdf.html | 1 + .../templates/convert/img-to-pdf.html | 3 +- .../templates/convert/pdf-to-html.html | 1 + .../templates/convert/pdf-to-img.html | 1 + .../templates/convert/pdf-to-pdfa.html | 1 + .../convert/pdf-to-presentation.html | 1 + .../templates/convert/pdf-to-text.html | 1 + .../templates/convert/pdf-to-word.html | 1 + .../templates/convert/pdf-to-xml.html | 1 + .../resources/templates/fragments/common.html | 831 +++++++++--------- .../templates/other/compress-pdf.html | 1 + .../resources/templates/other/ocr-pdf.html | 1 + src/main/resources/templates/sign.html | 441 +++++----- 16 files changed, 685 insertions(+), 674 deletions(-) diff --git a/.gitignore b/.gitignore index 88be02aa..3c11770c 100644 --- a/.gitignore +++ b/.gitignore @@ -109,4 +109,6 @@ local.properties *.tar.gz *.rar -/build \ No newline at end of file +/build + +/.vscode \ No newline at end of file diff --git a/src/main/resources/static/css/general.css b/src/main/resources/static/css/general.css index 3190465e..124a35e4 100644 --- a/src/main/resources/static/css/general.css +++ b/src/main/resources/static/css/general.css @@ -42,3 +42,8 @@ html[lang-direction=rtl] * { position: absolute; bottom: 0; } + +.btn-group > label:first-of-type { + border-top-left-radius: 0.25rem !important; + border-bottom-left-radius: 0.25rem !important; +} diff --git a/src/main/resources/static/js/game.js b/src/main/resources/static/js/game.js index 2d138f93..ffad304b 100644 --- a/src/main/resources/static/js/game.js +++ b/src/main/resources/static/js/game.js @@ -108,16 +108,17 @@ function initializeGame() { } -function resetEnemies() { - pdfs.forEach((pdf) => gameContainer.removeChild(pdf)); - pdfs.length = 0; -} + function resetEnemies() { + pdfs.forEach((pdf) => gameContainer.removeChild(pdf)); + pdfs.length = 0; + } function updateGame() { if (gameOver || paused) return; - pdfs.forEach((pdf, pdfIndex) => { + for (let pdfIndex = 0; pdfIndex < pdfs.length; pdfIndex++) { + const pdf = pdfs[pdfIndex]; const pdfY = parseInt(pdf.style.top) + pdfSpeed; if (pdfY + 50 > gameContainer.clientHeight) { gameContainer.removeChild(pdf); @@ -149,11 +150,7 @@ function resetEnemies() { } } } - }); - - - - + }; projectiles.forEach((projectile, projectileIndex) => { const projectileY = parseInt(projectile.style.top) - 10; @@ -180,31 +177,32 @@ function resetEnemies() { setTimeout(updateGame, 1000 / 60); } -function resetGame() { - playerX = gameContainer.clientWidth / 2; - playerY = 50; - updatePlayerPosition(); - pdfs.forEach((pdf) => gameContainer.removeChild(pdf)); - projectiles.forEach((projectile) => gameContainer.removeChild(projectile)); + function resetGame() { + playerX = gameContainer.clientWidth / 2; + playerY = 50; + updatePlayerPosition(); - pdfs.length = 0; - projectiles.length = 0; + pdfs.forEach((pdf) => gameContainer.removeChild(pdf)); + projectiles.forEach((projectile) => gameContainer.removeChild(projectile)); - score = 0; - level = 1; - lives = 3; - - gameOver = false; + pdfs.length = 0; + projectiles.length = 0; - updateScore(); - updateLives(); - levelElement.textContent = 'Level: ' + level; - pdfSpeed = 1; - clearTimeout(spawnPdfTimeout); // Clear the existing spawnPdfTimeout - setTimeout(updateGame, 1000 / 60); - spawnPdfInterval(); -} + score = 0; + level = 1; + lives = 3; + + gameOver = false; + + updateScore(); + updateLives(); + levelElement.textContent = 'Level: ' + level; + pdfSpeed = 1; + clearTimeout(spawnPdfTimeout); // Clear the existing spawnPdfTimeout + setTimeout(updateGame, 1000 / 60); + spawnPdfInterval(); + } @@ -243,9 +241,7 @@ function resetGame() { updateHighScore(); } alert('Game Over! Your final score is: ' + score); - setTimeout(() => { // Wrap the resetGame() call in a setTimeout - resetGame(); - }, 0); + document.getElementById('game-container-wrapper').close(); } @@ -281,6 +277,7 @@ function resetGame() { }); + window.resetGame = resetGame; } window.initializeGame = initializeGame; diff --git a/src/main/resources/templates/convert/file-to-pdf.html b/src/main/resources/templates/convert/file-to-pdf.html index 2aab4bf5..f90572f0 100644 --- a/src/main/resources/templates/convert/file-to-pdf.html +++ b/src/main/resources/templates/convert/file-to-pdf.html @@ -5,6 +5,7 @@ +
diff --git a/src/main/resources/templates/convert/img-to-pdf.html b/src/main/resources/templates/convert/img-to-pdf.html index afd704dc..a3c2bcf8 100644 --- a/src/main/resources/templates/convert/img-to-pdf.html +++ b/src/main/resources/templates/convert/img-to-pdf.html @@ -5,6 +5,7 @@ +
@@ -40,7 +41,7 @@

- - - - +
+
Lives: 3
+
Score: 0
+
High Score: 0
+
Level: 1
+ +
+ + +
+ + - - - - -
-
- - -
-
-
-
- - - - - - - - - - - + +
+
+ + +
+
+
+
+ + + + + + -
\ No newline at end of file diff --git a/src/main/resources/templates/other/compress-pdf.html b/src/main/resources/templates/other/compress-pdf.html index 189dd993..f173dba4 100644 --- a/src/main/resources/templates/other/compress-pdf.html +++ b/src/main/resources/templates/other/compress-pdf.html @@ -6,6 +6,7 @@ +
diff --git a/src/main/resources/templates/other/ocr-pdf.html b/src/main/resources/templates/other/ocr-pdf.html index 3e36b5eb..d9c400bb 100644 --- a/src/main/resources/templates/other/ocr-pdf.html +++ b/src/main/resources/templates/other/ocr-pdf.html @@ -6,6 +6,7 @@ +
diff --git a/src/main/resources/templates/sign.html b/src/main/resources/templates/sign.html index 8613ec07..cc9d2dfc 100644 --- a/src/main/resources/templates/sign.html +++ b/src/main/resources/templates/sign.html @@ -12,32 +12,41 @@ +
@@ -46,20 +55,30 @@

- - - - +
+ +
+ + + + +
+ +
+ +
+ +
+ + +
+
- -
- - - -
+ +
@@ -67,93 +86,58 @@
+ + + \ No newline at end of file