[New Page] Bookmarklets

Moderator: Unholy

Re: [New Page] Bookmarklets

Postby Fredo-p » Sun Jun 22, 2014 7:03 am

Never mind. I thought you would be able to highlight the javescript and then drag that entire selection to the toolbar, but it didn't work. Well, that just means Chrome's section is done.
[ img ][ img ]
Arizona Wiki | @Waze_Arizona Twitter
Verizon Samsung Galaxy S8+

Fredo-p
State Manager
State Manager
 
Posts: 2007
Joined: Mon Aug 05, 2013 4:35 am
Location: Everywhere
Has thanked: 269 times
Been thanked: 643 times

Re: [New Page] Bookmarklets

Postby Fredo-p » Sun Jun 22, 2014 7:04 am

Don't know what the hell is going on, but installing these and having them work is hit or miss. I'm having more luck with the drag-n-drop links from Alan vs the scripts on the wiki page. :evil:
[ img ][ img ]
Arizona Wiki | @Waze_Arizona Twitter
Verizon Samsung Galaxy S8+

Fredo-p
State Manager
State Manager
 
Posts: 2007
Joined: Mon Aug 05, 2013 4:35 am
Location: Everywhere
Has thanked: 269 times
Been thanked: 643 times

Re: [New Page] Bookmarklets

Postby kentsmith9 » Sun Jun 22, 2014 6:33 pm

The script is exactly like a hyperlink. You can copy-select the javascript in its entirety and then create a new link however you want. Paste the javascript in the hyperlink field and save it.

I have not had any problems with any of the methods you can use to create a link.
USA: Now Idaho; previously California (Northern, SF/SJ)

[ img ][ img ][ img ][ img ][ img ][ img ]
PLEASE READ: Waze Map Editor (Start Here) | Editing Quick-start | Best Practices | Junctions
kentsmith9
Waze Global Champs
Waze Global Champs
 
Posts: 5683
Joined: Mon Apr 23, 2012 3:33 pm
Location: Boise ID and SF/SJ Bay Area of Northern California
Has thanked: 1577 times
Been thanked: 1791 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: 4860 times

Re: [New Page] Bookmarklets

Postby MGODLEW » Thu Sep 18, 2014 2:43 pm

The Minimum Locks Bookmarklet is no longer working, is there an update/fix?
[ img ]
Rank 6 US Champ, Beta Tester & iOS Beta Leader | Waze Wishlist | Improper Edits | iPhone 6: JB iOS 9.0.2 |
Area Managing: State of Pennsylvania
MGODLEW
EmeritusChamps
EmeritusChamps
 
Posts: 2006
Joined: Tue Dec 20, 2011 6:39 pm
Location: Pennsylvania
Has thanked: 779 times
Been thanked: 704 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: 830
Joined: Fri Sep 03, 2010 1:48 am
Location: Rock Hill, SC, USA
Has thanked: 352 times
Been thanked: 519 times

Re: [New Page] Bookmarklets

Postby sketch » Sat Sep 27, 2014 4:13 pm

Minimum lock:

Code: Select all
javascript:(function() {
  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;
  Object.forEach(W.model.segments.objects, function(k, v) {
     if (count < 150 && v.onScreen() && 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 Waze.Action.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 Waze.Action.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 Waze.Action.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 Waze.Action.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 Waze.Action.UpdateObject(v, {lockRank: pri_lvl}));
        }
   }
  });
})();

I don't mean to say yours is bad or anything, crazycaveman – I had already done this a few days ago and forgot to post it. It's exactly the same as bgodette's old one except "UpdateObject" used to be "UpdateSegmentDetails". Neither one works in the current beta editor, however.

Default values:
Freeway = 4
Ramp = 4
Major Hwy = 3
Minor Hwy = 2
Primary Street = 2
ALL US EDITORS READ: New USA road type guidance
assistant regional coordinator • south central region • usa
waze global champ • beta leader • tier one • new orleans
2017 chevrolet ss sedan 6mt • slipstream blue metallic
[ img ] [ img ]
sketch
Waze Global Champs
Waze Global Champs
 
Posts: 6454
Joined: Sat Aug 08, 2009 6:13 pm
Location: Nouvelle-Orléans, Louisiane, États-Unis
Has thanked: 2077 times
Been thanked: 2560 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: 830
Joined: Fri Sep 03, 2010 1:48 am
Location: Rock Hill, SC, USA
Has thanked: 352 times
Been thanked: 519 times

Re: [New Page] Bookmarklets

Postby karlcr9911 » Tue Oct 07, 2014 9:36 pm

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?
Regional Coordinator - U.S. South Central
iOS Beta Leader / Alpha Tester | WME Beta Tester
[ img ][ img ][ img ][ img ][ img ][ img ]
SCR Wazeopedia
karlcr9911
Global Champ Mentor
Global Champ Mentor
 
Posts: 2394
Joined: Fri Aug 23, 2013 2:05 am
Location: North East Texas, USA
Has thanked: 571 times
Been thanked: 1530 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: 830
Joined: Fri Sep 03, 2010 1:48 am
Location: Rock Hill, SC, USA
Has thanked: 352 times
Been thanked: 519 times

PreviousNext

Return to Wiki Updates and Discussion

Who is online

Users browsing this forum: No registered users