[New Page] Bookmarklets

Moderator: Unholy

Re: [New Page] Bookmarklets

Postby AlanOfTheBerg » Thu Jun 05, 2014 3:22 pm

There are some bookmarklets here which could be moved: https://wiki.waze.com/wiki/Map_Editing_ ... et_Scripts
Wiki Resources: Map Editing Manual | alanoftheberg@gmail.com
Oregon-based US Country Manager | iPhone6 - VZ
AlanOfTheBerg
EmeritusChamps
EmeritusChamps
 
Posts: 23624
Joined: Sat Aug 28, 2010 8:48 pm
Location: US Country Manager - Oregon, USA
Has thanked: 1112 times
Been thanked: 4866 times

Re: [New Page] Bookmarklets

Postby AlanOfTheBerg » Mon Jun 23, 2014 10:02 pm

I have updated my bookmarklets page by removing old scripts and also updated the bookmarklets wiki page removing the Livemap-to-WME as it didn't work and Livemap has this functionality built in now.
Wiki Resources: Map Editing Manual | alanoftheberg@gmail.com
Oregon-based US Country Manager | iPhone6 - VZ
AlanOfTheBerg
EmeritusChamps
EmeritusChamps
 
Posts: 23624
Joined: Sat Aug 28, 2010 8:48 pm
Location: US Country Manager - Oregon, USA
Has thanked: 1112 times
Been thanked: 4866 times

Re: [New Page] Bookmarklets

Postby AlanOfTheBerg » Wed Oct 29, 2014 11:44 pm

The extraneous nodes bookmarklet should be updated, and noted to NOT use it in areas where there are 1-way streets. For wide rural areas with extra junctions and all 2-way streets, it is very helpful.
Wiki Resources: Map Editing Manual | alanoftheberg@gmail.com
Oregon-based US Country Manager | iPhone6 - VZ
AlanOfTheBerg
EmeritusChamps
EmeritusChamps
 
Posts: 23624
Joined: Sat Aug 28, 2010 8:48 pm
Location: US Country Manager - Oregon, USA
Has thanked: 1112 times
Been thanked: 4866 times

Re: [New Page] Bookmarklets

Postby brandonrossl » Thu Oct 23, 2014 6:25 pm

Is there a level-3-friendly version of the auto-lock? I can't seem to get it to work and it may be due to the fact that I'm only a level 3.

Thanks!
brandonrossl
 
Posts: 180
Joined: Thu Apr 10, 2014 11:39 pm
Location: VA, USA
Has thanked: 64 times
Been thanked: 11 times

Re: [New Page] Bookmarklets

Postby brandonrossl » Thu Oct 23, 2014 6:40 pm

That's weird, I tried both.

I do have 64-bit Chrome installed, don't know if that makes a difference.
brandonrossl
 
Posts: 180
Joined: Thu Apr 10, 2014 11:39 pm
Location: VA, USA
Has thanked: 64 times
Been thanked: 11 times

Re: [New Page] Bookmarklets

Postby brandonrossl » Fri Oct 24, 2014 2:04 pm

brandonrossl
 
Posts: 180
Joined: Thu Apr 10, 2014 11:39 pm
Location: VA, USA
Has thanked: 64 times
Been thanked: 11 times

Re: [New Page] Bookmarklets

Postby brandonrossl » Mon Oct 27, 2014 5:07 pm

For me, it simply failed and didn't do anything.
brandonrossl
 
Posts: 180
Joined: Thu Apr 10, 2014 11:39 pm
Location: VA, USA
Has thanked: 64 times
Been thanked: 11 times

Re: [New Page] Bookmarklets

Postby crazycaveman » Thu Sep 25, 2014 1:43 pm

I have been playing around with the segment locks bookmarklet, and believe I have it fixed. Haven't done extensive testing yet, but here it is. Please let me know if you run into any issues; I'm new with this stuff and just used another bookmarklet I was given to hack this one enough to (seemingly) work.

Code: Select all
javascript:(function() {

  /* value used is -1 from rank visible in WME */
  /* fwy_lvl = 3 would appear locked at 4 in WME */
  /* can set locks to be null, which will use the auto-lock */
  var fwy_lvl = 3;
  var rmp_lvl = 3;
  var maj_lvl = 2;
  var min_lvl = 1;
  var pri_lvl = null;
  var absolute = false;
  var count = 0;
 
  function onScreen(obj) {
    if (obj.geometry) {
      return(W.map.getExtent().intersectsBounds(obj.geometry.getBounds()));
    }
    return(false);
  }
 
  Object.forEach(W.model.segments.objects, function(k, v) {
    if (count < 150 && onScreen(v) && v.isGeometryEditable()) {
      /* fwy */
      if (v.attributes.roadType == 3 && (v.attributes.lockRank == null || v.attributes.lockRank < fwy_lvl || (absolute && v.attributes.lockRank != fwy_lvl))) {
   count++;
        W.model.actionManager.add(new Waze.Action.UpdateObject(v, {lockRank: fwy_lvl}));
      }
      /* ramp */
      if (v.attributes.roadType == 4 && (v.attributes.lockRank == null || v.attributes.lockRank < rmp_lvl || (absolute && v.attributes.lockRank != rmp_lvl))) {
        count++;
        W.model.actionManager.add(new Waze.Action.UpdateObject(v, {lockRank: rmp_lvl}));
      }
      /* MH */
      if (v.attributes.roadType == 6 && (v.attributes.lockRank == null || v.attributes.lockRank < maj_lvl || (absolute && v.attributes.lockRank != maj_lvl))) {
        count++;
        W.model.actionManager.add(new Waze.Action.UpdateObject(v, {lockRank: maj_lvl}));
      }
      /* mH */
      if (v.attributes.roadType == 7 && (v.attributes.lockRank == null || v.attributes.lockRank < min_lvl || (absolute && v.attributes.lockRank != min_lvl))) {
        count++;
        W.model.actionManager.add(new Waze.Action.UpdateObject(v, {lockRank: min_lvl}));
      }
      /* primary */
      if (v.attributes.roadType == 2 && (v.attributes.lockRank == null || v.attributes.lockRank < pri_lvl || (absolute && v.attributes.lockRank != pri_lvl))) {
        count++;
        W.model.actionManager.add(new Waze.Action.UpdateObject(v, {lockRank: pri_lvl}));
      }
    }
  });
})();
[ img ][ img ] [ img ][ img ][ img ]
ARC: South Atlantic Region
crazycaveman
US Waze Champs
US Waze Champs
 
