WME Color Errors

Adds colours to show errors

当前为 2020-07-01 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name WME Color Errors
  3. // @name:fr WME Color Errors
  4. // @version 0.85
  5. // @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=
  6. // @description Adds colours to show errors
  7. // @description:fr Colorisation pour afficher les erreurs
  8. // @include https://www.waze.com/editor*
  9. // @include https://www.waze.com/*/editor*
  10. // @include https://beta.waze.com/*
  11. // @exclude https://www.waze.com/user/*
  12. // @exclude https://www.waze.com/*/user/*
  13. // @namespace https://gf.qytechs.cn/fr/scripts/21186-wme-color-errors
  14. // @author Sebiseba
  15. // @copyright Sebiseba 2014-2017
  16. // @grant none
  17. // ==/UserScript==
  18.  
  19. var WMECErrors={}, ColorErrors_mapLayer=[], CErrLeg, CErrSeg, CErrPoi, myLevel, prefPhone, debug="";
  20. var CErrWaze, CErrorsMap, CErrorsModel, CErrorsI18n, CErrorsOpenLayers, CErrorshandle, CErrorshandleClass, CErrorshandleClass2,
  21.  
  22. //french rules
  23. 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 |Passage |Place |Placette |Pont |Promenade |Quai |Résidence[s]? |Route |[ ]?Rue[ ]?|Ruelle |Sente |Sentier |Square |Traverse |Venelle |Villa |Voie )",
  24. parkNameSeg="^(Aire |Place |Square )",
  25. excepNameSeg="(Périphérique|Rocade|Duplex|Tunnel|Pont)",
  26. privNameSeg="^(Allée |Avenue |Boulevard |Chemin |Clos |Côte |Cours |Faubourg |Hameau |Impasse |Lotissement |Mail |Passage |Porte |Promenade |Quai |Route |Rue |Ruelle |Sente |Sentier |Voie )",
  27. parkNamePoi="(Parking[s]?|Parc-Relais|Placette|Aire|Arrêt|Emplacement)",
  28. 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)",
  29. busPoi="(Bus[ ][-][ ]|Gare Routière)",
  30. tramPoi="(Tramway[ ][-][ ]|Métro[ ][-][ ])",
  31. possibleTransPoi="(Tram$|Métro$|Arrêt$|Gare$|Station$|Tram |Métro |Arrêt |Gare |Station )",
  32.  
  33. // common all countries
  34. 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)",
  35. landmarkPoi="(RIVER_STREAM|CANAL|SEA_LAKE_POOL|POOL|SWAMP_MARSH|ISLAND|FOREST_GROVE|BRIDGE)",
  36. excepCatPoi="(RIVER_STREAM|CANAL|SEA_LAKE_POOL|SWAMP_MARSH|ISLAND|FOREST_GROVE|BRIDGE|SWAMP_MARSH|PARK|JUNCTION_INTERCHANGE|CEMETERY|TUNNEL)",
  37. entryPointPoi="(BRIDGE|CANAL|FOREST_GROVE|ISLAND|JUNCTION_INTERCHANGE|POOL|RIVER_STREAM|SEA_LAKE_POOL|SWAMP_MARSH|TUNNEL)",
  38. wazeBot="(admin|avseu|WazeFeed|waze-maint-bot|Waze3rdparty)";
  39.  
  40. // *********************
  41. // ** HELPER FUNCTION **
  42. // *********************
  43.  
  44. function getId(node) {
  45. return document.getElementById(node);
  46. }
  47. function getElementsByClassName(classname, node) {
  48. node || (node=document.getElementsByTagName("body")[0]);
  49. for (var a=[], re=new RegExp("\\b" + classname + "\\b"), els=
  50. node.getElementsByTagName("*"), i=
  51. 0, j=
  52. els.length;i < j;i++) {
  53. re.test(els[i].className) && a.push(els[i]);
  54. }
  55. return a;
  56. }
  57. function IsJsonString(str) {
  58. try {
  59. JSON.parse(str);
  60. } catch (e) {
  61. return false;
  62. }
  63. return true;
  64. }
  65. function getSelectedFeatures(){
  66. if(!W.selectionManager.getSelectedFeatures)
  67. return W.selectionManager.selectedItems;
  68. return W.selectionManager.getSelectedFeatures();
  69. }
  70. // *************
  71. // ** INIT **
  72. // *************
  73. function CErrors_bootstrap() {
  74. if (typeof unsafeWindow === "undefined") {
  75. unsafeWindow =( function () {
  76. var dummyElem=document.createElement('p');
  77. dummyElem.setAttribute('onclick', 'return window;');
  78. return dummyElem.onclick();
  79. }) ();
  80. }
  81. console.log("starting WME Color Errors", GM_info.script.version);
  82. CErrors_init();
  83. fixTel();
  84. }
  85. function CErrors_init(){
  86. // W object needed
  87. CErrWaze=unsafeWindow.W; if(typeof(CErrWaze) === 'undefined'){ if (debug) { console.error("WME ColorErrors - CErrWaze : NOK"); } window.setTimeout(CErrors_init, 500); return; }
  88. CErrorsMap=CErrWaze.map; if(typeof(CErrorsMap) == 'undefined'){ if (debug) { console.error("WME ColorErrors - CErrorsmap : NOK"); } window.setTimeout(CErrors_init, 500); return; }
  89. CErrorsModel=CErrWaze.model; if(typeof(CErrorsModel) == 'undefined'){ if (debug) { console.error("WME ColorErrors - CErrorsmodel : NOK"); } window.setTimeout(CErrors_init, 500); return; }
  90. if(typeof(CErrorsModel.getTopCountry()) === 'undefined' || CErrorsModel.getTopCountry() === null){ if (debug) { console.error("WME ColorErrors - CErrorsmodel Countries top : NOK"); } window.setTimeout(CErrors_init, 500); return; }
  91. CErrorsI18n=unsafeWindow.I18n; if(typeof (CErrorsI18n) == 'undefined') { if (debug) { console.error('WME ColorErrors - CErrorsI18n : NOK'); } setTimeout(CErrors_init, 500); return; }
  92. // OpenLayers
  93. CErrorsOpenLayers=unsafeWindow.OpenLayers; if(typeof(CErrorsOpenLayers) === 'undefined'){ if (debug) { console.error("WME ColorErrors - OL : NOK"); } window.setTimeout(CErrors_init, 500); return; }
  94. // Waze GUI needed
  95. CErrorshandle=getId("user-info"); if(typeof(CErrorshandle) == 'undefined'){ window.setTimeout(CErrors_init, 500); return; }
  96. CErrorshandleClass=getElementsByClassName("nav-tabs", CErrorshandle)[0]; if(typeof(CErrorshandleClass) === 'undefined'){ window.setTimeout(CErrors_init, 500); return; }
  97. CErrorshandleClass2=getElementsByClassName("tab-content", CErrorshandle)[0]; if(typeof(CErrorshandleClass2) === 'undefined'){ window.setTimeout(CErrors_init, 500); return; }
  98.  
  99. // Verify localStorage. Init if empty or not correct
  100. if (typeof(localStorage.WMEColorErrors) === "undefined" || localStorage.WMEColorErrors.lenght===null || !IsJsonString(localStorage.WMEColorErrors)) {
  101. WMECErrors.opacity=0.85; // Icons Opacity on map
  102. WMECErrors.myLvl=false; // Show when editable
  103. WMECErrors.seg_Bad=false; // Bad Segments (group)
  104. WMECErrors.seg_Priv=true; // Private with bad name
  105. WMECErrors.seg_Park=true; // Parking with name (but Place / Square)
  106. WMECErrors.seg_Rail=true; // Railroad with bad name
  107. WMECErrors.seg_HW_name=true; //Highways with bad name
  108. WMECErrors.seg_Dir_name=true; // Directions but not Ramp/Freeway
  109. WMECErrors.seg_Toll=true; // Toll (but Ramp/Freeway)
  110. WMECErrors.seg_Ramp_name=true; // Ramp with 3 directions or more
  111. WMECErrors.seg_Ramp_city=true; // Ramp with city name
  112. WMECErrors.seg_RShield=true; // Wrong prefix
  113. WMECErrors.seg_RSAlt=true; //Roadshield must be in alt
  114. WMECErrors.seg_SNameAlt=true; //Road name must be in alt
  115. WMECErrors.seg_DleSpace=true; // Double space in name
  116. WMECErrors.seg_SegBadRS=true; // RoadShield but bad type
  117. WMECErrors.seg_HNFree=true; // House number on Freeway or ramp
  118. WMECErrors.seg_BadSpeed=true; // Bad speed (ex: >80km/h in city)
  119. WMECErrors.seg_BadAltState=true; // Alt State != Main State
  120. WMECErrors.seg_EmptyCityAlt=true; // Alt City is empty
  121. WMECErrors.seg_LockValue=true; // Bad lock
  122. // POI
  123. WMECErrors.poi_Bad=false; // Bad POI (group)
  124. WMECErrors.poi_Park_name=true; // Parking with [P]
  125. WMECErrors.poi_Address=true; // Dxxx/Nxxx in or no address
  126. WMECErrors.poi_Entry=true; // Entry Point not defined
  127. WMECErrors.poi_LandM=true; // Landmark with address (street |& city)
  128. WMECErrors.poi_DleSpace=true; // Double space in name
  129. // Low errors
  130. WMECErrors.poi_Resid=true; // Maybe a residential
  131. WMECErrors.poi_Google=true; // No link with Google
  132. WMECErrors.poi_Phone=true; // bad phone number format
  133. WMECErrors.poi_WFeed=true; // Place created by WazeFeed
  134. WMECErrors.poi_WPark=true; // Place created by WazeParking1
  135. WMECErrors.poi_Relig=true; // Religious Center with bad name
  136. WMECErrors.poi_Transp=true; // Bad type or bad name for Buses, Subway or Tramway
  137. WMECErrors.poi_GasSta=true; // Gas Station with bad name
  138. WMECErrors.poi_Other=true; // Place "Other"
  139. localStorage.setItem('WMEColorErrors', JSON.stringify(WMECErrors));
  140. }
  141.  
  142. // Phone prefix
  143. switch(CErrorsModel.getTopCountry().id) {
  144. case 3: prefPhone='+213[ ](\\d{2})'; break; // format +213 (dd) xx xx xx @ Algeria
  145. case 73: prefPhone='+33[ ]\\d[ ]\\d{2}'; break; // format +33 d (dd) xx xx xx @ France
  146. case 74: prefPhone='+594[ ]594'; break; // format +594 594 xx xx xx @ French Guiana
  147. case 88: prefPhone='+590[ ]590'; break; // format +590 590 xx xx xx @ Guadeloupe
  148. case 141: prefPhone='+596[ ]596'; break; // format +596 596 xx xx xx @ Martinique
  149. case 148: prefPhone='+377[ ]\\d{2}'; break; // format +377 xx xx xx xx @ Monaco
  150. case 152: prefPhone='+212[ ](\\d{3})'; break; // format +212 xxx xx xx xx @ Morocco
  151. case 184: prefPhone='+262[ ]262'; break; // format +262 262 xx xx xx @ Reunion
  152. default : break;
  153. }
  154.  
  155. // WME Layers check
  156. var layersColor=CErrorsMap.getLayersBy("uniqueName","__WME_Color_Errors"), layersIcons=CErrorsMap.getLayersBy("uniqueName","__WME_Color_Errors_Icons");
  157. var ColorErrors_style=new CErrorsOpenLayers.Style({
  158. pointRadius: 2,
  159. fontWeight: "normal",
  160. label : "${labelText}",
  161. fontFamily: "Tahoma, Courier New",
  162. labelOutlineColor: "#FFFFFF",
  163. labelOutlineWidth: 2,
  164. fontColor: '#000000',
  165. fontSize: "10px"
  166. });
  167. if (layersColor.length === 0) {
  168. ColorErrors_mapLayer=new CErrorsOpenLayers.Layer.Vector("Color Errors", {
  169. displayInLayerSwitcher: false,
  170. uniqueName: "__WME_Color_Errors",
  171. styleMap: new CErrorsOpenLayers.StyleMap(ColorErrors_style)
  172. });
  173. CErrorsI18n.translations[CErrorsI18n.locale].layers.name["__WME_Color_Errors"]="Color Errors";
  174. CErrorsMap.addLayer(ColorErrors_mapLayer);
  175. ColorErrors_mapLayer.setVisibility(true);
  176. }
  177. if (layersIcons.length === 0) {
  178. ColorErrors_mapLayerIcons=new CErrorsOpenLayers.Layer.Vector("Color Errors Icons", {
  179. displayInLayerSwitcher: false,
  180. uniqueName: "__WME_Color_Errors_Icons",
  181. styleMap: new CErrorsOpenLayers.StyleMap(ColorErrors_style)
  182. });
  183. CErrorsI18n.translations[CErrorsI18n.locale].layers.name["__WME_Color_Errors_Icons"]="Color Errors Icons";
  184. CErrorsMap.addLayer(ColorErrors_mapLayerIcons);
  185. ColorErrors_mapLayerIcons.setVisibility(true);
  186. }
  187. myLevel=CErrWaze.loginManager.user.rank;
  188. CErrors_Mainhtml();
  189. }
  190. function CErrAddInfo(){
  191. if (getSelectedFeatures().length !== 0 && !getId('ErrorsList')) {
  192. var CEtest = document.createElement('li');
  193. CEtest.id = "ErrorsList";
  194. if(getElementsByClassName('additional-attributes')[0]) getElementsByClassName('additional-attributes')[0].appendChild(CEtest);
  195. }
  196. }
  197. // *************
  198. // ** HTML **
  199. // *************
  200.  
  201. function CErrors_Mainhtml() {
  202. if (CErrorsI18n.locale == 'fr') {
  203. CErrSeg=new Array('Contrôle des segments',
  204. 'Mauvais segments',
  205. 'Voie privée avec possible mauvais nom',
  206. 'Voie de Parking nommée',
  207. 'Voie ferrée nommée ou nom en alt',
  208. 'Types Routes avec mauvais nom',
  209. 'Bretelle avec plusieurs directions',
  210. 'Direction (sauf bretelle et Autoroute)',
  211. 'Mauvais préfixe (RoadShield)',
  212. 'Double espace dans le nom',
  213. 'Péage (sauf bretelle et Autoroute)',
  214. 'Bretelle/Autoroute avec nom de ville',
  215. 'Le RoadShield doit être en alt',
  216. 'Le nom de route doit être en alt',
  217. 'RoadShield sur mauvais type de voie',
  218. 'N° de rue sur mauvais type de voie',
  219. 'Mauvaise vitesse validée',
  220. 'Département alt différent du principal',
  221. 'Lock non conforme (Auto ou valeur)',
  222. 'Alt non conforme'
  223. );
  224. CErrPoi=new Array('Contrôle des places',
  225. 'Mauvaises places',
  226. 'Parking mal nommé ou sans nom',
  227. 'Pas d\'adresse ou contenant Dxxx/Nxxx',
  228. 'Point d\'entrée non défini',
  229. 'Site naturel avec adresse',
  230. 'Double espace dans le nom',
  231. 'Peut-être une place résidentielle',
  232. 'Pas de lien avec Google',
  233. 'Lieu édité par WazeFeed',
  234. 'Lieu de type "Autres"',
  235. 'Lieu édité par WazeParking1',
  236. 'Parking : type non défini',
  237. 'Mauvais format du n° de tel',
  238. 'Lieu de culte (nom ou catégorie)',
  239. 'Transport (nom ou catégorie)',
  240. 'Station-Service mal nommée',
  241. );
  242. CErrLeg=new Array('Légende',
  243. 'A corriger',
  244. 'A vérifier',
  245. 'Pour information',
  246. 'Réglages',
  247. 'Opacité des icônes',
  248. 'Afficher seulements les éditables',
  249. 'Verrouillé par la publicité'
  250. );
  251. }
  252. else {
  253. CErrSeg=new Array('Segments Checking',
  254. 'Bad Segments',
  255. 'Private with possible bad name',
  256. 'Parking with bad name or without',
  257. 'Railroad with name or altname',
  258. 'Highways with bad name',
  259. 'Ramp with several directions',
  260. 'Direction (but Ramp/Freeway)',
  261. 'Wrong prefix (RoadShield)',
  262. 'Double spacing in name',
  263. 'Toll (but Ramp/Freeway)',
  264. 'Ramp/Freeway with city name',
  265. 'RoadShield must be in alt',
  266. 'Road name must be in alt',
  267. 'RoadShield but bad type',
  268. 'HN but bad type',
  269. 'Bad speed verified',
  270. 'Alt State dirrent to Main State',
  271. 'Bad lock (Auto or value)',
  272. 'Bad Alt'
  273. );
  274. CErrPoi=new Array('Places Checking',
  275. 'Bad Places',
  276. 'Parking with bad name or null',
  277. 'No address or Dxxx/Nxxx within',
  278. 'Entry Point not defined',
  279. 'Natural features with address',
  280. 'Double spacing in name',
  281. 'Maybe a residential place',
  282. 'No link with Google',
  283. 'Place created by WazeFeed',
  284. 'Place type is "Other"',
  285. 'Place created by WazeParking1',
  286. 'Parking : type undefined',
  287. 'Bad phone number format',
  288. 'Religious Center (name or cat)',
  289. 'Transportation (name or cat)',
  290. 'Gas Station with bad name'
  291. );
  292. CErrLeg=new Array('Legend',
  293. 'To correct',
  294. 'To check',
  295. 'For information',
  296. 'Settings',
  297. 'Icons opacity',
  298. 'Show when editable',
  299. 'Locked by ad'
  300. );
  301. }
  302. //Create content in CErrors's tab
  303. var CEnewtab=document.createElement('li');
  304. CEnewtab.innerHTML="<a href='#sidepanel-ColorErrors' data-toggle='tab'><span class='fa fa-eye' title='Color Errors'></span></a>";
  305. CErrorshandleClass.appendChild(CEnewtab);
  306.  
  307. var WMECErrors=JSON.parse(localStorage.getItem('WMEColorErrors'));
  308. var CEaddon=document.createElement('section');
  309. CEaddon.id="sidepanel-ColorErrors";
  310. 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>'
  311. + '<h4 style="float:left;clear:both;">'+CErrLeg[4]+'</h4><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>'
  312. + '<div style="float:left;clear:both;"><input type="checkbox" id="_myLvl"'+(WMECErrors.myLvl ? ' checked' : '')+'/> '+CErrLeg[6]+'</div>'
  313. + '<br><br><h4 style="float:left;margin-top:10px;">'+CErrSeg[0]+'</h4><div style="clear:both;">'
  314. + '<input type="checkbox" id="_seg_Bad"'+(WMECErrors.seg_Bad ? ' checked' : '')+'/> '+CErrSeg[1]+'<br><div id="BadSeg" style="margin-left:5px;"><table>';
  315. CEcontent += fillHtml("seg_Priv", "seg_Bad","#ff7700","\uf256",CErrSeg[2]);
  316. CEcontent += fillHtml("seg_Ramp_name", "seg_Bad","#ff7700","\uf25a",CErrSeg[6]);
  317. CEcontent += fillHtml("seg_BadSpeed", "seg_Bad","#ff7700","\uf1ce",CErrSeg[16]);
  318. CEcontent += fillHtml("seg_BadAltState","seg_Bad","#ff7700","\uf037",CErrSeg[17]);
  319. CEcontent += fillHtml("seg_EmptyCityAlt","seg_Bad","#ff7700","\uf064",CErrSeg[19]);
  320. CEcontent += fillHtml("seg_LockValue", "seg_Bad","#ff7700","\uf023",CErrSeg[18]);
  321. CEcontent += fillHtml("seg_Park", "seg_Bad","#ff0000","\uf288",CErrSeg[3]);
  322. CEcontent += fillHtml("seg_Rail", "seg_Bad","#ff0000","\uf238",CErrSeg[4]);
  323. CEcontent += fillHtml("seg_Dir_name", "seg_Bad","#ff0000","\uf0a9",CErrSeg[7]);
  324. CEcontent += fillHtml("seg_Toll", "seg_Bad","#ff0000","\uf155",CErrSeg[10]);
  325. CEcontent += fillHtml("seg_Ramp_city", "seg_Bad","#ff0000","\uf015",CErrSeg[11]);
  326. CEcontent += fillHtml("seg_SNameAlt", "seg_Bad","#ff0000","\uf079",CErrSeg[13]);
  327. CEcontent += fillHtml("seg_DleSpace", "seg_Bad","#ff0000","\uf101",CErrSeg[9]);
  328. CEcontent += fillHtml("seg_HW_name", "seg_Bad","#ff0000","\uf018",CErrSeg[5]);
  329. CEcontent += fillHtml("seg_RSAlt", "seg_Bad","#ff0000","\uf074",CErrSeg[12]);
  330. CEcontent += fillHtml("seg_RShield", "seg_Bad","#ff0000","\uf152",CErrSeg[8]);
  331. CEcontent += fillHtml("seg_SegBadRS", "seg_Bad","#ff0000","\uf044",CErrSeg[14]);
  332. CEcontent += fillHtml("seg_HNFree", "seg_Bad","#ff0000","\uf162",CErrSeg[15]);
  333.  
  334. CEcontent += '</table></div></div><br><h4 style="float:left;">'+CErrPoi[0]+'</h4><div style="clear:both;"><tr><td><input type="checkbox" id="_poi_Bad"'+(WMECErrors.poi_Bad ? ' checked' : '')+'/> '+CErrPoi[1]+'<br><div id="BadPoi" style="margin-left:5px;"><table>';
  335. CEcontent += fillHtml("poi_Address", "poi_Bad","#ff0000","\uf2bc",CErrPoi[3]);
  336. CEcontent += fillHtml("poi_LandM", "poi_Bad","#ff0000","\uf1bb",CErrPoi[5]);
  337. CEcontent += fillHtml("poi_DleSpace", "poi_Bad","#ff0000","\uf101",CErrPoi[6]);
  338. CEcontent += fillHtml("poi_Transp", "poi_Bad","#ff0000","\uf207",CErrPoi[15]);
  339. CEcontent += fillHtml("poi_GasSta", "poi_Bad","#ff0000","\uf1b9",CErrPoi[16]);
  340. CEcontent += fillHtml("poi_Park_name","poi_Bad","#ff0000","\uf288",CErrPoi[2]);
  341. CEcontent += fillHtml("poi_Park_type","poi_Bad","#ff0000","\uf11d",CErrPoi[12]);
  342. CEcontent += fillHtml("poi_Relig", "poi_Bad","#ff0000","\uf015",CErrPoi[14]);
  343. CEcontent += fillHtml("poi_Entry", "poi_Bad","#ff7700","\uf18e",CErrPoi[4]);
  344. CEcontent += fillHtml("poi_Resid", "poi_Bad","#ff7700","\uf015",CErrPoi[7]);
  345. CEcontent += fillHtml("poi_Google", "poi_Bad","#ff7700","\uf1a0",CErrPoi[8]);
  346. CEcontent += fillHtml("poi_Phone", "poi_Bad","#ff7700","\uf095",CErrPoi[13]);
  347. CEcontent += fillHtml("poi_Other", "poi_Bad","#ff7700","\uf29c",CErrPoi[10]);
  348. CEcontent += fillHtml("poi_WFeed", "poi_Bad","#ffcc00","\uf263",CErrPoi[9]);
  349. CEcontent += fillHtml("poi_WPark", "poi_Bad","#ffcc00","\uf263",CErrPoi[11]);
  350. CEcontent += '</table></div></div><br><h4 style="float:left;">'+CErrLeg[0]+'</h4><div style="clear:both;">';
  351. CEcontent += '<table><tr><td><div style="margin:5px;width:30px;height:2px;background-color:#ff0000;"></div></td><td>'+CErrLeg[1]+'</td></tr>';
  352. CEcontent += '<tr><td><div style="margin:5px;width:30px;height:2px;background-color:#ff7700;"></div></td><td>'+CErrLeg[2]+'</td></tr>';
  353. CEcontent += '<tr><td><div style="margin:5px;width:30px;height:2px;background-color:#ffcc00;"></div></td><td>'+CErrLeg[3]+'</td></tr></table></div>';
  354. CEaddon.innerHTML=CEcontent;
  355. CEaddon.className='tab-pane';
  356. CErrorshandleClass2.appendChild(CEaddon);
  357.  
  358. getId('errOpacity').value=WMECErrors.opacity;
  359. getId('opacityValue').innerHTML = getId('errOpacity').value;
  360.  
  361. getId('errOpacity').onmousemove = function(){
  362. getId('opacityValue').innerHTML = getId('errOpacity').value;
  363. var ls=JSON.parse(localStorage.WMEColorErrors);
  364. ls.opacity=getId('errOpacity').value;
  365. localStorage.setItem('WMEColorErrors', JSON.stringify(ls));
  366. CErrColor();
  367. };
  368. getId('_myLvl').onclick=(function(){
  369. var ls=JSON.parse(localStorage.WMEColorErrors);
  370. (getId('_myLvl').checked === true ? ls.myLvl=true : ls.myLvl=false);
  371. localStorage.setItem('WMEColorErrors', JSON.stringify(ls));
  372. CErrColor();
  373. });
  374. getId('_seg_Bad').onclick=(function(){
  375. var ls=JSON.parse(localStorage.WMEColorErrors);
  376. if (getId('_seg_Bad').checked === true) {
  377. for (var i=0; getElementsByClassName('_seg', BadSeg) [i]; i++) getElementsByClassName('_seg', BadSeg) [i].disabled=false;
  378. ls.seg_Bad=true;
  379. }
  380. else {
  381. for (var i=0; getElementsByClassName('_seg', BadSeg) [i]; i++) getElementsByClassName('_seg', BadSeg) [i].disabled=true;
  382. ls.seg_Bad=false;
  383. }
  384. localStorage.setItem('WMEColorErrors', JSON.stringify(ls));
  385. CErrColor();
  386. });
  387. getId('_poi_Bad').onclick=(function(){
  388. var ls=JSON.parse(localStorage.WMEColorErrors);
  389. if (getId('_poi_Bad').checked === true) {
  390. for (var i=0; getElementsByClassName('_poi', BadPoi) [i]; i++) getElementsByClassName('_poi', BadPoi) [i].disabled=false;
  391. ls.poi_Bad=true;
  392. }
  393. else {
  394. for (var i=0; getElementsByClassName('_poi', BadPoi) [i]; i++) getElementsByClassName('_poi', BadPoi) [i].disabled=true;
  395. ls.poi_Bad=false;
  396. }
  397. localStorage.setItem('WMEColorErrors', JSON.stringify(ls));
  398. CErrColor();
  399. });
  400. 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(); });
  401. 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(); });
  402. 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(); });
  403. 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(); });
  404. 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(); });
  405. 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(); });
  406. 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(); });
  407. 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(); });
  408. 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(); });
  409. 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(); });
  410. 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(); });
  411. 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(); });
  412. 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(); });
  413. 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(); });
  414. 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(); });
  415. 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(); });
  416. 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(); });
  417. 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(); });
  418.  
  419. 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(); });
  420. 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(); });
  421. 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(); });
  422. 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(); });
  423. 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(); });
  424. 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(); });
  425. 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(); });
  426. 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(); });
  427. 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(); });
  428. 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(); });
  429. 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(); });
  430. 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(); });
  431. 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(); });
  432. 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(); });
  433. 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(); });
  434.  
  435. CErrWaze.selectionManager.events.register("selectionchanged", null, CErrAddInfo);
  436. CErrWaze.selectionManager.events.register("selectionchanged", null, CErrColor);
  437. CErrorsModel.actionManager.events.register("afterclearactions", null, CErrColor);
  438. CErrorsModel.actionManager.events.register("afterundoaction", null, CErrColor);
  439. CErrorsMap.events.register("zoomend", null, CErrColor);
  440. CErrorsMap.events.register("moveend", null, CErrColor);
  441. window.setTimeout(CErrColor, 500);
  442. }
  443. function fillHtml(id,type,color,icon,text) {
  444. var WMECErrors=JSON.parse(localStorage.getItem('WMEColorErrors'));
  445. 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>';
  446. }
  447. function checkClicLayer(){
  448. var lieu=CErrorsI18n.translations[CErrorsI18n.locale].layers.name.landmarks;
  449. getId('layer-switcher-'+CErrorsMap.getLayersByName(lieu)[0].id).onclick=(function(){
  450. window.setTimeout((function() {
  451. CErrColor();
  452. }),10);
  453. });
  454. }
  455. function addIcon(icon,color,geometry,type,pos) {
  456. var style = {
  457. fill: false,
  458. stroke: false,
  459. label: icon,
  460. labelAlign: "cb",
  461. labelXOffset: -4,
  462. labelYOffset: (pos*20),
  463. fontColor: color,
  464. fontSize:"20px",
  465. fontOpacity: getId('errOpacity').value,
  466. fontFamily: "FontAwesome",
  467. labelOutlineWidth: 2,
  468. zIndex: 99999
  469. };
  470. if (type==="segment") {
  471. if(geometry.length==2){
  472. var midX = (((geometry[0].x + geometry[1].x) / 2) + geometry[0].x) / 2;
  473. var midY = (((geometry[0].y + geometry[1].y) / 2) + geometry[0].y) / 2;
  474. var labelPoint = new CErrorsOpenLayers.Geometry.Point(midX,midY);
  475. var imageFeature = new CErrorsOpenLayers.Feature.Vector(labelPoint, null, style);
  476. ColorErrors_mapLayer.addFeatures([imageFeature]);
  477. }
  478. else {
  479. for(i=0;i<geometry.length-1;i++){
  480. if(i%3==1){
  481. var midX = (((geometry[i].x + geometry[i+1].x) / 2) + geometry[i].x) / 2;
  482. var midY = (((geometry[i].y + geometry[i+1].y) / 2) + geometry[i].y) / 2;
  483. var labelPoint = new CErrorsOpenLayers.Geometry.Point(midX,midY);
  484. var imageFeature = new CErrorsOpenLayers.Feature.Vector(labelPoint, null, style);
  485. ColorErrors_mapLayer.addFeatures([imageFeature]);
  486. }
  487. }
  488. }
  489. }
  490. else {
  491. var midX = (((geometry.left + geometry.right) / 2) + geometry.right) / 2;
  492. var midY = (((geometry.bottom + geometry.top) / 2) + geometry.bottom) / 2;
  493. var labelPoint = new CErrorsOpenLayers.Geometry.Point(midX,midY);
  494. var imageFeature = new CErrorsOpenLayers.Feature.Vector(labelPoint, null, style);
  495. ColorErrors_mapLayer.addFeatures([imageFeature]);
  496. }
  497. }
  498. function addLegend(id,icon,color,text){
  499. if(getSelectedFeatures()[0] && getSelectedFeatures()[0].model.attributes.id===id && getId('ErrorsList')) {
  500. getId('ErrorsList').innerHTML +="<span style='color:"+color+";font-family:FontAwesome;'>"+icon+"</span> <span style='color:"+color+";'>"+text+"</span><br>";
  501. }
  502. }
  503. function CErrColor(){
  504. var lineFeature=[], ls=JSON.parse(localStorage.WMEColorErrors);
  505. var lieu=CErrorsI18n.translations[CErrorsI18n.locale].layers.name.landmarks;
  506.  
  507. // Initialize layer
  508. try { ColorErrors_mapLayer.destroyFeatures(); }
  509. catch(err){ log('err destroyFeatures: ',err); }
  510.  
  511. if (getId('ErrorsList')) { getId('ErrorsList').innerHTML=""; }
  512.  
  513. //Segments Checking
  514. if (ls.seg_Bad) {
  515. for (var seg in CErrorsModel.segments.objects) {
  516. // Get values
  517. var segment=CErrorsModel.segments.getObjectById(seg), j=0;
  518. var attributes=segment.attributes;
  519. var geometry=attributes.geometry.components;
  520. var line=getId(segment.geometry.id);
  521. if (segment===null || line === null || segment.state === "Update") continue;
  522. //Name
  523. var sid=attributes.primaryStreetID;
  524. var street=CErrorsModel.streets.getObjectById(sid);
  525. if (street===null) continue;
  526. //Alt Name
  527. var salt=attributes.streetIDs[0];
  528. var streetalt=CErrorsModel.streets.getObjectById(salt);
  529. if (streetalt) {
  530. var altname=streetalt.name;
  531. var streetAltCity = CErrorsModel.cities.getObjectById(streetalt.cityID);
  532. } else { var altname=""; }
  533. //City
  534. var streetCity = CErrorsModel.cities.getObjectById(street.cityID);
  535.  
  536. if (streetCity===null) continue;
  537. streetCity = streetCity.attributes.name;
  538.  
  539. var roadType=attributes.roadType;
  540. if (attributes.primaryStreetID === null || attributes.primaryStreetID === undefined) continue;
  541. if (CErrorsModel.streets.getObjectById(attributes.primaryStreetID) === null || CErrorsModel.streets.getObjectById(attributes.primaryStreetID) === undefined) continue;
  542. var newWidth="", newColor="", newOpacity="0", gline="";
  543.  
  544. if ((ls.myLvl && attributes.rank <= myLevel) || ls.myLvl===false) {
  545. if (ls.seg_Ramp_city) { // Ramp/Freeway with city name
  546. if (streetCity && /^(3|4)$/.test(attributes.roadType)) {
  547. newColor="#ff0000"; newWidth=3; newOpacity=0.95; gline=segment.attributes.geometry.getVertices();
  548. j++;
  549. addIcon("\uf015",newColor,geometry,"segment",j);
  550. addLegend(attributes.id,"\uf015",newColor,CErrSeg[11]);
  551. }
  552. }
  553. if (street.name || altname) {
  554. if (/( - )/.test(street.name)) { var trs=street.name.split(" - "); }
  555. if (ls.seg_Priv) { // Private with bad name
  556. if (attributes.roadType===17 && new RegExp(streetNameSeg).test(street.name)===false) {
  557. newColor="#ff7700"; newWidth=3; newOpacity=0.95; gline=segment.attributes.geometry.getVertices();
  558. j++;
  559. addIcon("\uf256",newColor,geometry,"segment",j);
  560. addLegend(attributes.id,"\uf256",newColor,CErrSeg[2]);
  561. }
  562. }
  563. if (ls.seg_Park && street.name) { // Parking with name (But Place / Square)
  564. if (attributes.roadType===20 && new RegExp(parkNameSeg).test(street.name)===false) {
  565. newColor="#ff0000"; newWidth=3; newOpacity=0.95; gline=segment.attributes.geometry.getVertices();
  566. j++;
  567. addIcon("\uf288",newColor,geometry,"segment",j);
  568. addLegend(attributes.id,"\uf288",newColor,CErrSeg[3]);
  569. }
  570. }
  571. if (ls.seg_Rail && street.name) { // Railroad with bad name
  572. if (attributes.roadType===18 && (altname || street.name)) { //Railroad with name
  573. newColor="#ff0000"; newWidth=3; newOpacity=0.95; gline=segment.attributes.geometry.getVertices();
  574. j++;
  575. addIcon("\uf238",newColor,geometry,"segment",j);
  576. addLegend(attributes.id,"\uf238",newColor,CErrSeg[4]);
  577. }
  578. }
  579. if (ls.seg_Ramp_name && street.name) {
  580. if (/^(3|4)$/.test(attributes.roadType) && /\/.*\//.test(street.name)) { // Ramp with 3 directions or more
  581. newColor="#ff0000"; newWidth=3; newOpacity=0.95; gline=segment.attributes.geometry.getVertices();
  582. j++;
  583. addIcon("\uf25b",newColor,geometry,"segment",j);
  584. addLegend(attributes.id,"\uf25b",newColor,CErrSeg[6]);
  585. }
  586. else if (/^(3|4)$/.test(attributes.roadType) && /\//.test(street.name)) { // Ramp with 2 directions
  587. newColor="#ff7700"; newWidth=3; newOpacity=0.95; gline=segment.attributes.geometry.getVertices();
  588. j++;
  589. addIcon("\uf25a",newColor,geometry,"segment",j);
  590. addLegend(attributes.id,"\uf25a",newColor,CErrSeg[6]);
  591. }
  592. }
  593. if (ls.seg_Dir_name && street.name) { // Directions but not Ramp/Freeway/Major
  594. if (/^[^3|4|6]$/.test(attributes.roadType) && /[:|>]/.test(street.name)) {
  595. newColor="#ff0000"; newWidth=3; newOpacity=0.95; gline=segment.attributes.geometry.getVertices();
  596. j++;
  597. addIcon("\uf0a9",newColor,geometry,"segment",j);
  598. addLegend(attributes.id,"\uf0a9",newColor,CErrSeg[7]);
  599. }
  600. }
  601. if (ls.seg_Toll) { // Toll but not Ramp/Freeway
  602. if (/^[^3|4]$/.test(attributes.roadType) && (attributes.fwdToll || attributes.revToll)) {
  603. newColor="#ff0000"; newWidth=3; newOpacity=0.95; gline=segment.attributes.geometry.getVertices();
  604. j++;
  605. addIcon("\uf155",newColor,geometry,"segment",j);
  606. addLegend(attributes.id,"\uf155",newColor,CErrSeg[10]);
  607. }
  608. }
  609. if (ls.seg_RSAlt && street.name) { // RoadShield must be in alt
  610. if (attributes.roadType!=19 && trs
  611. && /^[A|C|D|N|M|R|T][0-9]+[a-z]?[0-9]?/.test(trs[0].replace(".",""))===true // Roadshield (1st part)
  612. && / - /.test(street.name)===true // Roadshield & street name (separator -)
  613. && /Intérieure|Extérieure/.test(trs[1])===false
  614. && streetCity // City ok
  615. ) {
  616. newColor="#ff0000"; newWidth=3; newOpacity=0.95; gline=segment.attributes.geometry.getVertices();
  617. j++;
  618. addIcon("\uf074",newColor,geometry,"segment",j);
  619. addLegend(attributes.id,"\uf074",newColor,CErrSeg[12]);
  620. }
  621. }
  622. if (ls.seg_HW_name && street.name) { // Highways with bad name
  623. 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) {
  624. newColor="#ff0000"; newWidth=3; newOpacity=0.95; gline=segment.attributes.geometry.getVertices();
  625. j++;
  626. addIcon("\uf018",newColor,geometry,"segment",j);
  627. addLegend(attributes.id,"\uf018",newColor,CErrSeg[5]);
  628. }
  629. }
  630. if (ls.seg_SegBadRS && street.name) { // RoadShield but bad type
  631. 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))) {
  632. newColor="#ff0000"; newWidth=3; newOpacity=0.95; gline=segment.attributes.geometry.getVertices();
  633. j++;
  634. addIcon("\uf044",newColor,geometry,"segment",j);
  635. addLegend(attributes.id,"\uf044",newColor,CErrSeg[14]);
  636. }
  637. }
  638. if (ls.seg_HNFree) { // House number on Freeway or ramp (and some undrivables)
  639. if (/^(3|4|8|14|18|19)$/.test(attributes.roadType) && attributes.hasHNs===true) {
  640. newColor="#ff0000"; newWidth=3; newOpacity=0.95; gline=segment.attributes.geometry.getVertices();
  641. j++;
  642. addIcon("\uf162",newColor,geometry,"segment",j);
  643. addLegend(attributes.id,"\uf162",newColor,CErrSeg[15]);
  644. }
  645. }
  646. if (ls.seg_BadSpeed) { // Bad speed (ex: >70km/h in city)
  647. if (attributes.fwdMaxSpeed>70 && attributes.fwdMaxSpeedUnverified===false && attributes.revMaxSpeed>70 && attributes.revMaxSpeedUnverified===false && streetCity) {
  648. newColor="#ff7700"; newWidth=3; newOpacity=0.95; gline=segment.attributes.geometry.getVertices();
  649. j++;
  650. addIcon("\uf1ce",newColor,geometry,"segment",j);
  651. addLegend(attributes.id,"\uf1ce",newColor,CErrSeg[16]);
  652. }
  653. }
  654. if (ls.seg_RShield && street.name) { // Wrong prefix (RoadShield)
  655. 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)
  656. || /^[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
  657. ) {
  658. newColor="#ff0000"; newWidth=3; newOpacity=0.95; gline=segment.attributes.geometry.getVertices();
  659. j++;
  660. addIcon("\uf152",newColor,geometry,"segment",j);
  661. addLegend(attributes.id,"\uf152",newColor,CErrSeg[8]);
  662. }
  663. }
  664. if (ls.seg_SNameAlt && street.name) { // Street Name must be in alt
  665. if (attributes.roadType!=19 && trs
  666. && /^[A|C|D|N|M|R|T][0-9]+[a-z]?[0-9]?/.test(trs[0].replace(".",""))===true // Roadshield (1st part)
  667. && /^[E][0-9]/.test(trs[1])===false // European Roadshield (2nd part)
  668. && new RegExp(excepNameSeg).test(street.name)===false // Exception
  669. && / - /.test(street.name)===true // Roadshield & street name (separator -)
  670. && /Intérieure|Extérieure/.test(trs[1])===false
  671. && !streetCity // No city
  672. ) {
  673. newColor="#ff0000"; newWidth=3; newOpacity=0.95; gline=segment.attributes.geometry.getVertices();
  674. j++;
  675. addIcon("\uf079",newColor,geometry,"segment",j);
  676. addLegend(attributes.id,"\uf079",newColor,CErrSeg[13]);
  677. }
  678. }
  679. if (ls.seg_DleSpace && street.name) { // Double spacing in name
  680. if (/ /.test(street.name)===true) {
  681. newColor="#ff0000"; newWidth=3; newOpacity=0.95; gline=segment.attributes.geometry.getVertices();
  682. j++;
  683. addIcon("\uf101",newColor,geometry,"segment",j);
  684. addLegend(attributes.id,"\uf101",newColor,CErrSeg[9]);
  685. }
  686. }
  687. if (ls.seg_BadAltState) {
  688. if (streetalt != null && CErrorsModel.cities.getObjectById(street.cityID).attributes.stateID != streetAltCity.attributes.stateID) { // Alt State != Main State
  689. newColor="#ff7700"; newWidth=3; newOpacity=0.95; gline=segment.attributes.geometry.getVertices();
  690. j++;
  691. addIcon("\uf037",newColor,geometry,"segment",j);
  692. 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>";
  693. }
  694. }
  695. if (ls.seg_EmptyCityAlt && streetalt != null) { // Bad Alt
  696. var g=0;
  697. for (var f=0; f < attributes.streetIDs.length; f++) {
  698. var streetalt=CErrorsModel.streets.getObjectById(attributes.streetIDs[f]);
  699. 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) {
  700. newColor="#ff7700"; newWidth=3; newOpacity=0.95; gline=segment.attributes.geometry.getVertices();
  701. j++;
  702. addIcon("\uf064",newColor,geometry,"segment",j);
  703. addLegend(attributes.id,"\uf064",newColor,CErrSeg[19]);
  704. }
  705. }/*
  706. g=0;
  707. for (var f=0; f < attributes.streetIDs.length; f++) {
  708. if (street.name == streetalt.name && streetAltCity.attributes.name != "") { g=1; }
  709. }
  710. if (g == 0) {
  711. newColor="#ff7700"; newWidth=3; newOpacity=0.95; gline=segment.attributes.geometry.getVertices();
  712. j++;
  713. addIcon("\uf064",newColor,geometry,"segment",j);
  714. addLegend(attributes.id,"\uf064",newColor,CErrSeg[19]);
  715. }*/
  716. }
  717. }
  718. if (ls.seg_LockValue) {
  719. if (
  720. ((attributes.fwdFlags==1 || attributes.revFlags==1) && attributes.lockRank != 4) || // Speedcam but not locked 5
  721. attributes.fwdFlags==0 && attributes.revFlags==0 && // no speedcam
  722. (/^(3|4|6|18)$/.test(attributes.roadType) && attributes.lockRank != 4 //Lock 5 for freeway, ramp, major and railroad
  723. || attributes.roadType==7 && attributes.lockRank != 3 //Lock 4 for minor
  724. || attributes.roadType==2 && attributes.lockRank != 2 //Lock 3 for primary
  725. || /^(1|8|17|19|22)$/.test(attributes.roadType) === true && attributes.lockRank != 0 && attributes.lockRank != null) //Lock 1 for others (5,10,15,16,20)
  726. ) {
  727. newColor="#ff7700"; newWidth=3; newOpacity=0.95; gline=segment.attributes.geometry.getVertices();
  728. j++;
  729. addIcon("\uf023",newColor,geometry,"segment",j);
  730. addLegend(attributes.id,"\uf023",newColor,CErrSeg[18]);
  731. }
  732. }
  733. // Highlight if error
  734. if (gline !== "") {
  735. var style={
  736. strokeWidth: newWidth,
  737. strokeColor: newColor,
  738. strokeOpacity: newOpacity
  739. };
  740. var points=[];
  741. for (var i=0; i<gline.length; i++) { points.push(new CErrorsOpenLayers.Geometry.Point(gline[i].x, gline[i].y)); }
  742. var newline=new CErrorsOpenLayers.Geometry.LineString(points);
  743. lineFeature.push(new CErrorsOpenLayers.Feature.Vector(newline, null, style));
  744. }
  745. }
  746. }
  747. }
  748.  
  749. //Places Checking
  750. if (ls.poi_Bad && getId('layer-switcher-group_places').checked) {
  751. for (var poi in CErrorsModel.venues.objects) {
  752. // Get values
  753. var venue=CErrorsModel.venues.getObjectById(poi), j=0;
  754. var pattributes=venue.attributes;
  755. var geometry=pattributes.geometry.bounds;
  756. var poly=pattributes.id;
  757. if (venue===null || poly === null || poi.state=="Update" || poi.selected) continue;
  758. var categories=pattributes.categories;
  759. var pname=pattributes.name;
  760. var venueStreet=CErrorsModel.streets.getObjectById(pattributes.streetID);
  761. if (venueStreet) { var venueCity = CErrorsModel.cities.getObjectById(venueStreet.cityID); }
  762. var newWidth="", newColor="", newOpacity="0", gpoly="";
  763.  
  764. if ((ls.myLvl && pattributes.rank <= myLevel && pattributes.adLocked===false) || ls.myLvl===false) {
  765. if (ls.poi_Resid) { // maybe a residential POI
  766. if ((/^[0-9][ ]?[a-zA-Z]/.test(pname)===true || new RegExp(privNameSeg).test(pname)===true) && pattributes.residential===false && pattributes.categories.indexOf("PARKING_LOT")===-1) {
  767. newColor="#ff7700"; newWidth=15; newOpacity=0.5; gpoly=pattributes.geometry.getVertices();
  768. if (venue.isPoint()) { newWidth=26; }
  769. j++;
  770. addIcon("\uf015",newColor,geometry,"venue",j);
  771. addLegend(poly,"\uf015",newColor,CErrPoi[7]);
  772. }
  773. }
  774. if (ls.poi_Google) { //POI without Google link
  775. if (pattributes.externalProviderIDs.length===0 && pattributes.residential===false && new RegExp(excepCatPoi).test(categories)===false) {
  776. newColor="#ff7700"; newWidth=15; newOpacity=0.5; gpoly=pattributes.geometry.getVertices();
  777. if (venue.isPoint()) { newWidth=26; }
  778. j++;
  779. addIcon("\uf1a0",newColor,geometry,"venue",j);
  780. addLegend(poly,"\uf1a0",newColor,CErrPoi[8]);
  781. }
  782. }
  783. if (ls.poi_Phone && pattributes.phone) { //POI with bad phone number
  784. if (new RegExp('^(\\'+prefPhone + ')([ ](\\d{2})){3}$').test(pattributes.phone)===false // Prefix + 4 digits
  785. && (/^[13]\d[ ](\d{2})$/).test(pattributes.phone)===false // 1x xx or 3x xx
  786. && (/^(0[ ]8\d{2})([ ](\d{3})){2}/).test(pattributes.phone)===false // 0 8xx xxx xxx
  787. && (/^(0[ ]8\d{2})([ ](\d{2})){3}/).test(pattributes.phone)===false // 0 8xx xx xx xx
  788. && (/^(15|17|18|112)$/).test(pattributes.phone)===false // Emergency numbers
  789. ) {
  790. newColor="#ff7700"; newWidth=15; newOpacity=0.5; gpoly=pattributes.geometry.getVertices();
  791. if (venue.isPoint()) { newWidth=26; }
  792. j++;
  793. addIcon("\uf095",newColor,geometry,"venue",j);
  794. addLegend(poly,"\uf095",newColor,CErrPoi[13]);
  795. }
  796. }
  797. if (ls.poi_Other) { // Place type is "Other"
  798. if (categories.indexOf("OTHER") > -1 && (/^Déchèterie/).test(pname)===false) {
  799. newColor="#ff7700"; newWidth=15; newOpacity=0.5; gpoly=pattributes.geometry.getVertices();
  800. if (venue.isPoint()) { newWidth=26; }
  801. j++;
  802. addIcon("\uf29c",newColor,geometry,"venue",j);
  803. addLegend(poly,"\uf29c",newColor,CErrPoi[10]);
  804. }
  805. }
  806. if (ls.poi_Entry) { // POI with default entryExitPoints
  807. if (new RegExp(entryPointPoi).test(categories)===false && pattributes.entryExitPoints.length===0 && venue.isPoint()===false) {
  808. newColor="#ff7700"; newWidth=15; newOpacity=0.5; gpoly=pattributes.geometry.getVertices();
  809. j++;
  810. addIcon("\uf18e",newColor,geometry,"venue",j);
  811. addLegend(poly,"\uf18e",newColor,CErrPoi[4]);
  812. }
  813. }
  814. if (ls.poi_Park_name && categories.indexOf("PARKING_LOT") > -1) { // Parking with bad name
  815. if (new RegExp(streetNameSeg).test(pname)===true) { continue; } //If parking name is a road
  816. if (new RegExp('^'+parkNamePoi+'$').test(pname)===true || // Only Parkings or Aire // ?️|?️️|
  817. new RegExp('^'+parkNamePoi).test(pname)===false // Don't start by ?️ or Parking
  818. // /^(Parking[s]?)( de[s]?| du | le[s]? | la | pour )/.test(pname)===true // Contain bad words
  819. ) {
  820. newColor="#ff0000"; newWidth=15; newOpacity=0.5; gpoly=pattributes.geometry.getVertices();
  821. j++;
  822. addIcon("\uf288",newColor,geometry,"venue",j);
  823. addLegend(poly,"\uf288",newColor,CErrPoi[2]);
  824. }
  825. else if (pname==="") {
  826. newColor="#ff7700"; newWidth=15; newOpacity=0.5; gpoly=pattributes.geometry.getVertices();
  827. j++;
  828. addIcon("\uf288",newColor,geometry,"venue",j);
  829. addLegend(poly,"\uf288",newColor,CErrPoi[2]);
  830. }
  831. if (venue.isPoint()) newWidth=26;
  832. }
  833. if (ls.poi_Park_type && categories.indexOf("PARKING_LOT") > -1) { // Parking with type undefined
  834. if (/PUBLIC|RESTRICTED|PRIVATE/.test(pattributes.categoryAttributes.PARKING_LOT.parkingType)===false) {
  835. newColor="#ff0000"; newWidth=15; newOpacity=0.5; gpoly=pattributes.geometry.getVertices();
  836. j++;
  837. addIcon("\uf11d",newColor,geometry,"venue",j);
  838. addLegend(poly,"\uf11d",newColor,CErrPoi[12]);
  839. }
  840. }
  841. if (ls.poi_Address) { // POI with bad address (Nxxx/Dxxx) or without address
  842. if (venueStreet===null) continue;
  843. if ((/^[A|D|N|M|R][0-9]+/.test(venueStreet.name) && /[ - ]/.test(venueStreet.name)) || (venueStreet.name===null && new RegExp(landmarkPoi).test(categories) === 'false')) {
  844. newColor="#ff0000"; newWidth=15; newOpacity=0.5; gpoly=pattributes.geometry.getVertices();
  845. if (venue.isPoint()) { newWidth=26; }
  846. j++;
  847. addIcon("\uf2bc",newColor,geometry,"venue",j);
  848. addLegend(poly,"\uf2bc",newColor,CErrPoi[3]);
  849. }
  850. }
  851. if (ls.poi_LandM) { // Landmark with road name or city name
  852. if (new RegExp(landmarkPoi).test(categories) && pname==="" && ((venueStreet && venueStreet.name) || (venueCity && venueCity.attributes.name))) {
  853. newColor="#ff0000"; newWidth=15; newOpacity=0.5; gpoly=pattributes.geometry.getVertices();
  854. if (venue.isPoint()) { newWidth=26; }
  855. j++;
  856. addIcon("\uf1bb",newColor,geometry,"venue",j);
  857. addLegend(poly,"\uf1bb",newColor,CErrPoi[5]);
  858. }
  859. }
  860. if (ls.poi_DleSpace) { // Double spacing in name
  861. if (venueStreet && (/ /.test(venueStreet.name)===true || / /.test(pname)===true)) {
  862. newColor="#ff0000"; newWidth=15; newOpacity=0.5; gpoly=pattributes.geometry.getVertices();
  863. j++;
  864. addIcon("\uf101",newColor,geometry,"venue",j);
  865. addLegend(poly,"\uf101",newColor,CErrPoi[6]);
  866. if (venue.isPoint()) { newWidth=26; }
  867. }
  868. }
  869. if (ls.poi_GasSta && categories.indexOf("GAS_STATION") > -1) { // Gas Station with bad name
  870. if (new RegExp(streetNameSeg).test(pname)===true) { continue; } //If parking name is a road
  871. if (/^(Station-service )/.test(pname)===false) { // Don't start by
  872. newColor="#ff0000"; newWidth=15; newOpacity=0.5; gpoly=pattributes.geometry.getVertices();
  873. j++;
  874. addIcon("\uf1b9",newColor,geometry,"venue",j);
  875. addLegend(poly,"\uf288",newColor,CErrPoi[16]);
  876. if (venue.isPoint()) newWidth=26;
  877. }
  878. }
  879. if (ls.poi_Transp && new RegExp(stationsPoi).test(categories)===false) { //Bus Subway and Tram Station wihtout others stations
  880. if ((
  881. categories.indexOf("BUS_STATION") > -1 && // Good category for bus station
  882. new RegExp('^'+busPoi).test(pname)===false // Bad name
  883. ) || (
  884. categories.indexOf("SUBWAY_STATION") > -1 && // Good category for subway station
  885. new RegExp('^'+tramPoi).test(pname)===false // Bad name
  886. ) || (
  887. categories.indexOf("TRAIN_STATION") > -1 && // Good category for train station
  888. /Gare d[e|u|es|\']/.test(pname)===false // Bad name
  889. ) || (
  890. categories.indexOf("OTHER") == -1 && categories.indexOf("BUS_STATION") == -1 && categories.indexOf("SUBWAY_STATION") == -1 && categories.indexOf("TRAIN_STATION") == -1 &&
  891. new RegExp('^'+possibleTransPoi).test(pname)===true // Maybe a transport station
  892. ) ){
  893. newColor="#ff0000"; newWidth=15; newOpacity=0.5; gpoly=pattributes.geometry.getVertices();
  894. j++;
  895. addIcon("\uf207",newColor,geometry,"venue",j);
  896. addLegend(poly,"\uf207",newColor,CErrPoi[15]);
  897. if (venue.isPoint()) { newWidth=26; }
  898. }
  899. }
  900. if (ls.poi_Relig && categories.indexOf("RELIGIOUS_CENTER") > -1) { // Religious Center with bad name
  901. if (new RegExp('^'+religiousPoi+'$').test(pname)===true || // category without name
  902. new RegExp('^'+religiousPoi).test(pname)===false) { // Bad 1st name
  903. newColor="#ff0000"; newWidth=15; newOpacity=0.5; gpoly=pattributes.geometry.getVertices();
  904. j++;
  905. addIcon("\uf015",newColor,geometry,"venue",j);
  906. addLegend(poly,"\uf015",newColor,CErrPoi[14]);
  907. if (venue.isPoint()) { newWidth=26; }
  908. }
  909. }
  910. if ((ls.poi_Relig && new RegExp('^'+religiousPoi).test(pname)===true && categories.indexOf("RELIGIOUS_CENTER") == -1) || // Religious Center Name but bad category
  911. (new RegExp('^'+religiousPoi+'$').test(pname)===true && categories.indexOf("RELIGIOUS_CENTER") == -1)) { // Bad Religious Center Name with bad category
  912. newColor="#ff0000"; newWidth=15; newOpacity=0.5; gpoly=pattributes.geometry.getVertices();
  913. j++;
  914. addIcon("\uf015",newColor,geometry,"venue",j);
  915. addLegend(poly,"\uf015",newColor,CErrPoi[14]);
  916. if (venue.isPoint()) { newWidth=26; }
  917. }
  918. if (ls.poi_WFeed || ls.poi_WPark) { //Place updated by WazeFeed
  919. if (pattributes.updatedBy && CErrorsModel.users.getObjectById(pattributes.updatedBy)) {
  920. var updName = CErrorsModel.users.getObjectById(pattributes.updatedBy).userName;
  921. if (((ls.poi_WFeed && new RegExp(wazeBot).test(updName)) || (ls.poi_WPark && updName=="WazeParking1")) && pattributes.residential===false) {
  922. newColor="#ffcc00"; newWidth=15; newOpacity=0.5; gpoly=pattributes.geometry.getVertices();
  923. if (venue.isPoint()) { newWidth=26; newOpacity=0.75; }
  924. j++;
  925. addIcon("\uf263",newColor,geometry,"venue",j);
  926. if (updName=="WazeFeed") { addLegend(poly,"\uf263",newColor,CErrPoi[9]); }
  927. else { addLegend(poly,"\uf263",newColor,CErrPoi[11]); }
  928. }
  929. }
  930. }
  931. // Highlight if error
  932.  
  933. }
  934. if (pattributes.adLocked) {
  935. newColor="#ff0000"; newWidth=15; newOpacity=0.75; gpoly=pattributes.geometry.getVertices();
  936. j++;
  937. addIcon("\uf023",newColor,geometry,"venue",j);
  938. addLegend(poly,"\uf023",newColor,CErrLeg[7]);
  939. if (venue.isPoint()) { newWidth=26; }
  940. }
  941. if (gpoly!=="") {
  942. var style={
  943. strokeWidth: newWidth,
  944. strokeColor: newColor,
  945. strokeOpacity: newOpacity,
  946. fillOpacity: 0
  947. };
  948. var points=[];
  949. for (var i=0; i<gpoly.length; i++) { points.push(new CErrorsOpenLayers.Geometry.Point(gpoly[i].x, gpoly[i].y)); }
  950. var newpoly=new CErrorsOpenLayers.Geometry.LinearRing(points);
  951. lineFeature.push(new CErrorsOpenLayers.Feature.Vector(newpoly, null, style));
  952. }
  953. }
  954. }
  955.  
  956. // Display highlighted features
  957. try{ ColorErrors_mapLayer.addFeatures(lineFeature); }
  958. catch(err){ log('err addFeatures: ',err); }
  959. }
  960. // *************************
  961. // ** Telephone fix FR **
  962. // *************************
  963. function fixTel(){
  964. var editpanel = $('#edit-panel');
  965. if (editpanel.length==0) { window.setTimeout(fixTel, 1000); return; }
  966.  
  967. $('#edit-panel').bind('DOMSubtreeModified',function(e){
  968. var editLM = $('#venue-edit-more-info');
  969. //console.debug("PHONE: editLM" , editLM);
  970. if (editLM.length==1) {
  971. var fixPhoneBtn = $('#wme-telephonefix-fr'); //console.debug("PHONE: fixPhoneBtn" , fixPhoneBtn);
  972. if (fixPhoneBtn.length==0)
  973. {
  974. fixPhoneBtn=document.createElement('button');
  975. fixPhoneBtn.innerHTML='fix';
  976. fixPhoneBtn.id='wme-telephonefix-fr';
  977. $(fixPhoneBtn).css({'float':'right','position':'absolute','right':'0px','bottom':'0px','height':'27px','background-color':'white','border-top-right-radius':'6px','border-bottom-right-radius':'6px','border':'1px solid #cccccc','border-left':'1px dashed #cccccc'});
  978. $('[name=phone]').parent().append(fixPhoneBtn);
  979.  
  980. try {
  981. var venue=Waze.selectionManager.getSelectedFeatures()[0].model;
  982. var phone=venue.attributes.phone;
  983. var newPhone='';
  984. var phoneTo='';
  985. 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");
  986. if (phoneTo!=venue.attributes.phone && phoneTo.startsWith('+33 8')==false)
  987. newPhone=phoneTo;
  988. phoneTo = venue.attributes.phone.replace(/^\+33[ ]*(?:\(?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");
  989. if (phoneTo!=venue.attributes.phone && phoneTo.startsWith('+33 8')==false)
  990. newPhone=phoneTo;
  991. 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");
  992. if (phoneTo!=venue.attributes.phone)
  993. newPhone=phoneTo;
  994. phoneTo = venue.attributes.phone.replace(/^\+33[ ]*(?:\(?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");
  995. if (phoneTo!=venue.attributes.phone)
  996. newPhone=phoneTo;
  997.  
  998. if (newPhone!='')
  999. {
  1000. fixPhoneBtn.addEventListener("click", function (v, p) {
  1001. return function () {
  1002. var newAtts = { phone: p, id: v.attributes.id };
  1003. Waze.model.actionManager.add(new (require("Waze/Action/UpdateObject"))(v, newAtts));
  1004. $(fixPhoneBtn).css({'display': 'none'});
  1005. }
  1006. }(venue, newPhone), false);
  1007. }
  1008. else
  1009. $(fixPhoneBtn).css({'display': 'none'});
  1010. }
  1011. catch (err)
  1012. {
  1013. $(fixPhoneBtn).css({'display': 'none'});
  1014. }
  1015. //.debug("PHONE: append fixPhoneBtn" , fixPhoneBtn);
  1016. }
  1017. }
  1018.  
  1019. })
  1020. }
  1021.  
  1022. CErrors_bootstrap();

QingJ © 2025

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