|
| 1 | +// ==UserScript== |
| 2 | +// @name WME Validator Localization for California |
| 3 | +// @namespace https://greasyfork.org/users/6605 |
| 4 | +// @version 1.1.10 |
| 5 | +// @author crazycaveman |
| 6 | +// @description This script localizes WME Validator for California, USA. You also need main package (WME Validator) installed. |
| 7 | +// @match https://beta.waze.com/*editor/* |
| 8 | +// @match https://www.waze.com/*editor/* |
| 9 | +// @exclude https://*.waze.com/*user/editor/* |
| 10 | +// @grant none |
| 11 | +// @run-at document-start |
| 12 | +// ==/UserScript== |
| 13 | +// |
| 14 | +/* |
| 15 | + See Settings->About->Available checks for complete list of checks and their params. |
| 16 | +
|
| 17 | + Examples: |
| 18 | +
|
| 19 | + Enable #170 "Lowercase street name" but allow lowercase "exit" and "to": |
| 20 | + "170.enabled": true, |
| 21 | + "170.params": { |
| 22 | + "regexp": "/^((exit|to) )?[a-z]/", |
| 23 | + "}, |
| 24 | +
|
| 25 | + Enable #130 "Custom check" to find a dot in street names, but allow dots at Ramps: |
| 26 | + "130.enabled": true, |
| 27 | + "130.params": { |
| 28 | + "titleEN": "Street name with a dot", |
| 29 | + "problemEN": "There is a dot in the street name (excluding Ramps)", |
| 30 | + "solutionEN": "Expand the abbreviation or remove the dot", |
| 31 | + "template": "${type}:${street}", |
| 32 | + "regexp": "D/^[^4][0-9]?:.*\\./", |
| 33 | + }, |
| 34 | + *Note: use D at the beginning of RegExp to enable debugging on JS console. |
| 35 | + *Note: do not forget to escape backslashes in strings, i.e. use "\\" instead of "\". |
| 36 | +*/ |
| 37 | + |
| 38 | +window.WME_Validator_United_States = { |
| 39 | + ".country": "United States", |
| 40 | + ".codeISO": "US", |
| 41 | + ".author": "crazycaveman", |
| 42 | + ".updated": "2015-11-10", |
| 43 | + ".link": "TODO: ", |
| 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])([SNWE] )?[a-z]/" |
| 53 | + }, |
| 54 | + "171.enabled": true, |
| 55 | + "171.params" : { |
| 56 | + regexp: "/((?!(\\bPhila|\\bPenna|.(\\bWash|\\bCmdr|\\bProf|\\bPres)|..(Adm|\\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}\\.|(?!(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}\\.|(?!(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}\\.|(#|^)[^NEWSR]?\\.)|(((?!\\b(D|O)).|#|^)'(?![sl]\\b)|(?!\\bNat).{3}'l|(#|^).{0,2}'l)|(Dr|St)\\.(#|$)|,|;|\\\\|((?!\\.( |#|$|R))\\..|(?!\\.( .|#.|$|R\\.))\\..{2}|\\.R(#|$|\\.R))|[Ee]x(p|w)y|Tunl|Long Is\\b|Brg/", |
| 57 | + problemEN: "The street name has incorrect abbreviation, or character", |
| 58 | + solutionEN: "Check upper/lower case, a space before/after the abbreviation and the accordance with the abbreviation table. Remove any comma (,), backslash (\\), or semicolon (;)" |
| 59 | + }, |
| 60 | + "171.solutionLink": "W:Abbreviations_and_acronyms/USA#Standard_suffix_abbreviations", |
| 61 | + |
| 62 | + "130.enabled": true, |
| 63 | + "130.params": { |
| 64 | + "titleEN": "Wrong name for state highway", |
| 65 | + "problemEN": "All state highways should be named SR-### in California", |
| 66 | + "solutionEN": "Change name to SR-### (if it is truly a state highway)", |
| 67 | + "template": "${state}:#${street}#${altStreet[#]}", |
| 68 | + "regexp": "/^California:.*\\b(?:State (Hwy|R(ou)?te)|SH-)\\b/i" |
| 69 | + }, |
| 70 | + "130.solutionLink": "W:Highway_naming/USA", |
| 71 | + "131.enabled": true, |
| 72 | + "131.params": { |
| 73 | + "titleEN": "Wrong road type", |
| 74 | + "problemEN": "All US Highways should be at least Major Highway (except BUS, SPUR, LOOP)", |
| 75 | + "solutionEN": "Change the road type to Major Highway", |
| 76 | + "template": "${typeRank}:#${street}@#${altStreet[@#]}@", |
| 77 | + "regexp": "/^[1-9][^245]?:.*#(US Hwy |US-)[0-9]+( ALT| BYP| CONN| TRUCK| Scenic| [NSWE])*@/i" |
| 78 | + }, |
| 79 | + "131.solutionLink": "W:Road_types/USA#Major_Highway", |
| 80 | + "132.enabled": true, |
| 81 | + "132.params": { |
| 82 | + "titleEN": "Wrong road type", |
| 83 | + "problemEN": "All US BUS, SPUR, LOOP highways and State Highways (except BUS, SPUR, LOOP) should be at least Minor Highway type", |
| 84 | + "solutionEN": "Change the road type to Minor Highway", |
| 85 | + "template": "${typeRank}:#${street}@#${altStreet[@#]}@", |
| 86 | + "regexp": "/^[1-9][^2-5]:.*#((State Hwy |SR-|SH-|IL-|IN-|K-|LA-|M-|MA-|MO-|MS-|NC-|ND-|NJ-|NV-|NY-|SC-|SD-|TN-|VT-|WIS-)[0-9]+( ALT| BYP| CONN| TRUCK| Scenic| [NSWE])*|(US Hwy |US-)[0-9]+( BUS| LOOP| SPUR)+( [NSWE])?)@/i" |
| 87 | + }, |
| 88 | + "132.solutionLink": "W:Road_types/USA#Minor_Highway", |
| 89 | + "133.enabled": true, |
| 90 | + "133.params": { |
| 91 | + "titleEN": "Wrong road type", |
| 92 | + "problemEN": "All State BUS, SPUR, LOOP Highways should be at least Primary Street type", |
| 93 | + "solutionEN": "Change the road type to Primary Street", |
| 94 | + "template": "${typeRank}:#${street}@#${altStreet[@#]}@", |
| 95 | + "regexp": "/^[1-9][^1-5]:.*#(State Hwy |SR-|SH-|IL-|IN-|K-|LA-|M-|MA-|MO-|MS-|NC-|ND-|NJ-|NV-|NY-|SC-|SD-|TN-|VT-|WIS-)[0-9]+( BUS| LOOP| SPUR)+( [NSWE])?@/i" |
| 96 | + }, |
| 97 | + "133.solutionLink": "W:Road_types/USA#Primary_Street", |
| 98 | + "134.enabled": true, |
| 99 | + "134.params": { |
| 100 | + "titleEN": "Wrong abbreviation", |
| 101 | + "problemEN": "Name abbreviation may be incorrect. Abbreviations ALT, BUS, BYP, CONN, LOOP, and SPUR should be in ALL CAPS", |
| 102 | + "solutionEN": "Change abbreviation to ALT, BUS, BYP, CONN, LOOP, SPUR, or TRUCK", |
| 103 | + "template": "${street}#${altStreet[#]}", |
| 104 | + "regexp": "/\\b([Aa]lt(ernate)?|[Bb](us(iness)?|yp(ass)?)|[Cc]onn(ector)?|[Ll]oop|[Ss]pur|[Tt]ruck)\\b/" |
| 105 | + }, |
| 106 | + "134.solutionLink": "W:Road_names/USA#United_States_Numbered_Highways", |
| 107 | + //Freeway lock |
| 108 | + "150.enabled": true, |
| 109 | + "150.params": { |
| 110 | + // {number} minimum lock level |
| 111 | + "n": 4, |
| 112 | + }, |
| 113 | + //Major Highway lock |
| 114 | + "151.enabled": true, |
| 115 | + "151.params": { |
| 116 | + // {number} minimum lock level |
| 117 | + "n": 3, |
| 118 | + }, |
| 119 | + //Minor Highway lock |
| 120 | + "152.enabled": true, |
| 121 | + "152.params": { |
| 122 | + // {number} minimum lock level |
| 123 | + "n": 2, |
| 124 | + }, |
| 125 | + //Ramp lock |
| 126 | + "153.enabled": true, |
| 127 | + "153.params": { |
| 128 | + // {number} minimum lock level |
| 129 | + "n": 4, |
| 130 | + }, |
| 131 | + //Primary Street lock |
| 132 | + "154.enabled": true, |
| 133 | + "154.params": { |
| 134 | + // {number} minimum lock level |
| 135 | + "n": 2, |
| 136 | + } |
| 137 | +}; |
0 commit comments