From 51f9651188876b6242d61cd39baf35a61e0d5f99 Mon Sep 17 00:00:00 2001 From: peshomir <80340328+peshomir@users.noreply.github.com> Date: Fri, 23 Feb 2024 08:49:37 +0200 Subject: [PATCH] Update v0.6.1.3 Add a settings option to automatically use fullscreen mode, add settings option to change whether the win counter is displayed. --- build.js | 2 +- static/fx_core.js | 20 +++++++++++++++++--- static/index.html | 9 +++++++++ 3 files changed, 27 insertions(+), 4 deletions(-) diff --git a/build.js b/build.js index 8c619e8..709d1b4 100644 --- a/build.js +++ b/build.js @@ -87,7 +87,7 @@ const { groups } = replaceOne(/((?\w+)\.textAlign=\w+,\2\.textBaseline=\ '$.drawImage(settingsGearIcon, $-$/2, $, $, $), ' + '$.imageSmoothingEnabled = false, ' + '$.font = "bold " + Math.floor($ * 0.4) + "px " + settings.fontName, ' + -'(!$ && $.fillText("Win count: " + wins_counter, Math.floor($ + $ / 2), Math.floor(($ + $ / 2) * 2.1))), ' + +'(settings.displayWinCounter && !$ && $.fillText("Win count: " + wins_counter, Math.floor($ + $ / 2), Math.floor(($ + $ / 2) * 2.1))), ' + '$'); // handle settings button click replaceOne(/(this\.\w+=function\((?\w+),(?\w+)\){[^}]+?)if\((?\w+=\w+\(\)),(?\w+)\)(?{for\([^}]+"Lobby ")/g, diff --git a/static/fx_core.js b/static/fx_core.js index 1da483d..f9096a9 100644 --- a/static/fx_core.js +++ b/static/fx_core.js @@ -1,5 +1,5 @@ -const fx_version = '0.6.1.1'; // FX Client Version -const fx_update = 'Feb 22'; // FX Client Last Updated +const fx_version = '0.6.1.3'; // FX Client Version +const fx_update = 'Feb 23'; // FX Client Last Updated if (localStorage.getItem("fx_winCount") == undefined || localStorage.getItem("fx_winCount") == null) { var wins_counter = 0; @@ -84,6 +84,8 @@ function KeybindsInput(containerElement) { var settings = { "fontName": "Trebuchet MS", "showBotDonations": false, + "displayWinCounter": true, + "useFullscreenMode": false, "hideAllLinks": false, "realisticNames": false, //"customMapFileBtn": true @@ -97,6 +99,8 @@ var settingsManager = new (function() { //showBotDonations: document.getElementById("settings_donations_bots"), hideAllLinks: document.getElementById("settings_hidealllinks"), realisticNames: document.getElementById("settings_realisticnames"), + displayWinCounter: document.getElementById("settings_displaywincounter"), + useFullscreenMode: document.getElementById("settings_usefullscreenmode"), //customMapFileBtn: document.getElementById("settings_custommapfileinput") }; this.save = function() { @@ -122,6 +126,16 @@ var settingsManager = new (function() { }; this.applySettings = function() { //setVarByName("bu", "px " + settings.fontName); + if (settings.useFullscreenMode && document.fullscreenEnabled) { + function tryEnterFullscreen() { + if (document.fullscreenElement !== null) return; + document.documentElement.requestFullscreen({ navigationUI: "hide" }) + .then(() => { console.log('Fullscreen mode activated'); }) + .catch((error) => { console.warn('Could not enter fullscreen mode:', error); }); + } + document.addEventListener('mousedown', tryEnterFullscreen, { once: true }); + document.addEventListener('click', tryEnterFullscreen, { once: true }); + } }; }); function removeWins() { @@ -226,6 +240,6 @@ const keybindHandler = key => { if (localStorage.getItem("fx_settings") !== null) { settings = {...settings, ...JSON.parse(localStorage.getItem("fx_settings"))}; } -//settingsManager.applySettings(); +settingsManager.applySettings(); console.log('Successfully loaded FX Client'); \ No newline at end of file diff --git a/static/index.html b/static/index.html index cdf361c..9770ec6 100644 --- a/static/index.html +++ b/static/index.html @@ -64,6 +64,15 @@ Display donations from bots in donation history viewer (applies to multiplayer only)
--> +
+