Skip to content

Commit 95aacef

Browse files
taroeldLordMidas
taroeld
authored andcommittedMar 1, 2025
feat: add modsettings for show/hide/lock delays
1 parent 7d02108 commit 95aacef

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed
 

‎msu/msu_mod/~nested_tooltips/msu_mod_settings.nut

+4
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,7 @@ local underlineSetting = nestedTooltipsPage.addBooleanSetting("NestedTooltips_Un
77
underlineSetting.addAfterChangeCallback(@(_oldValue) ::NestedTooltips.UI.JSConnection.updateNestedTooltipTextStyle());
88
local colorSetting = nestedTooltipsPage.addColorPickerSetting("NestedTooltips_Color", "0,35,65,1.0", "Text Color", "The color for nested tooltip hyperlinks text.");
99
colorSetting.addAfterChangeCallback(@(_oldValue) ::NestedTooltips.UI.JSConnection.updateNestedTooltipTextStyle());
10+
11+
nestedTooltipsPage.addRangeSetting("showDelay", 150, 0, 1000, 5, "Show Time", "The time in milliseconds until the tooltip appears after hovering an element.");
12+
nestedTooltipsPage.addRangeSetting("hideDelay", 50, 0, 1000, 5, "Hide Time", "The time in milliseconds until the tooltip disappears after leaving an element.");
13+
nestedTooltipsPage.addRangeSetting("lockDelay", 500, 0, 10000, 5, "Lock Time", "The time in milliseconds until the tooltip locks and allows you to enter it with your mouse to access nested tooltips.");

‎ui/mods/msu/nested_tooltips.js

+9-8
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@ MSU.NestedTooltip = {
22
__regexp : /(?:\[|[)tooltip=([\w\.]+?)\.(.+?)(?:\]|])(.*?)(?:\[|[)\/tooltip(?:\]|])/gm,
33
__imgRegexp : /(?:\[|[)imgtooltip=([\w\.]+?)\.(.+?)(?:\]|])(.*?)(?:\[|[)\/imgtooltip(?:\]|])/gm,
44
__tooltipStack : [],
5-
__tooltipHideDelay : 100,
6-
__tooltipShowDelay : 200,
5+
__getTooltipHideDelay : function(){ return MSU.getSettingValue(MSU.ID, "hideDelay")}, // default 100,
6+
__getTooltipShowDelay : function(){ return MSU.getSettingValue(MSU.ID, "showDelay")}, // default 200,
7+
__getTooltipLockDelay : function(){ return MSU.getSettingValue(MSU.ID, "lockDelay")}, // default 1000,
78
__showTooltipTimeout : null,
89
KeyImgMap : {},
910
TextStyle: "",
@@ -81,7 +82,7 @@ MSU.NestedTooltip = {
8182
clearTimeout(self.__showTooltipTimeout);
8283
self.__showTooltipTimeout = setTimeout(function(){
8384
self.onShowTooltipTimerExpired(tooltipSource, _tooltipParams);
84-
}, _tooltipParams.isTileTooltip === true ? 0 : self.__tooltipShowDelay);
85+
}, _tooltipParams.isTileTooltip === true ? 0 : self.__getTooltipShowDelay());
8586

8687
tooltipSource.on('mouseleave.msu-tooltip-loading', function (_event)
8788
{
@@ -246,7 +247,7 @@ MSU.NestedTooltip = {
246247

247248
progressImage.velocity({ opacity: 0 },
248249
{
249-
duration: 1000,
250+
duration: self.__getTooltipLockDelay(),
250251
begin: function()
251252
{
252253
progressImage.css("opacity", 1)
@@ -280,14 +281,14 @@ MSU.NestedTooltip = {
280281
var sourceData = $(this).data('msu-nested');
281282
self.clearTimeouts(sourceData);
282283
sourceData.isHovered = true;
283-
sourceData.updateStackTimeout = setTimeout(self.updateStack.bind(self), self.__tooltipHideDelay);
284+
sourceData.updateStackTimeout = setTimeout(self.updateStack.bind(self), self.__getTooltipHideDelay());
284285
});
285286
_sourceContainer.on('mouseleave.msu-tooltip-showing remove.msu-tooltip-showing', function (_event)
286287
{
287288
var sourceData = $(this).data('msu-nested');
288289
self.clearTimeouts(sourceData);
289290
sourceData.isHovered = false;
290-
sourceData.updateStackTimeout = setTimeout(self.updateStack.bind(self), self.__tooltipHideDelay);
291+
sourceData.updateStackTimeout = setTimeout(self.updateStack.bind(self), self.__getTooltipHideDelay());
291292
});
292293
},
293294
addTooltipContainerMouseHandler : function(_tooltipContainer)
@@ -304,7 +305,7 @@ MSU.NestedTooltip = {
304305
setTimeout(function(){
305306
self.cleanSourceContainer(tooltipData.sourceContainer);
306307
return;
307-
}, self.__tooltipHideDelay)
308+
}, self.__getTooltipHideDelay())
308309
}
309310
else
310311
{
@@ -317,7 +318,7 @@ MSU.NestedTooltip = {
317318
var tooltipData = $(this).data("msu-nested");
318319
self.clearTimeouts(tooltipData);
319320
tooltipData.isHovered = false;
320-
tooltipData.updateStackTimeout = setTimeout(self.updateStack.bind(self), self.__tooltipHideDelay);
321+
tooltipData.updateStackTimeout = setTimeout(self.updateStack.bind(self), self.__getTooltipHideDelay());
321322
});
322323
_tooltipContainer.on('mousedown.msu-tooltip-container', function (_event)
323324
{

0 commit comments

Comments
 (0)