Get a sneak peek at whats next for Permanent Hazards on our April 7th Office Hours!
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 Reply
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.

Script authors: don't use *.waze.com or waze.com/*

Post by AlanOfTheBerg
Hi all,

There are many pages used at Waze outside of editor. I think some scripts and extensions are causing issues by constantly trying to execute in other spaces, such as the editor dashboard (waze.com/user/editor/).

Please make sure the execution space for your scripts are tightly controlled down to just the actual editor URLs.

Thanks
-Alan
AlanOfTheBerg
EmeritusChamps
EmeritusChamps
Posts: 23627
Has thanked: 568 times
Been thanked: 3478 times

POSTER_ID:701618

1

Send a message
Wiki Resources: Map Editing Manual | alanoftheberg@gmail.com
Oregon-based US Ex-Global Champ Editor | iPhone13Pro - VZ

Post by AlanOfTheBerg
Glodenox wrote:This slightly modified regex should do proper matching now that the beta version of the editor has moved:

Code: Select all

// @include /^https:\/\/(www|beta)\.waze\.com\/(?!user\/)(.{2,6}\/)?editor\/.*$/
Is this the most current and recommended @include for WME-specific scripts? I'm going to update my OP to actually include the recommendation, instead of only saying "don't do this." (I fell to my own pet peeve of URs which complain about a wrong location but have no guidance as to the correct location... :roll: )
AlanOfTheBerg
EmeritusChamps
EmeritusChamps
Posts: 23627
Has thanked: 568 times
Been thanked: 3478 times
Send a message
Wiki Resources: Map Editing Manual | alanoftheberg@gmail.com
Oregon-based US Ex-Global Champ Editor | iPhone13Pro - VZ

Post by bgodette
For native Chrome extensions (CWS extensions) this is what needs to be in your manifest.json:

Code: Select all

   "content_scripts": [ {
      ...
      "matches": [ "https://*.waze.com/*editor/*" ],
      "exclude_matches": [ "https://www.waze.com/*user/editor/*" ]
   } ],
It's not perfect as new excludes will need to be added anytime Waze adds a new URL that matches /*editor/
bgodette
Waze Global Champs
Waze Global Champs
Posts: 3441
Has thanked: 27 times
Been thanked: 257 times
Send a message

Post by ekrw
Yesterday I discovered that browsing to https://editor-beta.waze.com/editor which will be translated into
https://beta.waze.com/editor/

A number of scripts seems to miss this in their "@includes" ...., correct?
ekrw
State Manager
State Manager
Posts: 609
Has thanked: 115 times
Been thanked: 83 times
Send a message
Country Manager, The Netherlands
https://s.waze.tools/c5.pnghttps://s.waze.tools/s0500.pnghttps://s.waze.tools/beta.png
Xiaomi Mi9 Lite (Android 10) - Waze v.4.63.0.1

Post by Glodenox
What would be the best combination of includes and excludes for a script running just in the editor?
I'm currently thinking of going with these 3 rules:

Code: Select all

// @include     https://www.waze.com/*editor/*
// @include     https://editor-beta.waze.com/*
// @exclude     https://www.waze.com/*user/editor/*
EDIT: combined one rule.
EDIT2: fixed exclusion rule as detailed below
Glodenox
Waze Global Champs
Waze Global Champs
Posts: 1565
Answers: 1
Has thanked: 278 times
Been thanked: 940 times
Send a message
Last edited by Glodenox on Thu Apr 14, 2016 9:24 am, edited 1 time in total.
Belgium & Luxembourg Coordinator • Script Writing Community Coordinator
https://www.tomputtemans.com/images/WazeBelgium.pnghttps://www.tomputtemans.com/images/WazeWMEbeta.png

Post by Glodenox
Oh right, I don't know why that went wrong. I've done this correctly in the script I had already modified... Either way: I've adjusted it in my previous post.
Glodenox
Waze Global Champs
Waze Global Champs
Posts: 1565
Answers: 1
Has thanked: 278 times
Been thanked: 940 times
Send a message
Belgium & Luxembourg Coordinator • Script Writing Community Coordinator
https://www.tomputtemans.com/images/WazeBelgium.pnghttps://www.tomputtemans.com/images/WazeWMEbeta.png

Post by Glodenox
I've just tested the regex above and it should work fine for all editor pages. I've only tested the regex though, not whether GreaseMonkey and TamperMonkey handle that correctly.
Surprisingly, that's the second time so far that I've seen a good use case for a negative lookback within regex. And the first one was just a couple of days ago. Weird :P

EDIT: one downside I should mention to using this regex is that the pop-up that users get will be a lot less readable for non-technical people. A list of URLs with some asterisks can be understood. Regex on the other hand...
Glodenox
Waze Global Champs
Waze Global Champs
Posts: 1565
Answers: 1
Has thanked: 278 times
Been thanked: 940 times
Send a message
Belgium & Luxembourg Coordinator • Script Writing Community Coordinator
https://www.tomputtemans.com/images/WazeBelgium.pnghttps://www.tomputtemans.com/images/WazeWMEbeta.png

Post by Glodenox
I guess that is of lesser importance here indeed.
Glodenox
Waze Global Champs
Waze Global Champs
Posts: 1565
Answers: 1
Has thanked: 278 times
Been thanked: 940 times
Send a message
Belgium & Luxembourg Coordinator • Script Writing Community Coordinator
https://www.tomputtemans.com/images/WazeBelgium.pnghttps://www.tomputtemans.com/images/WazeWMEbeta.png

Post by Glodenox
This slightly modified regex should do proper matching now that the beta version of the editor has moved:

Code: Select all

// @include /^https:\/\/(www|beta)\.waze\.com\/(?!user\/)(.{2,6}\/)?editor\/.*$/
Glodenox
Waze Global Champs
Waze Global Champs
Posts: 1565
Answers: 1
Has thanked: 278 times
Been thanked: 940 times
Send a message
Belgium & Luxembourg Coordinator • Script Writing Community Coordinator
https://www.tomputtemans.com/images/WazeBelgium.pnghttps://www.tomputtemans.com/images/WazeWMEbeta.png

Post by Glodenox
AlanOfTheBerg wrote:Is this the most current and recommended @include for WME-specific scripts? I'm going to update my OP to actually include the recommendation, instead of only saying "don't do this." (I fell to my own pet peeve of URs which complain about a wrong location but have no guidance as to the correct location... :roll: )
I'm not sure whether I'm in a position to recommend stuff, but it is the most current @include, yes.
Glodenox
Waze Global Champs
Waze Global Champs
Posts: 1565
Answers: 1
Has thanked: 278 times
Been thanked: 940 times
Send a message
Belgium & Luxembourg Coordinator • Script Writing Community Coordinator
https://www.tomputtemans.com/images/WazeBelgium.pnghttps://www.tomputtemans.com/images/WazeWMEbeta.png