Page 1 of 2

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

PostPosted: Wed Apr 13, 2016 4:46 pm
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

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

PostPosted: Thu Jul 14, 2016 8:07 pm
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: )

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

PostPosted: Mon Apr 18, 2016 9:48 pm
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/

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

PostPosted: Wed Nov 09, 2016 4:14 pm
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?

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

PostPosted: Wed Apr 13, 2016 7:40 pm
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

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

PostPosted: Thu Apr 14, 2016 9:26 am
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.

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

PostPosted: Tue Jun 07, 2016 8:18 am
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...

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

PostPosted: Tue Jun 07, 2016 11:13 am
by Glodenox
I guess that is of lesser importance here indeed.

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

PostPosted: Wed Jul 13, 2016 9:45 am
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\/.*$/

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

PostPosted: Thu Jul 14, 2016 8:18 pm
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.