Posts: 832
Joined: Fri Sep 03, 2010 1:48 am
Location: Rock Hill, SC, USA
Has thanked: 352 times
Been thanked: 522 times

Re: [New Page] Bookmarklets

Postby crazycaveman » Tue Oct 07, 2014 2:44 pm

Updated again for the newest WME:
Code: Select all
javascript:(function() {

  /* value used is -1 from rank visible in WME */
  /* fwy_lvl = 3 would appear locked at 4 in WME */
  /* can set locks to be null, which will use the auto-lock */
  var fwy_lvl = 3;
  var rmp_lvl = 3;
  var maj_lvl = 2;
  var min_lvl = 1;
  var pri_lvl = 1;
  var absolute = false;
  var count = 0;
  var UpdateObject;
 
  if (typeof(require) !== "undefined") {
      UpdateObject = require("Waze/Action/UpdateObject");
  } else {
      UpdateObject = Waze.Action.UpdateObject;
  }

  function onScreen(obj) {
    if (obj.geometry) {
      return(W.map.getExtent().intersectsBounds(obj.geometry.getBounds()));
    }
    return(false);
  }
 
  Object.forEach(W.model.segments.objects, function(k, v) {
   if (count < 150 && onScreen(v) && v.isGeometryEditable()) {
     /* fwy */
      if (v.attributes.roadType == 3 && (v.attributes.lockRank < fwy_lvl || (absolute && v.attributes.lockRank != fwy_lvl))) {
   count++;
        W.model.actionManager.add(new UpdateObject(v, {lockRank: fwy_lvl}));
      }
      /* ramp */
      if (v.attributes.roadType == 4 && (v.attributes.lockRank < rmp_lvl || (absolute && v.attributes.lockRank != rmp_lvl))) {
        count++;
        W.model.actionManager.add(new UpdateObject(v, {lockRank: rmp_lvl}));
      }
      /* MH */
      if (v.attributes.roadType == 6 && (v.attributes.lockRank < maj_lvl || (absolute && v.attributes.lockRank != maj_lvl))) {
        count++;
        W.model.actionManager.add(new UpdateObject(v, {lockRank: maj_lvl}));
      }
      /* mH */
      if (v.attributes.roadType == 7 && (v.attributes.lockRank < min_lvl || (absolute && v.attributes.lockRank != min_lvl))) {
        count++;
        W.model.actionManager.add(new UpdateObject(v, {lockRank: min_lvl}));
      }
      /* primary */
      if (v.attributes.roadType == 2 && (v.attributes.lockRank < pri_lvl || (absolute && v.attributes.lockRank != pri_lvl))) {
        count++;
        W.model.actionManager.add(new UpdateObject(v, {lockRank: pri_lvl}));
      }
    }
  });
})();


Default values:
Freeway = 4
Ramp = 4
Major Hwy = 3
Minor Hwy = 2
Primary Street = 2

Just had to change the Waze.Action.UpdateObject to UpdateObject

Edit 10/23: Updated script here to match the one in the wiki. Found that it didn't work if Toolbox wasn't installed.
Last edited by crazycaveman on Thu Oct 23, 2014 6:49 pm, edited 1 time in total.
[ img ][ img ] [ img ][ img ][ img ]
ARC: South Atlantic Region
crazycaveman
US Waze Champs
US Waze Champs
 
Posts: 832
Joined: Fri Sep 03, 2010 1:48 am
Location: Rock Hill, SC, USA
Has thanked: 352 times
Been thanked: 522 times

Re: [New Page] Bookmarklets

Postby crazycaveman » Tue Oct 07, 2014 9:45 pm

karlcr9911 wrote:Hey Crazycaveman - great script! Why the change from PS locking to a 2 to an Auto Lock now? Auto Lock isn't active in the US yet, is it?

Not yet. That's just the way I had it and was too lazy to change it :lol: Also, for my state, that's the main standard we're sticking with
[ img ][ img ] [ img ][ img ][ img ]
ARC: South Atlantic Region
crazycaveman
US Waze Champs
US Waze Champs
 
Posts: 832
Joined: Fri Sep 03, 2010 1:48 am
Location: Rock Hill, SC, USA
Has thanked: 352 times
Been thanked: 522 times

Next

Return to Wiki Updates and Discussion

Who is online

Users browsing this forum: No registered users