WME Validator Virginia Localization

This script localizes WME Validator for United States. You also need main package (WME Validator) installed.

  1. // ==UserScript==
  2. // @name WME Validator Virginia Localization
  3. // @version 0.1.4
  4. // @description This script localizes WME Validator for United States. You also need main package (WME Validator) installed.
  5. // @match https://editor-beta.waze.com/*editor/*
  6. // @match https://www.waze.com/*editor/*
  7. // @grant none
  8. // @run-at document-start
  9. // @namespace https://greasyfork.org/users/6285
  10. // ==/UserScript==
  11. //
  12.  
  13. /*
  14. * 0.1.0 - New State Standards for SR < (600 && 785 && 985) and VA > 600 &!(785|895)
  15. */
  16.  
  17.  
  18. /*
  19. See Settings->About->Available checks for complete list of checks and their params.
  20.  
  21. Examples:
  22.  
  23. Enable #170 "Lowercase street name" but allow lowercase "exit" and "to":
  24. "170.enabled": true,
  25. "170.params": {
  26. "regexp": "/^((exit|to) )?[a-z]/",
  27. "},
  28.  
  29. Enable #130 "Custom check" to find a dot in street names, but allow dots at Ramps:
  30. "130.enabled": true,
  31. "130.params": {
  32. "titleEN": "Street name with a dot",
  33. "problemEN": "There is a dot in the street name (excluding Ramps)",
  34. "solutionEN": "Expand the abbreviation or remove the dot",
  35. "template": "${type}:${street}",
  36. "regexp": "D/^[^4][0-9]?:.*\\./",
  37. },
  38. *Note: use D at the beginning of RegExp to enable debugging on JS console.
  39. *Note: do not forget to escape backslashes in strings, i.e. use "\\" instead of "\".
  40. */
  41.  
  42. window.WME_Validator_United_States = {
  43. ".country": "United States",
  44. ".codeISO": "US",
  45. ".author": "SuperMedic",
  46. ".updated": "2014-12-02",
  47. ".link": "https://greasyfork.org/en/scripts/6859-wme-validator-virginia-localization",
  48. // Ramp name too long
  49. "112.enabled": false,
  50. "112.params": {
  51. "n": 55,
  52. },
  53. // Custom Check
  54. "130.enabled": true,
  55. "130.params": {
  56. "titleEN": "Potential Incorrect Abbreviation",
  57. "problemEN": "Name abbreviation may be incorrect. Alternative routes should be labeled ALT and abbreviations ALT, BUS, BYP, CONN, LOOP, SCN, SPUR, or TRUCK should be in ALL CAPS",
  58. "solutionEN": "Change abbreviation to ALT, BUS, BYP, CONN, LOOP, SCN, SPUR, or TRUCK in ALL CAPS",
  59. "template": "${street}##${altStreet[0]}##${altStreet[1]}##${altStreet[2]}##${altStreet[3]}##${altStreet[4]}##${altStreet[5]}##${altStreet[6]}##${altStreet[7]}##${altStreet[8]}##${altStreet[9]}",
  60. "regexp": "/!?[0-9].+(Alt|Business|Bus|Byp|Conn|Loop|Scn|Spur|Truck)\\b/"
  61. },
  62. // Custom Check
  63. "131.enabled": true,
  64. "131.params": {
  65. "titleEN": "Wrong name on US Highway",
  66. "problemEN": "All US highways should be named US-###",
  67. "solutionEN": "Change name to US-###",
  68. "template": "${street}##${altStreet[0]}##${altStreet[1]}##${altStreet[2]}##${altStreet[3]}##${altStreet[4]}##${altStreet[5]}##${altStreet[6]}##${altStreet[7]}##${altStreet[8]}##${altStreet[9]}",
  69. "regexp": ".*\\b(?:US Highway |US Hwy Route |US Hwy Rte |US Hwy |US Rte |US- |US )[0-9]{1,3}\\b/i"
  70. },
  71. "131.solutionLink": "W:Virginia#Roads",
  72. // Custom Check
  73. "132.enabled": true,
  74. "132.params": {
  75. "titleEN": "Wrong road type (Major)",
  76. "problemEN": "All US Highways should be at least Major Highway (except BUS, SPUR, LOOP)",
  77. "solutionEN": "Change the road type to Major Highway",
  78. "template": "${typeRank}#${street}@#${altStreet[0]}@#${altStreet[1]}@#${altStreet[2]}@#${altStreet[3]}@#${altStreet[4]}@#${altStreet[5]}@#${altStreet[6]}@#${altStreet[7]}@#${altStreet[8]}@#${altStreet[9]}@",
  79. "regexp": "/^[1-9](?![245]).*#(?:US Hwy |US-)[0-9]+(?: ALT| BYP| CONN| TRUCK| SCN| Scenic| [NSWE])*@/i"
  80. },
  81. "132.solutionLink": "W:Road_types/USA#Major_Highway",
  82. // Custom Check
  83. "133.enabled": true,
  84. "133.params": {
  85. "titleEN": "Wrong road type (Minor)",
  86. "problemEN": "All US BUS, SPUR, LOOP Highways and all State Highways (except BUS, SPUR, LOOP) should be at least Minor Highway type",
  87. "solutionEN": "Change the road type to Minor Highway",
  88. "template": "${typeRank}#${street}@#${altStreet[0]}@#${altStreet[1]}@#${altStreet[2]}@#${altStreet[3]}@#${altStreet[4]}@#${altStreet[5]}@#${altStreet[6]}@#${altStreet[7]}@#${altStreet[8]}@#${altStreet[9]}@",
  89. "regexp": "/^[1-9](?![2-5]).*#(?:(?:State Hwy |SH-|K-|LA-|M-|MA-|MS-|NC-|SC-)[0-9]+(?:| ALT| BYP| CONN| TRUCK| SCN| Scenic| [NSWE])*|(?:US Hwy |US-)[0-9]+(?: BUS| LOOP| SPUR)+(?: [NSWE])?)@/i"
  90. },
  91. "133.solutionLink": "W:Road_types/USA#Minor_Highway",
  92. // Custom Check
  93. "134.enabled": true,
  94. "134.params": {
  95. "titleEN": "Wrong road type (Primary)",
  96. "problemEN": "All State BUS, SPUR, LOOP Highways should be at least Primary Street type",
  97. "solutionEN": "Change the road type to Primary Street",
  98. "template": "${typeRank}#${street}@#${altStreet[0]}@#${altStreet[1]}@#${altStreet[2]}@#${altStreet[3]}@#${altStreet[4]}@#${altStreet[5]}@#${altStreet[6]}@#${altStreet[7]}@#${altStreet[8]}@#${altStreet[9]}@",
  99. "regexp": "/^[1-9](?![1-5]).*#(?:State Hwy |SH-|K-|LA-|M-|MA-|MS-|NC-|SC-)[0-9]+(?: BUS| LOOP| SPUR)+(?: [NSWE])?@/i"
  100. },
  101. "134.solutionLink": "W:Road_types/USA#Primary_Street",
  102. // Custom Check - State Name = Virginia
  103. "135.enabled": true,
  104. "135.params": {
  105. "titleEN": "Not VA State",
  106. "problemEN": "Incorrect State Name - State name should be Virginia (are you in Virginia?)",
  107. "solutionEN": "Verify correct state name on segment.",
  108. "template": "${state}",
  109. "regexp": "!/^Virginia$/"
  110. },
  111. "135.solutionLink": "W:Virginia",
  112. // Custom Check
  113. "136.enabled": true,
  114. "136.params": {
  115. "titleEN": "Wrong name on Virginia Primary Route",
  116. "problemEN": "All primary routes numberd < 600 and 785 and 895 named SR-### in Virginia",
  117. "solutionEN": "Change name to SR-###",
  118. "template": "${state}:##${street}##${altStreet[0]}##${altStreet[1]}##${altStreet[2]}##${altStreet[3]}##${altStreet[4]}##${altStreet[5]}##${altStreet[6]}##${altStreet[7]}##${altStreet[8]}##${altStreet[9]}",
  119. "regexp": "/^Virginia:.*(?:State Hwy |State Rd |State Rte |VA |VA- |VA Hwy |VA-Hwy |V A |SH-)(?:[1-5]{0,1}[1-9]{0,2})#/i"
  120. },
  121. "136.solutionLink": "W:Virginia#Roads",
  122. // Custom Check
  123. "137.enabled": true,
  124. "137.params": {
  125. "titleEN": "Wrong name on Virginia Secondary Route",
  126. "problemEN": "All primary routes numberd > 600 NOT 785 and 895 named VA-### in Virginia",
  127. "solutionEN": "Change name to VA-###",
  128. "template": "${state}:##${street}##${altStreet[0]}##${altStreet[1]}##${altStreet[2]}##${altStreet[3]}##${altStreet[4]}##${altStreet[5]}##${altStreet[6]}##${altStreet[7]}##${altStreet[8]}##${altStreet[9]}",
  129. "regexp": "/^Virginia:.*(?:State Hwy |State Rd |State Rte |SR |SR- |VA Hwy |VA-Hwy |V A |SH-)(?:(?:[6-9][1-9]{2,})|(?:[1-9]{4,}))#/i"
  130. },
  131. "137.solutionLink": "W:Road_types/USA#Service_Road",
  132. // Custom Check
  133. "138.enabled": true,
  134. "138.params": {
  135. "titleEN": "Service Road",
  136. "problemEN": "Incorrect Function Class - Do not use Service Road Function Class",
  137. "solutionEN": "Change Function Class to Street",
  138. "template": "${typeRank}",
  139. "regexp": "/^9$/"
  140. },
  141. "138.solutionLink": "W:Road_types/USA#Service_Road",
  142. // Custom Check
  143. "139.enabled": true,
  144. "139.params": {
  145. "titleEN": "Bad Street Name",
  146. "problemEN": "Street Name has been identified as mass entered name that is incorrect. (dfa, nul, or null)",
  147. "solutionEN": "Correct the street name to remove dfa, nul, or null",
  148. "template": "${street}##${altStreet[0]}##${altStreet[1]}##${altStreet[2]}##${altStreet[3]}##${altStreet[4]}##${altStreet[5]}##${altStreet[6]}##${altStreet[7]}##${altStreet[8]}##${altStreet[9]}",
  149. "regexp": ".*\\b(dfa|nul|null)\\b/i"
  150. },
  151. "139.solutionLink": "W:Road_types/USA#Primary_Street",
  152. //No lock on freeway
  153. "150.enabled": true,
  154. "150.params": {
  155. // {number} minimum lock level
  156. "n": 5,
  157. },
  158. //No lock on major highway
  159. "151.enabled": true,
  160. "151.params": {
  161. // {number} minimum lock level
  162. "n": 3,
  163. },
  164. //No lock on minor highway
  165. "152.enabled": true,
  166. "152.params": {
  167. // {number} minimum lock level
  168. "n": 2,
  169. },
  170. //No lock on ramp
  171. "153.enabled": true,
  172. "153.params": {
  173. // {number} minimum lock level
  174. "n": 4,
  175. },
  176. //No lock on primary street
  177. "154.enabled": false,
  178. "154.params": {
  179. // {number} minimum lock level
  180. "n": 1,
  181. },
  182. //No State name selected
  183. "106.enabled": true,
  184. };