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.
Post by TheLastTaterTot
Thanks to Pz's help, I have now successfully added a shortcut for Streets Vector Layer.

If you already have the Developer Tools extension installed for your browser, you just need to open it up while in WME and select the tab to view "Resources" > "Local Storage" > http://www.waze.com. There should be a stored variable, keyboardShortcuts, within that list.

The easiest way to get the correct keyCode for your shortcut is to open up the WME shortcuts pane and temporarily assign the desired keys to another event (i.e., use "Keyboard Shortcuts" link in the bottom left of WME or press "?" hotkey). So, if I have no shortcut assigned for the Vector layer and I want to use alt+l, I might temporarily assign those keys to "Toggle Junctions." After the shortcut has been set, I'll go looking for the corresponding key codes for toggleJunctions saved within the long keyboardShortcuts array, copy the two numbers into clipboard, and then remove the shortcut for "Toggle Junctions" by making the values "0,-1"
(i.e., find "toggleJunctions":"4,76", copy "4,76", then edit to "toggleJunctions":"0,-1"). Finally, I paste the copied key codes over to the entry for toggleStreet...: "toggleStreet(Vector)":"4,76",... and reload WME. The keys can be verified by taking a look in the Keyboard Shortcuts pane again. If it looks good there, the new shortcut should now work.

Alternatively, you could also manually find the values for your shortcut with the help of this website: http://www.cambiaresearch.com/articles/ ... -key-codes. The first number must be 0-7 and represents the modifier key(s) and the second number is the associated key press (a letter, number, or a function key).

The key codes for modifier key(s) are:
0 - no modifier key(s)
1 - ctrl
2 - shift
3 - ctrl+shift
4 - alt
5 - ctrl+alt
6 - alt+shift
7 - ctrl+alt+shift

Thus, if you want ctrl+alt+shift+s as the shortcut, you would use ""7,83". 83 is the key code for 's'.
TheLastTaterTot
Wiki Master
Wiki Master
Posts: 480
Has thanked: 253 times
Been thanked: 287 times
Send a message
Last edited by TheLastTaterTot on Fri Oct 30, 2015 9:33 am, edited 3 times in total.
R5 | RI SM | CA, MA & NY AM | Mentor

Post by TheLastTaterTot
@andy: Yup, that's it. toggleStreet(Vector) is currently assigned "4,76" (alt+l) for you.
TheLastTaterTot
Wiki Master
Wiki Master
Posts: 480
Has thanked: 253 times
Been thanked: 287 times
Send a message
R5 | RI SM | CA, MA & NY AM | Mentor

Post by TheLastTaterTot
@andy: no, modify keyboardShortcuts directly.

From something like this:
{..."toggleEditableAreas":"2,69","toggleRoadClosures":"3,67","toggleStreet(Vector)":"0,-1",...}

To this:
{..."toggleEditableAreas":"2,69","toggleRoadClosures":"3,67","toggleStreet(Vector)":"3,83",...}


"..." represents parts of the code that was omitted from the post for brevity sake.
TheLastTaterTot
Wiki Master
Wiki Master
Posts: 480
Has thanked: 253 times
Been thanked: 287 times
Send a message
R5 | RI SM | CA, MA & NY AM | Mentor

Post by TheLastTaterTot
What a big tease, bedo!! :) :)

Is this "Waze soon" or soon soon??

Thanks so much for figuring out how to fix the labels!
TheLastTaterTot
Wiki Master
Wiki Master
Posts: 480
Has thanked: 253 times
Been thanked: 287 times
Send a message
R5 | RI SM | CA, MA & NY AM | Mentor

Post by TheLastTaterTot
This is one of those times I wish there was an option to favorite a post so I can come back to it later when I need it. :D I suppose a bookmark should suffice.
Glodenox wrote:And at the same time it would probably be best to wrap the whole script inside a function to prevent a collision of function names or variables with other scripts (which seems very likely due to the very generic function names). It's not that hard to do as it won't impact your script:

Code: Select all

(function() {
  // All function and variable declarations go in here as they are now
})();
For the console issue, I personally use a different function for that:

Code: Select all

function log(obj) {
  if (localStorage.svlDebug) { // just a suggestion, feel free to do something else
    console.log(obj);
  }
}
Also, there is a global variable svlAttempts that could be put as a var at the top of the script as it is not useful anywhere else (inside the function declaration I showed in this post). The risk of a collision with other scripts is very minimal though.

Just trying to make your script even better :)
TheLastTaterTot
Wiki Master
Wiki Master
Posts: 480
Has thanked: 253 times
Been thanked: 287 times
Send a message
R5 | RI SM | CA, MA & NY AM | Mentor

Post by Timbones
I installed this for the first time, got this: (otherwise seemed to work okay)
Timbones
Coordinators
Coordinators
Posts: 7358
Answers: 2
Has thanked: 954 times
Been thanked: 2916 times
Send a message
Attachments
Timbones(6) • UK Coordinator • Forum Moderator • Closure Monitor
Scripts: WME Colour HighlightsWME Route TesterWME Geometries

Post by Timbones
It *would* be possible to hide dirt roads, Parking Lots, etc at zooms where streets aren't included in the vector data. Then it would at least be consistent.

Sent from my Nexus 4 using Tapatalk
Timbones
Coordinators
Coordinators
Posts: 7358
Answers: 2
Has thanked: 954 times
Been thanked: 2916 times
Send a message
Timbones(6) • UK Coordinator • Forum Moderator • Closure Monitor
Scripts: WME Colour HighlightsWME Route TesterWME Geometries

Post by Timbones
KuniaKid wrote:Is it possible to have Private and Parking lot Roads not show up until zoom level 4?
Please! I want this too. Maybe it could be an optional setting?
I really don't mind if they are invisible yet selectable.
Timbones
Coordinators
Coordinators
Posts: 7358
Answers: 2
Has thanked: 954 times
Been thanked: 2916 times
Send a message
Timbones(6) • UK Coordinator • Forum Moderator • Closure Monitor
Scripts: WME Colour HighlightsWME Route TesterWME Geometries

Post by Timbones
Doesn't run at all on /en-GB/editor :( I suspect it'll break other languages with dashes.

Why not stick with something simple: https://*.waze.com/*editor/*

Belt and braces: check that Waze object exists, and quit your bootstrap if it doesn't:

Code: Select all

  if (typeof Waze == 'undefined') {
    return; // not WME
  }
Timbones
Coordinators
Coordinators
Posts: 7358
Answers: 2
Has thanked: 954 times
Been thanked: 2916 times
Send a message
Timbones(6) • UK Coordinator • Forum Moderator • Closure Monitor
Scripts: WME Colour HighlightsWME Route TesterWME Geometries

Post by Timbones
bedo2991 wrote:
  • Locked segments above your editing level are shown with a intimidating black line.
This doesn't really affect me (and I haven't seen it in action), but I'd prefer that Street Vector Layer just showed me the roads based on their types. WME Color Highlights already has an option to add the intimidating black line...
Timbones
Coordinators
Coordinators
Posts: 7358
Answers: 2
Has thanked: 954 times
Been thanked: 2916 times
Send a message
Timbones(6) • UK Coordinator • Forum Moderator • Closure Monitor
Scripts: WME Colour HighlightsWME Route TesterWME Geometries