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 by Glodenox
I've found that the issue is located somewhere in the initialization of the script. It waits for a user login, even though there is already a user logged in. By executing the following bit of code I'm able to make Validator appear again on Firefox:

Code: Select all

Waze.loginManager.events.triggerEvent('login');
In the shape of a bookmarklet that gives:

Code: Select all

javascript:Waze.loginManager.events.triggerEvent('login');
So I'm guessing (as I can't read the source code) that the check for a logged in user is incorrect or that the state listener is added too late.

Personally I'm using this code to trigger when the user has logged in and this seems to work fine:

Code: Select all

    if (typeof Waze === 'undefined' ||
        typeof Waze.loginManager === 'undefined') {
      setTimeout(init, 100);
      return;
    }
    if (!Waze.loginManager.hasUser()) {
      Waze.loginManager.events.register("login", null, init);
      Waze.loginManager.events.register("loginStatus", null, init);
      if (!Waze.loginManager.hasUser()) {
        return;
      }
    }
EDIT: oh wait, it seems I also have another check before I can actually access the tabs (to add a tab or manage them):

Code: Select all

    var tabs = document.querySelector('#user-tabs .nav-tabs');
    if (!tabs) {
      setTimeout(init, 400);
      return;
    }
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
In theory, that's not an error. ‰ stands for 'per mille' (per thousand). So 33‰ = 3.3%
But as this symbol isn't used that often, I also think it would be better to replace it with a percentage instead.
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
Firefox is giving the following error in the browser console:

Code: Select all

SecurityError: The operation is insecure.
This is usually caused by a Same Origin Policy issue.
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
Yay, Validator is working again on Firefox as well! Thanks!

In order to move the processing of segments to another thread: perhaps you could look into moving the processor to a Web Worker? Though it does seem to be a bit difficult to use in a userscript.
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 think the internal structure for street names or cities changed a bit, causing the script to mark all road segments as 'missing country and state'. I haven't done a lot yet with that part of the data model, so I can't remember what it used to look like.
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
The past 4 pages in this thread already talk about this issue ;)
You can somewhat mitigate the issue by putting "!23" in the "Reported as" field in the search tab, though it will still slightly break the script.

We'll have to wait for the script author to fix this, I'm afraid.
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
The script is sort of encrypted, but as with anything you have to run, there are ways of looking at what is inside. That said, I don't think that's the way to go here.

Basically, the script should be made more robust to not fail completely whenever a certain validation fails. Do we have a full list of all checks the script performs somewhere? Including all regional differences would probably become troublesome though.
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
So the addition of the ExtendedSVG renderer fixes the script already? I've just installed the userscript at https://dbcm.github.io/waze/valfix/valfix.js as a userscript on Firefox, but the validator still doesn't seem to work yet here (I've made it so that the fix gets executed before validator).

I'll look into it later if other people say this does seem to fix validator for them.
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
It's just a regular userscript, so I can't see where there would be a difference between TamperMonkey and GreaseMonkey here. Unless there's another bug that is only present on Firefox that hasn't been fixed this way. But I'll look into it closer in a couple of hours.
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 been able to get this to work consistently in Firefox after a couple of changes to the code of dbcm. The if statement around the proxy for require was unnecessary and I had to use window.require instead of just require to get it to work with GreaseMonkey. [EDIT: This has now been applied to dbcm's script] I've checked with TamperMonkey and this new version works there as well.
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 Mon Feb 13, 2017 8:28 pm, 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