WME Validator Maryland Localization

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

当前为 2015-12-03 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name WME Validator Maryland Localization
  3. // @version 0.1.1
  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/7755-alan-boyd
  10. // ==/UserScript==
  11. //
  12.  
  13. /*
  14. * 0.1.1 - New State Standards for MD-XXX Road Names
  15. */
  16.  
  17. /* Modification of Original program WME Validator Virginia Localization by Supermedic
  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": "subs5",
  38. ".updated": "2015-12-03",
  39. ".link": "https://greasyfork.org/en/scripts/14467-wme-validator-maryland-localization",
  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:Maryland#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 = Maryland
  95. "135.enabled": true,
  96. "135.params": {
  97. "titleEN": "Not MD State",
  98. "problemEN": "Incorrect State Name - State name should be Maryland (are you in Maryland?)",
  99. "solutionEN": "Verify correct state name on segment.",
  100. "template": "${state}",
  101. "regexp": "!/^Maryland$/"
  102. },
  103. "135.solutionLink": "W:Maryland",
  104. // Custom Check
  105. "136.enabled": true,
  106. "136.params": {
  107. "titleEN": "Wrong name on Maryland Route",
  108. "problemEN": "All primary routes should be named MD-### in Maryland",
  109. "solutionEN": "Change name to MD-###",
  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": "/^Maryland:.*(?:State Hwy |State Rd |State Rte |MD |MD |MD Hwy |MD-Hwy |M D |SH-)(?:[1-5]{0,1}[1-9]{0,2})#/i"
  112. },
  113. "136.solutionLink": "W:Maryland#Roads",
  114. // Custom Check
  115. "138.enabled": true,
  116. "138.params": {
  117. "titleEN": "Service Road",
  118. "problemEN": "Incorrect Function Class - Do not use Service Road Function Class",
  119. "solutionEN": "Change Function Class to Street",
  120. "template": "${typeRank}",
  121. "regexp": "/^9$/"
  122. },
  123. "138.solutionLink": "W:Road_types/USA#Service_Road",
  124. // Custom Check
  125. "139.enabled": true,
  126. "139.params": {
  127. "titleEN": "Bad Street Name",
  128. "problemEN": "Street Name has been identified as mass entered name that is incorrect. (dfa, nul, or null)",
  129. "solutionEN": "Correct the street name to remove dfa, nul, or null",
  130. "template": "${street}##${altStreet[0]}##${altStreet[1]}##${altStreet[2]}##${altStreet[3]}##${altStreet[4]}##${altStreet[5]}##${altStreet[6]}##${altStreet[7]}##${altStreet[8]}##${altStreet[9]}",
  131. "regexp": ".*\\b(dfa|nul|null)\\b/i"
  132. },
  133. "139.solutionLink": "W:Road_types/USA#Primary_Street",
  134. //No lock on freeway
  135. "150.enabled": true,
  136. "150.params": {
  137. // {number} minimum lock level
  138. "n": 5,
  139. },
  140. //No lock on major highway
  141. "151.enabled": true,
  142. "151.params": {
  143. // {number} minimum lock level
  144. "n": 3,
  145. },
  146. //No lock on minor highway
  147. "152.enabled": true,
  148. "152.params": {
  149. // {number} minimum lock level
  150. "n": 2,
  151. },
  152. //No lock on ramp
  153. "153.enabled": true,
  154. "153.params": {
  155. // {number} minimum lock level
  156. "n": 3,
  157. },
  158. //No lock on primary street
  159. "154.enabled": false,
  160. "154.params": {
  161. // {number} minimum lock level
  162. "n": 1,
  163. },
  164. //No State name selected
  165. "106.enabled": true,
  166. };