WME Validator Idaho Localization

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

  1. // ==UserScript==
  2. // @name WME Validator Idaho Localization
  3. // @version 0.0.1.4
  4. // @description This script localizes WME Validator for Idaho. 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/29545-matthewstarbuck
  10. // @author MatthewStarbuck
  11. // ==/UserScript==
  12. //
  13.  
  14. /*
  15. * 0.1.4 - Minor Tweaks
  16. */
  17.  
  18.  
  19. /*
  20. See Settings->About->Available checks for complete list of checks and their params.
  21.  
  22. Examples:
  23.  
  24. Enable #170 "Lowercase street name" but allow lowercase "exit" and "to":
  25. "170.enabled": true,
  26. "170.params": {
  27. "regexp": "/^((exit|to) )?[a-z]/",
  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": "MatthewStarbuck",
  38. ".updated": "2016-06-17",
  39. ".link": "https://greasyfork.org/en/scripts/",
  40. // Ramp name too long
  41. "112.enabled": false,
  42. "112.params": {
  43. "n": 55,
  44. },
  45. // Custom Check
  46. "130.enabled": true,
  47. "130.params": {
  48. "titleEN": "Potential Incorrect Abbreviation",
  49. "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",
  50. "solutionEN": "Change abbreviation to ALT, BUS, BYP, CONN, LOOP, SCN, SPUR, or TRUCK in ALL CAPS",
  51. "template": "${street}##${altStreet[0]}##${altStreet[1]}##${altStreet[2]}##${altStreet[3]}##${altStreet[4]}##${altStreet[5]}##${altStreet[6]}##${altStreet[7]}##${altStreet[8]}##${altStreet[9]}",
  52. "regexp": "/!?[0-9].+(Alt|Business|Bus|Byp|Conn|Loop|Scn|Spur|Truck)\\b/"
  53. },
  54. // Custom Check
  55. "131.enabled": true,
  56. "131.params": {
  57. "titleEN": "Wrong name on US Highway",
  58. "problemEN": "All US highways should be named US-###",
  59. "solutionEN": "Change name to US-###",
  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": ".*\\b(?:US Highway |US Hwy Route |US Hwy Rte |US Hwy |US Rte |US- |US )[0-9]{1,3}\\b/i"
  62. },
  63. "131.solutionLink": "W:Idaho#Major_Roads",
  64. // Custom Check
  65. "132.enabled": true,
  66. "132.params": {
  67. "titleEN": "Wrong road type (Major)",
  68. "problemEN": "All US Highways should be at least Major Highway (except BUS, SPUR, LOOP)",
  69. "solutionEN": "Change the road type to Major Highway",
  70. "template": "${typeRank}#${street}@#${altStreet[0]}@#${altStreet[1]}@#${altStreet[2]}@#${altStreet[3]}@#${altStreet[4]}@#${altStreet[5]}@#${altStreet[6]}@#${altStreet[7]}@#${altStreet[8]}@#${altStreet[9]}@",
  71. "regexp": "/^[1-9](?![245]).*#(?:US Hwy |US-)[0-9]+(?: ALT| BYP| CONN| TRUCK| SCN| Scenic| [NSWE])*@/i"
  72. },
  73. "132.solutionLink": "W:Road_types/USA#Major_Highway",
  74. // Custom Check
  75. "133.enabled": true,
  76. "133.params": {
  77. "titleEN": "Wrong road type (Minor)",
  78. "problemEN": "All US BUS, SPUR, LOOP Highways and all State Highways (except BUS, SPUR, LOOP) should be at least Minor Highway type",
  79. "solutionEN": "Change the road type to Minor Highway",
  80. "template": "${typeRank}#${street}@#${altStreet[0]}@#${altStreet[1]}@#${altStreet[2]}@#${altStreet[3]}@#${altStreet[4]}@#${altStreet[5]}@#${altStreet[6]}@#${altStreet[7]}@#${altStreet[8]}@#${altStreet[9]}@",
  81. "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"
  82. },
  83. "133.solutionLink": "W:Road_types/USA#Minor_Highway",
  84. // Custom Check
  85. "134.enabled": true,
  86. "134.params": {
  87. "titleEN": "Wrong road type (Primary)",
  88. "problemEN": "All State BUS, SPUR, LOOP Highways should be at least Primary Street type",
  89. "solutionEN": "Change the road type to Primary Street",
  90. "template": "${typeRank}#${street}@#${altStreet[0]}@#${altStreet[1]}@#${altStreet[2]}@#${altStreet[3]}@#${altStreet[4]}@#${altStreet[5]}@#${altStreet[6]}@#${altStreet[7]}@#${altStreet[8]}@#${altStreet[9]}@",
  91. "regexp": "/^[1-9](?![1-5]).*#(?:State Hwy |SH-|K-|LA-|M-|MA-|MS-|NC-|SC-)[0-9]+(?: BUS| LOOP| SPUR)+(?: [NSWE])?@/i"
  92. },
  93. "134.solutionLink": "W:Road_types/USA#Primary_Street",
  94. // Custom Check - State Name = Idaho
  95. "135.enabled": true,
  96. "135.params": {
  97. "titleEN": "Not Idaho",
  98. "problemEN": "Incorrect State Name - State name should be Idaho (Where are you?)",
  99. "solutionEN": "Verify correct state name on segment.",
  100. "template": "${state}",
  101. "regexp": "!/^Idaho$/"
  102. },
  103. "135.solutionLink": "W:Idaho",
  104. // Custom Check
  105. "136.enabled": true,
  106. "136.params": {
  107. "titleEN": "Wrong name on Idaho State Highway",
  108. "problemEN": "All designated state Highways should be named State Hwy",
  109. "solutionEN": "Change name to State Hwy ###",
  110. "template": "${state}:##${street}##${altStreet[0]}##${altStreet[1]}@#${altStreet[2]}@#${altStreet[3]}@#${altStreet[4]}@#${altStreet[5]}@#${altStreet[6]}@#${altStreet[7]}@#${altStreet[8]}@#${altStreet[9]}@",
  111. "regexp": "/^Idaho:.*(?:State Rd |State Rte |ID |ID- |SH- |ID Hwy |ID-Hwy)(?:[1-5]{0,1}[1-9]{0,2})#/i"
  112. },
  113. "136.solutionLink": "W:Idaho#Major_Roads",
  114. // Custom Check
  115. "137.enabled": true,
  116. "137.params": {
  117. "titleEN": "Wrong name on Idaho County Road",
  118. "problemEN": "All County Roads should be named CR-###",
  119. "solutionEN": "Change name to CR-###",
  120. "template": "${state}:##${street}##${altStreet[0]}##${altStreet[1]}@#${altStreet[2]}@#${altStreet[3]}@#${altStreet[4]}@#${altStreet[5]}@#${altStreet[6]}@#${altStreet[7]}@#${altStreet[8]}@#${altStreet[9]}@",
  121. "regexp": "/^Idaho:.*(?:County Road |County Rd |Co Road |Co Rd |C O)(?:(?:[6-9][1-9]{2,})|(?:[1-9]{4,}))#/i"
  122. },
  123. "137.solutionLink": "W:Road_types/USA#Service_Road",
  124. // Custom Check
  125. "138.enabled": true,
  126. "138.params": {
  127. "titleEN": "Service Road",
  128. "problemEN": "Incorrect Function Class - Do not use Service Road Function Class",
  129. "solutionEN": "Change Function Class to Street",
  130. "template": "${typeRank}",
  131. "regexp": "/^9$/"
  132. },
  133. "138.solutionLink": "W:Road_types/USA#Service_Road",
  134. // Custom Check
  135. "139.enabled": true,
  136. "139.params": {
  137. "titleEN": "Bad Street Name",
  138. "problemEN": "Street Name has been identified as mass entered name that is incorrect. (dfa, nul, or null)",
  139. "solutionEN": "Correct the street name to remove dfa, nul, or null",
  140. "template": "${street}##${altStreet[0]}##${altStreet[1]}@#${altStreet[2]}@#${altStreet[3]}@#${altStreet[4]}@#${altStreet[5]}@#${altStreet[6]}@#${altStreet[7]}@#${altStreet[8]}@#${altStreet[9]}@",
  141. "regexp": ".*\\b(dfa|nul|null)\\b/i"
  142. },
  143. "139.solutionLink": "W:Road_types/USA#Primary_Street",
  144. //No lock on freeway
  145. "150.enabled": true,
  146. "150.params": {
  147. // {number} minimum lock level
  148. "n": 4,
  149. },
  150. //No lock on Major Highway
  151. "151.enabled": true,
  152. "151.params": {
  153. // {number} minimum lock level
  154. "n": 3,
  155. },
  156. //No lock on Minor Highway
  157. "152.enabled": true,
  158. "152.params": {
  159. // {number} minimum lock level
  160. "n": 2,
  161. },
  162. //No lock on Ramp
  163. "153.enabled": true,
  164. "153.params": {
  165. // {number} minimum lock level
  166. "n": 4,
  167. },
  168. //No lock on Primary Street
  169. "154.enabled": true,
  170. "154.params": {
  171. // {number} minimum lock level
  172. "n": 1,
  173. },
  174. //No State name selected
  175. "106.enabled": true,
  176. //Default US checks
  177. "24.enabled": !0,
  178. "25.enabled": !0,
  179. "27.enabled": !0,
  180. "34.enabled": !0,
  181. "35.enabled": !0,
  182. "38.enabled": !0,
  183. "39.enabled": !0,
  184. "43.enabled": !0,
  185. "48.enabled": !0,
  186. "78.enabled": !0,
  187. "87.enabled": !0,
  188. "90.enabled": !0,
  189. "107.enabled": !0,
  190. "108.enabled": !0,
  191. "109.enabled": !0,
  192. "112.enabled": !1,
  193. "118.enabled": !0,
  194. "116.enabled": !0,
  195. "119.enabled": !0,
  196. "120.enabled": !0,
  197. "121.enabled": !0,
  198. "172.enabled": !0,
  199. "173.enabled": !0,
  200. "190.enabled": !0,
  201. "192.enabled": !0,
  202. "170.enabled": !0,
  203. "170.params": {
  204. "regexp": "/^(?!(to) [^a-z])((S|N|W|E) )?[a-z]/"
  205. },
  206. "171.enabled": true,
  207. "171.solutionLink": "W:Abbreviations_and_acronyms/USA#Standard_suffix_abbreviations",
  208. "171.params": {
  209. "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/",
  210. "problemEN": "The street name has incorrect abbreviation, or character",
  211. "solutionEN": "Check upper/lower case, a space before/after the abbreviation and the accordance with the abbreviation table. Remove any comma (,), backslash (\\), or semicolon (;)"
  212. },
  213. };