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.
archived
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>.imageSmoothingEnabled = false, ' +
'$<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>');
// handle settings button click
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_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');

View File

@ -64,6 +64,15 @@
Display donations from bots in donation history viewer (applies to multiplayer only)
<input type="checkbox" id="settings_donations_bots"><span class="checkmark"></span>
</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">
Hide Links option also hides app store links
<input type="checkbox" id="settings_hidealllinks"><span class="checkmark"></span>