WME Validator New Hampshire Localization

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

  1. // ==UserScript==
  2. // @name WME Validator New Hampshire Localization
  3. // @version 0.1.6
  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/en/users/57906-cny-sti
  10. // ==/UserScript==
  11. //
  12.  
  13. /*
  14. * 0.1.6 - Mapraid Ready - Messed up 0.1.5
  15. */
  16.  
  17. /* Modification of Original program WME Validator Vermont Localization by subs5
  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. },
  30. *Note: use D at the beginning of RegExp to enable debugging on JS console.
  31. *Note: do not forget to escape backslashes in strings, i.e. use "\\" instead of "\".
  32. */
  33.  
  34. window.WME_Validator_United_States = {
  35. ".country": "United States",
  36. ".codeISO": "US",
  37. ".author": "CNY_STi",
  38. ".updated": "2016-07-31",
  39. ".link": "https://greasyfork.org/en/scripts/21843-wme-validator-new-hampshire-localization",
  40. // Ramp name too long
  41. "112.enabled": false,
  42. "112.params": {
  43. "n": 55,
  44. },
  45. //Default US checks
  46. "27.enabled": true,
  47. "90.enabled": true,
  48. "106.enabled": true,
  49. "112.enabled": false,
  50. "170.enabled": true,
  51. "170.params": {
  52. "regexp": "/^(?!(to) [^a-z])((S|N|W|E) )?[a-z]/",
  53. },
  54. // Custom Check
  55. "130.enabled": true,
  56. "130.params": {
  57. "titleEN": "Potential Incorrect Abbreviation",
  58. "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",
  59. "solutionEN": "Change abbreviation to ALT, BUS, BYP, CONN, LOOP, SCN, SPUR, or TRUCK in ALL CAPS",
  60. "template": "${street}##${altStreet[0]}##${altStreet[1]}##${altStreet[2]}##${altStreet[3]}##${altStreet[4]}##${altStreet[5]}##${altStreet[6]}##${altStreet[7]}##${altStreet[8]}##${altStreet[9]}",
  61. "regexp": "/!?[0-9].+(Alt|Business|Bus|Byp|Conn|Loop|Scn|Spur|Truck)\\b/"
  62. },
  63. // Custom Check
  64. "131.enabled": true,
  65. "131.params": {
  66. "titleEN": "Wrong name on US Highway",
  67. "problemEN": "All US highways should be named US-###",
  68. "solutionEN": "Change name to US-###",
  69. "template": "${street}##${altStreet[0]}##${altStreet[1]}##${altStreet[2]}##${altStreet[3]}##${altStreet[4]}##${altStreet[5]}##${altStreet[6]}##${altStreet[7]}##${altStreet[8]}##${altStreet[9]}",
  70. "regexp": ".*\\b(?:US Highway |US Hwy Route |US Hwy Rte |US Hwy |US Rte |US- |US )[0-9]{1,3}\\b/i"
  71. },
  72. "131.solutionLink": "W:New_Hampshire#Naming_Standards",
  73. // Custom Check
  74. "132.enabled": true,
  75. "132.params": {
  76. "titleEN": "Wrong road type (Major)",
  77. "problemEN": "All US Highways should be at least Major Highway (except BUS, SPUR, LOOP)",
  78. "solutionEN": "Change the road type to Major Highway",
  79. "template": "${typeRank}#${street}@#${altStreet[0]}@#${altStreet[1]}@#${altStreet[2]}@#${altStreet[3]}@#${altStreet[4]}@#${altStreet[5]}@#${altStreet[6]}@#${altStreet[7]}@#${altStreet[8]}@#${altStreet[9]}@",
  80. "regexp": "/^[1-9](?![245]).*#(?:US Hwy |US-)[0-9]+(?: ALT| BYP| CONN| TRUCK| SCN| Scenic| [NSWE])*@/i"
  81. },
  82. "132.solutionLink": "W:Road_types/USA#Major_Highway",
  83. // Custom Check
  84. "133.enabled": true,
  85. "133.params": {
  86. "titleEN": "Wrong road type (Minor)",
  87. "problemEN": "All US BUS, SPUR, LOOP Highways and all State Highways (except BUS, SPUR, LOOP) should be at least Minor Highway type",
  88. "solutionEN": "Change the road type to Minor Highway",
  89. "template": "${typeRank}#${street}@#${altStreet[0]}@#${altStreet[1]}@#${altStreet[2]}@#${altStreet[3]}@#${altStreet[4]}@#${altStreet[5]}@#${altStreet[6]}@#${altStreet[7]}@#${altStreet[8]}@#${altStreet[9]}@",
  90. "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"
  91. },
  92. "133.solutionLink": "W:Road_types/USA#Minor_Highway",
  93. // Custom Check
  94. "134.enabled": true,
  95. "134.params": {
  96. "titleEN": "Wrong road type (Primary)",
  97. "problemEN": "All State BUS, SPUR, LOOP Highways should be at least Primary Street type",
  98. "solutionEN": "Change the road type to Primary Street",
  99. "template": "${typeRank}#${street}@#${altStreet[0]}@#${altStreet[1]}@#${altStreet[2]}@#${altStreet[3]}@#${altStreet[4]}@#${altStreet[5]}@#${altStreet[6]}@#${altStreet[7]}@#${altStreet[8]}@#${altStreet[9]}@",
  100. "regexp": "/^[1-9](?![1-5]).*#(?:State Hwy |SH-|K-|LA-|M-|MA-|MS-|NC-|SC-)[0-9]+(?: BUS| LOOP| SPUR)+(?: [NSWE])?@/i"
  101. },
  102. "134.solutionLink": "W:Road_types/USA#Primary_Street",
  103. // Custom Check - State Name = New Hampshire
  104. "135.enabled": true,
  105. "135.params": {
  106. "titleEN": "Not NH State",
  107. "problemEN": "Incorrect State Name - State name should be New Hamsphire (are you in New Hampshire?)",
  108. "solutionEN": "Verify correct state name on segment.",
  109. "template": "${state}",
  110. "regexp": "!/^New Hampshire$/"
  111. },
  112. "135.solutionLink": "W:New_Hampshire",
  113. // Custom Check
  114. "136.enabled": true,
  115. "136.params": {
  116. "titleEN": "Wrong name on New Hampshire Route",
  117. "problemEN": "All primary routes should be named SR-### in New Hampshire",
  118. "solutionEN": "Change name to SR-###",
  119. "template": "${state}:##${street}##${altStreet[0]}##${altStreet[1]}##${altStreet[2]}##${altStreet[3]}##${altStreet[4]}##${altStreet[5]}##${altStreet[6]}##${altStreet[7]}##${altStreet[8]}##${altStreet[9]}",
  120. "regexp": "/^New Hampshire:.*(?:State Hwy |State Rd |State Rte |SR |NH |NH Hwy |NH-Hwy |N H |Rte |SH-)(?:[1-5]{0,1}[1-9]{0,2})( [SNEW])?#/i"
  121. },
  122. "136.solutionLink": "W:New_Hampshire#Naming_Standards",
  123. // Custom Check
  124. "138.enabled": true,
  125. "138.params": {
  126. "titleEN": "Service Road",
  127. "problemEN": "Incorrect Function Class - Do not use Service Road Function Class",
  128. "solutionEN": "Change Function Class to Street",
  129. "template": "${typeRank}",
  130. "regexp": "/^9$/"
  131. },
  132. "138.solutionLink": "W:Road_types/USA#Service_Road",
  133. // Custom Check
  134. "139.enabled": true,
  135. "139.params": {
  136. "titleEN": "Bad Street Name",
  137. "problemEN": "Street Name has been identified as mass entered name that is incorrect. (dfa, nul, or null)",
  138. "solutionEN": "Correct the street name to remove dfa, nul, or null",
  139. "template": "${street}##${altStreet[0]}##${altStreet[1]}##${altStreet[2]}##${altStreet[3]}##${altStreet[4]}##${altStreet[5]}##${altStreet[6]}##${altStreet[7]}##${altStreet[8]}##${altStreet[9]}",
  140. "regexp": ".*\\b(dfa|nul|null)\\b/i"
  141. },
  142. "139.solutionLink": "W:Road_types/USA#Primary_Street",
  143. //No lock on freeway
  144. "150.enabled": true,
  145. "150.params": {
  146. // {number} minimum lock level
  147. "n": 5,
  148. },
  149. //No lock on major highway
  150. "151.enabled": true,
  151. "151.params": {
  152. // {number} minimum lock level
  153. "n": 3,
  154. },
  155. //No lock on minor highway
  156. "152.enabled": true,
  157. "152.params": {
  158. // {number} minimum lock level
  159. "n": 3,
  160. },
  161. //No lock on ramp
  162. "153.enabled": true,
  163. "153.params": {
  164. // {number} minimum lock level
  165. "n": 3,
  166. },
  167. //No lock on primary street
  168. "154.enabled": true,
  169. "154.params": {
  170. // {number} minimum lock level
  171. "n": 1,
  172. },
  173. //No State name selected
  174. "106.enabled": true,
  175. //Default US checks
  176. "24.enabled": !0,
  177. "25.enabled": !0,
  178. "27.enabled": !0,
  179. "34.enabled": !0,
  180. "35.enabled": !0,
  181. "38.enabled": !0,
  182. "39.enabled": !0,
  183. "43.enabled": !0,
  184. "48.enabled": !0,
  185. "78.enabled": !0,
  186. "87.enabled": !0,
  187. "90.enabled": !0,
  188. "107.enabled": !0,
  189. "108.enabled": !0,
  190. "109.enabled": !0,
  191. "112.enabled": !1,
  192. "118.enabled": !0,
  193. "116.enabled": !0,
  194. "119.enabled": !0,
  195. "120.enabled": !0,
  196. "121.enabled": !0,
  197. "172.enabled": !0,
  198. "173.enabled": !0,
  199. "190.enabled": !0,
  200. "192.enabled": !0,
  201. "170.params": {
  202. "regexp": "/^(?!(to) [^a-z])((S|N|W|E) )?[a-z]/"
  203. },
  204. "171.enabled": true,
  205. "171.solutionLink": "W:Abbreviations_and_acronyms/USA#Standard_suffix_abbreviations",
  206. "171.params": {
  207. "regexp": "/((?!(\\bPhila|\\bPenna|.(\\bWash|\\bCmdr|\\bProf|\\bPres)|..(\\bAdm|\\bSte|\\bCpl|\\bMaj|\\bSgt|\\bRe[vc]|\\bR\\.R|\\bGov|\\bGen|\\bHon|\\bCpl)|...(\\bSt|\\b[JSD]r|\\bLt|\\bFt)|...(#| )[NEWSR])).{5}\\.|((?!(hila|enna|(\\bWash|\\bCmdr|\\bProf|\\bPres)|.(\\bAdm|\\bSte|\\bCpl|\\bMaj|\\bSgt|\\bRe[vc]|\\bR\\.R|\\bGov|\\bGen|\\bHon|\\bCpl)|..(\\bSt|\\b[JSD]r|\\bLt|\\bFt)|..(#| )[NEWSR])).{4}|(\\bhila|\\benna))\\.|((?!(ila|nna|(ash|mdr|rof|res)|(\\bAdm|\\bSte|\\bCpl|\\bMaj|\\bSgt|\\bRe[vc]|\\bR\\.R|\\bGov|\\bGen|\\bHon|\\bCpl)|.(\\bSt|\\b[JSD]r|\\bLt|\\bFt)|.(#| )[NEWSR])).{3}|\\b(ila|nna|ash|mdr|rof|res))\\.|((?!(la|na|(sh|dr|of|es)|(dm|te|pl|aj|gt|e[vc]|\\.R|ov|en|on|pl)|(\\bSt|\\b[JSD]r|\\bLt|\\bFt)|(#| )[NEWSR])).{2}|\\b(la|na|sh|dr|of|es|dm|te|pl|aj|gt|e[vc]|\\.R|ov|en|on|pl))\\.|(#|^)[^NEWSR]?\\.)|(((?!\\b(D|O|L)).|#|^)\'(?![sl]\\b)|(#|^)\'s|(?!\\b(In|Na)t).{3}\'l|(#|^).{0,2}\'l)|(Dr|St)\\.(#|$)|,|;|\\\\|((?!\\.( |#|$|R))\\..|(?!\\.( .|#.|$|R\\.))\\..{2}|\\.R(#|$|\\.R))|[Ee]x(p|w)y\\b|Tunl\\b|Long Is\\b|Brg\\b/",
  208. "problemEN": "The street name has incorrect abbreviation, or character",
  209. "solutionEN": "Check upper/lower case, a space before/after the abbreviation and the accordance with the abbreviation table. Remove any comma (,), backslash (\\), or semicolon (;)"
  210. },
  211. // #133 ## Check for database generated improper city names.
  212. "133.enabled": true,
  213. "133.solutionLink": "W:Duplicate_cities#Changing_or_Merging_an_Entire_City_Name",
  214. "133.params": {
  215. "titleEN": "Improper City Naming",
  216. "problemEN": "This segment has a generated city name which is not its' proper name",
  217. "solutionEN": "Fill out the form to have the city renamed, and contact your SM or RC to finalize the process",
  218. "template": "${city}#${altCity[#]}",
  219. "regexp": "/(^|#)Greater [\\w -]+ Area|[\\w -]+\\(\\d+\\)(#|$)/"
  220. },
  221. // #171 ## Check for improper use of a period (.) that is not on the USA
  222. // recommended abbreviations list (PesachZ)
  223. "171.enabled": true,
  224. "171.solutionLink": "W:Abbreviations_and_acronyms/USA#Standard_suffix_abbreviations",
  225. "171.params": {
  226. "regexp": "/((?!(\\bPhila|\\bPenna|.(\\bWash|\\bCmdr|\\bProf|\\bPres)|..(\\bAdm|\\bSte|\\bCpl|\\bMaj|\\bSgt|\\bRe[vc]|\\bR\\.R|\\bGov|\\bGen|\\bHon|\\bCpl)|...(\\bSt|\\b[JSD]r|\\bLt|\\bFt)|...(#| )[NEWSR])).{5}\\.|((?!(hila|enna|(\\bWash|\\bCmdr|\\bProf|\\bPres)|.(\\bAdm|\\bSte|\\bCpl|\\bMaj|\\bSgt|\\bRe[vc]|\\bR\\.R|\\bGov|\\bGen|\\bHon|\\bCpl)|..(\\bSt|\\b[JSD]r|\\bLt|\\bFt)|..(#| )[NEWSR])).{4}|(\\bhila|\\benna))\\.|((?!(ila|nna|(ash|mdr|rof|res)|(\\bAdm|\\bSte|\\bCpl|\\bMaj|\\bSgt|\\bRe[vc]|\\bR\\.R|\\bGov|\\bGen|\\bHon|\\bCpl)|.(\\bSt|\\b[JSD]r|\\bLt|\\bFt)|.(#| )[NEWSR])).{3}|\\b(ila|nna|ash|mdr|rof|res))\\.|((?!(la|na|(sh|dr|of|es)|(dm|te|pl|aj|gt|e[vc]|\\.R|ov|en|on|pl)|(\\bSt|\\b[JSD]r|\\bLt|\\bFt)|(#| )[NEWSR])).{2}|\\b(la|na|sh|dr|of|es|dm|te|pl|aj|gt|e[vc]|\\.R|ov|en|on|pl))\\.|(#|^)[^NEWSR]?\\.)|(((?!\\b(D|O|L)).|#|^)\'(?![sl]\\b)|(#|^)\'s|(?!\\b(In|Na)t).{3}\'l|(#|^).{0,2}\'l)|(Dr|St)\\.(#|$)|,|;|\\\\|((?!\\.( |#|$|R))\\..|(?!\\.( .|#.|$|R\\.))\\..{2}|\\.R(#|$|\\.R))|[Ee]x(p|w)y\\b|\\b[Ee]x[dn]\\b|Tunl\\b|Long Is\\b|Brg\\b/",
  227. "problemEN": "The street name has incorrect abbreviation, or character",
  228. "solutionEN": "Check upper/lower case, a space before/after the abbreviation and the accordance with the abbreviation table. Remove any comma (,), backslash (\\), or semicolon (;)"
  229. },
  230. };