forked from SkiDooGuy/WME-Road-Shield-Assistant
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathWME-RSA.user.js
More file actions
2165 lines (2162 loc) · 106 KB
/
Copy pathWME-RSA.user.js
File metadata and controls
2165 lines (2162 loc) · 106 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
"use strict";
// ==UserScript==
// @name WME Road Shield Assistant
// @namespace https://greasyfork.org/en/users/286957-skidooguy
// @version 2026.07.07.001
// @description Adds shield information display to WME
// @author SkiDooGuy, jm6087, Karlsosha
// @match https://www.waze.com/editor*
// @match https://www.waze.com/*/editor*
// @match https://beta.waze.com/editor*
// @match https://beta.waze.com/*/editor*
// @exclude https://www.waze.com/user/editor*
// @require https://greasyfork.org/scripts/24851-wazewrap/code/WazeWrap.js
// @require https://cdn.jsdelivr.net/npm/@turf/turf@7/turf.min.js
// @updateURL https://update.greasyfork.org/scripts/425050/WME%20Road%20Shield%20Assistant.meta.js
// @downloadURL https://update.greasyfork.org/scripts/425050/WME%20Road%20Shield%20Assistant.user.js
// @grant GM_xmlhttpRequest
// @grant unsafeWindow
// @connect greasyfork.org
// @contributionURL https://github.com/WazeDev/Thank-The-Authors
// ==/UserScript==
/* global W */
/* global WazeWrap */
/* global turf */
// import type { Node, Segment, SegmentAddress, Street, Turn, WmeSDK } from "wme-sdk-typings";
// import type { Point, LineString, Position, Feature } from "geojson";
// import * as turf from "@turf/turf";
// import _ from "underscore";
// import WazeWrap from "https://greasyfork.org/scripts/24851-wazewrap/code/WazeWrap.js";
let sdk;
unsafeWindow.SDK_INITIALIZED.then(() => {
if (!unsafeWindow.getWmeSdk) {
throw new Error("SDK is not installed");
}
sdk = unsafeWindow.getWmeSdk({ scriptId: "wme-road-shield-assistant", scriptName: "WME Road Shield Assistant" });
console.log(`SDK v ${sdk.getSDKVersion()} on ${sdk.getWMEVersion()} initialized`);
sdk.Events.once({ eventName: "wme-ready" }).then(rsaInit);
});
function rsaInit() {
if (!WazeWrap.Ready) {
setTimeout(() => {
rsaInit();
}, 100);
return;
}
const GF_LINK = "https://greasyfork.org/en/scripts/425050-wme-road-shield-assisstant";
const FORUM_LINK = "https://www.waze.com/discuss/t/script-road-shield-assistant-rsa/227100";
const RSA_UPDATE_NOTES = `<b>NEW:</b><br>
- Remove Waze Wrap Remote Storage<br>
<b>BUGFIXES:</b><br>
<b>KNOWN ISSUES:</b><br><br>`;
let CountryID;
(function (CountryID) {
CountryID[CountryID["AFGANISTAN"] = 1] = "AFGANISTAN";
CountryID[CountryID["ALBANIA"] = 2] = "ALBANIA";
CountryID[CountryID["ALGERIA"] = 3] = "ALGERIA";
CountryID[CountryID["AMERICAN_SAMOA"] = 4] = "AMERICAN_SAMOA";
CountryID[CountryID["ANDORRA"] = 5] = "ANDORRA";
CountryID[CountryID["ANGOLA"] = 6] = "ANGOLA";
CountryID[CountryID["ANGUILLA"] = 7] = "ANGUILLA";
CountryID[CountryID["ANTARCTICA"] = 8] = "ANTARCTICA";
CountryID[CountryID["ANTIGUA_AND_BARBUDA"] = 9] = "ANTIGUA_AND_BARBUDA";
CountryID[CountryID["ARGENTINA"] = 10] = "ARGENTINA";
CountryID[CountryID["ARMENIA"] = 11] = "ARMENIA";
CountryID[CountryID["ARUBA"] = 12] = "ARUBA";
CountryID[CountryID["AUSTRALIA"] = 13] = "AUSTRALIA";
CountryID[CountryID["AUSTRIA"] = 14] = "AUSTRIA";
CountryID[CountryID["AZERBAIJAN"] = 15] = "AZERBAIJAN";
CountryID[CountryID["BAHAMAS"] = 16] = "BAHAMAS";
CountryID[CountryID["BAHRAIN"] = 17] = "BAHRAIN";
CountryID[CountryID["BAKER_ISLAND"] = 18] = "BAKER_ISLAND";
CountryID[CountryID["BANGLADESH"] = 19] = "BANGLADESH";
CountryID[CountryID["BARBADOS"] = 20] = "BARBADOS";
CountryID[CountryID["BELGUIM"] = 21] = "BELGUIM";
CountryID[CountryID["BELIZE"] = 22] = "BELIZE";
CountryID[CountryID["BENIN"] = 23] = "BENIN";
CountryID[CountryID["BERMUDA"] = 24] = "BERMUDA";
CountryID[CountryID["BHUTAN"] = 25] = "BHUTAN";
CountryID[CountryID["BOLIVIA"] = 26] = "BOLIVIA";
CountryID[CountryID["BOSNIA_AND_HERZEGOWINA"] = 27] = "BOSNIA_AND_HERZEGOWINA";
CountryID[CountryID["BOTSWANA"] = 28] = "BOTSWANA";
CountryID[CountryID["BOUVET_ISLAND"] = 29] = "BOUVET_ISLAND";
CountryID[CountryID["BRAZIL"] = 30] = "BRAZIL";
CountryID[CountryID["BRITISH_INDIAN_OCEAN_TERRITORY"] = 31] = "BRITISH_INDIAN_OCEAN_TERRITORY";
CountryID[CountryID["BRITISH_VIRGIN_ISLANDS"] = 32] = "BRITISH_VIRGIN_ISLANDS";
CountryID[CountryID["BRUNEI"] = 33] = "BRUNEI";
CountryID[CountryID["BULGARIA"] = 34] = "BULGARIA";
CountryID[CountryID["BURKINA_FASO"] = 35] = "BURKINA_FASO";
CountryID[CountryID["BURUNDI"] = 36] = "BURUNDI";
CountryID[CountryID["BELARUS"] = 37] = "BELARUS";
CountryID[CountryID["CAMBODIA"] = 38] = "CAMBODIA";
CountryID[CountryID["CAMEROON"] = 39] = "CAMEROON";
CountryID[CountryID["CANADA"] = 40] = "CANADA";
CountryID[CountryID["CAPE_VERDE"] = 41] = "CAPE_VERDE";
CountryID[CountryID["CAYMAN_ISLANDS"] = 42] = "CAYMAN_ISLANDS";
CountryID[CountryID["CENTRAL_AFRICAN_REPUBLIC"] = 43] = "CENTRAL_AFRICAN_REPUBLIC";
CountryID[CountryID["CHAD"] = 44] = "CHAD";
CountryID[CountryID["CHILE"] = 45] = "CHILE";
CountryID[CountryID["CHINA"] = 46] = "CHINA";
CountryID[CountryID["CHRISTMAS_ISLAND"] = 47] = "CHRISTMAS_ISLAND";
CountryID[CountryID["COCOS_ISLANDS"] = 48] = "COCOS_ISLANDS";
CountryID[CountryID["KEELING_ISLANDS"] = 48] = "KEELING_ISLANDS";
CountryID[CountryID["COLOMBIA"] = 49] = "COLOMBIA";
CountryID[CountryID["COMOROS"] = 50] = "COMOROS";
CountryID[CountryID["CONGO"] = 51] = "CONGO";
CountryID[CountryID["COOK_ISLANDS"] = 52] = "COOK_ISLANDS";
CountryID[CountryID["COSTA_RICA"] = 53] = "COSTA_RICA";
CountryID[CountryID["CROATIA"] = 54] = "CROATIA";
CountryID[CountryID["CUBA"] = 55] = "CUBA";
CountryID[CountryID["CYPRUS"] = 56] = "CYPRUS";
CountryID[CountryID["CZECH_REPUBLIC"] = 57] = "CZECH_REPUBLIC";
CountryID[CountryID["DENMARK"] = 58] = "DENMARK";
CountryID[CountryID["DJIBOUTI"] = 59] = "DJIBOUTI";
CountryID[CountryID["DOMINICA"] = 60] = "DOMINICA";
CountryID[CountryID["DOMINICAN_REPUBLIC"] = 61] = "DOMINICAN_REPUBLIC";
CountryID[CountryID["ECUADOR"] = 62] = "ECUADOR";
CountryID[CountryID["EGYPT"] = 63] = "EGYPT";
CountryID[CountryID["EL_SALVADOR"] = 64] = "EL_SALVADOR";
CountryID[CountryID["EQUATORIAL_GUINEA"] = 65] = "EQUATORIAL_GUINEA";
CountryID[CountryID["ERITREA"] = 66] = "ERITREA";
CountryID[CountryID["ESTONIA"] = 67] = "ESTONIA";
CountryID[CountryID["ETHIOPIA"] = 68] = "ETHIOPIA";
CountryID[CountryID["FALKLAND_ISLANDS"] = 69] = "FALKLAND_ISLANDS";
CountryID[CountryID["ISLAS_MALVINAS"] = 69] = "ISLAS_MALVINAS";
CountryID[CountryID["FAROE_ISLANDS"] = 70] = "FAROE_ISLANDS";
CountryID[CountryID["MICRONEISA"] = 71] = "MICRONEISA";
CountryID[CountryID["FIJI"] = 72] = "FIJI";
CountryID[CountryID["FRNACE"] = 73] = "FRNACE";
CountryID[CountryID["FRENCH_GUIANA"] = 74] = "FRENCH_GUIANA";
CountryID[CountryID["FRENCH_POLYNESIA"] = 75] = "FRENCH_POLYNESIA";
CountryID[CountryID["FRENCH_SOUTHERN_TERRITORIES"] = 76] = "FRENCH_SOUTHERN_TERRITORIES";
CountryID[CountryID["GABON"] = 77] = "GABON";
CountryID[CountryID["GAMBIA"] = 78] = "GAMBIA";
CountryID[CountryID["GEORGIA"] = 80] = "GEORGIA";
CountryID[CountryID["GERMANY"] = 81] = "GERMANY";
CountryID[CountryID["GHANA"] = 82] = "GHANA";
CountryID[CountryID["GIBRALTAR"] = 83] = "GIBRALTAR";
CountryID[CountryID["GLORIOSO_ISLANDS"] = 84] = "GLORIOSO_ISLANDS";
CountryID[CountryID["GREECE"] = 85] = "GREECE";
CountryID[CountryID["GREENLAND"] = 86] = "GREENLAND";
CountryID[CountryID["GRENADA"] = 87] = "GRENADA";
CountryID[CountryID["GUADELOUPE"] = 88] = "GUADELOUPE";
CountryID[CountryID["GUAM"] = 89] = "GUAM";
CountryID[CountryID["GUATEMALA"] = 90] = "GUATEMALA";
CountryID[CountryID["GUERNSEY"] = 91] = "GUERNSEY";
CountryID[CountryID["GUINEA"] = 92] = "GUINEA";
CountryID[CountryID["GUINEA_BISSAU"] = 93] = "GUINEA_BISSAU";
CountryID[CountryID["GUYANA"] = 94] = "GUYANA";
CountryID[CountryID["HAITI"] = 95] = "HAITI";
CountryID[CountryID["HEARD_AND_MCDONAL_ISLANDS"] = 96] = "HEARD_AND_MCDONAL_ISLANDS";
CountryID[CountryID["HONDURAS"] = 97] = "HONDURAS";
CountryID[CountryID["HOWLAND_ISLAND"] = 98] = "HOWLAND_ISLAND";
CountryID[CountryID["HUNGARY"] = 99] = "HUNGARY";
CountryID[CountryID["ICELAND"] = 100] = "ICELAND";
CountryID[CountryID["INDIA"] = 101] = "INDIA";
CountryID[CountryID["INDONESIA"] = 102] = "INDONESIA";
CountryID[CountryID["IRAN"] = 103] = "IRAN";
CountryID[CountryID["IRAQ"] = 104] = "IRAQ";
CountryID[CountryID["IRELAND"] = 105] = "IRELAND";
CountryID[CountryID["ITALY"] = 107] = "ITALY";
CountryID[CountryID["COTE_DIVORE"] = 108] = "COTE_DIVORE";
CountryID[CountryID["JAMAICA"] = 109] = "JAMAICA";
CountryID[CountryID["JAN_MAYEN"] = 110] = "JAN_MAYEN";
CountryID[CountryID["JAPAN"] = 111] = "JAPAN";
CountryID[CountryID["JARVIS_ISLAND"] = 112] = "JARVIS_ISLAND";
CountryID[CountryID["JERSEY"] = 113] = "JERSEY";
CountryID[CountryID["JOHNSTON_ATOLL"] = 114] = "JOHNSTON_ATOLL";
CountryID[CountryID["JORDAN"] = 115] = "JORDAN";
CountryID[CountryID["JUAN_DE_NOVA_ISLAND"] = 116] = "JUAN_DE_NOVA_ISLAND";
CountryID[CountryID["KAZAKHSTAN"] = 117] = "KAZAKHSTAN";
CountryID[CountryID["KENYA"] = 118] = "KENYA";
CountryID[CountryID["KIRIBATI"] = 119] = "KIRIBATI";
CountryID[CountryID["KUWAIT"] = 120] = "KUWAIT";
CountryID[CountryID["KYRGYZSTAN"] = 121] = "KYRGYZSTAN";
CountryID[CountryID["LAOS"] = 122] = "LAOS";
CountryID[CountryID["LATVIA"] = 123] = "LATVIA";
CountryID[CountryID["LEBANON"] = 124] = "LEBANON";
CountryID[CountryID["LESOTHO"] = 125] = "LESOTHO";
CountryID[CountryID["LIBERIA"] = 126] = "LIBERIA";
CountryID[CountryID["LIBYA"] = 127] = "LIBYA";
CountryID[CountryID["LIECHTENSTEIN"] = 128] = "LIECHTENSTEIN";
CountryID[CountryID["LITHUANIA"] = 129] = "LITHUANIA";
CountryID[CountryID["LUXEMBOURG"] = 130] = "LUXEMBOURG";
CountryID[CountryID["MACAU"] = 131] = "MACAU";
CountryID[CountryID["MACEDONIA"] = 132] = "MACEDONIA";
CountryID[CountryID["MADAGASCAR"] = 133] = "MADAGASCAR";
CountryID[CountryID["MALAWI"] = 134] = "MALAWI";
CountryID[CountryID["MALAYSIA"] = 135] = "MALAYSIA";
CountryID[CountryID["MALDIVES"] = 136] = "MALDIVES";
CountryID[CountryID["MALI"] = 137] = "MALI";
CountryID[CountryID["MALTA"] = 138] = "MALTA";
CountryID[CountryID["ISLE_OF_MAN"] = 139] = "ISLE_OF_MAN";
CountryID[CountryID["MARSHALL_ISLANDS"] = 140] = "MARSHALL_ISLANDS";
CountryID[CountryID["MARTINIQUE"] = 141] = "MARTINIQUE";
CountryID[CountryID["MAURITANIA"] = 142] = "MAURITANIA";
CountryID[CountryID["MAURITIUS"] = 143] = "MAURITIUS";
CountryID[CountryID["MAYOTTE"] = 144] = "MAYOTTE";
CountryID[CountryID["MEXICO"] = 145] = "MEXICO";
CountryID[CountryID["MIDWAY_ISLAND"] = 146] = "MIDWAY_ISLAND";
CountryID[CountryID["MOLDOVA"] = 147] = "MOLDOVA";
CountryID[CountryID["MONACO"] = 148] = "MONACO";
CountryID[CountryID["MONGOLIA"] = 149] = "MONGOLIA";
CountryID[CountryID["MONTENEGRO"] = 150] = "MONTENEGRO";
CountryID[CountryID["MONTSERRAT"] = 151] = "MONTSERRAT";
CountryID[CountryID["MOROCCO"] = 152] = "MOROCCO";
CountryID[CountryID["MOZAMBIQUE"] = 153] = "MOZAMBIQUE";
CountryID[CountryID["MYANMAR"] = 154] = "MYANMAR";
CountryID[CountryID["NAMIBIA"] = 155] = "NAMIBIA";
CountryID[CountryID["NAURU"] = 156] = "NAURU";
CountryID[CountryID["NEPAL"] = 157] = "NEPAL";
CountryID[CountryID["NETHERLANDS"] = 158] = "NETHERLANDS";
CountryID[CountryID["NEW_CALEDONIA"] = 159] = "NEW_CALEDONIA";
CountryID[CountryID["NEW_ZEALAND"] = 161] = "NEW_ZEALAND";
CountryID[CountryID["NICARAGUA"] = 162] = "NICARAGUA";
CountryID[CountryID["NIGER"] = 163] = "NIGER";
CountryID[CountryID["NIGERIA"] = 164] = "NIGERIA";
CountryID[CountryID["NIUE"] = 165] = "NIUE";
CountryID[CountryID["NORFOLK_ISLAND"] = 166] = "NORFOLK_ISLAND";
CountryID[CountryID["NORTHERN_MARIANA_ISLANDS"] = 167] = "NORTHERN_MARIANA_ISLANDS";
CountryID[CountryID["NORTH_KOREA"] = 168] = "NORTH_KOREA";
CountryID[CountryID["KOREA_NORTH"] = 168] = "KOREA_NORTH";
CountryID[CountryID["NORWAY"] = 169] = "NORWAY";
CountryID[CountryID["OMAN"] = 170] = "OMAN";
CountryID[CountryID["PASIFIC_ISLANDS"] = 171] = "PASIFIC_ISLANDS";
CountryID[CountryID["PALAU"] = 171] = "PALAU";
CountryID[CountryID["PAKISTAN"] = 172] = "PAKISTAN";
CountryID[CountryID["PANAMA"] = 173] = "PANAMA";
CountryID[CountryID["PAPUA_NEW_GUINEA"] = 174] = "PAPUA_NEW_GUINEA";
CountryID[CountryID["PARACEL_ISLANDS"] = 175] = "PARACEL_ISLANDS";
CountryID[CountryID["PARAGUAY"] = 176] = "PARAGUAY";
CountryID[CountryID["PERU"] = 177] = "PERU";
CountryID[CountryID["PHILIPPINES"] = 178] = "PHILIPPINES";
CountryID[CountryID["PITCAIRN_ISLANDS"] = 179] = "PITCAIRN_ISLANDS";
CountryID[CountryID["POLAND"] = 180] = "POLAND";
CountryID[CountryID["PORTUGAL"] = 181] = "PORTUGAL";
CountryID[CountryID["PUERTO_RICO"] = 182] = "PUERTO_RICO";
CountryID[CountryID["QATAR"] = 183] = "QATAR";
CountryID[CountryID["REUNION"] = 184] = "REUNION";
CountryID[CountryID["ROMANIA"] = 185] = "ROMANIA";
CountryID[CountryID["RUSSIA"] = 186] = "RUSSIA";
CountryID[CountryID["RWANDA"] = 187] = "RWANDA";
CountryID[CountryID["SAN_MARINO"] = 188] = "SAN_MARINO";
CountryID[CountryID["SAO_TOME_AND_PRINCIPE"] = 189] = "SAO_TOME_AND_PRINCIPE";
CountryID[CountryID["SAUDI_ARABIA"] = 190] = "SAUDI_ARABIA";
CountryID[CountryID["SENEGAL"] = 191] = "SENEGAL";
CountryID[CountryID["SERBIA"] = 192] = "SERBIA";
CountryID[CountryID["SEYCHELLES"] = 193] = "SEYCHELLES";
CountryID[CountryID["SIERRA_LEONE"] = 194] = "SIERRA_LEONE";
CountryID[CountryID["SINGAPORE"] = 195] = "SINGAPORE";
CountryID[CountryID["SLOVAKIA"] = 196] = "SLOVAKIA";
CountryID[CountryID["SLOVENIA"] = 197] = "SLOVENIA";
CountryID[CountryID["SOLOMON_ISLANDS"] = 198] = "SOLOMON_ISLANDS";
CountryID[CountryID["SOMALIA"] = 199] = "SOMALIA";
CountryID[CountryID["SOUTH_AFRICA"] = 200] = "SOUTH_AFRICA";
CountryID[CountryID["SOUTH_GEORGIA_AND_THE_SOUTH_SANDWICH_ISLANDS"] = 201] = "SOUTH_GEORGIA_AND_THE_SOUTH_SANDWICH_ISLANDS";
CountryID[CountryID["SOUTH_GEORGIA"] = 201] = "SOUTH_GEORGIA";
CountryID[CountryID["SOUTH_SANDWICH_ISLANDS"] = 201] = "SOUTH_SANDWICH_ISLANDS";
CountryID[CountryID["SOUTH_KOREA"] = 202] = "SOUTH_KOREA";
CountryID[CountryID["KOREA_SOUTH"] = 202] = "KOREA_SOUTH";
CountryID[CountryID["SPAIN"] = 203] = "SPAIN";
CountryID[CountryID["SPRATLY_ISLANDS"] = 204] = "SPRATLY_ISLANDS";
CountryID[CountryID["SRI_LANKA"] = 205] = "SRI_LANKA";
CountryID[CountryID["ST_MARTIN"] = 254] = "ST_MARTIN";
CountryID[CountryID["SAINT_MARTIN"] = 254] = "SAINT_MARTIN";
CountryID[CountryID["ST_HELENA"] = 206] = "ST_HELENA";
CountryID[CountryID["ST_KITTS_AND_NEVIS"] = 207] = "ST_KITTS_AND_NEVIS";
CountryID[CountryID["ST_LUCIA"] = 208] = "ST_LUCIA";
CountryID[CountryID["ST_PIERRE_AND_MIQUELON"] = 209] = "ST_PIERRE_AND_MIQUELON";
CountryID[CountryID["ST_VINCENT_AND_THE_GRENADINES"] = 210] = "ST_VINCENT_AND_THE_GRENADINES";
CountryID[CountryID["SUDAN"] = 211] = "SUDAN";
CountryID[CountryID["SURINAME"] = 212] = "SURINAME";
CountryID[CountryID["SVALBARD"] = 213] = "SVALBARD";
CountryID[CountryID["SWAZILAND"] = 214] = "SWAZILAND";
CountryID[CountryID["SWEDEN"] = 215] = "SWEDEN";
CountryID[CountryID["SWITZERLAND"] = 216] = "SWITZERLAND";
CountryID[CountryID["SYRIA"] = 217] = "SYRIA";
CountryID[CountryID["TAIWAN"] = 218] = "TAIWAN";
CountryID[CountryID["TAJIKISTAN"] = 219] = "TAJIKISTAN";
CountryID[CountryID["TANZANIA"] = 220] = "TANZANIA";
CountryID[CountryID["THAILAND"] = 221] = "THAILAND";
CountryID[CountryID["TOGO"] = 222] = "TOGO";
CountryID[CountryID["TOKELAU"] = 223] = "TOKELAU";
CountryID[CountryID["TONGA"] = 224] = "TONGA";
CountryID[CountryID["TRINIDAD_AND_TOBAGO"] = 225] = "TRINIDAD_AND_TOBAGO";
CountryID[CountryID["TUNISIA"] = 226] = "TUNISIA";
CountryID[CountryID["TURKEY"] = 227] = "TURKEY";
CountryID[CountryID["TURKMENISTAN"] = 228] = "TURKMENISTAN";
CountryID[CountryID["TURKS_AND_CAICOS_ISLANDS"] = 229] = "TURKS_AND_CAICOS_ISLANDS";
CountryID[CountryID["TUVALU"] = 230] = "TUVALU";
CountryID[CountryID["UGANDA"] = 231] = "UGANDA";
CountryID[CountryID["UKRAINE"] = 232] = "UKRAINE";
CountryID[CountryID["UNITED_ARAB_EMIRATES"] = 233] = "UNITED_ARAB_EMIRATES";
CountryID[CountryID["UNITED_KINGDOM"] = 234] = "UNITED_KINGDOM";
CountryID[CountryID["UK"] = 234] = "UK";
CountryID[CountryID["GREAT_BRITAIN"] = 234] = "GREAT_BRITAIN";
CountryID[CountryID["UNITED_STATES"] = 235] = "UNITED_STATES";
CountryID[CountryID["USA"] = 235] = "USA";
CountryID[CountryID["UNITED_STATES_OF_AMERICA"] = 235] = "UNITED_STATES_OF_AMERICA";
CountryID[CountryID["URUGUAY"] = 236] = "URUGUAY";
CountryID[CountryID["UZBEKISTAN"] = 237] = "UZBEKISTAN";
CountryID[CountryID["VANUATU"] = 238] = "VANUATU";
CountryID[CountryID["VENEZUELA"] = 239] = "VENEZUELA";
CountryID[CountryID["VIETNAM"] = 240] = "VIETNAM";
CountryID[CountryID["US_VIRGIN_ISLANDS"] = 241] = "US_VIRGIN_ISLANDS";
CountryID[CountryID["WAKE_ISLAND"] = 242] = "WAKE_ISLAND";
CountryID[CountryID["WALLIS_AND_FUTUNA"] = 243] = "WALLIS_AND_FUTUNA";
CountryID[CountryID["WESTERN_SAHARA"] = 245] = "WESTERN_SAHARA";
CountryID[CountryID["SAMOA"] = 246] = "SAMOA";
CountryID[CountryID["YEMEN"] = 247] = "YEMEN";
CountryID[CountryID["DEMOCRATIC_REPUBLIC_OF_THE_CONGO"] = 248] = "DEMOCRATIC_REPUBLIC_OF_THE_CONGO";
CountryID[CountryID["DRC"] = 248] = "DRC";
CountryID[CountryID["ZAMBIA"] = 249] = "ZAMBIA";
CountryID[CountryID["ZIMBABWE"] = 250] = "ZIMBABWE";
CountryID[CountryID["FINLAND"] = 251] = "FINLAND";
CountryID[CountryID["CURACAO"] = 252] = "CURACAO";
CountryID[CountryID["BONAIRE_SINT_EUSTATIUS_SABA_ISLAND"] = 253] = "BONAIRE_SINT_EUSTATIUS_SABA_ISLAND";
CountryID[CountryID["BONAIRE"] = 253] = "BONAIRE";
CountryID[CountryID["SINT_EUSTATIUS"] = 253] = "SINT_EUSTATIUS";
CountryID[CountryID["SABA_ISLAND"] = 253] = "SABA_ISLAND";
CountryID[CountryID["SAINT_BARTHELEMY"] = 255] = "SAINT_BARTHELEMY";
CountryID[CountryID["SAINT_BARTHS"] = 255] = "SAINT_BARTHS";
CountryID[CountryID["SAINT_BARTS"] = 255] = "SAINT_BARTS";
CountryID[CountryID["HONG_KONG"] = 256] = "HONG_KONG";
CountryID[CountryID["SINT_MAARTEN"] = 257] = "SINT_MAARTEN";
CountryID[CountryID["TIMOR_LESTE"] = 258] = "TIMOR_LESTE";
CountryID[CountryID["SOUTH_SUDAN"] = 259] = "SOUTH_SUDAN";
})(CountryID || (CountryID = {}));
const MIN_ZOOM_LEVEL = 14;
let ZoomLevel;
(function (ZoomLevel) {
ZoomLevel[ZoomLevel["ZM0"] = 12] = "ZM0";
ZoomLevel[ZoomLevel["ZM1"] = 13] = "ZM1";
ZoomLevel[ZoomLevel["ZM2"] = 14] = "ZM2";
ZoomLevel[ZoomLevel["ZM3"] = 15] = "ZM3";
ZoomLevel[ZoomLevel["ZM4"] = 16] = "ZM4";
ZoomLevel[ZoomLevel["ZM5"] = 17] = "ZM5";
ZoomLevel[ZoomLevel["ZM6"] = 18] = "ZM6";
ZoomLevel[ZoomLevel["ZM7"] = 19] = "ZM7";
ZoomLevel[ZoomLevel["ZM8"] = 20] = "ZM8";
ZoomLevel[ZoomLevel["ZM9"] = 21] = "ZM9";
ZoomLevel[ZoomLevel["ZM10"] = 22] = "ZM10";
})(ZoomLevel || (ZoomLevel = {}));
const minShieldDisplayLengths = {
15: 150,
16: 90,
17: 80,
18: 70,
19: 60,
20: 50,
21: 40,
22: 30,
};
const CountryDataSheetInfo = {};
const RoadAbbr = {};
let mainSheetLoaded = false;
const iconsAllowingNoText = new Set([
2000, // Atlantic City Expy
2079, // Garden State Parkway
2033, // Florida's Turnpike
2082, // Palisades Pkwy
2093, // Ontario State Pkwy
2094, // Niagara Scenic Pkwy
2199, // Westpark Tollway,
2198, // Sam Houston Parkway,
2196, // Fort Bend
2050, // AA Hwy,
2069, // Blue Ridge Pkwy
5058, // QEW
]);
const Strings = {
en: {
enableScript: "Script enabled",
HighSegShields: "Segments with Shields",
HighSegShieldsClr: "Segments with Shields",
ShowSegShields: "Show Segment Shields on Map",
SegShieldMissing: "Segments that might be missing shields",
SegShieldMissingClr: "Segments that might be missing shields",
SegShieldError: "Segments that have shields but maybe shouldn't",
SegShieldErrorClr: "Segments that have shields but maybe shouldn't",
HighNodeShields: "Nodes with Shields (TG)",
HighNodeShieldsClr: "Nodes with Shields (TG)",
ShowNodeShields: "Show Node Shield Info",
ShowExitShields: "Has Exit Signs",
ShowTurnTTS: "Has TIO",
AlertTurnTTS: "Alert if TTS is different from default",
NodeShieldMissing: "Nodes that might be missing shields",
NodeShieldMissingClr: "Nodes that might be missing shields",
resetSettings: "Reset Settings",
disabledFeat: "(Feature not configured for this country)",
ShowTowards: "Has Towards",
ShowVisualInst: "Has Visual Instruction",
SegHasDir: "Segment Shields with direction",
SegHasDirClr: "Segment Shields with direction",
SegInvDir: "Segment Shields without direction",
SegInvDirClr: "Segment Shields without direction",
IconHead: "Map Icons",
HighlightHead: "Highlights",
HighlightColors: "Highlight Colors",
ShowRamps: "Include Ramps",
Experimental: "Experimental Features (Use at Your own Risk)",
AlternativeShields: "Alternative Name Shields",
AlternativePrimaryCity: "Alternative Street with Primary City",
AlternativeNoCity: "Alternative Street with No City",
mHPlus: "Only show on minor highways or greater",
titleCase: "Segments/nodes with direction not in large-and-small-caps format",
TitleCaseClr: "Segments/nodes with direction not in large-and-small-caps format",
TitleCaseSftClr: "Direction in free text might not be in large-and-small-caps format",
checkTWD: "Include Towards field",
checkTTS: "Include TTS field",
checkVI: "Include Visual Instruction field",
},
"en-us": {
enableScript: "Script enabled",
HighSegShields: "Segments with Shields",
HighSegShieldsClr: "Segments with Shields",
ShowSegShields: "Show Segment Shields on Map",
SegShieldMissing: "Segments that might be missing shields",
SegShieldMissingClr: "Segments that might be missing shields",
SegShieldError: "Segments that have shields but maybe shouldn't",
SegShieldErrorClr: "Segments that have shields but maybe shouldn't",
HighNodeShields: "Nodes with Shields (TG)",
HighNodeShieldsClr: "Nodes with Shields (TG)",
ShowNodeShields: "Show Node Shield Info",
ShowExitShields: "Has Exit Signs",
ShowTurnTTS: "Has TIO",
AlertTurnTTS: "Alert if TTS is different from default",
NodeShieldMissing: "Nodes that might be missing shields",
NodeShieldMissingClr: "Nodes that might be missing shields",
resetSettings: "Reset Settings",
disabledFeat: "(Feature not configured for this country)",
ShowTowards: "Has Towards",
ShowVisualInst: "Has Visual Instruction",
SegHasDir: "Segment Shields with direction",
SegHasDirClr: "Segment Shields with direction",
SegInvDir: "Segment Shields without direction",
SegInvDirClr: "Segment Shields without direction",
IconHead: "Map Icons",
HighlightHead: "Highlights",
HighlightColors: "Highlight Colors",
ShowRamps: "Include Ramps",
Experimental: "Experimental Features (Unstable use at Your own Risk)",
AlternativeShields: "Alternative Name Shields",
AlternativePrimaryCity: "Alternative Street with Primary City",
AlternativeNoCity: "Alternative Street with No City",
mHPlus: "Only show on minor highways or greater",
titleCase: "Segments/nodes with direction not in large-and-small-caps format",
TitleCaseClr: "Segments/nodes with direction not in large-and-small-caps format",
TitleCaseSftClr: "Direction in free text might not be in large-and-small-caps format",
checkTWD: "Include Towards field",
checkTTS: "Include TTS field",
checkVI: "Include Visual Instruction field",
},
"es-419": {
enableScript: "Script habilitado",
HighSegShields: "Segmentos con escudos",
HighSegShieldsClr: "Segmentos con escudos",
ShowSegShields: "Mostrar escudos de segmentos en el mapa",
SegShieldMissing: "Segmentos a los que les pueden faltar escudos",
SegShieldMissingClr: "Segmentos a los que les pueden faltar escudos",
SegShieldError: "Segmentos que tienen escudos y quizá no deberían",
SegShieldErrorClr: "Segmentos que tienen escudos y quizá no deberían",
HighNodeShields: "Nodos con escudos (TG)",
HighNodeShieldsClr: "Nodos con escudos (TG)",
ShowNodeShields: "Mostrar Info de Escudo en Nodo",
ShowExitShields: "Incluir iconos de giro (si existen)",
ShowTurnTTS: "Incuir TTS",
AlertTurnTTS: "Alertar si TTS fue modificado",
NodeShieldMissing: "Nodos a los que les pueden faltar escudos",
NodeShieldMissingClr: "Nodos a los que les pueden faltar escudos",
resetSettings: "Reiniciar ajustes",
disabledFeat: "(Funcionalidad no configurada para ese país)",
ShowTowards: "Incluir dirección (si existe)",
ShowVisualInst: "Incluir instrucción visual",
SegHasDir: "Escudos con dirección",
SegHasDirClr: "Escudos con dirección",
SegInvDir: "Escudos sin dirección",
SegInvDirClr: "Escudos sin dirección",
IconHead: "Iconos en mapa",
HighlightHead: "Destacar",
HighlightColors: "Reseña de Colores",
ShowRamps: "Incluir Rampas",
Experimental: "Experimental Features",
AlternativeShields: "Alternative Name Shields",
AlternativePrimaryCity: "Alternative Street with Primary City",
AlternativeNoCity: "Alternative Street with No City",
mHPlus: "Only show on minor highways or greater",
titleCase: "Segments/nodes with direction not in large-and-small-caps format",
TitleCaseClr: "Segments/nodes with direction not in large-and-small-caps format",
TitleCaseSftClr: "Direction in free text might not be in large-and-small-caps format",
checkTWD: "Include Towards field",
checkTTS: "Include TTS field",
checkVI: "Include Visual Instruction field",
},
uk: {
enableScript: "Скріпт вимкнено",
HighSegShields: "Сегменти з шильдами",
HighSegShieldsClr: "Сегменти з шильдами",
ShowSegShields: "Показувати шильди на мапі",
SegShieldMissing: "Сегменти, яким можливо потрібні шильди",
SegShieldMissingClr: "Сегменти, яким можливо потрібні шильди",
SegShieldError: "Сегменти, які мають шильди, але можливо вони непотрібні",
SegShieldErrorClr: "Сегменти, які мають шильди, але можливо вони непотрібні",
HighNodeShields: "Вузли з шильдами (TG)",
HighNodeShieldsClr: "Вузли з шильдами (TG)",
ShowNodeShields: "Показувати деталі шильда на вузлі ",
ShowExitShields: "Включити іконку повороту (якщо вони є)",
ShowTurnTTS: "Вимкнути TTS",
AlertTurnTTS: "Сповіщати, якщо TTS відрізняється від типового",
NodeShieldMissing: "Вузли, на яких можуть бути відсутні щити",
NodeShieldMissingClr: "Вузли, на яких можуть бути відсутні щити",
resetSettings: "Скинути налаштування",
disabledFeat: "Відсутні налаштування для цієї страни",
ShowTowards: "Включаючи Towards (якщо існує)",
ShowVisualInst: "Включаючи візуальні інструкції",
SegHasDir: "Шильди з напрямками",
SegHasDirClr: "Шильди з напрямками",
SegInvDir: "Шильди без напрямків",
SegInvDirClr: "Шильди без напрямків",
IconHead: "Іконки на мапі",
HighlightHead: "Підсвічувати",
HighlightColors: "Кольори підсвічування",
ShowRamps: "Включаючи рампи",
Experimental: "Экспериментальні засобливості",
AlternativeShields: "Шильди альтернатівних назв",
AlternativePrimaryCity: "Альтернативна назва с основним містом",
AlternativeNoCity: "Альтернативна назва без міста",
mHPlus: "Only show on minor highways or greater",
titleCase: "Segments/nodes with direction not in large-and-small-caps format",
TitleCaseClr: "Segments/nodes with direction not in large-and-small-caps format",
TitleCaseSftClr: "Direction in free text might not be in large-and-small-caps format",
checkTWD: "Include Towards field",
checkTTS: "Include TTS field",
checkVI: "Include Visual Instruction field",
},
fr: {
enableScript: "Script activé",
HighSegShields: "Segments avec cartouche",
HighSegShieldsClr: "Segments avec cartouche",
ShowSegShields: "Afficher les cartouches sur la carte",
SegShieldMissing: "Segments dont le cartouche pourrait manquer",
SegShieldMissingClr: "Segments dont le cartouche pourrait manquer",
SegShieldError: "Segments ayant un cartouche mais ne devraient peut-être pas",
SegShieldErrorClr: "Segments ayant un cartouche mais ne devraient peut-être pas",
HighNodeShields: "Noeuds avec cartouche (TG)",
HighNodeShieldsClr: "Noeuds avec cartouche (TG)",
ShowNodeShields: "Afficher les infos des cartouches de noeuds",
ShowExitShields: "As des panneaux de sortie",
ShowTurnTTS: "Has TIO",
AlertTurnTTS: "Alert if TTS is different from default",
NodeShieldMissing: "Noeud dont le cartouche pourrait manquer",
NodeShieldMissingClr: "Noeud dont le cartouche pourrait manquer",
resetSettings: "Réinitialiser les paramètres",
disabledFeat: "Feature not configured for this country",
ShowTowards: 'As "En direction de"',
ShowVisualInst: "As des instructions visuelles",
SegHasDir: "Cartouche de segment avec direction",
SegHasDirClr: "Cartouche de segment avec direction",
SegInvDir: "Cartouche de segment sans direction",
SegInvDirClr: "Cartouche de segment sans direction",
IconHead: "Icônes de carte",
HighlightHead: "Surlignages",
HighlightColors: "Couleurs de surlignage",
ShowRamps: "Inclure les bretelles",
mHPlus: "Only show on minor highways or greater",
Experimental: "Experimental Features",
AlternativeShields: "Alternative Name Shields",
AlternativePrimaryCity: "Alternative Street with Primary City",
AlternativeNoCity: "Alternative Street with No City",
titleCase: "Segments/nodes with direction not in large-and-small-caps format",
TitleCaseClr: "Segments/nodes with direction not in large-and-small-caps format",
TitleCaseSftClr: "Direction in free text might not be in large-and-small-caps format",
checkTWD: 'Inclure le champ "en direction de"',
checkTTS: "Inclure le champ TTS",
checkVI: "Inclure le champ d'instruction visuel",
},
};
const CheckAltName = new Set([
// France
73,
]);
let BadNames = [];
let rsaSettings = {
lastSaveAction: 0,
enableScript: true,
HighSegShields: false,
ShowSegShields: true,
SegShieldMissing: false,
SegShieldError: false,
SegHasDir: false,
SegInvDir: false,
HighNodeShields: true,
ShowNodeShields: false,
ShowExitShields: false,
ShowTurnTTS: false,
AlertTurnTTS: false,
ShowTowards: false,
ShowVisualInst: false,
NodeShieldMissing: false,
HighSegClr: "#0066ff",
MissSegClr: "#00ff00",
ErrSegClr: "#cc00ff",
HighNodeClr: "#ff00bf",
MissNodeClr: "#ff0000",
SegHasDirClr: "#ffff00",
SegInvDirClr: "#66ffff",
TitleCaseClr: "#ff9933",
TitleCaseSftClr: "#ffff66",
ShowRamps: true,
AlternativeShields: false,
mHPlus: false,
titleCase: false,
checkTWD: false,
checkTTS: false,
checkVI: false,
mapLayerVisible: false,
iconLayerVisible: false,
};
let UpdateObj;
let SetTurn;
const rsaMapLayer = { layerName: "RSA Map Layer", zIndexing: false };
const rsaIconLayer = { layerName: "RSA Icon Layer", zIndexing: false };
let LANG;
let alternativeType;
const styleConfig = {
styleContext: {
highNodeColor: (context) => {
return context?.feature?.properties?.style?.strokeColor;
},
labelExternalGraphic: (context) => {
const style = context?.feature?.properties?.style;
if (!style || !style?.sign || !style?.txt)
return "";
return `https://renderer-am.waze.com/renderer/v1/signs/${style.sign}?text=${style.txt}`;
},
labelGraphicHeight: (context) => {
return context?.feature?.properties?.style?.height;
},
labelGraphicWidth: (context) => {
return context?.feature?.properties?.style?.width;
},
shieldExternalGraphic: (context) => {
return context?.feature?.properties?.style?.externalGraphic;
},
shieldGraphicWidth: (context) => {
return context?.feature?.properties?.style?.graphicWidth;
},
shieldGraphicHeight: (context) => {
return context?.feature?.properties?.style?.graphicHeight;
},
shieldLabel: (context) => {
return context?.feature?.properties?.style?.label;
},
nodeStyleStrokeColor: (context) => {
return context?.feature?.properties?.style?.strokeColor;
},
nodeStyleStrokeOpacity: (context) => {
return context?.feature?.properties?.style?.strokeOpacity;
},
nodeStyleStrokeWidth: (context) => {
return context?.feature?.properties?.style?.strokeWidth;
},
nodeStyleFillOpacity: (context) => {
return context?.feature?.properties?.style?.fillOpacity;
},
nodeStylePointRadius: (context) => {
return context?.feature?.properties?.style?.pointRadius;
},
segHighlightStrokeOpacity: (context) => {
return context?.feature?.properties?.style?.strokeOpacity;
},
segHighlightStrokeColor: (context) => {
return context?.feature?.properties?.style?.strokeColor;
},
segHighlightStrokeWidth: (context) => {
return context?.feature?.properties?.style?.strokeWidth;
},
segHighlightFillColor: (context) => {
return context?.feature?.properties?.style?.fillColor;
},
segHighlightFillOpacity: (context) => {
return context?.feature?.properties?.style?.fillOpacity;
},
shieldLabelYOffset: (context) => {
return context?.feature?.properties?.style?.labelYOffset;
},
},
styleRules: [
{
predicate: applyPointLabel,
style: {
strokeColor: "${highNodeColor}",
strokeOpacity: 0.75,
strokeWidth: 4,
fillColor: "${highNodeColor}",
fillOpacity: 0.75,
pointRadius: 3,
},
},
{
predicate: applyShield,
style: {
externalGraphic: "${shieldExternalGraphic}",
graphicWidth: "${shieldGraphicWidth}",
graphicHeight: "${shieldGraphicHeight}",
graphicXOffset: -20,
graphicYOffset: -20,
style: "opacity: 1",
fillOpacity: 1,
fill: "black",
stroke: "black",
fontColor: "green",
labelOutlineColor: "white",
labelOutlineWidth: 1,
fontSize: 12,
display: "grid",
label: "${shieldLabel}",
labelYOffset: "${shieldLabelYOffset}",
},
},
{
predicate: applySegHighlight,
style: {
strokeColor: "${segHighlightStrokeColor}",
strokeOpacity: "${segHighlightStrokeOpacity}",
strokeWidth: "${segHighlightStrokeWidth}",
fillColor: "${segHighlightFillColor}",
fillOpacity: "${segHighlightFillOpacity}",
},
},
{
predicate: applyStyleNode,
style: {
strokeColor: "${nodeStyleStrokeColor}",
strokeOpacity: "${nodeStyleStrokeOpacity}",
strokeWidth: "${nodeStyleStrokeWidth}",
fillColor: "${nodeStyleFillColor}",
fillOpacity: "${nodeStyleFillOpacity}",
pointRadius: "${nodeStylePointRadius}",
},
},
{
predicate: applyStyleLabel,
style: {
externalGraphic: "${labelExternalGraphic}",
graphicHeight: "${labelGraphicHeight}",
graphicWidth: "${labelGraphicWidth}",
fillOpacity: "${nodeStyleFillOpacity}",
fontSize: 12,
graphicZIndex: 2432,
},
},
],
};
console.debug(`SDK v. ${sdk.getSDKVersion()} on ${sdk.getWMEVersion()} initialized`);
// function rsaBootstrap() {
// // if (!document.getElementById('edit-panel') || !sdk.DataModel.Countries.getTopCountry() || !WazeWrap.Ready) {
// // setTimeout(rsaBootstrap, 200);
// // }
// if (sdk.State.isReady()) {
// initRSA();
// } else {
// sdk.Events.once({eventName: "wme-ready"}).then(initRSA);
// }
// }
function initRSA() {
const locale = sdk.Settings.getLocale();
LANG = locale.localeCode.toLowerCase();
console.log("RSA: Initializing...");
startScriptUpdateMonitor();
// let UpdateObj = sdk.DataModel. require('Waze/Action/UpdateObject');
// let SetTurn = require('Waze/Model/Graph/Actions/SetTurn');
const rsaCss = [
'.rsa-wrapper {position:relative;width:100%;font-size:12px;font-family:"Rubik", "Boing-light", sans-serif;user-select:none;}',
".rsa-section-wrapper {display:block;width:100%;padding:4px;}",
".rsa-section-wrapper.border {border-bottom:1px solid grey;margin-bottom:5px;}",
".rsa-header {font-weight:bold;}",
".rsa-option-container {padding:3px;}",
".rsa-option-container.no-display {display:none;}",
".rsa-option-container.sub {margin-left:20px;}",
'input[type="checkbox"].rsa-checkbox {display:inline-block;position:relative;top:3px;vertical-align:top;margin:0;}',
'input[type="color"].rsa-color-input {display:inline-block;position:relative;width:20px;padding:0px 1px;border:0px;vertical-align:top;cursor:pointer;}',
'input[type="color"].rsa-color-input:focus {outline-width:0;}',
"label.rsa-label {display:inline-block;position:relative;max-width:80%;vertical-align:top;font-weight:normal;padding-left:5px;word-wrap:break-word;}",
".group-title.toolbar-top-level-item-title.rsa:hover {cursor:pointer;}",
].join(" ");
const $rsaTab = $("<div>");
$rsaTab.html = [
`<div class='rsa-wrapper' id='rsa-tab-wrapper'>
<div style='margin-bottom:5px;border-bottom:1px solid black;'>
<span style='font-weight:bold;'>
<a href='https://www.waze.com/forum/viewtopic.php?f=1851&t=315748' target='_blank' style='text-decoration:none;'>Road Shield Assistant</a>
</span> - v${GM_info.script.version}
</div>
<div class='rsa-option-container'>
<input type=checkbox class='rsa-checkbox' id='rsa-enableScript' />
<label class='rsa-label' for='rsa-enableScript'><span id='rsa-text-enableScript'></span></label>
</div>
<div class='rsa-option-container'>
<input type=checkbox class='rsa-checkbox' id='rsa-ShowRamps' />
<label class='rsa-label' for='rsa-ShowRamps'><span id='rsa-text-ShowRamps'></span></label>
</div>
<div class='rsa-option-container'>
<input type=checkbox class='rsa-checkbox' id='rsa-mHPlus' />
<label class='rsa-label' for='rsa-mHPlus'><span id='rsa-text-mHPlus'></span></label>
</div>
<span id='rsa-text-IconHead' class='rsa-header'></span>
<div style='border-top:2px solid black;'>
<div class='rsa-option-container'>
<input type=checkbox class='rsa-checkbox' id='rsa-ShowSegShields' />
<label class='rsa-label' for='rsa-ShowSegShields'><span id='rsa-text-ShowSegShields'></span></label>
</div>
<div class='rsa-option-container no-display'>
<input type=checkbox class='rsa-checkbox' id='rsa-NodeShieldMissing' />
<label class='rsa-label' for='rsa-NodeShieldMissing'><span id='rsa-text-NodeShieldMissing'></span></label>
</div>
<div class='rsa-option-container'>
<input type=checkbox class='rsa-checkbox' id='rsa-ShowNodeShields' />
<label class='rsa-label' for='rsa-ShowNodeShields'><span id='rsa-text-ShowNodeShields'></span></label>
</div>
<div class='rsa-option-container sub'>
<input type=checkbox class='rsa-checkbox' id='rsa-ShowExitShields' />
<label class='rsa-label' for='rsa-ShowExitShields'><span id='rsa-text-ShowExitShields'></span></label>
</div>
<div class='rsa-option-container sub'>
<input type=checkbox class='rsa-checkbox' id='rsa-ShowTurnTTS' />
<label class='rsa-label' for='rsa-ShowTurnTTS'><span id='rsa-text-ShowTurnTTS'></span></label>
</div>
<div class='rsa-option-container sub'>
<input type=checkbox class='rsa-checkbox' id='rsa-ShowTowards' />
<label class='rsa-label' for='rsa-ShowTowards'><span id='rsa-text-ShowTowards'></span></label>
</div>
<div class='rsa-option-container sub'>
<input type=checkbox class='rsa-checkbox' id='rsa-ShowVisualInst' />
<label class='rsa-label' for='rsa-ShowVisualInst'><span id='rsa-text-ShowVisualInst'></span></label>
</div>
<div class='rsa-option-container sub' style='display:none;'>
<input type=checkbox class='rsa-checkbox' id='rsa-AlertTurnTTS' />
<label class='rsa-label' for='rsa-AlertTurnTTS'><span id='rsa-text-AlertTurnTTS'></span></label>
</div>
</div>
<span id='rsa-text-HighlightHead' class='rsa-header'></span>
<div style='border-top:2px solid black;'>
<div class='rsa-option-container' style='display:none;'>
<input type=checkbox class='rsa-checkbox' id='rsa-HighNodeShields' />
<label class='rsa-label' for='rsa-HighNodeShields'><span id='rsa-text-HighNodeShields'></span></label>
</div>
<div class='rsa-option-container'>
<input type=checkbox class='rsa-checkbox' id='rsa-HighSegShields' />
<label class='rsa-label' for='rsa-HighSegShields'><span id='rsa-text-HighSegShields'></span></label>
</div>
<div class='rsa-option-container'>
<input type=checkbox class='rsa-checkbox' id='rsa-SegHasDir' />
<label class='rsa-label' for='rsa-SegHasDir'><span id='rsa-text-SegHasDir'></span></label>
</div>
<div class='rsa-option-container'>
<input type=checkbox class='rsa-checkbox' id='rsa-SegInvDir' />
<label class='rsa-label' for='rsa-SegInvDir'><span id='rsa-text-SegInvDir'></span></label>
</div>
<div class='rsa-option-container' id='rsa-container-titleCase'>
<input type=checkbox class='rsa-checkbox' id='rsa-titleCase' />
<label class='rsa-label' for='rsa-titleCase'><span id='rsa-text-titleCase'></span></label>
</div>
<div class='rsa-option-container sub' id='rsa-container-checkTWD'>
<input type=checkbox class='rsa-checkbox' id='rsa-checkTWD' />
<label class='rsa-label' for='rsa-checkTWD'><span id='rsa-text-checkTWD'></span></label>
</div>
<div class='rsa-option-container sub' id='rsa-container-checkTTS'>
<input type=checkbox class='rsa-checkbox' id='rsa-checkTTS' />
<label class='rsa-label' for='rsa-checkTTS'><span id='rsa-text-checkTTS'></span></label>
</div>
<div class='rsa-option-container sub' id='rsa-container-checkVI'>
<input type=checkbox class='rsa-checkbox' id='rsa-checkVI' />
<label class='rsa-label' for='rsa-checkVI'><span id='rsa-text-checkVI'></span></label>
</div>
<div class='rsa-option-container'>
<input type=checkbox class='rsa-checkbox' id='rsa-SegShieldMissing' />
<label class='rsa-label' for='rsa-SegShieldMissing'><span id='rsa-text-SegShieldMissing'></span></label>
</div>
<div class='rsa-option-container'>
<input type=checkbox class='rsa-checkbox' id='rsa-SegShieldError' />
<label class='rsa-label' for='rsa-SegShieldError'><span id='rsa-text-SegShieldError'></span></label>
</div>
</div>
<span id='rsa-text-HighlightColors' class='rsa-header'></span>
<div style='border-top:2px solid black;'>
<div class='rsa-option-container'>
<input type=color class='rsa-color-input' id='rsa-HighSegClr' />
<label class='rsa-label' for='rsa-HighSegClr'><span id='rsa-text-HighSegShieldsClr'></span></label>
</div>
<div class='rsa-option-container'>
<input type=color class='rsa-color-input' id='rsa-SegHasDirClr' />
<label class='rsa-label' for='rsa-SegHasDirClr'><span id='rsa-text-SegHasDirClr'></span></label>
</div>
<div class='rsa-option-container'>
<input type=color class='rsa-color-input' id='rsa-SegInvDirClr' />
<label class='rsa-label' for='rsa-SegInvDirClr'><span id='rsa-text-SegInvDirClr'></span></label>
</div>
<div class='rsa-option-container'>
<input type=color class='rsa-color-input' id='rsa-MissSegClr' />
<label class='rsa-label' for='rsa-MissSegClr'><span id='rsa-text-SegShieldMissingClr'></span></label>
</div>
<div class='rsa-option-container'>
<input type=color class='rsa-color-input' id='rsa-ErrSegClr' />
<label class='rsa-label' for='rsa-ErrSegClr'><span id='rsa-text-SegShieldErrorClr'></span></label>
</div>
<div class='rsa-option-container'>
<input type=color class='rsa-color-input' id='rsa-HighNodeClr' />
<label class='rsa-label' for='rsa-HighNodeClr'><span id='rsa-text-HighNodeShieldsClr'></span></label>
</div>
<div class='rsa-option-container no-display'>
<input type=color class='rsa-color-input' id='rsa-MissNodeClr' />
<label class='rsa-label' for='rsa-MissNodeClr'><span id='rsa-text-NodeShieldMissingClr'></span></label>
</div>
<div class='rsa-option-container' id='rsa-container-TitleCaseClr'>
<input type=color class='rsa-color-input' id='rsa-TitleCaseClr' />
<label class='rsa-label' for='rsa-TitleCaseClr'><span id='rsa-text-TitleCaseClr'></span></label>
</div>
<div class='rsa-option-container' id='rsa-container-TitleCaseSftClr'>
<input type=color class='rsa-color-input' id='rsa-TitleCaseSftClr' />
<label class='rsa-label' for='rsa-TitleCaseSftClr'><span id='rsa-text-TitleCaseSftClr'></span></label>
</div>
</div>
<span id='rsa-text-Experimental' class='rsa-header'></span>
<div style='border-top:2px solid black;'>
<div class='rsa-option-container'>
<input type=checkbox class='rsa-checkbox' id='rsa-AlternativeShields' />
<label class='rsa-label' for='rsa-AlternativeShields'><span id='rsa-text-AlternativeShields'></span></label>
</div>
<div class='rsa-option-container sub'>
<input type=radio class='rsa-checkbox' value='AlternativePrimaryCity' name='AlternativeShields' id='rsa-AlternativePrimaryCity' checked/>
<label class='rsa-label' for='rsa-AlternativePrimaryCity'><span id='rsa-text-AlternativePrimaryCity'></span></label>
</div>
<div class='rsa-option-container sub'>
<input type=radio class='rsa-checkbox' value='AlternativeNoCity' name='AlternativeShields' id='rsa-AlternativeNoCity' />
<label class='rsa-label' for='rsa-AlternativeNoCity'><span id='rsa-text-AlternativeNoCity'></span></label>
</div>
</div>
<div style='border-top:2px solid black;'>
<div class='rsa-option-container'>
<input type=button id='rsa-resetSettings' />
</div>
</div>
</div>`,
].join(" ");
const $rsaFixWrapper = $('<div id="rsa-autoWrapper" class="toolbar-button ItemInactive" style="display:none;margin-right:5px;">');
const $rsaFixInner = $('<div class="group-title toolbar-top-level-item-title rsa" style="margin:5px 0 0 15px;font-size:12px;">RSA Fix</div>');
// WazeWrap.Interface.Tab('RSA', $rsaTab.html, setupOptions, 'RSA');
sdk.Sidebar.registerScriptTab().then((r) => {
r.tabLabel.innerHTML = "RSA";
r.tabPane.innerHTML = $rsaTab.html;
setupOptions();
});
$(`<style type="text/css">${rsaCss}</style>`).appendTo("head");
// $($rsaFixInner).appendTo($rsaFixWrapper);
// $($rsaFixWrapper).appendTo($('#primary-toolbar > div'));
WazeWrap.Interface.ShowScriptUpdate(GM_info.script.name, GM_info.script.version, RSA_UPDATE_NOTES, GF_LINK, FORUM_LINK);
console.log("RSA: loaded");
}
function startScriptUpdateMonitor() {
try {
const updateMonitor = new WazeWrap.Alerts.ScriptUpdateMonitor(GM_info.script.name, GM_info.script.version, GM_info.script.downloadURL, GM_xmlhttpRequest, GM_info.script.updateURL);
updateMonitor.start();
}
catch (ex) {
// Report, but don't stop if ScriptUpdateMonitor fails.
console.error("WME RSA:", ex);
}
}
function processAlternativeSettings() {
if (rsaSettings.AlternativeShields) {
const alt_primary = $("#rsa-AlternativePrimaryCity");
alt_primary.prop("disabled", false);
const alt_nocity = $("#rsa-AlternativeNoCity");
alt_nocity.prop("disabled", false);
const primaryCityButton = alt_primary[0];
const noCityButton = alt_primary[0];
if (primaryCityButton.checked) {
alternativeType = primaryCityButton.value;
}
if (noCityButton.checked) {
alternativeType = noCityButton.value;
}
}
toggleAlternativeShields();
}
function getId(ele) {
return document.getElementById(ele);
}
function setChecked(ele, status) {
$(`#${ele}`).prop("checked", status);
}
function setValue(ele, value) {
const inputElem = $(`#${ele}`);
inputElem.attr("value", value);
// inputElem.css('border', `1px solid ${value}`);
}
function toggleAlternativeShields() {