Page 2 of 4

Re: [New Page] Bookmarklets

Posted: Thu Oct 23, 2014 6:31 pm
by crazycaveman
brandonrossl wrote: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!
Just make sure everything is 2 or lower and it should work for you. Just so you know, the version on the wiki is different from the one posted here and should work with any setup; the one posted here will work if you have toolbox installed (I'll update it in a bit)

Re: [New Page] Bookmarklets

Posted: Mon Oct 27, 2014 4:25 pm
by crazycaveman
I have made a modified version of the min lock bookmarklet to set the locks to the lower of the user's rank or the set lock level for each segment.

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 thisUser = Waze.loginManager.user;
  if (thisUser === null) return;
  var usrRank = thisUser.normalizedLevel;
  var UpdateObject;
  
  if (typeof(require) !== "undefined") {
      UpdateObject = require("Waze/Action/UpdateObject");
  } else {
      UpdateObject = Waze.Action.UpdateObject;
  }
  
  if (fwy_lvl > (usrRank - 1)) fwy_lvl = usrRank - 1;
  if (rmp_lvl > (usrRank - 1)) rmp_lvl = usrRank - 1;
  if (maj_lvl > (usrRank - 1)) maj_lvl = usrRank - 1;
  if (min_lvl > (usrRank - 1)) min_lvl = usrRank - 1;
  if (pri_lvl > (usrRank - 1)) pri_lvl = usrRank - 1;
  
  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}));
      }
    }
  });
})();

Re: [New Page] Bookmarklets

Posted: Mon Oct 27, 2014 6:55 pm
by crazycaveman
Before, the lock script would simply fail to apply any lock to the roads that were set above the user's rank, but should still have worked at or below their rank.
voludu2 wrote:The remove all extraneous nodes bookmarklet is dangerous right now because of the ABBA reversing bug in WME. -- it is difficult to spot the reversed segments, even for higher-level editors.

And for lower-level editors editing in areas where major routes are unlocked -- this can really mess up waze navigation.
Yes, this is a major bug and should probably be noted on the page, at the very least, so users are aware of the issue. Maybe the toolbox devs would be willing to share their version, which fixes the issue?

Re: [New Page] Bookmarklets

Posted: Thu Jan 29, 2015 8:49 pm
by crazycaveman
I've updated the segments lock script to lock railroads at 2 and ferries at 5, based on the standard locking template that seems to be gaining momentum.

Re: [New Page] Bookmarklets

Posted: Sun Jun 22, 2014 5:46 am
by Fredo-p
tonestertm wrote:I made the text changes, (verify?) but if you were suggesting that adding the other bookmarklet was agreeable, that looks like it's beyond my beginning Wikiskills, with the whole Talk page bit. Maybe I'm just intimidated because I'm still finding my feet in the Wiki, and it's nowhere near as complicated as I'm thinking it is....
Have no fear.....Super Wiki-Man IS HERE!!!!!!!
super wiki man.jpg
(10.47 KiB) Downloaded 997 times

Re: [New Page] Bookmarklets

Posted: Sun Jun 22, 2014 5:52 am
by Fredo-p
Already added the image of the Chrome menu icon. Working on adding some more text to the Chrome instructions. I've been installing non-play store supported scripts into Chrome for some time when playing web browser based games.

There are two different ways to access the Bookmarks Manager. I'll add them both.

Re: [New Page] Bookmarklets

Posted: Sun Jun 22, 2014 6:50 am
by Fredo-p
Done. Check it out and let me know. There is another way of adding bookmarlets, but I have to test it to see.

https://wiki.waze.com/wiki/Bookmarklets#Chrome

Re: [New Page] Bookmarklets

Posted: Sun Jun 22, 2014 7:03 am
by Fredo-p
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.

Re: [New Page] Bookmarklets

Posted: Sun Jun 22, 2014 7:04 am
by Fredo-p
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:

Re: [New Page] Bookmarklets

Posted: Tue Oct 07, 2014 9:36 pm
by karlcr9911
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?