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 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_version = '0.6.5'; // FX Client Version
|
||||||
const fx_update = 'Jun 26'; // FX Client Last Updated
|
const fx_update = 'Jul 5'; // FX Client Last Updated
|
||||||
|
|
||||||
if (localStorage.getItem("fx_winCount") == undefined || localStorage.getItem("fx_winCount") == null) {
|
if (localStorage.getItem("fx_winCount") == undefined || localStorage.getItem("fx_winCount") == null) {
|
||||||
var wins_counter = 0;
|
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
|
// should probably firgure out a way to do this without reloading - // You can't do it, localstorages REQUIRE you to reload
|
||||||
window.location.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() {
|
this.syncFields = function() {
|
||||||
Object.keys(inputFields).forEach(function(key) { inputFields[key].value = settings[key]; });
|
Object.keys(inputFields).forEach(function(key) { inputFields[key].value = settings[key]; });
|
||||||
Object.keys(checkboxFields).forEach(function(key) { checkboxFields[key].checked = 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">
|
<meta itemprop="image" content="https://fxclient.github.io/FXclient/assets/logo.png">
|
||||||
|
|
||||||
<!-- FX Client CSS -->
|
<!-- FX Client CSS -->
|
||||||
<link rel="stylesheet" href="main.css?1719909880253">
|
<link rel="stylesheet" href="main.css?1720169113922">
|
||||||
<!-- Game CSS -->
|
<!-- Game CSS -->
|
||||||
<style>
|
<style>
|
||||||
html,
|
html,
|
||||||
|
@ -111,6 +111,8 @@
|
||||||
<footer>
|
<footer>
|
||||||
<button onclick="settingsManager.resetAll()">Reset Settings</button>
|
<button onclick="settingsManager.resetAll()">Reset Settings</button>
|
||||||
<button onclick="settingsManager.save()">Save Settings</button>
|
<button onclick="settingsManager.save()">Save Settings</button>
|
||||||
|
<button onclick="settingsManager.importFromFile()">Import</button>
|
||||||
|
<button onclick="settingsManager.exportToFile()">Export</button>
|
||||||
</footer>
|
</footer>
|
||||||
</div>
|
</div>
|
||||||
<div class="window scrollable selectable" id="playerlist" style="display: none;">
|
<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>
|
<p id="donationhistory_note">Note: donations from bots are not shown here</p>
|
||||||
<table><tbody id="donationhistory_content"></tbody></table>
|
<table><tbody id="donationhistory_content"></tbody></table>
|
||||||
</div>
|
</div>
|
||||||
<script src="variables.js?1719909880253"></script>
|
<script src="variables.js?1720169113922"></script>
|
||||||
<script src="fx_core.js?1719909880253"></script>
|
<script src="fx_core.js?1720169113922"></script>
|
||||||
<script src="game.js?1719909880253"></script>
|
<script src="game.js?1720169113922"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
2
main.css
2
main.css
|
@ -28,7 +28,7 @@
|
||||||
border-width : 2px;
|
border-width : 2px;
|
||||||
border-width : calc(0.15 * (1vw + 1vh));
|
border-width : calc(0.15 * (1vw + 1vh));
|
||||||
font-size : 20px;
|
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%;
|
max-height : 90%;
|
||||||
transition : 0.2s;
|
transition : 0.2s;
|
||||||
z-index : 10;
|
z-index : 10;
|
||||||
|
|
Loading…
Reference in New Issue