Compare commits
3 Commits
5dfe34c2d0
...
d4d68e752c
| Author | SHA1 | Date |
|---|---|---|
|
|
d4d68e752c | |
|
|
0841224a61 | |
|
|
46d925daa1 |
12
modUtils.js
12
modUtils.js
|
|
@ -106,6 +106,7 @@ class ModUtils {
|
||||||
}
|
}
|
||||||
return Object.fromEntries(Object.entries(groups).map(([identifier, groupNumber]) => [identifier, expressionMatchResult[groupNumber]]));
|
return Object.fromEntries(Object.entries(groups).map(([identifier, groupNumber]) => [identifier, expressionMatchResult[groupNumber]]));
|
||||||
}
|
}
|
||||||
|
/** @param {{ [x: string]: string; }} [nameMappings] */
|
||||||
matchRawCode(/** @type {string} */ raw, nameMappings) {
|
matchRawCode(/** @type {string} */ raw, nameMappings) {
|
||||||
const { expression, groups } = this.generateRegularExpression(raw, false, nameMappings);
|
const { expression, groups } = this.generateRegularExpression(raw, false, nameMappings);
|
||||||
try {
|
try {
|
||||||
|
|
@ -148,8 +149,8 @@ class ModUtils {
|
||||||
* @typedef {{ dictionary?: { [x: string]: string } }} BaseOptions
|
* @typedef {{ dictionary?: { [x: string]: string } }} BaseOptions
|
||||||
* @typedef {BaseOptions & { addToDictionary?: string[] }} MatchCodeOptions
|
* @typedef {BaseOptions & { addToDictionary?: string[] }} MatchCodeOptions
|
||||||
*/
|
*/
|
||||||
matchCode(code, /** @type {MatchCodeOptions=} */ options) {
|
matchCode(/** @type {string} */ code, /** @type {MatchCodeOptions=} */ options) {
|
||||||
const result = this.matchRawCode(minifyCode(code));
|
const result = this.matchRawCode(minifyCode(code), options?.dictionary);
|
||||||
if (options?.addToDictionary !== undefined) {
|
if (options?.addToDictionary !== undefined) {
|
||||||
options.addToDictionary.forEach(varName => {
|
options.addToDictionary.forEach(varName => {
|
||||||
if (result[varName] === undefined)
|
if (result[varName] === undefined)
|
||||||
|
|
@ -185,4 +186,9 @@ class ModUtils {
|
||||||
escapeRegExp = escapeRegExp
|
escapeRegExp = escapeRegExp
|
||||||
}
|
}
|
||||||
|
|
||||||
export default ModUtils;
|
export default ModUtils;
|
||||||
|
|
||||||
|
/** @param {(modUtils: ModUtils) => any} callback */
|
||||||
|
export function definePatch(callback) {
|
||||||
|
return (/** @type {ModUtils} */ modUtils) => callback(modUtils)
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
import { definePatch } from "../modUtils.js"
|
||||||
|
|
||||||
|
export default definePatch(({ insertCode }) => {
|
||||||
|
|
||||||
|
// Hide propaganda popup
|
||||||
|
insertCode(`/* here */
|
||||||
|
a = b.c + 60 * 1000;
|
||||||
|
(new ea()).show(eS.eb, eS.colors, eS.id);
|
||||||
|
eS = null;
|
||||||
|
return true;`, `if (__fx.settings.hidePropagandaPopup) return;`)
|
||||||
|
|
||||||
|
})
|
||||||
|
|
@ -26,6 +26,7 @@ var settings = {
|
||||||
customBackgroundUrl: "",
|
customBackgroundUrl: "",
|
||||||
keybindButtons: false,
|
keybindButtons: false,
|
||||||
attackPercentageKeybinds: [],
|
attackPercentageKeybinds: [],
|
||||||
|
hidePropagandaPopup: false
|
||||||
};
|
};
|
||||||
__fx.settings = settings;
|
__fx.settings = settings;
|
||||||
const discontinuedSettings = ["hideAllLinks", "fontName"];
|
const discontinuedSettings = ["hideAllLinks", "fontName"];
|
||||||
|
|
@ -92,6 +93,11 @@ const settingsManager = new (function () {
|
||||||
label: "Highlight clan spawnpoints",
|
label: "Highlight clan spawnpoints",
|
||||||
note: "Increases the spawnpoint glow size for members of your clan",
|
note: "Increases the spawnpoint glow size for members of your clan",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
for: "hidePropagandaPopup",
|
||||||
|
type: "checkbox",
|
||||||
|
label: "Hide propaganda popup"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
for: "detailedTeamPercentage", type: "checkbox",
|
for: "detailedTeamPercentage", type: "checkbox",
|
||||||
label: "Detailed team pie chart percentage",
|
label: "Detailed team pie chart percentage",
|
||||||
|
|
@ -189,7 +195,6 @@ const settingsManager = new (function () {
|
||||||
WindowManager.closeWindow("settings");
|
WindowManager.closeWindow("settings");
|
||||||
discontinuedSettings.forEach((settingName) => delete settings[settingName]);
|
discontinuedSettings.forEach((settingName) => delete settings[settingName]);
|
||||||
localStorage.setItem("fx_settings", JSON.stringify(settings));
|
localStorage.setItem("fx_settings", JSON.stringify(settings));
|
||||||
// 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();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"version": "0.6.15.2",
|
"version": "0.6.16",
|
||||||
"lastUpdated": "Oct 6",
|
"lastUpdated": "Nov 3",
|
||||||
"changes": [
|
"changes": [
|
||||||
"Fix for game update v2.13.3"
|
"Add a settings option for hiding the propaganda popup"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue