You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is it possible to incorporate an in-built JavaScript function like those in TrMenu
And supports calling functions between menus.
The following is an example from TrMenu.
Functions:
flash: |- function flash() { var display = new Date().getSeconds() % 2 == 0 return display ? args[0] : " " } flash()
In this example, we define a function called flash under Functions. This function checks if the current system time (seconds) is even and returns the passed parameter or a space accordingly.
This function can create a blinking animation effect and supports custom parameters as the blinking symbol.
The call format is ${[funcName]_[Arg1]_[Arg2]}, for example ${flash_>}.
The line var args = new Array() is automatically added above the default function, and the arguments are written into it. Thus, the parameters passed to the built-in function can be directly used in the form of the args array.
bStats:
servers: 'vars("${bStats.query_servers_&a_&7 servers}")'players: 'vars("${bStats.query_players_&6_&7 players}")'menus: 'vars("${bStats.query_menus_&2_&7 menus}")'opens: |- function opens() { var data = utils.query("https://bstats.org/api/v1/plugins/5742/charts/menu_open_counts/data?maxElements=1") if (data.has()){ return "&b" + data.asJson().getAsJsonArray().get(0).getAsJsonArray().get(1) + "&7" } return "&8Loading." + vars("${flash_.}") + "&7" } opens()query: |- function query() { var data = utils.query("https://bstats.org/api/v1/plugins/5742/charts/" + args[0] + "/data?maxElements=1") if (data.has()){ return args[1] + data.asJson().getAsJsonArray().get(0).getAsJsonArray().get(1) + args[2] } return "&8Loading." + vars("${flash_.}") } query()
The text was updated successfully, but these errors were encountered:
Is it possible to incorporate an in-built JavaScript function like those in TrMenu
And supports calling functions between menus.
The following is an example from TrMenu.
In this example, we define a function called
flash
under Functions. This function checks if the current system time (seconds) is even and returns the passed parameter or a space accordingly.This function can create a blinking animation effect and supports custom parameters as the blinking symbol.
The call format is
${[funcName]_[Arg1]_[Arg2]}
, for example${flash_>}
.The line
var args = new Array()
is automatically added above the default function, and the arguments are written into it. Thus, the parameters passed to the built-in function can be directly used in the form of theargs
array.The text was updated successfully, but these errors were encountered: