WME Color Errors

Colorisation pour afficher les erreurs

当前为 2022-03-30 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name WME Color Errors
  3. // @version 2022.03.30
  4. // @icon data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAACXBIWXMAAA7DAAAOwwHHb6hkAAAAIGNIUk0AAHolAACAgwAA+f8AAIDpAAB1MAAA6mAAADqYAAAXb5JfxUYAAALuSURBVHja7Jots6swEIb7x6qiUFVVUVEoVBSqKioqU8EfqKpCRaE6FShMo5gjUCiOYebOzTXnvaKlhR44LbS9vcyQmVWdbt5nd7P5GGbr/eFjvT98jtQ+Zuv9oVzvDxiplbMTyVgBPieACWACmADeD/Bn7ABfE8D77PfYAfBUgFCt4DEKZz7H/Js5oMzDSoXPBPh6GCBSHAvSJviGkQW4it4HECmvI9IncygYY2ALcgPGgTccpD9AkQRwf4g4cQPEWYnzsDHkXRlxESTFawFixUDOkxIwIeEvLiKojFFclKPIDOJwhWWX6AWHWF35VPFrAEJeKwXHw9aUsIm8TO6GyE7S80iA3bUuCGRiUZotPKeWRR4+F0DXxBMeIrNHoUaRhhAAKCJei+htI8ocnZUGG7c+j34OQF08FTvk5xLJELJKiEICAEixWfbsRuySOSDHTtA+ED8D5Jo3nF3EA4CBqkR4p98KDd63nc4VTMNv3gga1/lwALeahCoYi6tRA5hzhFmJPFr1Kp92AADWQNHqd3cYQORX7Y1D52gZObQ3YAO7Nu86s5X7Wjb9qD/AOboihkX7SDfLhwGWm7TDu0UsLlnqDbATVR1SKGO7CEAfAqDo0m+NOvsmYjdsDXByq4wsYkkGAxDZkd1cN+YevIgbPb11IV8vuB52lz8CHhWP7QNG1foyC5CULZMWMWQfCCoRFy1+ygQBq+07yjxnJ65vLnMqELWVk82gBbvRRh24MuroOhFELQi0u+6HnYViSRuLT+gUbclAmSEOFVYeOx6nGQPzJbY6Qdb+B6RaNJoBlfFrTqNZ6DfuAIQJ6LTE0FGmGoKRRob8MHv9haY56RxkwaG0QV7am6JtkSHRCvzqokOY+Lc3slR3HJkdCuatoIIAwdmOJUWdtosMg9Dp++7EpiWad+0Bp6z9V68S6/0BgfTBvr1MOKCMwZfBs59Vfs3G/CZUvczZ6XV6ApgAJoAJYAIYM8DoP/YY9ec2fwcAaebQXj6i79wAAAAASUVORK5CYII=
  5. // @description Colorisation pour afficher les erreurs
  6. // @include https://www.waze.com/editor*
  7. // @include https://www.waze.com/*/editor*
  8. // @include https://beta.waze.com/*
  9. // @exclude https://www.waze.com/user/*
  10. // @exclude https://www.waze.com/*/user/*
  11. // @namespace https://gf.qytechs.cn/fr/scripts/21186-wme-color-errors
  12. // @author Sebiseba
  13. // @copyright Sebiseba 2014-2022
  14. // @license GNU GPL v2
  15. // @grant none
  16. // ==/UserScript==
  17.  
  18. var WMECErrors={}, ColorErrors_mapLayer=[], CErrLeg, CErrSeg, CErrPoi, debug="";
  19. var ActiveCountry, ABBR, UpdateObject, cntryDB = {
  20. FR: { str_lvl:0, pri_lvl:2, min_lvl:3, maj_lvl:4, rmp_lvl:4, fwy_lvl:4, rwy_lvl:4, nar_lvl:0 },
  21. GP: { str_lvl:0, pri_lvl:2, min_lvl:3, maj_lvl:4, rmp_lvl:4, fwy_lvl:4, rwy_lvl:4, nar_lvl:0 },
  22. MB: { str_lvl:0, pri_lvl:2, min_lvl:3, maj_lvl:4, rmp_lvl:4, fwy_lvl:4, rwy_lvl:4, nar_lvl:0 },
  23. FG: { str_lvl:0, pri_lvl:2, min_lvl:3, maj_lvl:4, rmp_lvl:4, fwy_lvl:4, rwy_lvl:4, nar_lvl:0 },
  24. RE: { str_lvl:0, pri_lvl:2, min_lvl:3, maj_lvl:4, rmp_lvl:4, fwy_lvl:4, rwy_lvl:4, nar_lvl:0 },
  25. FP: { str_lvl:0, pri_lvl:2, min_lvl:3, maj_lvl:4, rmp_lvl:4, fwy_lvl:4, rwy_lvl:4, nar_lvl:0 },
  26. BE: { str_lvl:null, pri_lvl:1, min_lvl:2, maj_lvl:3, rmp_lvl:4, fwy_lvl:4, rwy_lvl:4, nar_lvl:0 }
  27. }; // France
  28. var CErrWaze, CErrorsMap, CErrorsModel, CErrorsI18n, CErrorsOpenLayers, CErrorshandle, CErrorshandleClass, CErrorshandleClass2,
  29.  
  30. //french rules
  31. streetNameSeg="^(^Le |^La |^Les |Grande |Allée |[ ]?Avenue[]?|Boulevard |Chemin |Cité |Clos |Côte |Cour[s]? |Descente |Domaine |Hameau |Impasse |Levée |Lotissement |Mail |Montée |Parc |Parvis |Passage |Place |Placette |Pont |Promenade |Quai |Résidence[s]? |Route |[ ]?Rue[ ]?|Ruelle |Sente |Sentier |Square |Terrasse |Traverse |Venelle |Villa |Voie )",
  32. parkNameSeg="^(Aire |Place |Square )",
  33. excepNameSeg="(Périphérique |Rocade |Duplex |Tunnel |Pont )",
  34. privNameSeg="^(Allée |Avenue |Boulevard |Chemin |Clos |Côte |Cours |Faubourg |Hameau |Impasse |Lotissement |Mail |Parvis |Passage |Port |Porte |Promenade |Quai |Route |Rue |Ruelle |Sente |Sentier |Terrasse |Voie )",
  35. parkNamePoi="(Parking[s]?|Parc-Relais|Placette|Aire|Arrêt|Emplacement)",
  36. religiousPoi="(Abbatiale |Abbaye |Basilique |Calvaire |Carmel |Cathédrale |Chapelle |Cloître |Collégiale |Conjuratoire |Couvent |Crypte |Dôme |Église |Grande Mosquée |Grotte |Mandir |Maison Diocésaine |Monastère |Mosquée |Notre-Dame |Oratoire |Ordre |Pagode |Paroisse |Presbytère |Prieuré |Sanctuaire |Stupa |Synagogue |Temple )",
  37. busPoi="(Bus[ ][-][ ]|Gare Routière)",
  38. tramPoi="(Tramway[ ][-][ ]|Métro[ ][-][ ])",
  39. possibleTransPoi="(Tram$|Métro$|Arrêt$|Gare$|Station$|Tram |Métro |Arrêt |Gare |Station )",
  40.  
  41. // common all countries
  42. stationsPoi="(CAR_WASH|CHARGING_STATION|FACTORY_INDUSTRIAL|GAS_STATION|JUNCTION_INTERCHANGE|PARKING_LOT|SEAPORT_MARINA_HARBOR|SKI_AREA|SUPERMARKET_GROCERY|TAXI_STATION|TRANSPORTATION|TRASH_AND_RECYCLING_FACILITIES)",
  43. landmarkPoi="(RIVER_STREAM|CANAL|SEA_LAKE_POOL|SWAMP_MARSH|ISLAND|FOREST_GROVE|BRIDGE)",
  44. excepCatPoi="(RIVER_STREAM|CANAL|SEA_LAKE_POOL|SWAMP_MARSH|ISLAND|FOREST_GROVE|BRIDGE|PARK|JUNCTION_INTERCHANGE|CEMETERY|TUNNEL)",
  45. entryPointPoi="(BRIDGE|CANAL|FOREST_GROVE|ISLAND|JUNCTION_INTERCHANGE|POOL|RIVER_STREAM|SEA_LAKE_POOL|SWAMP_MARSH|TUNNEL)",
  46. wazeBot="(admin|avseu|WazeFeed|waze-maint-bot|Waze3rdparty)";
  47.  
  48. // *********************
  49. // ** HELPER FUNCTION **
  50. // *********************
  51. function getId(node) {
  52. return document.getElementById(node);
  53. }
  54. function getElementsByClassName(classname, node) {
  55. node || (node=document.getElementsByTagName("body")[0]);
  56. for (var a=[], re=new RegExp("\\b" + classname + "\\b"), els=
  57. node.getElementsByTagName("*"), i=
  58. 0, j=
  59. els.length;i < j;i++) {
  60. re.test(els[i].className) && a.push(els[i]);
  61. }
  62. return a;
  63. }
  64. function IsJsonString(str) {
  65. try {
  66. JSON.parse(str);
  67. } catch (e) {
  68. return false;
  69. }
  70. return true;
  71. }
  72. function getSelectedFeatures(){
  73. if(!W.selectionManager.getSelectedFeatures)
  74. return W.selectionManager.selectedItems;
  75. return W.selectionManager.getSelectedFeatures();
  76. }
  77. function openInNewTab(url) {
  78. var win = window.open('https://wazeopedia.waze.com/wiki/France/' + url, '_blank');
  79. win.focus();
  80. }
  81. function onScreen(obj) {
  82. if (obj.geometry) {
  83. return(W.map.getExtent().intersectsBounds(obj.geometry.getBounds()));
  84. }
  85. return(false);
  86. }
  87.  
  88. // *************
  89. // ** INIT **
  90. // *************
  91. function CErrors_bootstrap() {
  92. if (typeof unsafeWindow === "undefined") {
  93. unsafeWindow =( function () {
  94. var dummyElem=document.createElement('p');
  95. dummyElem.setAttribute('onclick', 'return window;');
  96. return dummyElem.onclick();
  97. }) ();
  98. }
  99. console.log("starting WME Color Errors", GM_info.script.version);
  100. CErrors_init();
  101. fixTel();
  102. }
  103. function CErrors_init(){
  104. // W object needed
  105. CErrWaze=unsafeWindow.W; if(typeof(CErrWaze) === 'undefined'){ if (debug) { console.error("WME ColorErrors - CErrWaze : NOK"); } window.setTimeout(CErrors_init, 500); return; }
  106. CErrorsMap=CErrWaze.map; if(typeof(CErrorsMap) == 'undefined'){ if (debug) { console.error("WME ColorErrors - CErrorsmap : NOK"); } window.setTimeout(CErrors_init, 500); return; }
  107. CErrorsModel=CErrWaze.model; if(typeof(CErrorsModel) == 'undefined'){ if (debug) { console.error("WME ColorErrors - CErrorsmodel : NOK"); } window.setTimeout(CErrors_init, 500); return; }
  108. if(typeof(CErrorsModel.getTopCountry()) === 'undefined' || CErrorsModel.getTopCountry() === null){ if (debug) { console.error("WME ColorErrors - CErrorsmodel Countries top : NOK"); } window.setTimeout(CErrors_init, 500); return; }
  109. CErrorsI18n=unsafeWindow.I18n; if(typeof (CErrorsI18n) == 'undefined') { if (debug) { console.error('WME ColorErrors - CErrorsI18n : NOK'); } setTimeout(CErrors_init, 500); return; }
  110. // OpenLayers
  111. CErrorsOpenLayers=unsafeWindow.OpenLayers; if(typeof(CErrorsOpenLayers) === 'undefined'){ if (debug) { console.error("WME ColorErrors - OL : NOK"); } window.setTimeout(CErrors_init, 500); return; }
  112. // Waze GUI needed
  113. CErrorshandle=getId("user-info"); if(typeof(CErrorshandle) == 'undefined'){ window.setTimeout(CErrors_init, 500); return; }
  114. CErrorshandleClass=getElementsByClassName("nav-tabs", CErrorshandle)[0]; if(typeof(CErrorshandleClass) === 'undefined'){ window.setTimeout(CErrors_init, 500); return; }
  115. CErrorshandleClass2=getElementsByClassName("tab-content", CErrorshandle)[0]; if(typeof(CErrorshandleClass2) === 'undefined'){ window.setTimeout(CErrors_init, 500); return; }
  116.  
  117. // Verify localStorage. Init if empty or not correct
  118. if (typeof(localStorage.WMEColorErrors) === "undefined" || localStorage.WMEColorErrors.lenght===null || !IsJsonString(localStorage.WMEColorErrors)) {
  119. WMECErrors.opacity=0.85; // Icons Opacity on map
  120. WMECErrors.myLvl=false; // Show when editable
  121. WMECErrors.seg_Bad=false; // Bad Segments (group)
  122. WMECErrors.seg_Priv=true; // Private with bad name
  123. WMECErrors.seg_Park=true; // Parking with name (but Place / Square)
  124. WMECErrors.seg_Rail=true; // Railroad with bad name
  125. WMECErrors.seg_HW_name=true; //Highways with bad name
  126. WMECErrors.seg_Dir_name=true; // Directions but not Ramp/Freeway
  127. WMECErrors.seg_Toll=true; // Toll (but Ramp/Freeway)
  128. WMECErrors.seg_Ramp_name=true; // Ramp with 3 directions or more
  129. WMECErrors.seg_Ramp_city=true; // Ramp with city name
  130. WMECErrors.seg_RShield=true; // Wrong prefix
  131. WMECErrors.seg_RSAlt=true; //Roadshield must be in alt
  132. WMECErrors.seg_SNameAlt=true; //Road name must be in alt
  133. WMECErrors.seg_DleSpace=true; // Double space in name
  134. WMECErrors.seg_SegBadRS=true; // RoadShield but bad type
  135. WMECErrors.seg_HNFree=true; // House number on Freeway or ramp
  136. WMECErrors.seg_BadSpeed=true; // Bad speed (ex: >80km/h in city)
  137. WMECErrors.seg_BadAltState=true; // Alt State != Main State
  138. WMECErrors.seg_EmptyCityAlt=true; // Alt City is empty
  139. WMECErrors.seg_LockValue=true; // Bad lock
  140. // POI
  141. WMECErrors.poi_Bad=false; // Bad POI (group)
  142. WMECErrors.poi_Park_name=true; // Parking with [P]
  143. WMECErrors.poi_Address=true; // Dxxx/Nxxx in or no address
  144. WMECErrors.poi_Entry=true; // Entry Point not defined
  145. WMECErrors.poi_LandM=true; // Landmark with address (street |& city)
  146. WMECErrors.poi_DleSpace=true; // Double space in name
  147. // Low errors
  148. WMECErrors.poi_Resid=true; // Maybe a residential
  149. WMECErrors.poi_Google=true; // No link with Google
  150. WMECErrors.poi_Phone=true; // bad phone number format
  151. WMECErrors.poi_WFeed=true; // Place created by WazeFeed
  152. WMECErrors.poi_WPark=true; // Place created by WazeParking1
  153. WMECErrors.poi_Relig=true; // Religious Center with bad name
  154. WMECErrors.poi_Transp=true; // Bad type or bad name for Buses, Subway or Tramway
  155. WMECErrors.poi_GasSta=true; // Gas Station with bad name
  156. WMECErrors.poi_Other=true; // Place "Other"
  157. //Autolock
  158. WMECErrors.autoLock=true; // Autolock
  159. localStorage.setItem('WMEColorErrors', JSON.stringify(WMECErrors));
  160. }
  161.  
  162. // WME Layers check
  163. var layersColor=CErrorsMap.getLayersBy("uniqueName","__WME_Color_Errors"), layersIcons=CErrorsMap.getLayersBy("uniqueName","__WME_Color_Errors_Icons");
  164. var ColorErrors_style=new CErrorsOpenLayers.Style({
  165. pointRadius: 2,
  166. fontWeight: "normal",
  167. label : "${labelText}",
  168. fontFamily: "Tahoma, Courier New",
  169. labelOutlineColor: "#FFFFFF",
  170. labelOutlineWidth: 2,
  171. fontColor: '#000000',
  172. fontSize: "10px"
  173. });
  174. if (layersColor.length === 0) {
  175. ColorErrors_mapLayer=new CErrorsOpenLayers.Layer.Vector("Color Errors", {
  176. displayInLayerSwitcher: false,
  177. uniqueName: "__WME_Color_Errors",
  178. styleMap: new CErrorsOpenLayers.StyleMap(ColorErrors_style)
  179. });
  180. CErrorsI18n.translations[CErrorsI18n.locale].layers.name["__WME_Color_Errors"]="Color Errors";
  181. CErrorsMap.addLayer(ColorErrors_mapLayer);
  182. ColorErrors_mapLayer.setVisibility(true);
  183. }
  184. if (layersIcons.length === 0) {
  185. ColorErrors_mapLayerIcons=new CErrorsOpenLayers.Layer.Vector("Color Errors Icons", {
  186. displayInLayerSwitcher: false,
  187. uniqueName: "__WME_Color_Errors_Icons",
  188. styleMap: new CErrorsOpenLayers.StyleMap(ColorErrors_style)
  189. });
  190. CErrorsI18n.translations[CErrorsI18n.locale].layers.name["__WME_Color_Errors_Icons"]="Color Errors Icons";
  191. CErrorsMap.addLayer(ColorErrors_mapLayerIcons);
  192. ColorErrors_mapLayerIcons.setVisibility(true);
  193. }
  194. UpdateObject = require("Waze/Action/UpdateObject");
  195. ActiveCountry = W.model.getTopCountry().abbr;
  196. ABBR = cntryDB[ActiveCountry];
  197. CErrors_Mainhtml();
  198. }
  199. function CErrAddInfo(){
  200. if (getSelectedFeatures().length !== 0 && !getId('ErrorsList')) {
  201. var CEtest = document.createElement('li');
  202. CEtest.id = "ErrorsList";
  203. if(getElementsByClassName('additional-attributes')[0]) getElementsByClassName('additional-attributes')[0].appendChild(CEtest);
  204. }
  205. }
  206.  
  207. // *************
  208. // ** HTML **
  209. // *************
  210. function CErrors_Mainhtml() {
  211. if (CErrorsI18n.locale == 'fr') {
  212. CErrSeg=new Array('Contrôle des segments',
  213. 'Mauvais segments',
  214. 'Voie privée avec possible mauvais nom',
  215. 'Voie de Parking nommée',
  216. 'Voie ferrée nommée ou nom en alt',
  217. 'Types Routes avec mauvais nom',
  218. 'Bretelle avec plusieurs directions',
  219. 'Direction (sauf bretelle et Autoroute)',
  220. 'Mauvais préfixe (RoadShield)',
  221. 'Double espace dans le nom',
  222. 'Péage (sauf bretelle et Autoroute)',
  223. 'Bretelle/Autoroute avec nom de ville',
  224. 'Le RoadShield doit être en alt',
  225. 'Le nom de route doit être en alt',
  226. 'RoadShield sur mauvais type de voie',
  227. 'N° de rue sur mauvais type de voie',
  228. 'Mauvaise vitesse validée',
  229. 'Département alt différent du principal',
  230. 'Lock non conforme (Auto ou valeur)',
  231. 'Alt non conforme'
  232. );
  233. CErrPoi=new Array('Contrôle des places',
  234. 'Mauvaises places',
  235. 'Parking mal nommé ou sans nom',
  236. 'Pas d\'adresse ou contenant Dxxx/Nxxx',
  237. 'Point d\'entrée non défini',
  238. 'Site naturel avec adresse',
  239. 'Double espace dans le nom',
  240. 'Peut-être une place résidentielle',
  241. 'Pas de lien avec Google',
  242. 'Lieu édité par WazeFeed',
  243. 'Lieu de type "Autres"',
  244. 'Lieu édité par WazeParking1',
  245. 'Parking : type non défini',
  246. 'Mauvais format du n° de tel',
  247. 'Lieu de culte (nom ou catégorie)',
  248. 'Transport (nom ou catégorie)',
  249. 'Station-Service mal nommée',
  250. );
  251. CErrLeg=new Array('Légende',
  252. 'A corriger',
  253. 'A vérifier',
  254. 'Pour information',
  255. 'Réglages',
  256. 'Opacité des icônes',
  257. 'Afficher seulements les éditables',
  258. 'Verrouillé par la publicité',
  259. 'Auto-verrouillage'
  260. );
  261. }
  262. else {
  263. CErrSeg=new Array('Segments Checking',
  264. 'Bad Segments',
  265. 'Private with possible bad name',
  266. 'Parking with bad name or without',
  267. 'Railroad with name or altname',
  268. 'Highways with bad name',
  269. 'Ramp with several directions',
  270. 'Direction (but Ramp/Freeway)',
  271. 'Wrong prefix (RoadShield)',
  272. 'Double spacing in name',
  273. 'Toll (but Ramp/Freeway)',
  274. 'Ramp/Freeway with city name',
  275. 'RoadShield must be in alt',
  276. 'Road name must be in alt',
  277. 'RoadShield but bad type',
  278. 'HN but bad type',
  279. 'Bad speed verified',
  280. 'Alt State dirrent to Main State',
  281. 'Bad lock (Auto or value)',
  282. 'Bad Alt'
  283. );
  284. CErrPoi=new Array('Places Checking',
  285. 'Bad Places',
  286. 'Parking with bad name or null',
  287. 'No address or Dxxx/Nxxx within',
  288. 'Entry Point not defined',
  289. 'Natural features with address',
  290. 'Double spacing in name',
  291. 'Maybe a residential place',
  292. 'No link with Google',
  293. 'Place created by WazeFeed',
  294. 'Place type is "Other"',
  295. 'Place created by WazeParking1',
  296. 'Parking : type undefined',
  297. 'Bad phone number format',
  298. 'Religious Center (name or cat)',
  299. 'Transportation (name or cat)',
  300. 'Gas Station with bad name'
  301. );
  302. CErrLeg=new Array('Legend',
  303. 'To correct',
  304. 'To check',
  305. 'For information',
  306. 'Settings',
  307. 'Icons opacity',
  308. 'Show when editable',
  309. 'Locked by ad',
  310. 'Autolock'
  311. );
  312. }
  313. //Create content in CErrors's tab
  314. var CEnewtab=document.createElement('li');
  315. CEnewtab.innerHTML="<a href='#sidepanel-ColorErrors' data-toggle='tab'><span class='fa fa-eye' title='Color Errors'></span></a>";
  316. CErrorshandleClass.appendChild(CEnewtab);
  317.  
  318. var WMECErrors=JSON.parse(localStorage.getItem('WMEColorErrors'));
  319. if (typeof(WMECErrors.autoLock) == "undefined") { WMECErrors.autoLock=false; }
  320. var CEaddon=document.createElement('section');
  321. CEaddon.id="sidepanel-ColorErrors";
  322. var CEcontent='<div style="float:left; margin-left:5px;padding-bottom:10px;"><b><a href="https://gf.qytechs.cn/fr/scripts/21186-wme-color-errors" target="_blank"><u>WME Color Errors</u></a></b> v'+ GM_info.script.version +'</div>'
  323. + '<H6 style="float:left;clear:both;">'+CErrLeg[4]+'</H6><span style="float:left;clear:both;font-weight:bold;margin-top:10px;">'+CErrLeg[5]+'</span><input id="errOpacity" type="range" max="1" min="0" step="0.05" style="float:left;width:240px;"><div id="opacityValue" style="float:left;font-weight:bold;padding-left:10px;"></div>'
  324. + '<div style="float:left;clear:both;"><input type="checkbox" id="_myLvl"'+(WMECErrors.myLvl ? ' checked' : '')+'/> '+CErrLeg[6]+'</div>'
  325. + '<br><br><H6 style="float:left;margin-top:10px;">'+CErrSeg[0]+'</H6><div style="clear:both;">'
  326. + '<input type="checkbox" id="_seg_Bad"'+(WMECErrors.seg_Bad ? ' checked' : '')+'/> <label for="_seg_Bad" style="font-weight:normal;">'+CErrSeg[1]+'</label><br><div id="BadSeg" style="margin-left:5px;"><table>'
  327. + fillHtml("seg_Priv", "seg_Bad","#ff7700","\uf256",CErrSeg[2])
  328. + fillHtml("seg_Ramp_name", "seg_Bad","#ff7700","\uf25a",CErrSeg[6])
  329. + fillHtml("seg_BadSpeed", "seg_Bad","#ff7700","\uf1ce",CErrSeg[16])
  330. + fillHtml("seg_BadAltState","seg_Bad","#ff7700","\uf037",CErrSeg[17])
  331. + fillHtml("seg_EmptyCityAlt","seg_Bad","#ff7700","\uf064",CErrSeg[19])
  332. + fillHtml("seg_LockValue", "seg_Bad","#ff7700","\uf023",CErrSeg[18])
  333. + fillHtml("seg_Park", "seg_Bad","#ff0000","\uf288",CErrSeg[3])
  334. + fillHtml("seg_Rail", "seg_Bad","#ff0000","\uf238",CErrSeg[4])
  335. + fillHtml("seg_Dir_name", "seg_Bad","#ff0000","\uf0a9",CErrSeg[7])
  336. + fillHtml("seg_Toll", "seg_Bad","#ff0000","\uf155",CErrSeg[10])
  337. + fillHtml("seg_Ramp_city", "seg_Bad","#ff0000","\uf015",CErrSeg[11])
  338. + fillHtml("seg_SNameAlt", "seg_Bad","#ff0000","\uf079",CErrSeg[13])
  339. + fillHtml("seg_DleSpace", "seg_Bad","#ff0000","\uf101",CErrSeg[9])
  340. + fillHtml("seg_HW_name", "seg_Bad","#ff0000","\uf018",CErrSeg[5])
  341. + fillHtml("seg_RSAlt", "seg_Bad","#ff0000","\uf074",CErrSeg[12])
  342. + fillHtml("seg_RShield", "seg_Bad","#ff0000","\uf152",CErrSeg[8])
  343. + fillHtml("seg_SegBadRS", "seg_Bad","#ff0000","\uf044",CErrSeg[14])
  344. + fillHtml("seg_HNFree", "seg_Bad","#ff0000","\uf162",CErrSeg[15])
  345.  
  346. + '</table></div></div><br><H6 style="float:left;">'+CErrPoi[0]+'</H6><div style="clear:both;"><tr><td><input type="checkbox" id="_poi_Bad"'+(WMECErrors.poi_Bad ? ' checked' : '')+'/> <label for="_poi_Bad" style="font-weight:normal;">'+CErrPoi[1]+'</label><br><div id="BadPoi" style="margin-left:5px;"><table>'
  347. + fillHtml("poi_Address", "poi_Bad","#ff0000","\uf2bc",CErrPoi[3])
  348. + fillHtml("poi_LandM", "poi_Bad","#ff0000","\uf1bb",CErrPoi[5])
  349. + fillHtml("poi_DleSpace", "poi_Bad","#ff0000","\uf101",CErrPoi[6])
  350. + fillHtml("poi_Transp", "poi_Bad","#ff0000","\uf207",CErrPoi[15])
  351. + fillHtml("poi_GasSta", "poi_Bad","#ff0000","\uf1b9",CErrPoi[16])
  352. + fillHtml("poi_Park_name","poi_Bad","#ff0000","\uf288",CErrPoi[2])
  353. + fillHtml("poi_Park_type","poi_Bad","#ff0000","\uf11d",CErrPoi[12])
  354. + fillHtml("poi_Relig", "poi_Bad","#ff0000","\uf015",CErrPoi[14])
  355. + fillHtml("poi_Entry", "poi_Bad","#ff7700","\uf18e",CErrPoi[4])
  356. + fillHtml("poi_Resid", "poi_Bad","#ff7700","\uf015",CErrPoi[7])
  357. + fillHtml("poi_Google", "poi_Bad","#ff7700","\uf1a0",CErrPoi[8])
  358. + fillHtml("poi_Phone", "poi_Bad","#ff7700","\uf095",CErrPoi[13])
  359. + fillHtml("poi_Other", "poi_Bad","#ff7700","\uf29c",CErrPoi[10])
  360. + fillHtml("poi_WFeed", "poi_Bad","#ffcc00","\uf263",CErrPoi[9])
  361. + fillHtml("poi_WPark", "poi_Bad","#ffcc00","\uf263",CErrPoi[11])
  362. + '</table></div></div><br><H6 style="float:left;">'+CErrLeg[0]+'</H6><div style="clear:both;">'
  363. + '<table><tr><td><div style="margin:5px;width:30px;height:2px;background-color:#ff0000;"></div></td><td>'+CErrLeg[1]+'</td></tr>'
  364. + '<tr><td><div style="margin:5px;width:30px;height:2px;background-color:#ff7700;"></div></td><td>'+CErrLeg[2]+'</td></tr>'
  365. + '<tr><td><div style="margin:5px;width:30px;height:2px;background-color:#ffcc00;"></div></td><td>'+CErrLeg[3]+'</td></tr>'
  366.  
  367. + '</table></div></div><div id="CMOnly"><br><H6 style="float:left;">'+CErrLeg[8]+'</H6><div style="clear:both;"><tr><td><input type="checkbox" id="_autoLock"'+(WMECErrors.autoLock ? ' checked' : '')+(typeof(ABBR) == 'undefined' ? 'disabled' : ' ')+'/> <label id="_autoLockLabel" for="_autoLock" style="font-weight:normal;">'+CErrLeg[8]+' ('+W.model.getTopCountry().name+')</label><br><div id="AutoLock" style="margin-left:5px;"><table>'
  368. + fillHtmlAL("Freeway",I18n.translations[I18n.locale].segment.road_types[3], (typeof(ABBR) == 'undefined' ? 'N/A' : (ABBR.fwy_lvl+1)))
  369. + fillHtmlAL("Ramp", I18n.translations[I18n.locale].segment.road_types[4], (typeof(ABBR) == 'undefined' ? 'N/A' : (ABBR.rmp_lvl+1)))
  370. + fillHtmlAL("Major", I18n.translations[I18n.locale].segment.road_types[6], (typeof(ABBR) == 'undefined' ? 'N/A' : (ABBR.maj_lvl+1)))
  371. + fillHtmlAL("Minor", I18n.translations[I18n.locale].segment.road_types[7], (typeof(ABBR) == 'undefined' ? 'N/A' : (ABBR.min_lvl+1)))
  372. + fillHtmlAL("Primary",I18n.translations[I18n.locale].segment.road_types[2], (typeof(ABBR) == 'undefined' ? 'N/A' : (ABBR.pri_lvl+1)))
  373. + fillHtmlAL("Street", I18n.translations[I18n.locale].segment.road_types[1], (typeof(ABBR) == 'undefined' ? 'N/A' : (ABBR.str_lvl+1)))
  374. + fillHtmlAL("Railway",I18n.translations[I18n.locale].segment.road_types[18],(typeof(ABBR) == 'undefined' ? 'N/A' : (ABBR.rwy_lvl+1)))
  375. + fillHtmlAL("Narrow", I18n.translations[I18n.locale].segment.road_types[22],(typeof(ABBR) == 'undefined' ? 'N/A' : (ABBR.nar_lvl+1)))
  376. + '</table></div></div>';
  377.  
  378. CEaddon.innerHTML=CEcontent;
  379. CEaddon.className='tab-pane';
  380. CErrorshandleClass2.appendChild(CEaddon);
  381.  
  382. getId('errOpacity').value=WMECErrors.opacity;
  383. getId('opacityValue').innerHTML = getId('errOpacity').value;
  384. getId('errOpacity').onmousemove = function(){
  385. getId('opacityValue').innerHTML = getId('errOpacity').value;
  386. var ls=JSON.parse(localStorage.WMEColorErrors);
  387. ls.opacity=getId('errOpacity').value;
  388. localStorage.setItem('WMEColorErrors', JSON.stringify(ls));
  389. CErrColor();
  390. };
  391. getId('_myLvl').onclick=(function(){
  392. var ls=JSON.parse(localStorage.WMEColorErrors);
  393. (getId('_myLvl').checked === true ? ls.myLvl=true : ls.myLvl=false);
  394. localStorage.setItem('WMEColorErrors', JSON.stringify(ls));
  395. CErrColor();
  396. });
  397. getId('_seg_Bad').onclick=(function(){
  398. var ls=JSON.parse(localStorage.WMEColorErrors);
  399. if (getId('_seg_Bad').checked === true) {
  400. for (var i=0; getElementsByClassName('_seg', BadSeg) [i]; i++) getElementsByClassName('_seg', BadSeg) [i].disabled=false;
  401. ls.seg_Bad=true;
  402. }
  403. else {
  404. for (var i=0; getElementsByClassName('_seg', BadSeg) [i]; i++) getElementsByClassName('_seg', BadSeg) [i].disabled=true;
  405. ls.seg_Bad=false;
  406. }
  407. localStorage.setItem('WMEColorErrors', JSON.stringify(ls));
  408. CErrColor();
  409. });
  410. getId('_poi_Bad').onclick=(function(){
  411. var ls=JSON.parse(localStorage.WMEColorErrors);
  412. if (getId('_poi_Bad').checked === true) {
  413. for (var i=0; getElementsByClassName('_poi', BadPoi) [i]; i++) getElementsByClassName('_poi', BadPoi) [i].disabled=false;
  414. ls.poi_Bad=true;
  415. }
  416. else {
  417. for (var i=0; getElementsByClassName('_poi', BadPoi) [i]; i++) getElementsByClassName('_poi', BadPoi) [i].disabled=true;
  418. ls.poi_Bad=false;
  419. }
  420. localStorage.setItem('WMEColorErrors', JSON.stringify(ls));
  421. CErrColor();
  422. });
  423. getId('_autoLock').onclick=(function(){
  424. var ls=JSON.parse(localStorage.WMEColorErrors);
  425. if (getId('_autoLock').checked === true) {
  426. for (var i=0; getElementsByClassName('_auto', AutoLock) [i]; i++) getElementsByClassName('_auto', AutoLock) [i].disabled=false;
  427. ls.autoLock=true;
  428. getId('addLockButton').className = 'fabkm fa fa-lock';
  429. getId('addLockButton').style.color = '#7f0';
  430. }
  431. else {
  432. for (var i=0; getElementsByClassName('_auto', AutoLock) [i]; i++) getElementsByClassName('_auto', AutoLock) [i].disabled=true;
  433. ls.autoLock=false;
  434. getId('addLockButton').className = 'fabkm fa fa-unlock';
  435. getId('addLockButton').style.color = '#f60';
  436. }
  437. localStorage.setItem('WMEColorErrors', JSON.stringify(ls));
  438. CErrColor();
  439. });
  440.  
  441. getId('_seg_Priv').onclick=(function(){ var ls=JSON.parse(localStorage.WMEColorErrors); (getId('_seg_Priv').checked === true) ? ls.seg_Priv=true : ls.seg_Priv=false; localStorage.setItem('WMEColorErrors', JSON.stringify(ls)); CErrColor(); });
  442. getId('_seg_Park').onclick=(function(){ var ls=JSON.parse(localStorage.WMEColorErrors); (getId('_seg_Park').checked === true) ? ls.seg_Park=true : ls.seg_Park=false; localStorage.setItem('WMEColorErrors', JSON.stringify(ls)); CErrColor(); });
  443. getId('_seg_Rail').onclick=(function(){ var ls=JSON.parse(localStorage.WMEColorErrors); (getId('_seg_Rail').checked === true) ? ls.seg_Rail=true : ls.seg_Rail=false; localStorage.setItem('WMEColorErrors', JSON.stringify(ls)); CErrColor(); });
  444. getId('_seg_HW_name').onclick=(function(){ var ls=JSON.parse(localStorage.WMEColorErrors); (getId('_seg_HW_name').checked === true) ? ls.seg_HW_name=true : ls.seg_HW_name=false; localStorage.setItem('WMEColorErrors', JSON.stringify(ls)); CErrColor(); });
  445. getId('_seg_Dir_name').onclick=(function(){ var ls=JSON.parse(localStorage.WMEColorErrors); (getId('_seg_Dir_name').checked === true) ? ls.seg_Dir_name=true : ls.seg_Dir_name=false; localStorage.setItem('WMEColorErrors', JSON.stringify(ls)); CErrColor(); });
  446. getId('_seg_Toll').onclick=(function(){ var ls=JSON.parse(localStorage.WMEColorErrors); (getId('_seg_Toll').checked === true) ? ls.seg_Toll=true : ls.seg_Toll=false; localStorage.setItem('WMEColorErrors', JSON.stringify(ls)); CErrColor(); });
  447. getId('_seg_Ramp_name').onclick=(function(){ var ls=JSON.parse(localStorage.WMEColorErrors); (getId('_seg_Ramp_name').checked === true) ? ls.seg_Ramp_name=true : ls.seg_Ramp_name=false; localStorage.setItem('WMEColorErrors', JSON.stringify(ls)); CErrColor(); });
  448. getId('_seg_Ramp_city').onclick=(function(){ var ls=JSON.parse(localStorage.WMEColorErrors); (getId('_seg_Ramp_city').checked === true) ? ls.seg_Ramp_city=true : ls.seg_Ramp_city=false; localStorage.setItem('WMEColorErrors', JSON.stringify(ls)); CErrColor(); });
  449. getId('_seg_RShield').onclick=(function(){ var ls=JSON.parse(localStorage.WMEColorErrors); (getId('_seg_RShield').checked === true) ? ls.seg_RShield=true : ls.seg_RShield=false; localStorage.setItem('WMEColorErrors', JSON.stringify(ls)); CErrColor(); });
  450. getId('_seg_RSAlt').onclick=(function(){ var ls=JSON.parse(localStorage.WMEColorErrors); (getId('_seg_RSAlt').checked === true) ? ls.seg_RSAlt=true : ls.seg_RSAlt=false; localStorage.setItem('WMEColorErrors', JSON.stringify(ls)); CErrColor(); });
  451. getId('_seg_SNameAlt').onclick=(function(){ var ls=JSON.parse(localStorage.WMEColorErrors); (getId('_seg_SNameAlt').checked === true) ? ls.seg_SNameAlt=true : ls.seg_SNameAlt=false; localStorage.setItem('WMEColorErrors', JSON.stringify(ls)); CErrColor(); });
  452. getId('_seg_DleSpace').onclick=(function(){ var ls=JSON.parse(localStorage.WMEColorErrors); (getId('_seg_DleSpace').checked === true) ? ls.seg_DleSpace=true : ls.seg_DleSpace=false; localStorage.setItem('WMEColorErrors', JSON.stringify(ls)); CErrColor(); });
  453. getId('_seg_SegBadRS').onclick=(function(){ var ls=JSON.parse(localStorage.WMEColorErrors); (getId('_seg_SegBadRS').checked === true) ? ls.seg_SegBadRS=true : ls.seg_SegBadRS=false; localStorage.setItem('WMEColorErrors', JSON.stringify(ls)); CErrColor(); });
  454. getId('_seg_HNFree').onclick=(function(){ var ls=JSON.parse(localStorage.WMEColorErrors); (getId('_seg_HNFree').checked === true) ? ls.seg_HNFree=true : ls.seg_HNFree=false; localStorage.setItem('WMEColorErrors', JSON.stringify(ls)); CErrColor(); });
  455. getId('_seg_BadSpeed').onclick=(function(){ var ls=JSON.parse(localStorage.WMEColorErrors); (getId('_seg_BadSpeed').checked === true) ? ls.seg_BadSpeed=true : ls.seg_BadSpeed=false; localStorage.setItem('WMEColorErrors', JSON.stringify(ls)); CErrColor(); });
  456. getId('_seg_BadAltState').onclick=(function(){ var ls=JSON.parse(localStorage.WMEColorErrors); (getId('_seg_BadAltState').checked === true) ? ls.seg_BadAltState=true : ls.seg_BadAltState=false; localStorage.setItem('WMEColorErrors', JSON.stringify(ls)); CErrColor(); });
  457. getId('_seg_EmptyCityAlt').onclick=(function(){ var ls=JSON.parse(localStorage.WMEColorErrors); (getId('_seg_EmptyCityAlt').checked === true) ? ls.seg_EmptyCityAlt=true : ls.seg_EmptyCityAlt=false; localStorage.setItem('WMEColorErrors', JSON.stringify(ls)); CErrColor(); });
  458. getId('_seg_LockValue').onclick=(function(){ var ls=JSON.parse(localStorage.WMEColorErrors); (getId('_seg_LockValue').checked === true) ? ls.seg_LockValue=true : ls.seg_LockValue=false; localStorage.setItem('WMEColorErrors', JSON.stringify(ls)); CErrColor(); });
  459.  
  460. getId('_poi_Park_name').onclick=(function(){ var ls=JSON.parse(localStorage.WMEColorErrors); (getId('_poi_Park_name').checked === true) ? ls.poi_Park_name=true : ls.poi_Park_name=false; localStorage.setItem('WMEColorErrors', JSON.stringify(ls)); CErrColor(); });
  461. getId('_poi_Park_type').onclick=(function(){ var ls=JSON.parse(localStorage.WMEColorErrors); (getId('_poi_Park_type').checked === true) ? ls.poi_Park_type=true : ls.poi_Park_type=false; localStorage.setItem('WMEColorErrors', JSON.stringify(ls)); CErrColor(); });
  462. getId('_poi_Address').onclick=(function(){ var ls=JSON.parse(localStorage.WMEColorErrors); (getId('_poi_Address').checked === true) ? ls.poi_Address=true : ls.poi_Address=false; localStorage.setItem('WMEColorErrors', JSON.stringify(ls)); CErrColor(); });
  463. getId('_poi_Entry').onclick=(function(){ var ls=JSON.parse(localStorage.WMEColorErrors); (getId('_poi_Entry').checked === true) ? ls.poi_Entry=true : ls.poi_Entry=false; localStorage.setItem('WMEColorErrors', JSON.stringify(ls)); CErrColor(); });
  464. getId('_poi_LandM').onclick=(function(){ var ls=JSON.parse(localStorage.WMEColorErrors); (getId('_poi_LandM').checked === true) ? ls.poi_LandM=true : ls.poi_LandM=false; localStorage.setItem('WMEColorErrors', JSON.stringify(ls)); CErrColor(); });
  465. getId('_poi_DleSpace').onclick=(function(){ var ls=JSON.parse(localStorage.WMEColorErrors); (getId('_poi_DleSpace').checked === true) ? ls.poi_DleSpace=true : ls.poi_DleSpace=false; localStorage.setItem('WMEColorErrors', JSON.stringify(ls)); CErrColor(); });
  466. getId('_poi_Resid').onclick=(function(){ var ls=JSON.parse(localStorage.WMEColorErrors); (getId('_poi_Resid').checked === true) ? ls.poi_Resid=true : ls.poi_Resid=false; localStorage.setItem('WMEColorErrors', JSON.stringify(ls)); CErrColor(); });
  467. getId('_poi_Google').onclick=(function(){ var ls=JSON.parse(localStorage.WMEColorErrors); (getId('_poi_Google').checked === true) ? ls.poi_Google=true : ls.poi_Google=false; localStorage.setItem('WMEColorErrors', JSON.stringify(ls)); CErrColor(); });
  468. getId('_poi_Phone').onclick=(function(){ var ls=JSON.parse(localStorage.WMEColorErrors); (getId('_poi_Phone').checked === true) ? ls.poi_Phone=true : ls.poi_Phone=false; localStorage.setItem('WMEColorErrors', JSON.stringify(ls)); CErrColor(); });
  469. getId('_poi_WFeed').onclick=(function(){ var ls=JSON.parse(localStorage.WMEColorErrors); (getId('_poi_WFeed').checked === true) ? ls.poi_WFeed=true : ls.poi_WFeed=false; localStorage.setItem('WMEColorErrors', JSON.stringify(ls)); CErrColor(); });
  470. getId('_poi_WPark').onclick=(function(){ var ls=JSON.parse(localStorage.WMEColorErrors); (getId('_poi_WPark').checked === true) ? ls.poi_WPark=true : ls.poi_WPark=false; localStorage.setItem('WMEColorErrors', JSON.stringify(ls)); CErrColor(); });
  471. getId('_poi_Relig').onclick=(function(){ var ls=JSON.parse(localStorage.WMEColorErrors); (getId('_poi_Relig').checked === true) ? ls.poi_Relig=true : ls.poi_Relig=false; localStorage.setItem('WMEColorErrors', JSON.stringify(ls)); CErrColor(); });
  472. getId('_poi_Other').onclick=(function(){ var ls=JSON.parse(localStorage.WMEColorErrors); (getId('_poi_Other').checked === true) ? ls.poi_Other=true : ls.poi_Other=false; localStorage.setItem('WMEColorErrors', JSON.stringify(ls)); CErrColor(); });
  473. getId('_poi_Transp').onclick=(function(){ var ls=JSON.parse(localStorage.WMEColorErrors); (getId('_poi_Transp').checked === true) ? ls.poi_Transp=true : ls.poi_Transp=false; localStorage.setItem('WMEColorErrors', JSON.stringify(ls)); CErrColor(); });
  474. getId('_poi_GasSta').onclick=(function(){ var ls=JSON.parse(localStorage.WMEColorErrors); (getId('_poi_GasSta').checked === true) ? ls.poi_GasSta=true : ls.poi_GasSta=false; localStorage.setItem('WMEColorErrors', JSON.stringify(ls)); CErrColor(); });
  475.  
  476. getId('_Freeway').onclick=(function(){ var ls=JSON.parse(localStorage.WMEColorErrors); (getId('_Freeway').checked === true) ? ls.Freeway=true : ls.Freeway=false; localStorage.setItem('WMEColorErrors', JSON.stringify(ls)); CErrColor(); });
  477. getId('_Ramp').onclick=(function(){ var ls=JSON.parse(localStorage.WMEColorErrors); (getId('_Ramp').checked === true) ? ls.Ramp=true : ls.Ramp=false; localStorage.setItem('WMEColorErrors', JSON.stringify(ls)); CErrColor(); });
  478. getId('_Major').onclick=(function(){ var ls=JSON.parse(localStorage.WMEColorErrors); (getId('_Major').checked === true) ? ls.Major=true : ls.Major=false; localStorage.setItem('WMEColorErrors', JSON.stringify(ls)); CErrColor(); });
  479. getId('_Minor').onclick=(function(){ var ls=JSON.parse(localStorage.WMEColorErrors); (getId('_Minor').checked === true) ? ls.Minor=true : ls.Minor=false; localStorage.setItem('WMEColorErrors', JSON.stringify(ls)); CErrColor(); });
  480. getId('_Primary').onclick=(function(){ var ls=JSON.parse(localStorage.WMEColorErrors); (getId('_Primary').checked === true) ? ls.Primary=true : ls.Primary=false; localStorage.setItem('WMEColorErrors', JSON.stringify(ls)); CErrColor(); });
  481. getId('_Street').onclick=(function(){ var ls=JSON.parse(localStorage.WMEColorErrors); (getId('_Street').checked === true) ? ls.Street=true : ls.Street=false; localStorage.setItem('WMEColorErrors', JSON.stringify(ls)); CErrColor(); });
  482. getId('_Railway').onclick=(function(){ var ls=JSON.parse(localStorage.WMEColorErrors); (getId('_Railway').checked === true) ? ls.Railway=true : ls.Railway=false; localStorage.setItem('WMEColorErrors', JSON.stringify(ls)); CErrColor(); });
  483. getId('_Narrow').onclick=(function(){ var ls=JSON.parse(localStorage.WMEColorErrors); (getId('_Narrow').checked === true) ? ls.Narrow=true : ls.Narrow=false; localStorage.setItem('WMEColorErrors', JSON.stringify(ls)); CErrColor(); });
  484.  
  485. if (CErrWaze.loginManager.user.rank > 3) {
  486. setTimeout(function () {
  487. var addLockButton = document.createElement('div');
  488. addLockButton.id = 'addLockButton';
  489. $(addLockButton).css({'float':'left','margin-right':'5px','cursor':'pointer','opacity':'0.6'});
  490. addLockButton.className = 'fabkm fa fa-lock';
  491. addLockButton.onclick = (function() {
  492. getId('_autoLock').click();
  493. if (getId('_autoLock').checked)
  494. { addLockButton.className = 'fabkm fa fa-lock';
  495. addLockButton.style.color = '#7f0';
  496. } else {
  497. addLockButton.className = 'fabkm fa fa-unlock';
  498. addLockButton.style.color = '#f60';
  499. }
  500. });
  501. getElementsByClassName('topbar')[0].insertBefore(addLockButton,getElementsByClassName('location-info-region')[0]);
  502. getElementsByClassName('topbar')[0].style.padding = '0 10px';
  503. addLockButton.onmouseover = (function () { getId('addLockButton').style.opacity = '1'; });
  504. addLockButton.onmouseout = (function () { getId('addLockButton').style.opacity = '0.6'; });
  505. if (WMECErrors.autoLock) {
  506. addLockButton.className = 'fabkm fa fa-lock';
  507. addLockButton.style.color = '#7f0';
  508. } else {
  509. addLockButton.className = 'fabkm fa fa-unlock';
  510. addLockButton.style.color = '#f60';
  511. }
  512. }, 1000);
  513. }
  514.  
  515. CErrWaze.selectionManager.events.register("selectionchanged", null, CErrAddInfo);
  516. CErrWaze.selectionManager.events.register("selectionchanged", null, CErrColor);
  517. CErrorsModel.actionManager.events.register("afterclearactions", null, CErrColor);
  518. CErrorsModel.actionManager.events.register("afterundoaction", null, CErrColor);
  519. CErrorsMap.events.register("zoomend", null, CErrColor);
  520. CErrorsMap.events.register("moveend", null, CErrColor);
  521. window.setTimeout(CErrColor, 500);
  522. }
  523. function fillHtml(id,type,color,icon,text) {
  524. var WMECErrors=JSON.parse(localStorage.getItem('WMEColorErrors'));
  525. return '<tr style="line-height:14px;"><td style="width:20px;"><input type="checkbox" class="'+(type==="seg_Bad" ? '_seg' : '_poi')+'" id="_'+id+'"'+(WMECErrors[id] ? ' checked' : '')+(WMECErrors[type] ? '' : ' disabled')+'/></td><td style="width:20px;"><font style="color:'+color+';font-family:FontAwesome;">'+icon+'</font></td><td><label for="_'+id+'" style="font-weight:normal;">'+text+'</label></td></tr>';
  526. }
  527. function fillHtmlAL(id,text,lockValue) {
  528. var WMECErrors=JSON.parse(localStorage.getItem('WMEColorErrors')), colorLock;
  529. switch (lockValue) {
  530. case 1: colorLock="#00cf00"; break;
  531. case 2: colorLock="#0179B5"; break;
  532. case 3: colorLock="#ffcc00"; break;
  533. case 4: colorLock="orange"; break;
  534. case 5: colorLock="red"; break;
  535. }
  536. return '<tr style="line-height:14px;"><td style="width:20px;"><input type="checkbox" class="_auto" id="_'+id+'" '+(WMECErrors[id] ? ' checked' : '')+(WMECErrors.autoLock ? '' : ' disabled')+'/></td><td style="width:30px;"><i class="fa fa-lock" style="color:'+colorLock+';"></i> '+lockValue+'</td><td><label for="_'+id+'" style="font-weight:normal;">'+text+'</label></td></tr>';
  537. }
  538. function checkClicLayer(){
  539. var lieu=CErrorsI18n.translations[CErrorsI18n.locale].layers.name.landmarks;
  540. getId('layer-switcher-'+CErrorsMap.getLayersByName(lieu)[0].id).onclick=(function(){
  541. window.setTimeout((function() {
  542. CErrColor();
  543. }),10);
  544. });
  545. }
  546. function addIcon(icon,color,geometry,type,pos) {
  547. var style = {
  548. fill: false,
  549. stroke: false,
  550. label: icon,
  551. labelAlign: "cb",
  552. labelXOffset: -4,
  553. labelYOffset: (pos*20),
  554. fontColor: color,
  555. fontSize:"20px",
  556. fontOpacity: getId('errOpacity').value,
  557. fontFamily: "FontAwesome",
  558. labelOutlineWidth: 2,
  559. zIndex: 99999
  560. };
  561. if (type==="segment") {
  562. if(geometry.length==2){
  563. var midX = (((geometry[0].x + geometry[1].x) / 2) + geometry[0].x) / 2;
  564. var midY = (((geometry[0].y + geometry[1].y) / 2) + geometry[0].y) / 2;
  565. var labelPoint = new CErrorsOpenLayers.Geometry.Point(midX,midY);
  566. var imageFeature = new CErrorsOpenLayers.Feature.Vector(labelPoint, null, style);
  567. ColorErrors_mapLayer.addFeatures([imageFeature]);
  568. }
  569. else {
  570. for(i=0;i<geometry.length-1;i++){
  571. if(i%3==1){
  572. var midX = (((geometry[i].x + geometry[i+1].x) / 2) + geometry[i].x) / 2;
  573. var midY = (((geometry[i].y + geometry[i+1].y) / 2) + geometry[i].y) / 2;
  574. var labelPoint = new CErrorsOpenLayers.Geometry.Point(midX,midY);
  575. var imageFeature = new CErrorsOpenLayers.Feature.Vector(labelPoint, null, style);
  576. ColorErrors_mapLayer.addFeatures([imageFeature]);
  577. }
  578. }
  579. }
  580. }
  581. else {
  582. var midX = (((geometry.left + geometry.right) / 2) + geometry.right) / 2;
  583. var midY = (((geometry.bottom + geometry.top) / 2) + geometry.bottom) / 2;
  584. var labelPoint = new CErrorsOpenLayers.Geometry.Point(midX,midY);
  585. var imageFeature = new CErrorsOpenLayers.Feature.Vector(labelPoint, null, style);
  586. ColorErrors_mapLayer.addFeatures([imageFeature]);
  587. }
  588. }
  589. function addLegend(id,icon,color,text,url){
  590. if(getSelectedFeatures()[0] && getSelectedFeatures()[0].model.attributes.id===id && getId('ErrorsList')) {
  591. getId('ErrorsList').innerHTML +="<div id='item"+id+"'><span style='color:"+color+";font-family:FontAwesome;'>"+icon+"</span> <span style='color:"+color+";'>"+text+"</span></div><br>";
  592. //getId('item'+id).onclick=openInNewTab(url);
  593. }
  594. }
  595. function relock(obj, key) {
  596. var objects = obj[key], _i = 0;
  597. while (typeof(objects[_i]) != "undefined") {
  598. W.model.actionManager.add(objects[_i]);
  599. _i++;
  600. }
  601. }
  602. function CErrColor(){
  603. var lineFeature=[], ls=JSON.parse(localStorage.WMEColorErrors);
  604. var lieu=CErrorsI18n.translations[CErrorsI18n.locale].layers.name.landmarks;
  605.  
  606. //Check if Autolock is defined for active country
  607. if (ActiveCountry != W.model.getTopCountry().abbr) {
  608. ActiveCountry = W.model.getTopCountry().abbr;
  609. ABBR = cntryDB[ActiveCountry];
  610. if (typeof(ABBR) == 'undefined') {
  611. getId('_autoLock').disabled=true;
  612. for (var i=0; getElementsByClassName('_auto', AutoLock) [i]; i++) getElementsByClassName('_auto', AutoLock) [i].disabled=true;
  613. } else {
  614. getId('_autoLock').disabled=false;
  615. for (var i=0; getElementsByClassName('_auto', AutoLock) [i]; i++) getElementsByClassName('_auto', AutoLock) [i].disabled=false;
  616. }
  617. getId('_autoLockLabel').innerHTML=CErrLeg[8]+' ('+W.model.getTopCountry().name+')';
  618. }
  619. if (CErrWaze.loginManager.user.rank > 3) { getId('CMOnly').style.display="block"; } else { getId('CMOnly').style.display="none"; }
  620.  
  621. // Initialize layer
  622. try { ColorErrors_mapLayer.destroyFeatures(); }
  623. catch(err){ log('err destroyFeatures: ',err); }
  624.  
  625. if (getId('ErrorsList')) { getId('ErrorsList').innerHTML=""; }
  626.  
  627. //Segments Checking
  628. if (ls.seg_Bad || ls.autoLock) {
  629. var autoLockId=[], relockObject = {'str':[], 'pri':[], 'min':[], 'maj':[], 'rmp':[], 'fwy':[], 'rwy':[], 'nar':[] };
  630.  
  631. for (var seg in CErrorsModel.segments.objects) {
  632. // Get values
  633. var segment=CErrorsModel.segments.getObjectById(seg), j=0;
  634. var attributes=segment.attributes;
  635. var geometry=attributes.geometry.components;
  636. var line=getId(segment.geometry.id);
  637. if (segment===null || line === null || segment.state === "Update") continue;
  638. //Name
  639. var sid=attributes.primaryStreetID;
  640. var street=CErrorsModel.streets.getObjectById(sid);
  641. if (street===null) continue;
  642. //Alt Name
  643. var salt=attributes.streetIDs[0];
  644. var streetalt=CErrorsModel.streets.getObjectById(salt);
  645. if (streetalt) {
  646. var altname=streetalt.name;
  647. var streetAltCity = CErrorsModel.cities.getObjectById(streetalt.cityID);
  648. } else { var altname=""; }
  649. //City
  650. var streetCity = CErrorsModel.cities.getObjectById(street.cityID);
  651.  
  652. if (streetCity===null) continue;
  653. streetCity = streetCity.attributes.name;
  654.  
  655. var roadType=attributes.roadType;
  656. if (attributes.primaryStreetID === null || attributes.primaryStreetID === undefined) continue;
  657. if (CErrorsModel.streets.getObjectById(attributes.primaryStreetID) === null || CErrorsModel.streets.getObjectById(attributes.primaryStreetID) === undefined) continue;
  658.  
  659. if (W.model.cities.objects[W.model.streets.objects[sid].cityID].attributes.countryID != W.model.getTopCountry().id || segment.isAllowed(segment.permissionFlags.EDIT_PROPERTIES) == false) { continue; }
  660.  
  661.  
  662. var newWidth="", newColor="", newOpacity="0", gline="";
  663. if (ls.seg_Bad && ((ls.myLvl && attributes.lockRank <= CErrWaze.loginManager.user.rank) || ls.myLvl===false)) {
  664. if (ls.seg_Ramp_city) { // Ramp/Freeway with city name
  665. if (streetCity && /^(3|4)$/.test(attributes.roadType)) {
  666. newColor="#ff0000"; newWidth=3; newOpacity=0.95; gline=segment.attributes.geometry.getVertices();
  667. j++;
  668. addIcon("\uf015",newColor,geometry,"segment",j);
  669. addLegend(attributes.id,"\uf015",newColor,CErrSeg[11],"Routes_Nommage#1.4.4_Bretelles_d.27entr.C3.A9e_ou_de_sortie_des_autoroutes_et_voies_rapides");
  670. }
  671. }
  672. if (street.name || altname) {
  673. if (/( - )/.test(street.name)) { var trs=street.name.split(" - "); }
  674. if (ls.seg_Priv) { // Private with bad name
  675. if (attributes.roadType===17 && new RegExp(streetNameSeg).test(street.name)===false) {
  676. newColor="#ff7700"; newWidth=3; newOpacity=0.95; gline=segment.attributes.geometry.getVertices();
  677. j++;
  678. addIcon("\uf256",newColor,geometry,"segment",j);
  679. addLegend(attributes.id,"\uf256",newColor,CErrSeg[2],"");
  680. }
  681. }
  682. if (ls.seg_Park && street.name) { // Parking with name (But Place / Square)
  683. if (attributes.roadType===20 && new RegExp(parkNameSeg).test(street.name)===false) {
  684. newColor="#ff0000"; newWidth=3; newOpacity=0.95; gline=segment.attributes.geometry.getVertices();
  685. j++;
  686. addIcon("\uf288",newColor,geometry,"segment",j);
  687. addLegend(attributes.id,"\uf288",newColor,CErrSeg[3],"");
  688. }
  689. }
  690. if (ls.seg_Rail && street.name) { // Railroad with bad name
  691. if (attributes.roadType===18 && (altname || street.name)) { //Railroad with name
  692. newColor="#ff0000"; newWidth=3; newOpacity=0.95; gline=segment.attributes.geometry.getVertices();
  693. j++;
  694. addIcon("\uf238",newColor,geometry,"segment",j);
  695. addLegend(attributes.id,"\uf238",newColor,CErrSeg[4],"Routes_Nommage#1.5.4_Voies_ferr.C3.A9es");
  696. }
  697. }
  698. if (ls.seg_Ramp_name && street.name) {
  699. if (/^(3|4)$/.test(attributes.roadType) && /\/.*\//.test(street.name)) { // Ramp with 3 directions or more
  700. newColor="#ff0000"; newWidth=3; newOpacity=0.95; gline=segment.attributes.geometry.getVertices();
  701. j++;
  702. addIcon("\uf25b",newColor,geometry,"segment",j);
  703. addLegend(attributes.id,"\uf25b",newColor,CErrSeg[6],"Routes_Nommage#1.4.4_Bretelles_d.27entr.C3.A9e_ou_de_sortie_des_autoroutes_et_voies_rapides");
  704. }
  705. else if (/^(3|4)$/.test(attributes.roadType) && /\//.test(street.name)) { // Ramp with 2 directions
  706. newColor="#ff7700"; newWidth=3; newOpacity=0.95; gline=segment.attributes.geometry.getVertices();
  707. j++;
  708. addIcon("\uf25a",newColor,geometry,"segment",j);
  709. addLegend(attributes.id,"\uf25a",newColor,CErrSeg[6],"Routes_Nommage#1.4.4_Bretelles_d.27entr.C3.A9e_ou_de_sortie_des_autoroutes_et_voies_rapides");
  710. }
  711. }
  712. if (ls.seg_Dir_name && street.name) { // Directions but not Ramp/Freeway/Major
  713. if (/^[^3|4|6]$/.test(attributes.roadType) && /[:|>]/.test(street.name)) {
  714. newColor="#ff0000"; newWidth=3; newOpacity=0.95; gline=segment.attributes.geometry.getVertices();
  715. j++;
  716. addIcon("\uf0a9",newColor,geometry,"segment",j);
  717. addLegend(attributes.id,"\uf0a9",newColor,CErrSeg[7],"Routes_Nommage#1.4.4_Bretelles_d.27entr.C3.A9e_ou_de_sortie_des_autoroutes_et_voies_rapides");
  718. }
  719. }
  720. if (ls.seg_Toll) { // Toll but not Ramp/Freeway
  721. if (/^[^3|4]$/.test(attributes.roadType) && (attributes.fwdToll || attributes.revToll)) {
  722. newColor="#ff0000"; newWidth=3; newOpacity=0.95; gline=segment.attributes.geometry.getVertices();
  723. j++;
  724. addIcon("\uf155",newColor,geometry,"segment",j);
  725. addLegend(attributes.id,"\uf155",newColor,CErrSeg[10],"");
  726. }
  727. }
  728. if (ls.seg_RSAlt && street.name) { // RoadShield must be in alt
  729. if (attributes.roadType!=19 && trs
  730. && /^[A|C|D|N|M|R|T][0-9]+[a-z]?[0-9]?/.test(trs[0].replace(".",""))===true // Roadshield (1st part)
  731. && / - /.test(street.name)===true // Roadshield & street name (separator -)
  732. && /Intérieure|Extérieure/.test(trs[1])===false
  733. && streetCity // City ok
  734. ) {
  735. newColor="#ff0000"; newWidth=3; newOpacity=0.95; gline=segment.attributes.geometry.getVertices();
  736. j++;
  737. addIcon("\uf074",newColor,geometry,"segment",j);
  738. addLegend(attributes.id,"\uf074",newColor,CErrSeg[12],"Routes_Nommage#1.3_Les_nommages_en_Agglom.C3.A9ration");
  739. }
  740. }
  741. if (ls.seg_HW_name && street.name) { // Highways with bad name
  742. if (/^(3|4|6)$/.test(attributes.roadType) && (/:/.test(street.name)===true && /^[A|C|D|N|M|R|T][0-9]+[a-z]?[0-9]?/.test(street.name)===false) && /^>/.test(street.name)===false && /^[Sortie ]+[0-9]+/.test(street.name)===false && /^(Rocade|Périphérique)/.test(street.name)===false) {
  743. newColor="#ff0000"; newWidth=3; newOpacity=0.95; gline=segment.attributes.geometry.getVertices();
  744. j++;
  745. addIcon("\uf018",newColor,geometry,"segment",j);
  746. addLegend(attributes.id,"\uf018",newColor,CErrSeg[5],"Routes_Nommage#1.4.2_Autoroutes");
  747. }
  748. }
  749. if (ls.seg_SegBadRS && street.name) { // RoadShield but bad type
  750. if (/^(1|8|17|20)$/.test(attributes.roadType) && (/^[A|D|N|M|R|T][0-9]+/.test(street.name) || /^[A|D|N|M|R|T]$/.test(street.name))) {
  751. newColor="#ff0000"; newWidth=3; newOpacity=0.95; gline=segment.attributes.geometry.getVertices();
  752. j++;
  753. addIcon("\uf044",newColor,geometry,"segment",j);
  754. addLegend(attributes.id,"\uf044",newColor,CErrSeg[14],"Routes_Classification#2.4_Famille_des_Routes");
  755. }
  756. }
  757. if (ls.seg_HNFree) { // House number on Freeway or ramp (and some undrivables)
  758. if (/^(3|4|8|14|18|19)$/.test(attributes.roadType) && attributes.hasHNs===true) {
  759. newColor="#ff0000"; newWidth=3; newOpacity=0.95; gline=segment.attributes.geometry.getVertices();
  760. j++;
  761. addIcon("\uf162",newColor,geometry,"segment",j);
  762. addLegend(attributes.id,"\uf162",newColor,CErrSeg[15],"");
  763. }
  764. }
  765. if (ls.seg_BadSpeed) { // Bad speed (ex: >70km/h in city)
  766. if (attributes.fwdMaxSpeed>70 && attributes.fwdMaxSpeedUnverified===false && attributes.revMaxSpeed>70 && attributes.revMaxSpeedUnverified===false && streetCity) {
  767. newColor="#ff7700"; newWidth=3; newOpacity=0.95; gline=segment.attributes.geometry.getVertices();
  768. j++;
  769. addIcon("\uf1ce",newColor,geometry,"segment",j);
  770. addLegend(attributes.id,"\uf1ce",newColor,CErrSeg[16],"Routes_Vitesses#4.2_Tour_d.27horizon_des_diff.C3.A9rentes_vitesses_limites");
  771. }
  772. }
  773. if (ls.seg_RShield && street.name) { // Wrong prefix (RoadShield)
  774. if ((trs && attributes.roadType!=19 && /^[A|D|N|M|R|T][0-9]+[a-z]?[0-9]?/.test(trs[0].replace(".",""))===false && / - /.test(street.name)===true)
  775. || /^[A|D|N|M|R|T][0-9]+[a-z]?[0-9]? ?-[A-Za-z]/.test(street.name)===true || /^[A|D|N|M|R|T][0-9]+[a-z]?[0-9]?- ?[A-Za-z]/.test(street.name)===true// No space between RS and street name
  776. ) {
  777. newColor="#ff0000"; newWidth=3; newOpacity=0.95; gline=segment.attributes.geometry.getVertices();
  778. j++;
  779. addIcon("\uf152",newColor,geometry,"segment",j);
  780. addLegend(attributes.id,"\uf152",newColor,CErrSeg[8],"");
  781. }
  782. }
  783. if (ls.seg_SNameAlt && street.name) { // Street Name must be in alt
  784. if (attributes.roadType!=19 && trs
  785. && /^[A|C|D|N|M|R|T][0-9]+[a-z]?[0-9]?/.test(trs[0].replace(".",""))===true // Roadshield (1st part)
  786. && /^[E][0-9]/.test(trs[1])===false // European Roadshield (2nd part)
  787. && new RegExp(excepNameSeg).test(street.name)===false // Exception
  788. && / - /.test(street.name)===true // Roadshield & street name (separator -)
  789. && /Intérieure|Extérieure/.test(trs[1])===false
  790. && !streetCity // No city
  791. ) {
  792. newColor="#ff0000"; newWidth=3; newOpacity=0.95; gline=segment.attributes.geometry.getVertices();
  793. j++;
  794. addIcon("\uf079",newColor,geometry,"segment",j);
  795. addLegend(attributes.id,"\uf079",newColor,CErrSeg[13],"Routes_Nommage#1.4_Les_nommages_hors_Agglom.C3.A9ration");
  796. }
  797. }
  798. if (ls.seg_DleSpace && street.name) { // Double spacing in name
  799. if (/ /.test(street.name)===true) {
  800. newColor="#ff0000"; newWidth=3; newOpacity=0.95; gline=segment.attributes.geometry.getVertices();
  801. j++;
  802. addIcon("\uf101",newColor,geometry,"segment",j);
  803. addLegend(attributes.id,"\uf101",newColor,CErrSeg[9],"");
  804. }
  805. }
  806. if (ls.seg_BadAltState) {
  807. if (streetalt != null && CErrorsModel.cities.getObjectById(street.cityID).attributes.stateID != streetAltCity.attributes.stateID) { // Alt State != Main State
  808. newColor="#ff7700"; newWidth=3; newOpacity=0.95; gline=segment.attributes.geometry.getVertices();
  809. j++;
  810. addIcon("\uf037",newColor,geometry,"segment",j);
  811. addLegend(attributes.id,"\uf037",newColor,CErrSeg[17]+"<br>Est <b><i>"+CErrorsModel.states.getObjectById(streetAltCity.attributes.stateID).name+"</i></b><br>Devrait être <b><i>"+CErrorsModel.states.getObjectById(CErrorsModel.cities.getObjectById(street.cityID).attributes.stateID).name+"</i></b>","");
  812. }
  813. }
  814. if (ls.seg_EmptyCityAlt && streetalt != null) { // Bad Alt
  815. var g=0;
  816. for (var f=0; f < attributes.streetIDs.length; f++) {
  817. var streetalt=CErrorsModel.streets.getObjectById(attributes.streetIDs[f]);
  818. if (CErrorsModel.cities.getObjectById(streetalt.cityID).attributes.name === "" && /^[A|C|D|E|N|M|R|T|V][0-9]+[a-z]?[0-9]?/.test(streetalt.name)===false && new RegExp(excepNameSeg).test(street.name)===false) {
  819. newColor="#ff7700"; newWidth=3; newOpacity=0.95; gline=segment.attributes.geometry.getVertices();
  820. j++;
  821. addIcon("\uf064",newColor,geometry,"segment",j);
  822. addLegend(attributes.id,"\uf064",newColor,CErrSeg[19],"");
  823. }
  824. }/*
  825. g=0;
  826. for (var f=0; f < attributes.streetIDs.length; f++) {
  827. if (street.name == streetalt.name && streetAltCity.attributes.name != "") { g=1; }
  828. }
  829. if (g == 0) {
  830. newColor="#ff7700"; newWidth=3; newOpacity=0.95; gline=segment.attributes.geometry.getVertices();
  831. j++;
  832. addIcon("\uf064",newColor,geometry,"segment",j);
  833. addLegend(attributes.id,"\uf064",newColor,CErrSeg[19],"");
  834. }*/
  835. }
  836. }
  837. if (ls.seg_LockValue && attributes.lockRank != 5) { // Ignore Lock 6
  838. if (
  839. ((attributes.fwdFlags==1 || attributes.revFlags==1) && attributes.lockRank != 4) || // Speedcam but not locked 5
  840. attributes.fwdFlags != 1 && attributes.revFlags != 1 && // no speedcam
  841. (/^(3|4|6|18)$/.test(attributes.roadType) && attributes.lockRank != 4 //Lock 5 for freeway, ramp, major and railroad
  842. || attributes.roadType==7 && attributes.lockRank != 3 //Lock 4 for minor
  843. || attributes.roadType==2 && attributes.lockRank != 2 //Lock 3 for primary
  844. || /^(1|8|17|19|22)$/.test(attributes.roadType) === true && attributes.lockRank != 0 && attributes.lockRank != null) //Lock 1 for others (5,10,15,16,20)
  845. ) {
  846. newColor="#ff7700"; newWidth=3; newOpacity=0.95; gline=segment.attributes.geometry.getVertices();
  847. j++;
  848. addIcon("\uf023",newColor,geometry,"segment",j);
  849. addLegend(attributes.id,"\uf023",newColor,CErrSeg[18],"WME_Droits");
  850. }
  851. }
  852. // Highlight if error
  853. if (gline !== "") {
  854. var style={
  855. strokeWidth: newWidth,
  856. strokeColor: newColor,
  857. strokeOpacity: newOpacity
  858. };
  859. var points=[];
  860. for (var i=0; i<gline.length; i++) { points.push(new CErrorsOpenLayers.Geometry.Point(gline[i].x, gline[i].y)); }
  861. var newline=new CErrorsOpenLayers.Geometry.LineString(points);
  862. lineFeature.push(new CErrorsOpenLayers.Feature.Vector(newline, null, style));
  863. }
  864. }
  865.  
  866. //Autolock
  867. var lock=attributes.lockRank;
  868. if (ls.autoLock === true &&
  869. (ls.myLvl && lock <= CErrWaze.loginManager.user.rank || ls.myLvl === false) &&
  870. lock != 5 &&
  871. onScreen(segment) &&
  872. autoLockId.indexOf(attributes.id) == -1 &&
  873. getId('_autoLock').disabled == false &&
  874. CErrWaze.loginManager.user.rank > 3) {
  875. if ( attributes.revFlags != '1' && attributes.fwdFlags != '1') {
  876. switch (attributes.roadType) {
  877. case 1: if ((lock == null || lock < ABBR.str_lvl) && ls.Street==true) { autoLockId.push(attributes.id); relockObject.str.push(new UpdateObject(segment, {lockRank: ABBR.str_lvl })); } break;
  878. case 2: if ((lock == null || lock < ABBR.pri_lvl) && ls.Primary==true) { autoLockId.push(attributes.id); relockObject.pri.push(new UpdateObject(segment, {lockRank: ABBR.pri_lvl })); } break;
  879. case 3: if ((lock == null || lock < ABBR.fwy_lvl) && ls.Freeway==true) { autoLockId.push(attributes.id); relockObject.fwy.push(new UpdateObject(segment, {lockRank: ABBR.fwy_lvl })); } break;
  880. case 4: if ((lock == null || lock < ABBR.rmp_lvl) && ls.Ramp==true) { autoLockId.push(attributes.id); relockObject.rmp.push(new UpdateObject(segment, {lockRank: ABBR.rmp_lvl })); } break;
  881. case 6: if ((lock == null || lock < ABBR.maj_lvl) && ls.Major==true) { autoLockId.push(attributes.id); relockObject.maj.push(new UpdateObject(segment, {lockRank: ABBR.maj_lvl })); } break;
  882. case 7: if ((lock == null || lock < ABBR.min_lvl) && ls.Minor==true) { autoLockId.push(attributes.id); relockObject.min.push(new UpdateObject(segment, {lockRank: ABBR.min_lvl })); } break;
  883. case 18: if ((lock == null || lock < ABBR.rwy_lvl) && ls.Railway==true) { autoLockId.push(attributes.id); relockObject.rwy.push(new UpdateObject(segment, {lockRank: ABBR.rwy_lvl })); } break;
  884. case 22: if ((lock == null || lock < ABBR.nar_lvl) && ls.Narrow==true) { autoLockId.push(attributes.id); relockObject.nar.push(new UpdateObject(segment, {lockRank: ABBR.nar_lvl })); } break;
  885. }
  886. }
  887. // Lock 5 if ASC
  888. if ((attributes.fwdFlags == '1' || attributes.revFlags == '1') && lock != '4') { autoLockId.push(attributes.id); relockObject.others.push(new UpdateObject(segment, {lockRank: '4' })); }
  889. }
  890. }
  891.  
  892. $.each(relockObject, function( key, value ) {
  893. relock(relockObject, key);
  894. });
  895. }
  896.  
  897. //Places Checking
  898. if (ls.poi_Bad && getId('layer-switcher-group_places').checked) {
  899. for (var poi in CErrorsModel.venues.objects) {
  900. // Get values
  901. var venue=CErrorsModel.venues.getObjectById(poi), j=0;
  902. var pattributes=venue.attributes;
  903. var geometry=pattributes.geometry.bounds;
  904. var poly=pattributes.id;
  905. if (venue===null || poly === null || poi.state=="Update" || poi.selected) continue;
  906. var categories=pattributes.categories;
  907. var pname=pattributes.name;
  908. var venueStreet=CErrorsModel.streets.getObjectById(pattributes.streetID);
  909. if (venueStreet) { var venueCity = CErrorsModel.cities.getObjectById(venueStreet.cityID); }
  910. var newWidth="", newColor="", newOpacity="0", gpoly="";
  911.  
  912. if ((ls.myLvl && pattributes.lockRank <= CErrWaze.loginManager.user.rank && pattributes.adLocked===false) || ls.myLvl===false) {
  913. if (ls.poi_Resid) { // maybe a residential POI
  914. if ((/^[0-9][ ]?[a-zA-Z]/.test(pname)===true || new RegExp(privNameSeg).test(pname)===true) && pattributes.residential===false && pattributes.categories.indexOf("PARKING_LOT")===-1) {
  915. newColor="#ff7700"; newWidth=15; newOpacity=0.5; gpoly=pattributes.geometry.getVertices();
  916. if (venue.isPoint()) { newWidth=26; }
  917. j++;
  918. addIcon("\uf015",newColor,geometry,"venue",j);
  919. addLegend(poly,"\uf015",newColor,CErrPoi[7],"");
  920. }
  921. }
  922. if (ls.poi_Google) { //POI without Google link
  923. if (pattributes.externalProviderIDs.length===0 && pattributes.residential===false && new RegExp(excepCatPoi).test(categories)===false) {
  924. newColor="#ff7700"; newWidth=15; newOpacity=0.5; gpoly=pattributes.geometry.getVertices();
  925. if (venue.isPoint()) { newWidth=26; }
  926. j++;
  927. addIcon("\uf1a0",newColor,geometry,"venue",j);
  928. addLegend(poly,"\uf1a0",newColor,CErrPoi[8],"");
  929. }
  930. }
  931. if (ls.poi_Phone && pattributes.phone) { //POI with bad phone number
  932. // Phone prefix
  933. var prefPhone;
  934. switch(CErrorsModel.getTopCountry().id) {
  935. case 3: prefPhone='+213[ ](\\d{2})'; break; // format +213 (dd) xx xx xx @ Algeria
  936. case 73: prefPhone='+33[ ]\\d[ ]\\d{2}'; break; // format +33 d xx xx xx xx @ France
  937. case 74: prefPhone='+594[ ](594|694)'; break; // format +594 594 xx xx xx @ French Guiana
  938. case 88: prefPhone='+590[ ](590|690)'; break; // format +590 590 xx xx xx @ Guadeloupe
  939. case 141: prefPhone='+596[ ]596'; break; // format +596 596 xx xx xx @ Martinique
  940. case 148: prefPhone='+377[ ]\\d{2}'; break; // format +377 xx xx xx xx @ Monaco
  941. case 152: prefPhone='+212[ ](\\d{3})'; break; // format +212 xxx xx xx xx @ Morocco
  942. case 184: prefPhone='+262[ ](262|692|693)'; break; // format +262 (262 ou 692) xx xx xx @ Reunion
  943. default : break;
  944. }
  945. if (new RegExp('^(\\'+prefPhone + ')([ ](\\d{2})){3}$').test(pattributes.phone)===false // Prefix + 4 digits
  946. && new RegExp('^(\\'+prefPhone + ')([ ](\\d{3})){2}$').test(pattributes.phone)===false // Prefix + 3 digits
  947. && (/^[13]\d[ ](\d{2})$/).test(pattributes.phone)===false // 1x xx or 3x xx
  948. && (/^(0[ ](8|9)\d{2})([ ](\d{3})){2}/).test(pattributes.phone)===false // 0 8xx xxx xxx
  949. && (/^(0[ ](8|9)\d{2})([ ](\d{2})){3}/).test(pattributes.phone)===false // 0 8xx xx xx xx
  950. && (/^(15|17|18|112|115)$/).test(pattributes.phone)===false // Emergency numbers
  951. ) {
  952. newColor="#ff7700"; newWidth=15; newOpacity=0.5; gpoly=pattributes.geometry.getVertices();
  953. if (venue.isPoint()) { newWidth=26; }
  954. j++;
  955. addIcon("\uf095",newColor,geometry,"venue",j);
  956. addLegend(poly,"\uf095",newColor,CErrPoi[13],"Lieux_Generalites#1.7._Format_du_num.C3.A9ro_de_t.C3.A9l.C3.A9phone");
  957. }
  958. }
  959. if (ls.poi_Other) { // Place type is "Other"
  960. if (categories.indexOf("OTHER") > -1 && (/^Déchèterie/).test(pname)===false) {
  961. newColor="#ff7700"; newWidth=15; newOpacity=0.5; gpoly=pattributes.geometry.getVertices();
  962. if (venue.isPoint()) { newWidth=26; }
  963. j++;
  964. addIcon("\uf29c",newColor,geometry,"venue",j);
  965. addLegend(poly,"\uf29c",newColor,CErrPoi[10],"");
  966. }
  967. }
  968. if (ls.poi_Entry) { // POI with default entryExitPoints
  969. if (new RegExp(entryPointPoi).test(categories)===false && pattributes.entryExitPoints.length===0 && venue.isPoint()===false) {
  970. newColor="#ff7700"; newWidth=15; newOpacity=0.5; gpoly=pattributes.geometry.getVertices();
  971. j++;
  972. addIcon("\uf18e",newColor,geometry,"venue",j);
  973. addLegend(poly,"\uf18e",newColor,CErrPoi[4],"Lieux_Generalites#1.3._Positionner_le_point_de_destination_d.27un_POI");
  974. }
  975. }
  976. if (ls.poi_Park_name && categories.indexOf("PARKING_LOT") > -1) { // Parking with bad name
  977. if (new RegExp(streetNameSeg).test(pname)===true) { continue; } //If parking name is a road
  978. if (new RegExp('^'+parkNamePoi+'$').test(pname)===true || // Only Parkings or Aire // ?️|?️️|
  979. new RegExp('^'+parkNamePoi).test(pname)===false // Don't start by ?️ or Parking
  980. // /^(Parking[s]?)( de[s]?| du | le[s]? | la | pour )/.test(pname)===true // Contain bad words
  981. ) {
  982. newColor="#ff0000"; newWidth=15; newOpacity=0.5; gpoly=pattributes.geometry.getVertices();
  983. j++;
  984. addIcon("\uf288",newColor,geometry,"venue",j);
  985. addLegend(poly,"\uf288",newColor,CErrPoi[2],"Lieux_Particuliers#2.3._Parkings");
  986. }
  987. else if (pname==="") {
  988. newColor="#ff7700"; newWidth=15; newOpacity=0.5; gpoly=pattributes.geometry.getVertices();
  989. j++;
  990. addIcon("\uf288",newColor,geometry,"venue",j);
  991. addLegend(poly,"\uf288",newColor,CErrPoi[2],"Lieux_Particuliers#2.3._Parkings");
  992. }
  993. if (venue.isPoint()) newWidth=26;
  994. }
  995. if (ls.poi_Park_type && categories.indexOf("PARKING_LOT") > -1) { // Parking with type undefined
  996. if (/PUBLIC|RESTRICTED|PRIVATE/.test(pattributes.categoryAttributes.PARKING_LOT.parkingType)===false) {
  997. newColor="#ff0000"; newWidth=15; newOpacity=0.5; gpoly=pattributes.geometry.getVertices();
  998. j++;
  999. addIcon("\uf11d",newColor,geometry,"venue",j);
  1000. addLegend(poly,"\uf11d",newColor,CErrPoi[12],"Lieux_Particuliers#2.3._Parkings");
  1001. }
  1002. }
  1003. if (ls.poi_Address) { // POI with bad address (Nxxx/Dxxx) or without address
  1004. if (venueStreet===null) continue;
  1005. if ((/^[A|D|N|M|R][0-9]+/.test(venueStreet.name) && /[ - ]/.test(venueStreet.name)) || (venueStreet.name===null && new RegExp(landmarkPoi).test(categories) === 'false')) {
  1006. newColor="#ff0000"; newWidth=15; newOpacity=0.5; gpoly=pattributes.geometry.getVertices();
  1007. if (venue.isPoint()) { newWidth=26; }
  1008. j++;
  1009. addIcon("\uf2bc",newColor,geometry,"venue",j);
  1010. addLegend(poly,"\uf2bc",newColor,CErrPoi[3],"Lieux_Generalites#1.2._Nommage_et_Adresse_d.27un_POI");
  1011. }
  1012. }
  1013. if (ls.poi_LandM) { // Landmark with road name or city name
  1014. if (new RegExp(landmarkPoi).test(categories) && pname==="" && ((venueStreet && venueStreet.name) || (venueCity && venueCity.attributes.name))) {
  1015. newColor="#ff0000"; newWidth=15; newOpacity=0.5; gpoly=pattributes.geometry.getVertices();
  1016. if (venue.isPoint()) { newWidth=26; }
  1017. j++;
  1018. addIcon("\uf1bb",newColor,geometry,"venue",j);
  1019. addLegend(poly,"\uf1bb",newColor,CErrPoi[5],"");
  1020. }
  1021. }
  1022. if (ls.poi_DleSpace) { // Double spacing in name
  1023. if (venueStreet && (/ /.test(venueStreet.name)===true || / /.test(pname)===true)) {
  1024. newColor="#ff0000"; newWidth=15; newOpacity=0.5; gpoly=pattributes.geometry.getVertices();
  1025. j++;
  1026. addIcon("\uf101",newColor,geometry,"venue",j);
  1027. addLegend(poly,"\uf101",newColor,CErrPoi[6],"");
  1028. if (venue.isPoint()) { newWidth=26; }
  1029. }
  1030. }
  1031. if (ls.poi_GasSta && categories.indexOf("GAS_STATION") > -1) { // Gas Station with bad name
  1032. if (new RegExp(streetNameSeg).test(pname)===true) { continue; } //If parking name is a road
  1033. if (/^(Station-service )/.test(pname)===false) { // Don't start by
  1034. newColor="#ff0000"; newWidth=15; newOpacity=0.5; gpoly=pattributes.geometry.getVertices();
  1035. j++;
  1036. addIcon("\uf1b9",newColor,geometry,"venue",j);
  1037. addLegend(poly,"\uf288",newColor,CErrPoi[16],"Lieux_Particuliers#2.5._Stations-services");
  1038. if (venue.isPoint()) newWidth=26;
  1039. }
  1040. }
  1041. if (ls.poi_Transp && new RegExp(stationsPoi).test(categories)===false && categories.indexOf("FAST_FOOD") == -1) { //Bus Subway and Tram Station wihtout others stations
  1042. if ((
  1043. categories.indexOf("BUS_STATION") > -1 && // Good category for bus station
  1044. new RegExp('^'+busPoi).test(pname)===false // Bad name
  1045. ) || (
  1046. categories.indexOf("SUBWAY_STATION") > -1 && // Good category for subway station
  1047. new RegExp('^'+tramPoi).test(pname)===false // Bad name
  1048. ) || (
  1049. categories.indexOf("TRAIN_STATION") > -1 && // Good category for train station
  1050. /Gare d[e|u|es|\']/.test(pname)===false // Bad name
  1051. ) || (
  1052. categories.indexOf("OTHER") == -1 && categories.indexOf("BUS_STATION") == -1 && categories.indexOf("SUBWAY_STATION") == -1 && categories.indexOf("TRAIN_STATION") == -1 &&
  1053. new RegExp('^'+possibleTransPoi).test(pname)===true // Maybe a transport station
  1054. ) ){
  1055. newColor="#ff0000"; newWidth=15; newOpacity=0.5; gpoly=pattributes.geometry.getVertices();
  1056. j++;
  1057. addIcon("\uf207",newColor,geometry,"venue",j);
  1058. addLegend(poly,"\uf207",newColor,CErrPoi[15],"Lieux_Particuliers#2.8._Arr.C3.AAts_de_bus.2C_m.C3.A9tro_et_tramway");
  1059. if (venue.isPoint()) { newWidth=26; }
  1060. }
  1061. }
  1062. if (ls.poi_Relig && categories.indexOf("RELIGIOUS_CENTER") > -1) { // Religious Center with bad name
  1063. if (new RegExp('^'+religiousPoi+'$').test(pname)===true || // category without name
  1064. new RegExp('^'+religiousPoi).test(pname)===false) { // Bad 1st name
  1065. newColor="#ff0000"; newWidth=15; newOpacity=0.5; gpoly=pattributes.geometry.getVertices();
  1066. j++;
  1067. addIcon("\uf015",newColor,geometry,"venue",j);
  1068. addLegend(poly,"\uf015",newColor,CErrPoi[14],"Lieux_Particuliers#2.10._Site_religieux");
  1069. if (venue.isPoint()) { newWidth=26; }
  1070. }
  1071. }
  1072. if ((ls.poi_Relig && new RegExp('^'+religiousPoi).test(pname)===true && categories.indexOf("RELIGIOUS_CENTER") == -1) || // Religious Center Name but bad category
  1073. (new RegExp('^'+religiousPoi+'$').test(pname)===true && categories.indexOf("RELIGIOUS_CENTER") == -1)) { // Bad Religious Center Name with bad category
  1074. newColor="#ff0000"; newWidth=15; newOpacity=0.5; gpoly=pattributes.geometry.getVertices();
  1075. j++;
  1076. addIcon("\uf015",newColor,geometry,"venue",j);
  1077. addLegend(poly,"\uf015",newColor,CErrPoi[14],"Lieux_Particuliers#2.10._Site_religieux");
  1078. if (venue.isPoint()) { newWidth=26; }
  1079. }
  1080. if (ls.poi_WFeed || ls.poi_WPark) { //Place updated by WazeFeed
  1081. if (pattributes.updatedBy && CErrorsModel.users.getObjectById(pattributes.updatedBy)) {
  1082. var updName = CErrorsModel.users.getObjectById(pattributes.updatedBy).userName;
  1083. if (((ls.poi_WFeed && new RegExp(wazeBot).test(updName)) || (ls.poi_WPark && updName=="WazeParking1")) && pattributes.residential===false) {
  1084. newColor="#ffcc00"; newWidth=15; newOpacity=0.5; gpoly=pattributes.geometry.getVertices();
  1085. if (venue.isPoint()) { newWidth=26; newOpacity=0.75; }
  1086. j++;
  1087. addIcon("\uf263",newColor,geometry,"venue",j);
  1088. if (updName=="WazeFeed") { addLegend(poly,"\uf263",newColor,CErrPoi[9],""); }
  1089. else { addLegend(poly,"\uf263",newColor,CErrPoi[11],""); }
  1090. }
  1091. }
  1092. }
  1093. // Highlight if error
  1094.  
  1095. }
  1096. if (pattributes.adLocked) {
  1097. newColor="#ff0000"; newWidth=15; newOpacity=0.75; gpoly=pattributes.geometry.getVertices();
  1098. j++;
  1099. addIcon("\uf023",newColor,geometry,"venue",j);
  1100. addLegend(poly,"\uf023",newColor,CErrLeg[7],"");
  1101. if (venue.isPoint()) { newWidth=26; }
  1102. }
  1103. if (gpoly!=="") {
  1104. var style={
  1105. strokeWidth: newWidth,
  1106. strokeColor: newColor,
  1107. strokeOpacity: newOpacity,
  1108. fillOpacity: 0
  1109. };
  1110. var points=[];
  1111. for (var i=0; i<gpoly.length; i++) { points.push(new CErrorsOpenLayers.Geometry.Point(gpoly[i].x, gpoly[i].y)); }
  1112. var newpoly=new CErrorsOpenLayers.Geometry.LinearRing(points);
  1113. lineFeature.push(new CErrorsOpenLayers.Feature.Vector(newpoly, null, style));
  1114. }
  1115. }
  1116. }
  1117.  
  1118. // Display highlighted features
  1119. try{ ColorErrors_mapLayer.addFeatures(lineFeature); }
  1120. catch(err){ log('err addFeatures: ',err); }
  1121. }
  1122. // **********************
  1123. // ** Telephone fix **
  1124. // **********************
  1125. function fixTel(){
  1126.  
  1127. var editpanel = $('#edit-panel');
  1128. if (editpanel.length==0) { window.setTimeout(fixTel, 1000); return; }
  1129.  
  1130. $('#edit-panel').bind('DOMSubtreeModified',function(e){
  1131. var g= $('td[name ="roadType"]');
  1132. g.change(function(){
  1133. alert($(this).val());
  1134. })
  1135. //var g = document.getElementsByName('roadType');
  1136. //console.log("test ",g.value, g.text, g.options[g.selectedIndex].text);
  1137.  
  1138.  
  1139. var editLM = $('#venue-edit-more-info');
  1140. //console.debug("PHONE: editLM" , editLM);
  1141. if (editLM.length==1) {
  1142. var fixPhoneBtn = $('#wme-telephonefix-fr'); //console.debug("PHONE: fixPhoneBtn" , fixPhoneBtn);
  1143. if (fixPhoneBtn.length==0) {
  1144. fixPhoneBtn=document.createElement('button');
  1145. fixPhoneBtn.innerHTML='fix';
  1146. fixPhoneBtn.id='wme-telephonefix-fr';
  1147. $(fixPhoneBtn).css({'float':'right','position':'absolute','right':'0px','bottom':'0px','background-color':'white','border-top-right-radius':'6px','border-bottom-right-radius':'6px','border':'1px solid #cccccc','border-left':'1px dashed #cccccc'});
  1148. $('[name=phone]').parent().append(fixPhoneBtn);
  1149.  
  1150. try {
  1151. var venue=Waze.selectionManager.getSelectedFeatures()[0].model;
  1152. var phone=venue.attributes.phone;
  1153. var newPhone='';
  1154. var phoneTo='';
  1155.  
  1156. // num 0800 et 0900
  1157. if (venue.attributes.phone.startsWith('08')==true) {
  1158. phoneTo = venue.attributes.phone.replace(/^0[.| |-]?8[.| |-]?([0-9])([0-9])[.| |-]?([0-9])([0-9])[.| |-]?([0-9])([0-9])[.| |-]?([0-9])([0-9])$/g, "0 8$1$2 $3$4$5 $6$7$8");
  1159. } else {
  1160. // rules by country
  1161. switch(CErrorsModel.getTopCountry().id) {
  1162. case 3: // Algeria
  1163. if (venue.attributes.phone.startsWith('+213')==true) {
  1164. phoneTo = venue.attributes.phone.replace(/^\+213[ ]?([0-9])[.| |-]?([0-9][0-9])[.| |-]?([0-9][0-9])[.| |-]?([0-9][0-9])[.| |-]?([0-9][0-9])$/g ,"+213 $1 $2 $3 $4 $5");
  1165. } else {
  1166. phoneTo = venue.attributes.phone.replace(/^0([0-9])[.| |-]?([0-9][0-9])[.| |-]?([0-9][0-9])[.| |-]?([0-9][0-9])[.| |-]?([0-9][0-9])$/g, "+213 $1 $2 $3 $4 $5");
  1167. }
  1168. break;
  1169. case 73: // France
  1170. if (venue.attributes.phone.startsWith('+33')==true) {
  1171. phoneTo = venue.attributes.phone.replace(/^\+33[ ]?([0-9])[.| |-]?([0-9][0-9])[.| |-]?([0-9][0-9])[.| |-]?([0-9][0-9])[.| |-]?([0-9][0-9])$/g ,"+33 $1 $2 $3 $4 $5");
  1172. } else if (venue.attributes.phone.startsWith('0033')==true) {
  1173. phoneTo = venue.attributes.phone.replace(/^0033[ ]?([0-9])[.| |-]?([0-9][0-9])[.| |-]?([0-9][0-9])[.| |-]?([0-9][0-9])[.| |-]?([0-9][0-9])$/g ,"+33 $1 $2 $3 $4 $5");
  1174. } else {
  1175. phoneTo = venue.attributes.phone.replace(/^0([0-9])[.| |-]?([0-9][0-9])[.| |-]?([0-9][0-9])[.| |-]?([0-9][0-9])[.| |-]?([0-9][0-9])$/g, "+33 $1 $2 $3 $4 $5");
  1176. }
  1177. break;
  1178. case 74: // French Guiana
  1179. if (venue.attributes.phone.startsWith('+594 5 94')==true || venue.attributes.phone.startsWith('+594594')==true) {
  1180. phoneTo = venue.attributes.phone.replace(/^\+594[ ]?([0-9])[.| |-]?([0-9][0-9])[.| |-]?([0-9][0-9])[.| |-]?([0-9][0-9])[.| |-]?([0-9][0-9])$/g ,"+594 $1$2 $3 $4 $5");
  1181. } else {
  1182. phoneTo = venue.attributes.phone.replace(/^0([0-9])[.| |-]?([0-9][0-9])[.| |-]?([0-9][0-9])[.| |-]?([0-9][0-9])[.| |-]?([0-9][0-9])$/g, "+594 $1$2 $3 $4 $5");
  1183. }
  1184. break;
  1185. case 88: // Guadeloupe
  1186. if (venue.attributes.phone.startsWith('+590 5 90')==true || venue.attributes.phone.startsWith('+590590')==true) {
  1187. phoneTo = venue.attributes.phone.replace(/^\+590[ ]?([0-9])[.| |-]?([0-9][0-9])[.| |-]?([0-9][0-9])[.| |-]?([0-9][0-9])[.| |-]?([0-9][0-9])$/g ,"+590 $1$2 $3 $4 $5");
  1188. } else {
  1189. phoneTo = venue.attributes.phone.replace(/^0([0-9])[.| |-]?([0-9][0-9])[.| |-]?([0-9][0-9])[.| |-]?([0-9][0-9])[.| |-]?([0-9][0-9])$/g, "+590 $1$2 $3 $4 $5");
  1190. }
  1191. break;
  1192. case 141: // Martinique
  1193. if (venue.attributes.phone.startsWith('+596 5 96')==true || venue.attributes.phone.startsWith('+596596')==true) {
  1194. phoneTo = venue.attributes.phone.replace(/^\+596[ ]?([0-9])[.| |-]?([0-9][0-9])[.| |-]?([0-9][0-9])[.| |-]?([0-9][0-9])[.| |-]?([0-9][0-9])$/g ,"+596 $1$2 $3 $4 $5");
  1195. } else {
  1196. phoneTo = venue.attributes.phone.replace(/^0([0-9])[.| |-]?([0-9][0-9])[.| |-]?([0-9][0-9])[.| |-]?([0-9][0-9])[.| |-]?([0-9][0-9])$/g, "+596 $1$2 $3 $4 $5");
  1197. }
  1198. break;
  1199. case 148: // Monaco
  1200. if (venue.attributes.phone.startsWith('+377')==true) {
  1201. phoneTo = venue.attributes.phone.replace(/^\+377[ ]?([0-9])[.| |-]?([0-9][0-9])[.| |-]?([0-9][0-9])[.| |-]?([0-9][0-9])[.| |-]?([0-9][0-9])$/g ,"+377 $1 $2 $3 $4 $5");
  1202. } else {
  1203. phoneTo = venue.attributes.phone.replace(/^0([0-9])[.| |-]?([0-9][0-9])[.| |-]?([0-9][0-9])[.| |-]?([0-9][0-9])[.| |-]?([0-9][0-9])$/g, "+377 $1 $2 $3 $4 $5");
  1204. }
  1205. break;
  1206. case 152: // Morocco
  1207. if (venue.attributes.phone.startsWith('+212')==true) {
  1208. phoneTo = venue.attributes.phone.replace(/^\+212[ ]?([0-9])[.| |-]?([0-9][0-9])[.| |-]?([0-9][0-9])[.| |-]?([0-9][0-9])[.| |-]?([0-9][0-9])$/g ,"+212 $1 $2 $3 $4 $5");
  1209. } else {
  1210. phoneTo = venue.attributes.phone.replace(/^0([0-9])[.| |-]?([0-9][0-9])[.| |-]?([0-9][0-9])[.| |-]?([0-9][0-9])[.| |-]?([0-9][0-9])$/g, "+212 $1 $2 $3 $4 $5");
  1211. }
  1212. break;
  1213. case 184: // Reunion
  1214. if (venue.attributes.phone.startsWith('+262 2 62')==true || venue.attributes.phone.startsWith('+262262')==true) {
  1215. phoneTo = venue.attributes.phone.replace(/^\+262[ ]?([0-9])[.| |-]?([0-9][0-9])[.| |-]?([0-9][0-9])[.| |-]?([0-9][0-9])[.| |-]?([0-9][0-9])$/g ,"+262 $1$2 $3 $4 $5");
  1216. } else {
  1217. phoneTo = venue.attributes.phone.replace(/^0([0-9])[.| |-]?([0-9][0-9])[.| |-]?([0-9][0-9])[.| |-]?([0-9][0-9])[.| |-]?([0-9][0-9])$/g, "+262 $1$2 $3 $4 $5");
  1218. }
  1219. break;
  1220. default : break;
  1221. }
  1222. }
  1223.  
  1224. if (phoneTo != venue.attributes.phone) { newPhone=phoneTo; }
  1225.  
  1226. if (newPhone!='')
  1227. {
  1228. fixPhoneBtn.addEventListener("click", function (v, p) {
  1229. return function () {
  1230. var newAtts = { phone: p, id: v.attributes.id };
  1231. Waze.model.actionManager.add(new (require("Waze/Action/UpdateObject"))(v, newAtts));
  1232. $(fixPhoneBtn).css({'display': 'none'});
  1233. }
  1234. }(venue, newPhone), false);
  1235. }
  1236. else
  1237. $(fixPhoneBtn).css({'display': 'none'});
  1238. }
  1239. catch (err)
  1240. {
  1241. $(fixPhoneBtn).css({'display': 'none'});
  1242. }
  1243. //.debug("PHONE: append fixPhoneBtn" , fixPhoneBtn);
  1244. }
  1245.  
  1246. var fixPhoneBtn = $('#wme-telephonefix-fr'); //console.debug("PHONE: fixPhoneBtn" , fixPhoneBtn);
  1247. }
  1248.  
  1249. })
  1250. }
  1251.  
  1252. CErrors_bootstrap();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址