From b35b190a040bb6a6967e0817d06208c9a363979d Mon Sep 17 00:00:00 2001 From: HearMeWhisper Date: Mon, 8 Nov 2021 13:58:03 -0500 Subject: [PATCH] MTG localstorage everything --- MTG/index.html | 16 ++++++++-------- MTG/script.js | 16 ++++++++++++++-- MTG/style.css | 18 +++++++++--------- 3 files changed, 31 insertions(+), 19 deletions(-) diff --git a/MTG/index.html b/MTG/index.html index 5926306..1be23d8 100644 --- a/MTG/index.html +++ b/MTG/index.html @@ -17,7 +17,7 @@
-
+
Player 1
@@ -27,7 +27,7 @@
-
+
Player 2
@@ -36,7 +36,7 @@
-
+
Player 3
@@ -45,7 +45,7 @@
-
+
Player 4
@@ -54,7 +54,7 @@
-
+
Player 5
@@ -63,7 +63,7 @@
-
+
Player 6
@@ -72,7 +72,7 @@
-
+
Player 7
@@ -81,7 +81,7 @@
-
+
Player 8
diff --git a/MTG/script.js b/MTG/script.js index 534c4c6..14655b5 100644 --- a/MTG/script.js +++ b/MTG/script.js @@ -1,8 +1,20 @@ window.onunload = function(){ - localStorage.setItem('playerCount', playerCount) + localStorage.setItem('playerCount', playerCount); + for (i=1; i<9; i++){ + localStorage.setItem('playerName'+i, document.getElementById('name'+i).innerHTML); + localStorage.setItem('lifeCount'+i, document.getElementById('lifeCount'+i).innerHTML) + } }; window.onload = function(){ - localStorage.getItem('playerCount') + localStorage.getItem('playerCount'); + for (i=1; i<9; i++){ + document.getElementById('name'+i).innerHTML = localStorage.getItem('playerName'+i); + document.getElementById('lifeCount'+i).innerHTML = 20 + if (document.getElementById('lifeCount'+i).innerHTML != ""){ + + document.getElementById('lifeCount'+i).innerHTML = localStorage.getItem('lifeCount'+i) + } + } }; diff --git a/MTG/style.css b/MTG/style.css index e0721bb..27477d8 100644 --- a/MTG/style.css +++ b/MTG/style.css @@ -5,16 +5,15 @@ } body{ background-color: darkslategray; - width:100vw; - height: 100vhs; + height: 100%; } - main{ - display: flex; - justify-content: space-evenly; - font-family: "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", Geneva, Verdana, sans-serif; + main{ + display: flex; + justify-content: space-evenly; + font-family: "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", Geneva, Verdana, sans-serif; flex-wrap: wrap; } - #name{ + .name{ font-size: xx-large; display: flex; margin: 0 0 20px; @@ -57,7 +56,7 @@ display: flex; justify-content: center; align-items: center; - min-height: 50%; + height: 200px; font-size: 5rem; user-select: none; } @@ -130,10 +129,11 @@ #buttonWrapper{ display: flex; flex-direction: row; - justify-content: space-around; + justify-content: space-evenly; position: fixed; bottom: 0; width: 100%; + margin-top: auto; } #lifeCount{ padding: 10px;