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.
dev
peshomir 2024-02-23 08:49:37 +02:00
parent 304e2fa5bd
commit 51f9651188
3 changed files with 27 additions and 4 deletions

View File

@ -87,7 +87,7 @@ const { groups } = replaceOne(/((?<canvas>\w+)\.textAlign=\w+,\2\.textBaseline=\
'$<canvas>.drawImage(settingsGearIcon, $<x>-$<w>/2, $<y>, $<h>, $<h>), ' + '$<canvas>.drawImage(settingsGearIcon, $<x>-$<w>/2, $<y>, $<h>, $<h>), ' +
'$<canvas>.imageSmoothingEnabled = false, ' + '$<canvas>.imageSmoothingEnabled = false, ' +
'$<canvas>.font = "bold " + Math.floor($<h> * 0.4) + "px " + settings.fontName, ' + '$<canvas>.font = "bold " + Math.floor($<h> * 0.4) + "px " + settings.fontName, ' +
'(!$<isMenuOpened> && $<canvas>.fillText("Win count: " + wins_counter, Math.floor($<x> + $<w> / 2), Math.floor(($<y> + $<h> / 2) * 2.1))), ' + '(settings.displayWinCounter && !$<isMenuOpened> && $<canvas>.fillText("Win count: " + wins_counter, Math.floor($<x> + $<w> / 2), Math.floor(($<y> + $<h> / 2) * 2.1))), ' +
'$<end>'); '$<end>');
// handle settings button click // handle settings button click
replaceOne(/(this\.\w+=function\((?<mouseX>\w+),(?<mouseY>\w+)\){[^}]+?)if\((?<coordsGet>\w+=\w+\(\)),(?<isMenuOpened>\w+)\)(?<end>{for\([^}]+"Lobby ")/g, replaceOne(/(this\.\w+=function\((?<mouseX>\w+),(?<mouseY>\w+)\){[^}]+?)if\((?<coordsGet>\w+=\w+\(\)),(?<isMenuOpened>\w+)\)(?<end>{for\([^}]+"Lobby ")/g,

View File

@ -1,5 +1,5 @@
const fx_version = '0.6.1.1'; // FX Client Version const fx_version = '0.6.1.3'; // FX Client Version
const fx_update = 'Feb 22'; // FX Client Last Updated const fx_update = 'Feb 23'; // 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;
@ -84,6 +84,8 @@ function KeybindsInput(containerElement) {
var settings = { var settings = {
"fontName": "Trebuchet MS", "fontName": "Trebuchet MS",
"showBotDonations": false, "showBotDonations": false,
"displayWinCounter": true,
"useFullscreenMode": false,
"hideAllLinks": false, "hideAllLinks": false,
"realisticNames": false, "realisticNames": false,
//"customMapFileBtn": true //"customMapFileBtn": true
@ -97,6 +99,8 @@ var settingsManager = new (function() {
//showBotDonations: document.getElementById("settings_donations_bots"), //showBotDonations: document.getElementById("settings_donations_bots"),
hideAllLinks: document.getElementById("settings_hidealllinks"), hideAllLinks: document.getElementById("settings_hidealllinks"),
realisticNames: document.getElementById("settings_realisticnames"), realisticNames: document.getElementById("settings_realisticnames"),
displayWinCounter: document.getElementById("settings_displaywincounter"),
useFullscreenMode: document.getElementById("settings_usefullscreenmode"),
//customMapFileBtn: document.getElementById("settings_custommapfileinput") //customMapFileBtn: document.getElementById("settings_custommapfileinput")
}; };
this.save = function() { this.save = function() {
@ -122,6 +126,16 @@ var settingsManager = new (function() {
}; };
this.applySettings = function() { this.applySettings = function() {
//setVarByName("bu", "px " + settings.fontName); //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() { function removeWins() {
@ -226,6 +240,6 @@ const keybindHandler = key => {
if (localStorage.getItem("fx_settings") !== null) { if (localStorage.getItem("fx_settings") !== null) {
settings = {...settings, ...JSON.parse(localStorage.getItem("fx_settings"))}; settings = {...settings, ...JSON.parse(localStorage.getItem("fx_settings"))};
} }
//settingsManager.applySettings(); settingsManager.applySettings();
console.log('Successfully loaded FX Client'); console.log('Successfully loaded FX Client');

View File

@ -64,6 +64,15 @@
Display donations from bots in donation history viewer (applies to multiplayer only) Display donations from bots in donation history viewer (applies to multiplayer only)
<input type="checkbox" id="settings_donations_bots"><span class="checkmark"></span> <input type="checkbox" id="settings_donations_bots"><span class="checkmark"></span>
</label><br>--> </label><br>-->
<label for="settings_displaywincounter" class="checkbox">
Display win counter
<input type="checkbox" id="settings_displaywincounter"><span class="checkmark"></span>
</label><br>
<label for="settings_usefullscreenmode" class="checkbox">
Use fullscreen mode<br>
<small>Note: fullscreen mode will trigger after you click anywhere on the page due to browser policy restrictions.</small>
<input type="checkbox" id="settings_usefullscreenmode"><span class="checkmark"></span>
</label><br>
<label for="settings_hidealllinks" class="checkbox"> <label for="settings_hidealllinks" class="checkbox">
Hide Links option also hides app store links Hide Links option also hides app store links
<input type="checkbox" id="settings_hidealllinks"><span class="checkmark"></span> <input type="checkbox" id="settings_hidealllinks"><span class="checkmark"></span>