diff --git a/build.js b/build.js index ec28742..73ddfd6 100644 --- a/build.js +++ b/build.js @@ -123,6 +123,12 @@ replaceOne(/(((\w+)\[\w+\])=\2\.replace\(\w+(\[\w+\]),\w+\4\))/g, "$1; if (setti replaceOne(/(this\.\w+=function\(\){)((\w+\.\w+)\[2\]=\3\[3\]=\3\[4\]=(?!this\.\w+\.\w+),)/g, "$1 if (settings.hideAllLinks) $3[0] = $3[1] = $; else $3[0] = $3[1] = true; $2") +// Make the main canvas context have an alpha channel if a custom background is being used +replaceOne(/(document\.getElementById\("canvasA"\),\(\w+=\w+\.getContext\("2d",){alpha:!1}/g, "$1 {alpha: makeMainMenuTransparent}") +// Clear canvas background if a custom background is being used +replaceOne(/(this\.\w+=function\(\){var (\w+),(\w+);)(\w+\.\w+\?\([^()]+setTransform\(\3=\2<\3\?\3:\2,0,0,\3,(?:Math\.floor\(\([^)]+\)\/2\)[,)]){2},(?:[^)]+\),){2}[^)]+\):(?\w+)\.fillStyle=\w+\.\w+,\5\.fillRect\((?0,0,\w+,\w+)\)}})/g, + '$1 if (makeMainMenuTransparent) $.clearRect($); else $4') + // Track donations replaceOne(/(this\.\w+=function\((\w+),(\w+)\)\{)(\2===\w+&&\(\w+\.\w+\((\w+\.\w+)\[0\],\5\[1\],\3\),this\.(\w+)\[12\]\+=\5\[1\],this\.\6\[16\]\+=\5\[0\]\),\3===\w+&&\()/g, "$1 donationsTracker.logDonation($2, $3, $5[0]); $4") @@ -135,8 +141,13 @@ replaceOne(/,(0!==\w+\[(\w+)\]\)&&\w+\.\w+\(\2,800,!1,0\),)/g, // Reset donation history when a new game is started replaceOne(new RegExp(`,${dictionary.playerBalances}=new Uint32Array\\(\\w+\\),`, "g"), "$& donationsTracker.reset(), "); -// remove the ads +// Disable built-in Territorial.io error reporting +replaceOne(/window\.addEventListener\("error",function (\w+)\((\w+)\){/g, + '$& window.removeEventListener("error", $1); return alert("Error:\\n" + $2.filename + " " + $2.lineno + " " + $2.colno + " " + $2.message);'); + +// Remove ads script = script.replace('//api.adinplay.com/libs/aiptag/pub/TRT/territorial.io/tag.min.js',''); + console.log("Formatting code..."); exposeVarsToGlobalScope = true; diff --git a/static/fx_core.js b/static/fx_core.js index f9096a9..65fe410 100644 --- a/static/fx_core.js +++ b/static/fx_core.js @@ -1,5 +1,5 @@ -const fx_version = '0.6.1.3'; // FX Client Version -const fx_update = 'Feb 23'; // FX Client Last Updated +const fx_version = '0.6.1.4'; // FX Client Version +const fx_update = 'Feb 24'; // FX Client Last Updated if (localStorage.getItem("fx_winCount") == undefined || localStorage.getItem("fx_winCount") == null) { var wins_counter = 0; @@ -89,11 +89,14 @@ var settings = { "hideAllLinks": false, "realisticNames": false, //"customMapFileBtn": true + "customBackgroundUrl": "", "attackPercentageKeybinds": [], }; +let makeMainMenuTransparent = false; var settingsManager = new (function() { var inputFields = { - fontName: document.getElementById("settings_fontname") + fontName: document.getElementById("settings_fontname"), + customBackgroundUrl: document.getElementById("settings_custombackgroundurl") }; var checkboxFields = { //showBotDonations: document.getElementById("settings_donations_bots"), @@ -136,6 +139,12 @@ var settingsManager = new (function() { document.addEventListener('mousedown', tryEnterFullscreen, { once: true }); document.addEventListener('click', tryEnterFullscreen, { once: true }); } + if (settings.customBackgroundUrl !== "") { + document.body.style.backgroundImage = "url(" + settings.customBackgroundUrl + ")"; + document.body.style.backgroundSize = "cover"; + document.body.style.backgroundPosition = "center"; + } + makeMainMenuTransparent = settings.customBackgroundUrl !== ""; }; }); function removeWins() { @@ -146,6 +155,24 @@ function removeWins() { alert("Successfully reset wins"); } } +const openCustomBackgroundFilePicker = () => { + const fileInput = document.getElementById("customBackgroundFileInput"); + fileInput.click(); + fileInput.addEventListener('change', handleFileSelect); +} +function handleFileSelect(event) { + const fileInput = event.target; + const selectedFile = fileInput.files[0]; + console.log(fileInput.files); + console.log(fileInput.files[0]); + if (selectedFile) { + const fileUrl = URL.createObjectURL(selectedFile); + console.log("File URL:", fileUrl); + fileInput.value = ""; + fileInput.removeEventListener("change", handleFileSelect); + } +} + var WindowManager = new (function() { var windows = {}; this.add = function(newWindow) { diff --git a/static/index.html b/static/index.html index 9770ec6..5672f47 100644 --- a/static/index.html +++ b/static/index.html @@ -81,6 +81,10 @@ Realistic Bot Names
+ +