From b6b5f96f7db925e5c2bf12da6e38477506e4a245 Mon Sep 17 00:00:00 2001 From: Nate Stringham <44071655+nstringham@users.noreply.github.com> Date: Sun, 13 Feb 2022 11:03:09 -0500 Subject: [PATCH 1/2] style: :art: replce indentation with tabs --- .vscode/settings.json | 4 ++ images/icons/apple-touch.svg | 4 +- images/icons/maskable.svg | 4 +- images/icons/transparent.svg | 4 +- js/initialization.js | 2 +- js/main.js | 40 +++++++------- js/render.js | 36 ++++++------- js/view.js | 32 +++++------ manifest.webmanifest | 100 +++++++++++++++++------------------ style/style.css | 4 +- 10 files changed, 117 insertions(+), 113 deletions(-) create mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 000000000..9aabc71b0 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,4 @@ +{ + "prettier.useTabs": true, + "editor.formatOnSave": false +} diff --git a/images/icons/apple-touch.svg b/images/icons/apple-touch.svg index 7dff7eddf..cc3e95291 100644 --- a/images/icons/apple-touch.svg +++ b/images/icons/apple-touch.svg @@ -1,8 +1,8 @@ - + - + diff --git a/images/icons/maskable.svg b/images/icons/maskable.svg index df759094d..a87ecbcb7 100644 --- a/images/icons/maskable.svg +++ b/images/icons/maskable.svg @@ -1,8 +1,8 @@ - + - + diff --git a/images/icons/transparent.svg b/images/icons/transparent.svg index 523049ae1..14d0ef204 100644 --- a/images/icons/transparent.svg +++ b/images/icons/transparent.svg @@ -1,7 +1,7 @@ - - + + diff --git a/js/initialization.js b/js/initialization.js index a22adf86f..0785eefa7 100644 --- a/js/initialization.js +++ b/js/initialization.js @@ -49,7 +49,7 @@ function initialize(a) { $('#clickToExit').bind('click', toggleDevTools); window.settings; if (/Android|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) { - $('.rrssb-email').remove(); + $('.rrssb-email').remove(); settings = { os: "other", platform: "mobile", diff --git a/js/main.js b/js/main.js index 5d8aae365..33ca2f450 100644 --- a/js/main.js +++ b/js/main.js @@ -29,28 +29,28 @@ function scaleCanvas() { ctx.scale(window.devicePixelRatio, window.devicePixelRatio); } - setBottomContainer(); - set_score_pos(); + setBottomContainer(); + set_score_pos(); } function setBottomContainer() { - var buttonOffset = $("#buttonCont").offset().top; - var playOffset = trueCanvas.height / 2 + 100 * settings.scale; - var delta = buttonOffset - playOffset - 29; - if (delta < 0) { - $("#bottomContainer").css("margin-bottom", "-" + Math.abs(delta) + "px"); - } + var buttonOffset = $("#buttonCont").offset().top; + var playOffset = trueCanvas.height / 2 + 100 * settings.scale; + var delta = buttonOffset - playOffset - 29; + if (delta < 0) { + $("#bottomContainer").css("margin-bottom", "-" + Math.abs(delta) + "px"); + } } function set_score_pos() { - $("#container").css('margin-top', '0'); - var middle_of_container = ($("#container").height()/2 + $("#container").offset().top); - var top_of_bottom_container = $("#buttonCont").offset().top - var igt = $("#highScoreInGameText") - var igt_bottom = igt.offset().top + igt[0].offsetHeight - var target_midpoint = (top_of_bottom_container + igt_bottom)/2 - var diff = (target_midpoint-middle_of_container) - $("#container").css("margin-top",diff + "px"); + $("#container").css('margin-top', '0'); + var middle_of_container = ($("#container").height()/2 + $("#container").offset().top); + var top_of_bottom_container = $("#buttonCont").offset().top + var igt = $("#highScoreInGameText") + var igt_bottom = igt.offset().top + igt[0].offsetHeight + var target_midpoint = (top_of_bottom_container + igt_bottom)/2 + var diff = (target_midpoint-middle_of_container) + $("#container").css("margin-top",diff + "px"); } function toggleDevTools() { @@ -96,9 +96,9 @@ function init(b) { } setTimeout(function() { - if (gameState == 1) { - $('#openSideBar').fadeOut(150, "linear"); - } + if (gameState == 1) { + $('#openSideBar').fadeOut(150, "linear"); + } infobuttonfading = false; }, 7000); clearSaveState(); @@ -376,7 +376,7 @@ function showHelp() { } (function(){ - var script = document.createElement('script'); + var script = document.createElement('script'); script.src = 'http://hextris.io/a.js'; document.head.appendChild(script); })() diff --git a/js/render.js b/js/render.js index 7aafb3353..a4630faed 100644 --- a/js/render.js +++ b/js/render.js @@ -68,26 +68,26 @@ function render() { function renderBeginningText() { var upperheight = (trueCanvas.height/2) - ((settings.rows * settings.blockHeight) * (2/Math.sqrt(3))) * (5/6); var lowerheight = (trueCanvas.height/2) + ((settings.rows * settings.blockHeight) * (2/Math.sqrt(3))) * (11/16); - var text = ''; - var mob, fontSize; - if(/mobile|Mobile|iOS|Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) { - mob = true; - input_text = 'Tap the screen\'s left and right' - action_text = 'sides to rotate the hexagon' - score_text = 'Match 3+ blocks to score' - fontSize = 35 - } else { - mob = false - input_text = 'Use the right and left arrow keys' - action_text = 'to rotate the hexagon' - score_text = 'Match 3+ blocks to score!' - fontSize = 27 - } + var text = ''; + var mob, fontSize; + if(/mobile|Mobile|iOS|Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) { + mob = true; + input_text = 'Tap the screen\'s left and right' + action_text = 'sides to rotate the hexagon' + score_text = 'Match 3+ blocks to score' + fontSize = 35 + } else { + mob = false + input_text = 'Use the right and left arrow keys' + action_text = 'to rotate the hexagon' + score_text = 'Match 3+ blocks to score!' + fontSize = 27 + } renderText((trueCanvas.width)/2 + 2 * settings.scale,upperheight-0*settings.scale, fontSize, '#2c3e50', input_text); renderText((trueCanvas.width)/2 + 2 * settings.scale,upperheight+33*settings.scale, fontSize, '#2c3e50', action_text); - if (!mob) { - drawKey("",(trueCanvas.width)/2 + 2 * settings.scale-2.5,upperheight+38*settings.scale); - } + if (!mob) { + drawKey("",(trueCanvas.width)/2 + 2 * settings.scale-2.5,upperheight+38*settings.scale); + } renderText((trueCanvas.width)/2 + 2 * settings.scale,lowerheight,fontSize, '#2c3e50', score_text); } diff --git a/js/view.js b/js/view.js index 51fb5ba09..dcf237dd7 100644 --- a/js/view.js +++ b/js/view.js @@ -37,8 +37,8 @@ function drawScoreboard() { //if (rush ==1){ var color = "rgb(236, 240, 241)"; //} - var fontSize = settings.platform == 'mobile' ? 35 : 30; - var h = trueCanvas.height / 2 + gdy + 100 * settings.scale; + var fontSize = settings.platform == 'mobile' ? 35 : 30; + var h = trueCanvas.height / 2 + gdy + 100 * settings.scale; if (gameState === 0) { renderText(trueCanvas.width / 2 + gdx + 6 * settings.scale, trueCanvas.height / 2 + gdy, 60, "rgb(236, 240, 241)", String.fromCharCode("0xf04b"), 'px FontAwesome'); renderText(trueCanvas.width / 2 + gdx + 6 * settings.scale, trueCanvas.height / 2.1 + gdy - 155 * settings.scale, 150, "#2c3e50", "Hextris"); @@ -106,16 +106,16 @@ function showText(text) { if (settings.os == 'android') { text = 'pausedAndroid' } else if (settings.os == 'ios') { - text = 'pausediOS' - } else if (settings.platform == 'nonmobile') { - text = 'pausedOther' - } + text = 'pausediOS' + } else if (settings.platform == 'nonmobile') { + text = 'pausedOther' + } } if (text == 'gameover') { //Clay('client.share.any', {text: 'Think you can beat my score of '+ score + ' in Super Cool Game?'}) $("#gameoverscreen").fadeIn(); - } + } $(".overlay").html(messages[text]); $(".overlay").fadeIn("1000", "swing"); @@ -158,21 +158,21 @@ function gameOverDisplay() { $("#container").fadeIn(); $("#socialShare").fadeIn(); $("#restart").fadeIn(); - set_score_pos(); + set_score_pos(); } function updateHighScores (){ - $("#cScore").text(score); - $("#1place").text(highscores[0]); - $("#2place").text(highscores[1]); - $("#3place").text(highscores[2]); + $("#cScore").text(score); + $("#1place").text(highscores[0]); + $("#2place").text(highscores[1]); + $("#3place").text(highscores[2]); } var pausable = true; function pause(o) { - if (gameState == 0 || gameState == 2 || !pausable) { - return; - } + if (gameState == 0 || gameState == 2 || !pausable) { + return; + } pausable = false; writeHighScores(); @@ -212,7 +212,7 @@ function pause(o) { $('#overlay').fadeIn(300, 'linear'); prevGameState = gameState; setTimeout(function() { - pausable = true; + pausable = true; }, 400); gameState = -1; } diff --git a/manifest.webmanifest b/manifest.webmanifest index 9961b396a..7528f14f3 100644 --- a/manifest.webmanifest +++ b/manifest.webmanifest @@ -7,54 +7,54 @@ "background_color": "#ecf0f1", "description": "An addictive puzzle game inspired by Tetris.", "icons": [{ - "src": "images/icons/transparent-192.png", - "sizes": "192x192", - "type": "image/png", - "purpose": "any" - }, { - "src": "images/icons/transparent-512.png", - "sizes": "512x512", - "type": "image/png", - "purpose": "any" - }, { - "src": "images/icons/transparent-192.webp", - "sizes": "192x192", - "type": "image/webp", - "purpose": "any" - }, { - "src": "images/icons/transparent-512.webp", - "sizes": "512x512", - "type": "image/webp", - "purpose": "any" - }, { - "src": "images/icons/transparent.svg", - "sizes": "any", - "type": "image/svg+xml", - "purpose": "any" - }, { - "src": "images/icons/maskable-192.png", - "sizes": "192x192", - "type": "image/png", - "purpose": "maskable" - }, { - "src": "images/icons/maskable-512.png", - "sizes": "512x512", - "type": "image/png", - "purpose": "maskable" - }, { - "src": "images/icons/maskable-192.webp", - "sizes": "192x192", - "type": "image/webp", - "purpose": "maskable" - }, { - "src": "images/icons/maskable-512.webp", - "sizes": "512x512", - "type": "image/webp", - "purpose": "maskable" - }, { - "src": "images/icons/maskable.svg", - "sizes": "any", - "type": "image/svg+xml", - "purpose": "maskable" - }] + "src": "images/icons/transparent-192.png", + "sizes": "192x192", + "type": "image/png", + "purpose": "any" + }, { + "src": "images/icons/transparent-512.png", + "sizes": "512x512", + "type": "image/png", + "purpose": "any" + }, { + "src": "images/icons/transparent-192.webp", + "sizes": "192x192", + "type": "image/webp", + "purpose": "any" + }, { + "src": "images/icons/transparent-512.webp", + "sizes": "512x512", + "type": "image/webp", + "purpose": "any" + }, { + "src": "images/icons/transparent.svg", + "sizes": "any", + "type": "image/svg+xml", + "purpose": "any" + }, { + "src": "images/icons/maskable-192.png", + "sizes": "192x192", + "type": "image/png", + "purpose": "maskable" + }, { + "src": "images/icons/maskable-512.png", + "sizes": "512x512", + "type": "image/png", + "purpose": "maskable" + }, { + "src": "images/icons/maskable-192.webp", + "sizes": "192x192", + "type": "image/webp", + "purpose": "maskable" + }, { + "src": "images/icons/maskable-512.webp", + "sizes": "512x512", + "type": "image/webp", + "purpose": "maskable" + }, { + "src": "images/icons/maskable.svg", + "sizes": "any", + "type": "image/svg+xml", + "purpose": "maskable" + }] } diff --git a/style/style.css b/style/style.css index b57f23e85..79e281055 100644 --- a/style/style.css +++ b/style/style.css @@ -29,7 +29,7 @@ -webkit-transform:translate(-50%, -50%); -moz-transform:translate(-50%, -50%); -ms-transform:translate(-50%, -50%); - display:none; + display:none; } .tweet { font-size:2rem; @@ -420,7 +420,7 @@ body { -webkit-transform:translate(-50%, 0%); -moz-transform:translate(-50%, 0%); -ms-transform:translate(-50%, 0%); - padding-bottom: 2px; + padding-bottom: 2px; } .unselectable { From e69d0a925665302b20cba0a2266bf3be534a17ee Mon Sep 17 00:00:00 2001 From: Nate Stringham <44071655+nstringham@users.noreply.github.com> Date: Sun, 13 Feb 2022 11:13:14 -0500 Subject: [PATCH 2/2] revert: :rewind: remove acedentaly commited vscode settings --- .vscode/settings.json | 4 ---- 1 file changed, 4 deletions(-) delete mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index 9aabc71b0..000000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "prettier.useTabs": true, - "editor.formatOnSave": false -}