Changes

From Wazeopedia

Talk:Bookmarklets

58 bytes removed, 4 years ago
Set segment locks in area
var min_lvl = 1;
var pri_lvl = 1;
var rr_lvl = 1;
var fer_lvl = 4;
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) {
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++;
count++;
W.model.actionManager.add(new UpdateObject(v, {lockRank: pri_lvl}));
}
/* railroad */
if (v.attributes.roadType == 18 && (v.attributes.lockRank < rr_lvl || (absolute && v.attributes.lockRank != rr_lvl))) {
count++;
W.model.actionManager.add(new UpdateObject(v, {lockRank: rr_lvl}));
}
/* ferry */
if (v.attributes.roadType == 14 && (v.attributes.lockRank < fer_lvl || (absolute && v.attributes.lockRank != fer_lvl))) {
count++;
W.model.actionManager.add(new UpdateObject(v, {lockRank: fer_lvl}));
}
}
249
edits