diff --git a/docker/Dockerfile b/docker/Dockerfile index 1d55371..9e02cc7 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -23,8 +23,7 @@ RUN ./install-composer.sh # Install Node.js and required packages RUN curl -sL https://deb.nodesource.com/setup_14.x | bash - RUN apt install -y nodejs -RUN npm install -g uglify-js -RUN npm install -g clean-css-cli +RUN npm install -g uglify-js clean-css-cli html-minifier EXPOSE 80 VOLUME /var/www/mapguesser diff --git a/public/static/css/mapguesser.css b/public/static/css/mapguesser.css index 060cfea..2d09895 100644 --- a/public/static/css/mapguesser.css +++ b/public/static/css/mapguesser.css @@ -83,12 +83,12 @@ div.buttonContainer.bottom { #loading { position: absolute; - width: 40px; - height: 40px; + width: 64px; + height: 64px; top: 50%; left: 50%; - margin-top: -20px; - margin-left: -20px; + margin-top: -32px; + margin-left: -32px; z-index: 3; } diff --git a/public/static/img/loading.gif b/public/static/img/loading.gif deleted file mode 100644 index 6752946..0000000 --- a/public/static/img/loading.gif +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:d4400fe604ac37f8a9f7ce77f645e89645166347976f8233a0852c2ccb0a24f0 -size 27593 diff --git a/public/static/img/loading.svg b/public/static/img/loading.svg new file mode 100644 index 0000000..06e021e --- /dev/null +++ b/public/static/img/loading.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/public/static/js/mapguesser.js b/public/static/js/mapguesser.js index 0160819..52c73be 100644 --- a/public/static/js/mapguesser.js +++ b/public/static/js/mapguesser.js @@ -35,7 +35,7 @@ Core.loadPositionInfo(Core.realPosition); document.getElementById('currentRound').innerHTML = String(Core.rounds.length) + '/' + String(Core.NUMBER_OF_ROUNDS); - document.getElementById('currentScoreSum').innerHTML = String(Core.scoreSum) + '/' + String((Core.rounds.length-1) * Core.MAX_SCORE); + document.getElementById('currentScoreSum').innerHTML = String(Core.scoreSum) + '/' + String((Core.rounds.length - 1) * Core.MAX_SCORE); } else { Core.startNewRound(); @@ -195,7 +195,7 @@ visible: !hidden, position: realPosition, title: 'Open in Google Maps', - zIndex: 2, + zIndex: Core.rounds.length * 2, clickable: true, draggable: false }); @@ -208,7 +208,7 @@ map: Core.map, visible: !hidden, position: guessPosition, - zIndex: 1, + zIndex: Core.rounds.length, clickable: false, draggable: false, label: { @@ -286,7 +286,7 @@ fontFamily: 'Roboto', fontSize: '16px', fontWeight: '500', - text: String(i+1) + text: String(i + 1) }); round.realMarker.setVisible(true); round.guessMarker.setVisible(true); @@ -470,4 +470,9 @@ document.getElementById('startNewGameButton').onclick = function () { Core.startNewGame(); } + + window.onbeforeunload = function (e) { + e.preventDefault(); + e.returnValue = ''; + }; })(); diff --git a/scripts/install.sh b/scripts/install.sh index 317b5f5..d7aaa17 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -5,7 +5,7 @@ ROOT_DIR=$(dirname $(readlink -f "$0"))/.. . ${ROOT_DIR}/.env if [ -f ${ROOT_DIR}/installed ]; then - echo "Mapguesser is already installed! To force reinstall, delete file 'installed' from the root directory!" + echo "MapGuesser is already installed! To force reinstall, delete file 'installed' from the root directory!" exit 1 fi @@ -14,10 +14,9 @@ echo "Installing MapGuesser DB..." mysql --host=${DB_HOST} --user=${DB_USER} --password=${DB_PASSWORD} ${DB_NAME} < ${ROOT_DIR}/db/mapguesser.sql if [ -z "${DEV}" ] || [ "${DEV}" -eq "0" ]; then - echo "Uglifying JS and CSS files..." + echo "Minifying JS, CSS and SVG files..." - uglifyjs ${ROOT_DIR}/public/static/js/mapguesser.js -c -m -o ${ROOT_DIR}/public/static/js/mapguesser.js - cleancss ${ROOT_DIR}/public/static/css/mapguesser.css -o ${ROOT_DIR}/public/static/css/mapguesser.css + ${ROOT_DIR}/scripts/minify.sh fi touch ${ROOT_DIR}/installed diff --git a/scripts/minify.sh b/scripts/minify.sh new file mode 100755 index 0000000..79c1bb5 --- /dev/null +++ b/scripts/minify.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +ROOT_DIR=$(dirname $(readlink -f "$0"))/.. + +. ${ROOT_DIR}/.env + +uglifyjs ${ROOT_DIR}/public/static/js/mapguesser.js -c -m -o ${ROOT_DIR}/public/static/js/mapguesser.js +cleancss ${ROOT_DIR}/public/static/css/mapguesser.css -o ${ROOT_DIR}/public/static/css/mapguesser.css +html-minifier ${ROOT_DIR}/public/static/img/loading.svg --collapse-whitespace --remove-comments -o ${ROOT_DIR}/public/static/img/loading.svg diff --git a/scripts/update.sh b/scripts/update.sh index 2c435a5..46e0cd4 100755 --- a/scripts/update.sh +++ b/scripts/update.sh @@ -5,8 +5,7 @@ ROOT_DIR=$(dirname $(readlink -f "$0"))/.. . ${ROOT_DIR}/.env if [ -z "${DEV}" ] || [ "${DEV}" -eq "0" ]; then - echo "Uglifying JS and CSS files..." + echo "Minifying JS, CSS and SVG files..." - uglifyjs ${ROOT_DIR}/public/static/js/mapguesser.js -c -m -o ${ROOT_DIR}/public/static/js/mapguesser.js - cleancss ${ROOT_DIR}/public/static/css/mapguesser.css -o ${ROOT_DIR}/public/static/css/mapguesser.css + ${ROOT_DIR}/scripts/minify.sh fi diff --git a/views/game.php b/views/game.php index 5ce1997..07a03e0 100644 --- a/views/game.php +++ b/views/game.php @@ -9,7 +9,7 @@
- +

Round: | Score: