Changes

From Wazeopedia

Bookmarklets

447 bytes added, 4 years ago
Set segment locks in area: Fix rank check
<!-- Do not modify this code directly. Go to the talk page to modify the formatted code and then compress it and paste the result below -->
{{pre2|<nowiki>
javascript:(function(){var fwy_lvl=34;var rmp_lvl=3;var maj_lvl=2;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){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()){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}))}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}))}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}))}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}))}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}))}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}))}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}))}}})})();
</nowiki>}}
249
edits