Compare commits

...

2 Commits

Author SHA1 Message Date
peshomir 431b8667a1 deploy: 7fcb584843 2024-07-05 08:45:15 +00:00
peshomir e0e22d3629 deploy: d3214ed1c9 2024-07-05 07:56:07 +00:00
6 changed files with 53 additions and 8 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

View File

@ -1,6 +1,6 @@
const dictionary = {"gIsTeamGame":"hU","game":"b","playerId":"ea","playerData":"a6","playerNames":"ju","rawPlayerNames":"tR","playerBalances":"eb","playerTerritories":"f5","gameState":"sn","fontSize":"fontSize","x":"fO","y":"fP","canvas":"gX","gHumans":"hu","playerStates":"vi","fontGeneratorFunction":"aZ.g5.g6","gIsSingleplayer":"iw","gLobbyMaxJoin":"qO","SingleplayerMenu":"z","getSingleplayerPlayerCount":"wh","gMaxPlayers":"ej","gBots":"iq","Translations":"aW","txt":"nq","strs":"a2M","uiSizes":"b1","gap":"gap","i":"eJ"};
const fx_version = '0.6.4.9'; // FX Client Version
const fx_update = 'Jun 26'; // FX Client Last Updated
const fx_version = '0.6.5'; // FX Client Version
const fx_update = 'Jul 5'; // FX Client Last Updated
if (localStorage.getItem("fx_winCount") == undefined || localStorage.getItem("fx_winCount") == null) {
var wins_counter = 0;
@ -212,6 +212,49 @@ var settingsManager = new (function() {
// should probably firgure out a way to do this without reloading - // You can't do it, localstorages REQUIRE you to reload
window.location.reload();
};
const fileInput = document.createElement("input");
fileInput.type = "file";
function handleFileSelect(event) {
const input = event.target;
/** @type {File} */
const selectedFile = input.files[0];
if (!selectedFile) return;
input.removeEventListener("change", handleFileSelect);
input.value = "";
if (!selectedFile.name.endsWith(".json")) return alert("Invalid file format");
const fileReader = new FileReader();
fileReader.onload = function() {
let result;
try {
result = JSON.parse(fileReader.result);
if (confirm("Warning: This will override all current settings, click \"OK\" to confirm")) settings = result;
localStorage.setItem("fx_settings", JSON.stringify(settings));
window.location.reload();
} catch (error) {
alert("Error\n" + error)
}
}
fileReader.readAsText(selectedFile);
}
this.importFromFile = function() {
fileInput.click();
fileInput.addEventListener('change', handleFileSelect);
};
// https://stackoverflow.com/a/34156339
function saveFile(content, fileName, contentType) {
var a = document.createElement("a");
var file = new Blob([content], {type: contentType});
a.href = URL.createObjectURL(file);
a.download = fileName;
a.click();
URL.revokeObjectURL(a.href);
}
this.exportToFile = function() {
saveFile(JSON.stringify(settings), 'FX_client_settings.json', 'application/json');
};
this.syncFields = function() {
Object.keys(inputFields).forEach(function(key) { inputFields[key].value = settings[key]; });
Object.keys(checkboxFields).forEach(function(key) { checkboxFields[key].checked = settings[key]; });

File diff suppressed because one or more lines are too long

View File

@ -35,7 +35,7 @@
<meta itemprop="image" content="https://fxclient.github.io/FXclient/assets/logo.png">
<!-- FX Client CSS -->
<link rel="stylesheet" href="main.css?1719909880253">
<link rel="stylesheet" href="main.css?1720169113922">
<!-- Game CSS -->
<style>
html,
@ -111,6 +111,8 @@
<footer>
<button onclick="settingsManager.resetAll()">Reset Settings</button>
<button onclick="settingsManager.save()">Save Settings</button>
<button onclick="settingsManager.importFromFile()">Import</button>
<button onclick="settingsManager.exportToFile()">Export</button>
</footer>
</div>
<div class="window scrollable selectable" id="playerlist" style="display: none;">
@ -122,8 +124,8 @@
<p id="donationhistory_note">Note: donations from bots are not shown here</p>
<table><tbody id="donationhistory_content"></tbody></table>
</div>
<script src="variables.js?1719909880253"></script>
<script src="fx_core.js?1719909880253"></script>
<script src="game.js?1719909880253"></script>
<script src="variables.js?1720169113922"></script>
<script src="fx_core.js?1720169113922"></script>
<script src="game.js?1720169113922"></script>
</body>
</html>

View File

@ -28,7 +28,7 @@
border-width : 2px;
border-width : calc(0.15 * (1vw + 1vh));
font-size : 20px;
font-size : calc(14px + ((0.4 * (0.8vw + 1vh)) + 0.15rem));
font-size : calc(14px + ((0.5 * (1.1vw - 0.1vh)) + 0.14rem));
max-height : 90%;
transition : 0.2s;
z-index : 10;