[Script] WazeWrap

Discussion for the unofficial, community-developed addons, extensions and scripts built for the Waze Map Editor.

The official index of these tools is the Community Plugins, Extensions and Tools wiki page.

Moderators: Unholy, bextein, Glodenox, JustinS83

Forum rules
Discussion for the unofficial, community-developed addons, extensions and scripts built for the Waze Map Editor.

DO NOT START a new thread unless it is about a new idea. Keep discussion of existing tools within the main thread for that tool.

The official index of these tools is the Community Plugins, Extensions and Tools wiki page.

Re: [Script] WazeWrap

Postby dBsooner » Sat Feb 02, 2019 8:51 pm

JustinS83 wrote:
dBsooner wrote:Thank you, Justin! Good stuff! Is the update content capable of being HTML encode?

Yes, you can pass html for the content. Just don't do anything to crazy and change the look of the window or I'll have to start sanitizing the css and that's no fun :)

Just want to pass in a UL with LIs. Basically take what I’m already doing and pass it to WazeWrap instead of my own alertbox. Gracias!
[ img ][ img ][ img ][ img ][ img ]
• AM: Eastern Oklahoma, DFW, Southern Florida
• Wiki: WME | Editing Manual | Best Practices | FAQ | Places
• AT&T | iPhone XS Max | iOS 12 | Waze Latest Beta
dBsooner
Map Editor - Level 5
Map Editor - Level 5
 
Posts: 593
Joined: Thu Oct 31, 2013 10:53 pm
Location: Tulsa / Broken Arrow, Oklahoma, US
Has thanked: 360 times
Been thanked: 315 times

Re: [Script] WazeWrap

Postby jm6087 » Thu Feb 07, 2019 2:02 am

I am not sure if this is WazeWrap or not but it didn't start happening until the new update window was added.

I have seen various scripts "stuck" in my address bar, BED, Outreach Tracker and some others. Also it appears to never finish loading. I have had the page show it is still loading for over 30 minutes.

[ img ]
jm6087
US Waze Champs
US Waze Champs
 
Posts: 3479
Joined: Wed Jun 17, 2015 10:05 pm
Location: Texas
Has thanked: 591 times
Been thanked: 1418 times

Re: [Script] WazeWrap

Postby crazycaveman » Mon Feb 11, 2019 2:09 pm

I haven't seen that problem (regarding page never finishing loading) with the new update dialog, editor loads fine whether an update log is shown or not. However, regarding the update log, if there are several scripts that update and produce a scroll bar, I am unable to scroll the list with the mouse (in Chrome and Firefox, have to click and drag the bar). Would it be possible to make the list scrollable with the mouse wheel?
[ img ][ img ] [ img ][ img ][ img ]
ARC: South Atlantic Region
crazycaveman
US Waze Champs
US Waze Champs
 
Posts: 827
Joined: Fri Sep 03, 2010 1:48 am
Location: Rock Hill, SC, USA
Has thanked: 351 times
Been thanked: 515 times

Re: [Script] WazeWrap

Postby JustinS83 » Tue Feb 12, 2019 2:31 pm

crazycaveman wrote:I haven't seen that problem (regarding page never finishing loading) with the new update dialog, editor loads fine whether an update log is shown or not. However, regarding the update log, if there are several scripts that update and produce a scroll bar, I am unable to scroll the list with the mouse (in Chrome and Firefox, have to click and drag the bar). Would it be possible to make the list scrollable with the mouse wheel?


I noticed the scroll wheel was not working when I was developing it but I don't see a reason for it to not work. I tried forcing it and still no-go. Not sure what is going on to be honest.
Script Writing Community Coordinator
[ img ][ img ][ img ][ img ][ img ]
JustinS83
Waze Global Champs
Waze Global Champs
 
Posts: 1321
Joined: Wed Dec 03, 2014 4:33 am
Location: Franklin, OH
Has thanked: 336 times
Been thanked: 2342 times

Re: [Script] WazeWrap

Postby dBsooner » Thu Feb 14, 2019 4:16 am

JustinS83 wrote:
crazycaveman wrote:I haven't seen that problem (regarding page never finishing loading) with the new update dialog, editor loads fine whether an update log is shown or not. However, regarding the update log, if there are several scripts that update and produce a scroll bar, I am unable to scroll the list with the mouse (in Chrome and Firefox, have to click and drag the bar). Would it be possible to make the list scrollable with the mouse wheel?


I noticed the scroll wheel was not working when I was developing it but I don't see a reason for it to not work. I tried forcing it and still no-go. Not sure what is going on to be honest.

I see this behavior in other webpages. One of which is my companies MNS / RMM portal. If I click to see a systems profile (popup of a ton of info about a computer / server) it opens in a overlaying div. wheel doesn’t work to scroll. Have to use scroll bar. Also, page down / page up doesn’t work either, unless I click somewhere in the actual div first. I think this is a problem with Chrome and handling DIV layer scrolling.
[ img ][ img ][ img ][ img ][ img ]
• AM: Eastern Oklahoma, DFW, Southern Florida
• Wiki: WME | Editing Manual | Best Practices | FAQ | Places
• AT&T | iPhone XS Max | iOS 12 | Waze Latest Beta
dBsooner
Map Editor - Level 5
Map Editor - Level 5
 
Posts: 593
Joined: Thu Oct 31, 2013 10:53 pm
Location: Tulsa / Broken Arrow, Oklahoma, US
Has thanked: 360 times
Been thanked: 315 times

Re: [Script] WazeWrap

Postby JustinS83 » Mon Feb 18, 2019 8:46 pm

Update released - 2019.02.18.01

Added an Events class. This class is designed to add extra, simple error handling when hooking WME events. All scripts that hook any of the WME events should add in their own error handling, but many do not, to prevent WME updates from breaking multiple scripts - even if there is only an error in one.

If one script breaks after hooking one of the events and the error that is thrown is not caught, the rest of the event handling queue is not executed so other scripts can/will be affected. Changing to use the WW events will prevent other scripts from being affected if there is an issue. Additional error handling should be done in the script, but switching to these events is a quick and easy way to protect your script, and others, in case of an error.

The following events are supported:
Code: Select all
moveend
zoomend
mousemove
changelayer
selectionchanged
change:editingHouseNumbers
afterundoaction
afterclearactions
afteraction


Implement virtually the same as when hooking native events.
Native:
Code: Select all
W.selectionManager.events.register("selectionchanged", null, handler);
W.model.actionManager.events.register("afterundoaction",null, handler);
W.model.actionManager.events.register("afterclearactions",null, handler);
W.model.actionManager.events.register("afteraction",null, handler);


Using WazeWrap:
Code: Select all
WazeWrap.Events.register("selectionchanged", null, handler);
WazeWrap.Events.register("afterundoaction",null, handler);
WazeWrap.Events.register("afterclearactions",null, handler);
WazeWrap.Events.register("afteraction",null, handler);


It is possible to pass an error handling method to the WazeWrap.Events.register() method as well if you want to try and recover from any error that occurs.
Code: Select all
WazeWrap.Events.register("selectionchanged", null, handler, errorHandler);

If no error handling method is passed then the error will be logged to the console, including the method name that threw the error.

To unregister the events, it is again essentially the same as unregistering natively
Code: Select all
WazeWrap.Events.unregister("selectionchanged", null, handler);
WazeWrap.Events.unregister("afterundoaction",null, handler);
WazeWrap.Events.unregister("afterclearactions",null, handler);
WazeWrap.Events.unregister("afteraction",null, handler);


Registering/unregistering for entering/exiting house number edit mode is the only one that is different, but you continue to use the same syntax as registering the other events with WazeWrap.Events
Native:
Code: Select all
W.editingMediator.on('change:editingHouseNumbers', handler);
W.editingMediator.off('change:editingHouseNumbers', handler);

WazeWrap:
Code: Select all
WazeWrap.Events.register("change:editingHouseNumbers", null, handler);
WazeWrap.Events.unregister("change:editingHouseNumbers", null, handler);


Note that when using the WazeWrap.Events.register for these you must pass a null value as the 2nd parameter - this is to keep the usage in line with all of the other register calls, despite the native registrations only taking two parameters.
Last edited by JustinS83 on Wed Mar 06, 2019 6:43 pm, edited 1 time in total.
Script Writing Community Coordinator
[ img ][ img ][ img ][ img ][ img ]
JustinS83
Waze Global Champs
Waze Global Champs
 
Posts: 1321
Joined: Wed Dec 03, 2014 4:33 am
Location: Franklin, OH
Has thanked: 336 times
Been thanked: 2342 times

Re: [Script] WazeWrap

Postby dBsooner » Tue Feb 19, 2019 12:40 am

Found an interesting z-index issue tonight. I can't seem to get the z-index high enough to be on-top of the UR Panel, but going to 10000 instead of 1000 gets above the turn restriction arrows. I found this by going directly to a UR in the URL (while I left my disabled turns enabled).

EDIT: Yep and I see a bug with URC-E too. LOL.

2019_02_18_18_34_55_Waze_Map_Editor.png
(194.86 KiB) Downloaded 605 times
[ img ][ img ][ img ][ img ][ img ]
• AM: Eastern Oklahoma, DFW, Southern Florida
• Wiki: WME | Editing Manual | Best Practices | FAQ | Places
• AT&T | iPhone XS Max | iOS 12 | Waze Latest Beta
dBsooner
Map Editor - Level 5
Map Editor - Level 5
 
Posts: 593
Joined: Thu Oct 31, 2013 10:53 pm
Location: Tulsa / Broken Arrow, Oklahoma, US
Has thanked: 360 times
Been thanked: 315 times

Re: [Script] WazeWrap

Postby JustinS83 » Tue Feb 19, 2019 12:52 am

dBsooner wrote:Found an interesting z-index issue tonight. I can't seem to get the z-index high enough to be on-top of the UR Panel, but going to 10000 instead of 1000 gets above the turn restriction arrows. I found this by going directly to a UR in the URL (while I left my disabled turns enabled).

EDIT: Yep and I see a bug with URC-E too. LOL.

2019_02_18_18_34_55_Waze_Map_Editor.png


I wasn't going to mess with the zindex to get on top of that stuff but people won't stop pointing it out. So. FINE.
Script Writing Community Coordinator
[ img ][ img ][ img ][ img ][ img ]
JustinS83
Waze Global Champs
Waze Global Champs
 
Posts: 1321
Joined: Wed Dec 03, 2014 4:33 am
Location: Franklin, OH
Has thanked: 336 times
Been thanked: 2342 times

Re: [Script] WazeWrap

Postby dBsooner » Tue Feb 19, 2019 2:51 am

JustinS83 wrote:
dBsooner wrote:Found an interesting z-index issue tonight. I can't seem to get the z-index high enough to be on-top of the UR Panel, but going to 10000 instead of 1000 gets above the turn restriction arrows. I found this by going directly to a UR in the URL (while I left my disabled turns enabled).

EDIT: Yep and I see a bug with URC-E too. LOL.

2019_02_18_18_34_55_Waze_Map_Editor.png


I wasn't going to mess with the zindex to get on top of that stuff but people won't stop pointing it out. So. FINE.


Lol! Hey. You don’t gotta fix it. I only mentioned it so others might not. Hehehe. Thanks for fixin it!
[ img ][ img ][ img ][ img ][ img ]
• AM: Eastern Oklahoma, DFW, Southern Florida
• Wiki: WME | Editing Manual | Best Practices | FAQ | Places
• AT&T | iPhone XS Max | iOS 12 | Waze Latest Beta
dBsooner
Map Editor - Level 5
Map Editor - Level 5
 
Posts: 593
Joined: Thu Oct 31, 2013 10:53 pm
Location: Tulsa / Broken Arrow, Oklahoma, US
Has thanked: 360 times
Been thanked: 315 times

Re: [Script] WazeWrap

Postby JustinS83 » Mon Apr 29, 2019 9:09 pm

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:

[ img ]

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.

[ img ]
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:
[ img ]
JustinS83
Waze Global Champs
Waze Global Champs
 
Posts: 1321
Joined: Wed Dec 03, 2014 4:33 am
Location: Franklin, OH
Has thanked: 336 times
Been thanked: 2342 times

PreviousNext

Return to Addons, Extensions, and Scripts

Who is online

Users browsing this forum: age4670, RichardPyne