Skip to content

Commit

Permalink
refactor: move UI Hooks to MSU.Hooks table (#302)
Browse files Browse the repository at this point in the history
  • Loading branch information
TaroEld authored Mar 23, 2023
1 parent a75ea82 commit 57cfdad
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
12 changes: 6 additions & 6 deletions ui/mods/msu/ui_hooks/main_menu_module.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
var createMainMenuButtons = MainMenuModule.prototype.createMainMenuButtons;
MSU.Hooks.MainMenuModule_createMainMenuButtons = MainMenuModule.prototype.createMainMenuButtons;
MainMenuModule.prototype.createMainMenuButtons = function ()
{
createMainMenuButtons.call(this);
MSU.Hooks.MainMenuModule_createMainMenuButtons.call(this);
this.addModOptionsButton();
};

Expand All @@ -27,16 +27,16 @@ MainMenuModule.prototype.notifyBackendModOptionsButtonPressed = function()
SQ.call(this.mSQHandle, 'onModOptionsButtonPressed');
};

var createWorldMapMenuButtons = MainMenuModule.prototype.createWorldMapMenuButtons;
MSU.Hooks.MainMenuModule_createWorldMapMenuButtons = MainMenuModule.prototype.createWorldMapMenuButtons;
MainMenuModule.prototype.createWorldMapMenuButtons = function (_isSavingAllowed, _seed)
{
createWorldMapMenuButtons.call(this, _isSavingAllowed, _seed);
MSU.Hooks.MainMenuModule_createWorldMapMenuButtons.call(this, _isSavingAllowed, _seed);
this.addModOptionsButton();
};

var createTacticalMapMenuButtons = MainMenuModule.prototype.createTacticalMapMenuButtons;
MSU.Hooks.MainMenuModule_createTacticalMapMenuButtons = MainMenuModule.prototype.createTacticalMapMenuButtons;
MainMenuModule.prototype.createTacticalMapMenuButtons = function (_isRetreatAllowed, _isQuitAllowed, _quitText)
{
createTacticalMapMenuButtons.call(this, _isRetreatAllowed, _isQuitAllowed, _quitText);
MSU.Hooks.MainMenuModule_createTacticalMapMenuButtons.call(this, _isRetreatAllowed, _isQuitAllowed, _quitText);
this.addModOptionsButton();
};
4 changes: 2 additions & 2 deletions ui/mods/msu/ui_hooks/tooltip_module.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var notifyBackendQueryTooltipData = TooltipModule.prototype.notifyBackendQueryTooltipData;
MSU.Hooks.TooltipModule_notifyBackendQueryTooltipData = TooltipModule.prototype.notifyBackendQueryTooltipData;
TooltipModule.prototype.notifyBackendQueryTooltipData = function (_data, _callback)
{
if (this.mSQHandle !== null && _data !== null && 'contentType' in _data && _data.contentType.search("msu-") == 0)
Expand All @@ -7,6 +7,6 @@ TooltipModule.prototype.notifyBackendQueryTooltipData = function (_data, _callba
}
else
{
notifyBackendQueryTooltipData.call(this, _data, _callback);
MSU.Hooks.TooltipModule_notifyBackendQueryTooltipData.call(this, _data, _callback);
}
}
3 changes: 2 additions & 1 deletion ui/mods/msu/utilities.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
var MSU = {
ID : "mod_msu"
ID : "mod_msu",
Hooks : {},
};
MSU.Utils = {};
MSU.Utils.Timers = {};
Expand Down

0 comments on commit 57cfdad

Please sign in to comment.