Actually, I thought about this and realized I was going about it all wrong.
I took another approach that made your script work perfectly.
I started with the bootstrap.user.js file that the original used, and modified it to call your FC Highlights file.
I also used the manifest.json file to specify the resources used (it won’t load them if they aren’t in the manifest). I removed any lines I could not understand from that file, including the key.
This seems to work perfectly. None of those silly errors with Waze or W not being defined.
I attached a zip of the directory
(unavailable attachment: MyExtension12345.zip)
The conflict with WMECH has been resolved. FC Highlights now uses a new layer that you’ll see in the WME Layer menu called “Functional Classification”. It does not have its own street name labels at this time though, so it is necessary to leave the existing WME Roads layer on to view those. The storage issue with Firefox should be resolved now as well, so any changes to the different road type colors should save and reload.
I’m also toying with different event listeners without trying to resort to redrawing the segments automatically every X seconds. Probably the most noticeable area this will be seen is if you search and change map locations. If the highlights don’t appear, just drag the map a bit or zoom in. This should change in a future version. Highlights should appear at the 500m zoom down to 2m as long as the layer is enabled.
One thing I noticed is it doesn’t seem to remember when I have turned it off. Every time I open a new window or do a full refresh it reactivates the layer.
Is there any way to make it remember or not turn on until I want it too?
Version 0.5 adds a checkbox that enables you to toggle between FC road type labels and the default Waze labels. Primary Street will display as “Collector”, mH as “Minor Arterial”, and MH as “Principal Arterial”.
Maybe “Minor Arterial (State Hwy min.)” and “Principal Arterial (US Hwy min.)”, or what would you prefer? I could maybe try to populate the dropdown with two separate entries for the same road type ID, but then I’m not sure what kind of hell could break loose. It would be kind of cool though to have multiple custom road type labels that tie back to the same ID.
EDIT: scratch that, because if someone has a “State Hwy” dropdown, I wouldn’t be able to differentiate whether it should actually be mH, MH, or freeway, etc. So, one label per road type. Just let me know the preferred labels.
The only ways to say it I can think of are probably too long for the box… like “Major Arterial (& US Hwy if not higher)” and “Minor Arterial (& State Hwy if not higher)”. Kind of a mess. But then maybe it’s too much to try to fit the gist of the rule into the box.
“Major Art (& US- if not higher)”
“Minor Art (& SR- if not higher)”
Though that doesn’t account for state-specific standards. Bah, I dunno.
The new WME version gives us more room for the road type labels, so I expanded the MH- and mH-equivalent labels. I’ve also added a wiki link to the Road Types USA quick reference chart.
Would it be possible to include a checkbox or button to temporarily turn it off while investigating something else nearby? Sometimes FC hightlighter, Color Highlighter, and toolbox all want to highlight the same segment(s), and it is useful to see just one at a time, without refreshing the whole browser.