diff --git a/index.html b/index.html index 4c2de1e..dd592cc 100644 --- a/index.html +++ b/index.html @@ -10,7 +10,6 @@
-Mode,Level,WPM,Words,Accuracy\n'; + storedData.forEach(function(row) { + displayContent += row.mode + ',' + row.level + ',' + row.wpm + ',' + row.words + ',' + row.accuracy + '\n'; + }); + displayContent += ''; + + // Display in the designated container + displayContainer.innerHTML = displayContent; + } } + +function downloadGameData() { + var storedData = JSON.parse(localStorage.getItem('typingGameData')) || []; + var csvContent = 'Mode,Level,WPM,Words,Accuracy\n'; + storedData.forEach(function(row) { + csvContent += row.mode + ',' + row.level + ',' + row.wpm + ',' + row.words + ',' + row.accuracy + '\n'; + }); + + var blob = new Blob([csvContent], { type: 'text/csv;charset=utf-8;' }); + var link = document.createElement('a'); + link.href = URL.createObjectURL(blob); + link.download = 'typing-game-data.csv'; + link.style.visibility = 'hidden'; + + document.body.appendChild(link); + link.click(); + document.body.removeChild(link); +} + + // generates a single line to be appended to the answer array // if a line with a maximum number of words is desired, pass it in as a parameter function generateLine(maxWords) { diff --git a/logic/main.css b/logic/main.css index 1b3c9fd..1e47d7e 100644 --- a/logic/main.css +++ b/logic/main.css @@ -333,6 +333,20 @@ input { font-size: 5vmin; } + +#buttonContainer { + position: fixed; /* Fixed positioning */ + top: 10px; /* Adjust as needed */ + left: 10px; /* Adjust as needed */ + display: flex; + flex-direction: column; + align-items: flex-start; +} + +#buttonContainer button { + margin-bottom: 5px; /* Spacing between buttons */ +} + #scoreText, #timeText { font-family: 'Verdana', sans-serif; } @@ -836,5 +850,3 @@ input:checked + .slider:before { - -