Update released - 2019.04.29.02
Added an alerts interface - this provides replacements for alert, prompt, confirm and some additional messages.
One of the main purposes of this update is to eliminate the use of the blocking messages alert, prompt and confirm. This also adds some other message types that allow a script to convey some information, warnings or debug messages to the user.
Example:
This is an error from WME Place Interface Enhancements that was previously an alert box that is now displayed as an error message:
https://imgur.com/q0uyg5W.png
The message will time out in 6 seconds so you do not have to click anything to continue interacting with WME. If you messed the message, or just want to review previous messages, an alert history is provided. All info, warning, error and success messages are entered into the history when they are displayed.
All alerts will display at the top center of the WME window so they are clearly visible.
https://imgur.com/Xa5NrV5.png
The alert history is an orange box with a triangle and exclamation mark, that defaults in the top left corner. This is draggable to another location if you desire (although the list only expands down so do not move it to the bottom of the map). This will display all alerts in the current WME session, with the latest being on top.
The alerts are accessed via: WazeWrap.Alerts.
Code: Select all
WazeWrap.Alerts.info(GM_info.script.name, "message");
WazeWrap.Alerts.warning(GM_info.script.name, "message");
WazeWrap.Alerts.error(GM_info.script.name, "message");
WazeWrap.Alerts.success(GM_info.script.name, "message");
WazeWrap.Alerts.prompt(GM_info.script.name, "message", default_inputbox_text (can be blank), okFunctionCallback, cancelFunctionCallback);
WazeWrap.Alerts.confirm(GM_info.script.name, "message", okFunctionCallback, cancelFunctionCallback, ok_button_text (default is "Ok"), cancel_button_text (default is cancel));
WazeWrap.Alerts.debug(GM_info.script.name, "message");
info, warning, error and success prompts just accept the script name (which can be automatically pulled using GM_info.script.name) and the message you want to display.
prompt - this is a replacement for alert boxes. You pass the script name and your message, just like the other boxes. In addition to that you can pass default text to fill in the input box in the prompt; if you do not wish to, just pass an empty string. You then pass callback functions for if the user pressed the ok or cancel button. If you only want to handle one or the other, only pass that one and pass null for the other.
confirm works much the same as prompt in that you pass the callbacks for the ok and cancel buttons, but you can also customize the text of these buttons.
debug messages are more for script debugging and not for use to send to end users. These boxes will display larger (700px wide instead of 500px) and they will allow scrolling.
Examples of the other alert types:
https://imgur.com/1wXUux5.png