data/Tips

Data of the random tips.

Source:

Members

(static, constant) tips :Array.<TipObject>

Source:

The list of all tips. (now exported)

Type:
  • Array.<TipObject>

Type Definitions

callbackShowTip(tipSpec, thisTipConfig, tipSpecOrig, moduleConfig) → {boolean|null}

Source:

Custom function to check whether a tip shall be shown or not.

Attention: This is evaluated before all other constraints were evaluated. Be careful before returning true, you may actually want to return null.

  • If you return true, it means you force(!) the tip to be shown. This overrides the usual conditions and shows the tip immediately.
  • If you return false, it means you disallow the tip to be shown.
  • If null is returned, the usual (other) conditions that determinate whether to show the tip are evaluated. If you throw something, this cancels the whole tip selection process.

Note that you can actually modify the values of the first two parameters, i.e. tipSpec and thisTipConfig. If you modify the config, it will be saved automatically. The difference between tipSpec and tipSpecOrig is, that in tipSpec the default values of the tips have been added/modified, if needed and that tipSpecOrig is the original as you have specified it in TipObject.

For stylistic reasons, it is recommend to not hardcode the function into the this file, but use a separate file/module.

Parameters:
Name Type Description
tipSpec TipObject

the TipObject, merged with default values

thisTipConfig module:RandomTips~TipConfigObject

the settings of the tip

tipSpecOrig TipObject

the original, unmodified (frozen) TipObject of the tip

moduleConfig module:RandomTips~ModuleConfig

the whole config of this module

Returns:
Type
boolean | null

TipObject

Source:
Properties:
Name Type Attributes Default Description
id string

just some ID

requiredShowCount integer | null

Shows the message x times; set to null to show infinitively. This is the maximum value.

allowDismiss bool <optional>
true

set to false to disallow dismissing the message. This likely makes no sense for any tip, so the default is true.

requireDismiss bool | integer <optional>
false

show the message, if it is not, at least, dismissed for x times. Alternatively set to true to require that message is dismissed the exact same number as requiredShowCount states, i.e. only dismissed count as "tip shown".

maximumDismiss integer | null <optional>
null

hides the message, if it has been dismissed x times.

requiredTriggers integer <optional>
10

require some displays ("triggers") of (any) add-on page before showing tip. This is effectively just a minimum limit, so it is not shown too "early".

showInContext Object.<string, integer> <optional>

a key-value object with context -> num to require the tip to be shown in a specific context for the given number of times. See RandomTips.setContext.

maximumInContest Object.<string, integer> <optional>

a key-value object with context -> num to only show the tip in a specific context at most for the given number of times. See RandomTips.setContext.

randomizeDisplay bool | integer <optional>
false

Randomizes the display with a chance of 50% by default (when set to true). You can override that percentage (as an integer, e.g. 0.2 instead of 20%). Note that the tip message display in general is already randomized with a chance of 20%, see RandomTips.GLOBAL_RANDOMIZE.

text string

The text to actually show. It is passed to the MessageHandler, so you can (& should) use a translatable string here.

actionButton Object <optional>

adds an action button to the message, is passed as-is to the MessageHandler module.

Properties
Name Type Description
text string

the text to use for the button

action string | function

the link or function to execute on click

showTip callbackShowTip <optional>

evaluate via a custom function whether to show or not to show the tip

The settings/constraints for a tip, represented in an object.

Type:
  • Object