[Script] WME Validator v2021.3.5 (+ PLACES BETA)

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] WME Validator 1.1.16 / 29.01.2016

Postby Glodenox » Wed Mar 16, 2016 10:46 am

Hmm, I've recently started having problems having WME Validator to load in Firefox 45.0 when I'm already logged in. This happens on two different computers.
The only message WME Validator gives in the browser console is "WME Validator v1.1.16: waiting for login...".
Only when I log out and log in, WME Validator loads fine for that session as the login gets triggered. So at least we know it isn't related to that. As this looks like a racing condition somewhere, I tried fixing it by putting the script to run before or after all other scripts, but neither action changed anything.

I personally use the following bit of code to check whether I still need to wait on a user login and that seems to work fine:
Code: Select all
// preceded by a check on whether the element with id user-info exists
if (!Waze.loginManager.hasUser()) {
  Waze.loginManager.events.register("login", null, exportFunction(init, unsafeWindow));
  Waze.loginManager.events.register("loginStatus", null, exportFunction(init, unsafeWindow));
  return;
}


To be absolutely safe that the event doesn't happen to be triggered between the check and registering the listener, you could also check hasUser again before actually returning, but in the time I've been using this bit of code I haven't had any issues yet.

EDIT: I've noticed that enabling the WME Toolbox makes Validator work again. Toolbox probably slows down Firefox enough for Validator to pick up that someone is already logged in. That's not really a solution though.
Last edited by Glodenox on Wed Mar 16, 2016 7:16 pm, edited 1 time in total.
Belgium & Luxembourg Coordinator • Script Writing Community Coordinator
[ img ][ img ]
Glodenox
Waze Global Champs
Waze Global Champs
 
Posts: 1268
Joined: Tue Aug 11, 2015 9:04 pm
Location: Belgium
Has thanked: 750 times
Been thanked: 1436 times

Re: [Script] WME Validator 1.1.16 / 29.01.2016

Postby Glodenox » Wed Mar 16, 2016 7:36 pm

Guys, isn't there some USA-specific thread about Validator in which such discussions can take place? Right now it's just cluttering this topic.

Another (easier) issue: would it be possible to fix the FontAwesome icons? This is what WME Validator looks like at the moment:
[ img ]

The problem is that the classes used to get FontAwesome icons were changed a month or two ago. You now need to apply the "fa" class and the icon-specific class. I've gone over the classes in Validator for you to make it easier:
icon-check -> fa fa-check-square-o (empty: fa fa-square-o)
icon-filter -> fa fa-filter
icon-search -> fa fa-search
icon-user -> fa fa-user
icon-wrench -> fa fa-wrench
icon-question-sign -> fa fa-question-circle
icon-list -> fa fa-list
icon-magic -> fa fa-magic

After these changes (I couldn't find any other occurrences of "icon-"), Validator looks like this again:
[ img ]
Belgium & Luxembourg Coordinator • Script Writing Community Coordinator
[ img ][ img ]
Glodenox
Waze Global Champs
Waze Global Champs
 
Posts: 1268
Joined: Tue Aug 11, 2015 9:04 pm
Location: Belgium
Has thanked: 750 times
Been thanked: 1436 times

Re: [Script] WME Validator 1.1.16 / 29.01.2016

Postby Glodenox » Tue Mar 29, 2016 4:58 pm

Weird, for some reason it seems to still be working on Firefox...
Belgium & Luxembourg Coordinator • Script Writing Community Coordinator
[ img ][ img ]
Glodenox
Waze Global Champs
Waze Global Champs
 
Posts: 1268
Joined: Tue Aug 11, 2015 9:04 pm
Location: Belgium
Has thanked: 750 times
Been thanked: 1436 times

Re: [Script] WME Validator 1.1.16 / 29.01.2016

Postby Glodenox » Wed Apr 06, 2016 12:56 pm

I've made a userscript that brings back the icons in the UI of WME Validator (or any other script that still uses the old FontAwesome 3.x-style icons): https://www.waze.com/forum/viewtopic.php?f=819&t=184439

This won't fix the issue in Google Chrome that you guys seem to be having though.
Belgium & Luxembourg Coordinator • Script Writing Community Coordinator
[ img ][ img ]
Glodenox
Waze Global Champs
Waze Global Champs
 
Posts: 1268
Joined: Tue Aug 11, 2015 9:04 pm
Location: Belgium
Has thanked: 750 times
Been thanked: 1436 times

Re: [Script] WME Validator 1.1.16 / 29.01.2016

Postby Glodenox » Fri Apr 15, 2016 6:57 am

Same issue here. And I've been unable to find any errors that seem to point to the script in the browser console. Except one error inside GreaseMonkey about a missing method modelFor, which doesn't appear when I disable WME Validator:
Code: Select all
TypeError: Type does not implements method: modelFor#fv89c0nqmvc core.js:116:1
Belgium & Luxembourg Coordinator • Script Writing Community Coordinator
[ img ][ img ]
Glodenox
Waze Global Champs
Waze Global Champs
 
Posts: 1268
Joined: Tue Aug 11, 2015 9:04 pm
Location: Belgium
Has thanked: 750 times
Been thanked: 1436 times

Re: [Script] WME Validator 1.1.16 / 29.01.2016

Postby Glodenox » Sat Apr 23, 2016 8:31 am

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;
    }
Belgium & Luxembourg Coordinator • Script Writing Community Coordinator
[ img ][ img ]
Glodenox
Waze Global Champs
Waze Global Champs
 
Posts: 1268
Joined: Tue Aug 11, 2015 9:04 pm
Location: Belgium
Has thanked: 750 times
Been thanked: 1436 times

Re: [Script] WME Validator 1.1.16 / 29.01.2016

Postby Glodenox » Sun Apr 24, 2016 8:44 pm

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.
Belgium & Luxembourg Coordinator • Script Writing Community Coordinator
[ img ][ img ]
Glodenox
Waze Global Champs
Waze Global Champs
 
Posts: 1268
Joined: Tue Aug 11, 2015 9:04 pm
Location: Belgium
Has thanked: 750 times
Been thanked: 1436 times

Re: [Script] WME Validator 1.1.17 / 01.06.2016

Postby Glodenox » Wed Jun 01, 2016 8:09 am

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.
Belgium & Luxembourg Coordinator • Script Writing Community Coordinator
[ img ][ img ]
Glodenox
Waze Global Champs
Waze Global Champs
 
Posts: 1268
Joined: Tue Aug 11, 2015 9:04 pm
Location: Belgium
Has thanked: 750 times
Been thanked: 1436 times

Re: [Script] WME Validator 1.1.18 / 02.06.2016

Postby Glodenox » Fri Jun 03, 2016 9:28 am

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.
Belgium & Luxembourg Coordinator • Script Writing Community Coordinator
[ img ][ img ]
Glodenox
Waze Global Champs
Waze Global Champs
 
Posts: 1268
Joined: Tue Aug 11, 2015 9:04 pm
Location: Belgium
Has thanked: 750 times
Been thanked: 1436 times

Re: [Script] WME Validator 1.1.19 / 04.06.2016

Postby Glodenox » Mon Sep 12, 2016 9:59 am

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.
Belgium & Luxembourg Coordinator • Script Writing Community Coordinator
[ img ][ img ]
Glodenox
Waze Global Champs
Waze Global Champs
 
Posts: 1268
Joined: Tue Aug 11, 2015 9:04 pm
Location: Belgium
Has thanked: 750 times
Been thanked: 1436 times

PreviousNext

Return to Addons, Extensions, and Scripts

Who is online

Users browsing this forum: Mapman44