Compare commits
2 Commits
8af3fa938a
...
431b8667a1
Author | SHA1 | Date |
---|---|---|
peshomir | 431b8667a1 | |
peshomir | e0e22d3629 |
Binary file not shown.
After Width: | Height: | Size: 4.3 KiB |
Binary file not shown.
After Width: | Height: | Size: 74 KiB |
47
fx_core.js
47
fx_core.js
|
@ -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]; });
|
||||
|
|
10
index.html
10
index.html
|
@ -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>
|
||||
|
|
Loading…
Reference in New Issue