forked from AudunVN/Navmap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathold.html
4310 lines (3821 loc) · 205 KB
/
old.html
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
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="cache-control" content="public">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta name="KEYWORDS" content="discovery navmap universe map freelancer game space error sirius">
<meta name="DESCRIPTION" content="An online version of Discovery Freelancer's in-game navigation map with quite a few extras.">
<link rel="icon" type="image/png" href="favicon.png">
<!--[if IE]><link href="favicon.ico" rel="shortcut icon" type="image/x-icon"><![endif]--><!-- Internet Exploder-->
<title>Discovery Navmap</title>
<script src="//code.jquery.com/jquery-1.11.3.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">
<script>
/* jquery cookie management methods */
!function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof exports?module.exports=e(require("jquery")):e(jQuery)}(function(e){function n(e){return u.raw?e:encodeURIComponent(e)}function o(e){return u.raw?e:decodeURIComponent(e)}function i(e){return n(u.json?JSON.stringify(e):String(e))}function t(e){0===e.indexOf('"')&&(e=e.slice(1,-1).replace(/\\"/g,'"').replace(/\\\\/g,"\\"));try{return e=decodeURIComponent(e.replace(c," ")),u.json?JSON.parse(e):e}catch(n){}}function r(n,o){var i=u.raw?n:t(n);return e.isFunction(o)?o(i):i}var c=/\+/g,u=e.cookie=function(t,c,s){if(arguments.length>1&&!e.isFunction(c)){if(s=e.extend({},u.defaults,s),"number"==typeof s.expires){var a=s.expires,d=s.expires=new Date;d.setMilliseconds(d.getMilliseconds()+864e5*a)}return document.cookie=[n(t),"=",i(c),s.expires?"; expires="+s.expires.toUTCString():"",s.path?"; path="+s.path:"",s.domain?"; domain="+s.domain:"",s.secure?"; secure":""].join("")}for(var f=t?void 0:{},p=document.cookie?document.cookie.split("; "):[],l=0,m=p.length;m>l;l++){var x=p[l].split("="),g=o(x.shift()),j=x.join("=");if(t===g){f=r(j,c);break}t||void 0===(j=r(j))||(f[g]=j)}return f};u.defaults={},e.removeCookie=function(n,o){return e.cookie(n,"",e.extend({},o,{expires:-1})),!e.cookie(n)}});
var dataRootPath = "data/v4950p8/";
var currentSystem;
var nameRegex = /nickname = (.*)/g;
var idsNameRegex = /ids_name = (.*)/g;
var idsSysNameRegex = /strid_name = (.*)/g;
var atmosphereRadiusRegex = /atmosphere_range = (.*)/g;
var sysNameRegex = /system = (.*)/g;
var idsInfoRegex = /ids_info = (.*)/g;
var scaleRegex = /navmapscale = (.*)/g;
var commentRegex = /[\n\r]+;+.*/g;
var currentSystemNickname = "Sirius";
var systemNameFile = dataRootPath+"special_systems.txt";
var initialWorldFile = dataRootPath+"initialworld.ini";
var commodityFile = dataRootPath+"select_equip.ini";
var systemPathFile = dataRootPath+"universe/systems_shortest_path.ini";
var systemLegalPathFile = dataRootPath+"universe/shortest_legal_path.ini";
var infocardFile = dataRootPath+"infocards.txt";
var universeFile = dataRootPath+"universe/universe.ini";
var infocardMapFile = dataRootPath+"infocardmap.ini";
var solarArchFile = dataRootPath+"solararch.ini";
var planetTextureRootPath = "textures/planets/";
var objectRegex = /(\n[^\r\n;]*\[[Oo]bject\])([^;\[]*(?=\n\w*|$))/g;
var archetypeIgnoreArray = [
"dsy_suprise_secret",
"suprise_ku_dragon_secret",
"suprise_dsy_gmg_vhf_secret",
"suprise_dsy_or_hf_secret",
"suprise_bw_elite2_secret",
"suprise_dsy_bayonet_secret",
"suprise_b_battleship_secret",
"invisible_base"
];
var baseIgnoreArray = [
"no_hidden_bases",
"no_hidden_bases"
];
var ignoreObjectRegex = new RegExp(
"nickname\\s*=\\s*(" + baseIgnoreArray.join("|") + ")" +
"|" +
"base\\s*=\\s*(" + baseIgnoreArray.join("_base|") + ")" +
"|" +
"archetype\\s*=\\s*(" + archetypeIgnoreArray.join("|") + ")", 'g'
);
var archetypeShowArray = [
"ithaca_station",
"junction_wreck",
"space_beamx_messina"
];
var showObjectRegex = new RegExp(
"archetype\\s*=\\s*(" + archetypeShowArray.join("|") + ")", 'g'
);
var zoneRegex = /(\n[^\r\n;]*\[[Zz]one\])([^;\[]*(?=\n\w*|$))/g;
var zoneNicknameRegex = /zone = ([^\r\n;]*)/g;
var asteroidsRegex = /(\[[Aa]steroids\])(\r\n.+)*/g;
var lootableZoneRegex = /(\n[^\r\n;]*\[[Ll]ootable[Zz]one\])([^;\[]*(?=\n\w*|$))/g;
var lootableZoneDynamicCommodityRegex = /dynamic_loot_commodity = (.*)/g;
var lootableZoneDynamicDifficultyRegex = /dynamic_loot_difficulty = (.*)/g;
var lootableZoneDynamicCountRegex = /dynamic_loot_count = (.*)/g;
var lootableZoneAsteroidCommodityRegex = /asteroid_loot_commodity = (.*)/g;
var lootableZoneAsteroidDifficultyRegex = /asteroid_loot_difficulty = (.*)/g;
var lootableZoneAsteroidCountRegex = /asteroid_loot_count = (.*)/g;
var activeAsteroidGetRequests = -1;
var groupRegex = /(\n[^\r\n;]*\[[Gg]roup\])([^;\[]*(?=\n\w*|$))/g;
var commodityRegex = /(\n[^\r\n;]*\[[Cc]ommodity\])([^;\[]*(?=\n\w*|$))/g
var ambientRegex = /(\n[^\r\n;]*\[[Aa]mbient\])([^;\[]*(?=\n\w*|$))/g;
var systemRegex = /(\n[^\r\n;]*\[[Ss]ystem\])([^;\[]*(?=\n\w*|$))/g;
var solarRegex = /(\n[^\r\n;]*\[[Ss]olar\])([^;\[]*(?=\n\w*|$))/g;
var baseRegex = /(\n[^\r\n;]*\[[Bb]ase\])([^;\[]*(?=\n\w*|$))/g;
var posRegex = /pos = (.*)/g;
var sizeRegex = /size = (.*)/g;
var repRegex = /reputation = (.*)/g;
var pathRegex = /Path = (.*)/g;
var gotoRegex = /[^\r\n;]*goto = ([^\r\n;]*)/g;
var burnColourRegex = /burn_color = (.*)/g;
var colourRegex = /color = (.*)/g
var archetypeRegex = /archetype = (.*)/g
var fogColourRegex = /property_fog_color = (.*)/g;
var infocardMapRegex = /[^;][Mm]ap *= *([^;\n\r]+)/g;
var zoneTypeRegex = /property_flags = (.*)/g;
var nameRegex = /nickname = ([^\r\n;]*)/g;
var solarRadiusRegex = /solar_radius = ([^\r\n;]*)/;
var solarTypeRegex = /type = ([^\r\n;]*)/;
var solarShapeRegex = /solar_shape = ([^\r\n;]*)/;
var textureRegex = /material_library = ([^\r\n;]*)/;
var textureFluffStringRegex = /material_library *= *solar\\planets\\/g;
var textureFileRegex = /(\\)([^;\\\r\n\.]*)(?=[\.\r\n])/;
var rotationRegex = /rotate = (.*)/g;
var textRegex = /(<(text|TEXT)>.+?<\/(text|TEXT)>|<(para|PARA)\/>)/g;
/* oorpArray contains systems which should be considered as OORP or otherwise inaccessible by the universe map. See also: */
var oorpArray = ["ew08","ew11","bw46","li08","ew14","ku08","hi05","st02","bw17","li14","ew17","ku16","hlp1","hlp2","bw11","ev03","ew05","hi03","ew45","ew18","ku17","ew85","hi22","ew12","rh11","rh12","rh10","li11","br17","br19","ew63","ga11","ga13","ga09","ga12","ga06","ga10","ga14","br10","iw09","li06","ca01","ev01","bw14", "bw13","st02c","st03b","hi19","hi08","hi08","ew37", "ku15", "li07","br22","br14","li10","bw21","bw58","li13","ev02","br09", "iw13", "ew19", "hi18"];
var systemScaleFactor = 1;
var searchTimedOut = "nope";
var universeFileGetResult;
var prevResponsiveState;
var prevResponsiveModeState;
var prevLabelMoveState;
var lastSearch;
var longSystemName;
var baseNameArray = {};
var systemNameArray = {};
var systemNameArrayState = "nope";
var systemClassArray = {};
var systemIdsNameArray = {};
var systemIdsNameArrayState = "nope";
var searchArray = {};
var matchArray = [];
var searchArrayState = "nope";
var systemPosArray = {};
var systemPosArrayState = "nope";
var systemInfoArray = {};
var systemScaleFactorArray = {};
var systemScaleFactorArrayState = "nope";
var infocardArray = {};
var infocardArrayState = "nope";
var infocardMapArray = {};
var infocardMapArrayState = "nope";
var baseSystemArray = {};
var baseSystemArrayState = "nope";
var factionNameArray = {};
var factionNameArrayState = "nope";
var commodityNameArray = {};
var commodityNameArrayState = "nope";
var connectionArray = {};
var connectionArrayState = "nope";
var solarArchArray = {};
var solarArchArrayState = "nope";
var jgConnectionArray = {};
var jgConnectionArrayState = "nope";
var systemConnectionState = "nope";
var universeMapState = "nope";
var sysLootableZoneArray = {};
var asteroidsURIArray = {};
/**
* Copyright 2009 by David Kerkeslager
* Released under the BSD License (http://davidkerkeslager.com/license.txt).
*
* This library defines an object-literal which allows one to store key/value pairs after the hash (#) in the URI.
* The syntax of the storage is modeled after the way that GET variables are stored after the question mark (?) in
* the URI.
*
* Example URI: "http://www.foo.com/index.html#foo=bar&baz=quux"
*
* Note: it should be obvious that this should not be used for storing private data of any kind.
*/
var URIHash =
{
/**
* Dump the contents of the URI hash into an associative array. If the hash is invalid, the method returns
* undefined.
*/
dump : function()
{
var hash = document.location.hash;
var dump = new Array();
if(hash.length == 0) return dump;
hash = hash.substring(1).split('&');
for(var key in hash)
{
var pair = hash[key].split('=');
if(pair.length != 2 || pair[0] in dump)
return undefined;
// escape for storage
dump[unescape(pair[0])] = unescape(pair[1]);
}
return dump;
},
/**
* Takes an associative array and stores it in the URI as a hash after the # prefix, replacing any pre-
* existing hash.
*/
load : function(array)
{
var first = true;
var hash = '';
for(var key in array)
{
if(!first) hash += '&';
hash += escape(key) + '=' + escape(array[key]);
}
document.location.hash = hash;
},
/**
* Get the value of a key from the hash. If the hash does not contain the key or the hash is invalid,
* the function returns undefined.
*/
get : function(key)
{
return this.dump()[key];
},
/**
* Set the value of a key in the hash. If the key does not exist, the key/value pair is added.
*/
set : function(key,value)
{
var dump = this.dump();
dump[key] = value;
var hash = new Array();
for(var key in dump)
hash.push(escape(key) + '=' + escape(dump[key]));
document.location.hash = hash.join('&');
}
}
var clickHandlersEnabled = true;
/* zoneFlagArray is a special lookup array that sets zone classes depending on their zoneFlag attribute. */
var zoneFlagArray = {
0: "zoneHidden",
64: "zoneRockAsteroids",
65: "zoneAlphaBigDust",
66: "zoneRock",
74: "zoneLeedsUraniumAsteroids",
82: "zoneDublinGoldField",
128: "zoneJerseyDebris",
129: "zoneDetroitDebrisNormal",
130: "zoneDetroitDebrisHigh",
132: "zoneDetroitDebrisLow",
256: "zoneIceAsteroidsSmall",
257: "zoneIceAsteroidsTau37",
258: "zoneIceAsteroids1",
512: "zoneLavaRocks",
513: "zoneVonRoheBeltLavaRocks",
514: "zoneDresdenLavaRocks",
1024: "zoneGreenAsteroids",
1026: "zoneZetaGreenAsteroids",
2049: "zoneIceAsteroids2",
4096: "zoneMinefield1",
4128: "zoneMinefield2",
8192: "zoneAsteroidField",
8200: "zoneAsteroids",
16400: "zoneIceNebula",
32768: "zoneDresdenFog",
32776: "zoneLeedsSmog",
32833: "zoneChugokuCloud",
62768: "zoneNebulaWithFogColour",
65536: "zoneExclusion1",
131072: "zoneExclusion2",
196608: "zoneExclusion3"
};
function updateCookie(){
/* checks for and stores config changes between sessions */
var elementValues = {};
$(":checkbox").each(function(){
elementValues[this.id] = this.checked;
});
elementValues["buttonText"] = $("button").text();
$.cookie('elementValues', elementValues, { expires: 7, path: '/' })
}
function repopulateFormElements(){
/* readds config changes if there are any stored ones when the page loads */
var elementValues = $.cookie('elementValues');
if (elementValues){
Object.keys(elementValues).forEach(function(element) {
var checked = elementValues[element];
$("#" + element).prop('checked', checked);
});
$("button").text(elementValues["buttonText"]);
}
}
$(document).ready(function () {
$(":checkbox").on("change", function(){
updateCookie();
updateConfigClasses();
});
$("#configButton").click(function(event) {
toggleConfigMenu();
event.stopPropagation();
});
$("#screenshotButton").click(function(event) {
$("body").toggleClass("screenshotMode");
});
$.cookie.json = true;
repopulateFormElements();
/* initialise rising/falling edge detector */
prevResponsiveState = "init";
prevResponsiveModeState = "init";
prevLabelMoveState = "init";
updateConfigClasses();
});
function toggleConfigMenu () {
/* Toggles the config menu and closes it if the user clicks outside the menu. */
$(".configMenu").toggleClass("closed");
if (document.querySelector(".configMenu").className.indexOf("closed") == -1) {
$('html').click(function() {
$(".configMenu").addClass("closed");
});
$(".configMenu").click(function(event){
event.stopPropagation();
});
} else {
$("html").unbind("click");
$(".configMenu").unbind("click");
}
}
function updateConfigClasses() {
/* Runs when the map script determines that there has been a change in configuration -
such as an option being changed in the config menu - which requires further action. */
if (document.querySelector(".configOption#wrecks input").checked) {
$(".object.wreck").removeClass("hidden");
$(".map .object.wreck label").hAlign();
} else {
$(".object.wreck").addClass("hidden");
}
if (document.querySelector(".configOption#onlyShowLatestPosition input").checked) {
$(".map").removeClass("showOldPlayerShipPositions");
} else {
$(".map").addClass("showOldPlayerShipPositions");
}
if (document.querySelector(".configOption#showInternalNicknames input").checked) {
$(".map").addClass("showInternalNicknames");
} else {
$(".map").removeClass("showInternalNicknames");
}
if (document.querySelector(".configOption#wreckLabels input").checked) {
$(".object.wreck label").removeClass("hidden");
$(".map .object.wreck label").hAlign();
} else {
$(".object.wreck label").addClass("hidden");
}
if (document.querySelector(".configOption#responsive input").checked) {
if (document.querySelector(".configOption#responsiveMode input").checked && (prevResponsiveModeState == "unchecked" || prevResponsiveModeState == "init")) {
$(".systemConnection").remove();
$("body").addClass("scaleWidth");
$("body").removeClass("scaleHeight");
prevResponsiveModeState = "checked";
generateSystemConnections();
} else if (!document.querySelector(".configOption#responsiveMode input").checked && (prevResponsiveModeState == "checked" || prevResponsiveModeState == "init")) {
$(".systemConnection").remove();
$("body").addClass("scaleHeight");
$("body").removeClass("scaleWidth");
prevResponsiveModeState = "unchecked";
generateSystemConnections();
}
}
if (document.querySelector(".configOption#responsive input").checked && (prevResponsiveState == "unchecked" || prevResponsiveState == "init")) {
$(".systemConnection").remove();
$("body").addClass("responsive");
prevResponsiveState = "checked";
generateSystemConnections();
} else if (!document.querySelector(".configOption#responsive input").checked && (prevResponsiveState == "checked" || prevResponsiveState == "init")) {
$(".systemConnection").remove();
$("body").removeClass("responsive");
prevResponsiveState = "unchecked";
generateSystemConnections();
}
if (document.querySelector(".configOption#labelMove input").checked && (prevLabelMoveState == "unchecked" || prevLabelMoveState == "init")) {
prevLabelMoveState = "checked";
if (document.querySelector(".map .system") == null && currentSystemNickname != "Sirius") {
objectTerritorialConflictResolver($(".map label:visible"));
}
} else if (!document.querySelector(".configOption#labelMove input").checked && (prevLabelMoveState == "checked" || prevLabelMoveState == "init")) {
prevLabelMoveState = "unchecked";
}
if (document.querySelector(".configOption#zoneLabels input").checked) {
$(".zone label").not($(".mineable label")).removeClass("hidden");
$(".map .zone label").hAlign();
} else {
$(".zone label").not($(".mineable label")).addClass("hidden");
}
if (document.querySelector(".configOption#zones input").checked) {
$(".zone").removeClass("hidden");
$(".map .zone label").hAlign();
} else {
$(".zone").addClass("hidden");
}
if (document.querySelector(".configOption#connections input").checked
&& document.querySelector(".systemConnectionProp") == null) {
generateSystemConnections();
if (document.querySelector(".map .system") == null) {
$(".systemConnectionProp").hide();
}
} else if (!(document.querySelector(".configOption#connections input").checked)) {
$(".systemConnectionProp").hide();
} else if (document.querySelector(".configOption#connections input").checked
&& document.querySelector(".map .system") !== null) {
$(".systemConnectionProp").show();
}
if (document.querySelector(".configOption#oorp input").checked) {
$(".oorp").removeClass("hidden");
$(".map .system.oorp label").hAlign();
} else {
$(".oorp").addClass("hidden");
}
generateSystemScale(currentSystem);
if (document.querySelector(".map .system") == null) {
$(".systemConnectionProp").hide();
}
if (document.querySelector(".configOption#universeLabels input").checked
&& document.querySelector(".map .system") !== null) {
$(".map div label").removeClass("labelDisabled");
$(".map .system label").hAlign();
} else if (document.querySelector(".map .system") !== null) {
$(".map div label").addClass("labelDisabled");
}
if (document.querySelector(".configOption#systemLabels input").checked
&& document.querySelector(".map .system") == null) {
$(".map div label").removeClass("labelDisabled");
$(".map div label").hAlign();
} else if (document.querySelector(".map .system") == null) {
$(".map div label").addClass("labelDisabled");
}
if (document.querySelector(".configOption#showAllObjects input").checked
&& document.querySelector(".map .system") == null) {
$(".map").addClass("showAllObjects");
$(".map div label").hAlign();
} else if (document.querySelector(".map .system") == null) {
$(".map").removeClass("showAllObjects");
}
if (document.querySelector(".configOption#showAllObjectLabels input").checked
&& document.querySelector(".map .system") == null) {
$(".map").addClass("showAllObjectLabels");
$(".map div label").hAlign();
} else if (document.querySelector(".map .system") == null) {
$(".map").removeClass("showAllObjectLabels");
}
if (document.querySelector(".configOption#showInfocardedObjectLabels input").checked
&& document.querySelector(".map .system") == null) {
$(".map").addClass("showInfocardedObjectLabels");
$(".map div label").hAlign();
} else if (document.querySelector(".map .system") == null) {
$(".map").removeClass("showInfocardedObjectLabels");
}
generateTooltips();
console.log("Config classes updated");
}
function generateSystemScale(system) {
if (document.querySelector(".mapScale") != null) {
currentSystem = system;
if (document.querySelector(".configOption#scale input").checked) {
$(".mapScale").addClass("arrows");
baseSize = 30;
} else {
$(".mapScale").removeClass("arrows");
baseSize = 27.5;
}
if (typeof systemScaleFactorArray[system.toLowerCase()] === "undefined") {
document.querySelector(".mapScale h2").innerHTML = baseSize+"k";
} else {
document.querySelector(".mapScale h2").innerHTML = (Math.round(baseSize/systemScaleFactorArray[system.toLowerCase()]*10) / 10)+"K";
}
}
}
function generateLookupArrays() {
/* contains all the AJAX .get requests responsible for generating the lookup arrays. */
/* there is no case where caching would cause issues: the content for each mod directory is static. */
$.ajaxSetup({
cache: true
});
/* systemNameArray and systemClassArray reference internal nicknames to system names and classes (i.e. houses). */
/* systemClassArray and systemNameFile are a bit special, as systemNameFile is not automagically generated;
there is no resource to do so, so these are set in special_systems.txt in the current data directory. */
$.get(systemNameFile, function(data) {
var nameArray = data.split("\n");
for (i = 0; i < nameArray.length; i++) {
var keyPairArray = nameArray[i].split(" = ");
systemNameArray[keyPairArray[0].toLowerCase()] = keyPairArray[1];
systemClassArray[keyPairArray[0].toLowerCase()] = keyPairArray[1].toString().slice(0,2).toLowerCase();
}
systemNameArrayState = "ready";
console.log("System nickname lookup array generated");
});
/* commodityNameArray references internal nicknames to commodity names. */
$.get(commodityFile, function(data) {
commodityFileGetResult = data.replace(commentRegex,"");
var commodityArray = commodityFileGetResult.match(commodityRegex);
for (i = 0; i < commodityArray.length; i++) {
if (commodityArray[i].toLowerCase().indexOf("nickname =") != -1 && commodityArray[i].toLowerCase().indexOf("ids_name =") != -1) {
var idsNameString = commodityArray[i].toLowerCase().match(idsNameRegex).join().substring(11);
var nameString = commodityArray[i].toLowerCase().match(nameRegex).join().substring(11);
commodityNameArray[nameString.toLowerCase()] = idsNameString;
}
}
console.log("Commodity nickname lookup array generated");
});
/* factionNameArray references internal nicknames to faction name infocards. */
$.get(initialWorldFile, function(data) {
intialWorldFileGetResult = data.replace(commentRegex,"");
var groupArray = intialWorldFileGetResult.match(groupRegex);
for (i = 0; i < groupArray.length; i++) {
if (groupArray[i].toLowerCase().indexOf("nickname =") != -1 && groupArray[i].toLowerCase().indexOf("ids_name =") != -1) {
var idsNameString = groupArray[i].toLowerCase().match(idsNameRegex).join().substring(11);
var nameString = groupArray[i].toLowerCase().match(nameRegex).join().substring(11);
factionNameArray[nameString.toLowerCase()] = idsNameString;
}
}
console.log("Faction nickname lookup array generated");
});
/* infocardMapArray lists any extra infocards associated with each infocard. */
/* This is used for base and planet descriptions, which occasionally use another infocard for
block text in addition to the main infocard with "technical data" or similar content. */
$.get(infocardMapFile, function(data) {
var mapArray = data.replace(commentRegex,"").match(infocardMapRegex);
for (i = 0; i < mapArray.length; i++) {
var lookupString = mapArray[i].split("=");
var keyPairArray = lookupString[1].replace(/ /g,"").split(",");
infocardMapArray[keyPairArray[0].toLowerCase()] = keyPairArray[1];
}
console.log("Infocard map lookup array generated");
});
/* infocardMapArray references infocard IDS numbers to infocards. */
$.get(infocardFile, function(data) {
var rawInfocardArray = data.replace(/\r/g,"").split("\n");
for (i = 0; i < rawInfocardArray.length-1; i += 2) {
infocardArray[rawInfocardArray[i].toString()] = rawInfocardArray[i+1].toString();
}
infocardArrayState = "ready";
console.log("Infocard lookup array generated");
});
/* systemPathArray lists systems connected to the input system (by jump gate or jump hole). */
$.get(systemPathFile, function(data) {
var rawPathFileArray = data.replace(/\r/g,"").split("\n");
for (i = 0; i < rawPathFileArray.length; i++) {
if (rawPathFileArray[i].indexOf("Path =") != -1) {
var currentConnection = rawPathFileArray[i].match(pathRegex).join().substring(7).replace(/ /g,"").split(",");
if (typeof currentConnection[3] !== "undefined") {
var lowCurrentConnection = currentConnection[0].trim().toLowerCase();
if (typeof connectionArray[lowCurrentConnection] == "undefined") {
connectionArray[lowCurrentConnection] = [currentConnection[3].trim().toLowerCase()];
}
if (connectionArray[lowCurrentConnection].indexOf(currentConnection[3].trim().toLowerCase()) == -1) {
connectionArray[lowCurrentConnection].push(currentConnection[3].trim().toLowerCase());
}
}
}
}
connectionArrayState = "ready";
console.log("Connection lookup array generated");
});
/* jgConnectionArray lists systems connected to the input system (by jump gate only). */
$.get(systemLegalPathFile, function(data) {
var rawLegalPathFileArray = data.replace(/\r/g,"").split("\n");
for (i = 0; i < rawLegalPathFileArray.length; i++) {
if (rawLegalPathFileArray[i].indexOf("Path =") != -1) {
var currentConnection = rawLegalPathFileArray[i].match(pathRegex).join().substring(7).replace(/ /g,"").split(",");
if (typeof currentConnection[3] !== "undefined") {
var lowCurrentConnection = currentConnection[0].trim().toLowerCase();
if (typeof jgConnectionArray[lowCurrentConnection] == "undefined") {
jgConnectionArray[lowCurrentConnection] = [currentConnection[3].trim().toLowerCase()];
}
if (jgConnectionArray[lowCurrentConnection].indexOf(currentConnection[3].trim().toLowerCase()) == -1) {
jgConnectionArray[lowCurrentConnection].push(currentConnection[3].trim().toLowerCase());
}
}
}
}
jgConnectionArrayState = "ready";
console.log("Jumpgate connection lookup array generated");
});
/* solarArchArray maps object solarArch attributes to object textures. */
/* This is a fun one! It's only used for planets so far,
and is used for applying whichever texture 01.jpg happens to be to the planet in question.
01.jpg is the result of a bulk rename option run on the exported textures, as there is no
lookup array to the correct name of the texture inside each .utf file - they are originally
relatively randomly named, so bulk renaming is just a somewhat cheap solution to ensure that
the script finds at least one of the textures in the relevant folder. The drawback of this is
that it is random whether it finds the up/down/left/right/bottom/top face of the planet texture,
but it's not really a noticeable problem nor one that's fixable easily. */
$.get(solarArchFile, function(data) {
var solarArray = data.replace(commentRegex,"").match(solarRegex);
for (i = 0; i < solarArray.length; i++) {
if (solarArray[i].toLowerCase().match(nameRegex)) {
var nicknameString = solarArray[i].toLowerCase().match(nameRegex).join().substring(11);
var solarArchObject = {};
if (solarArray[i].toLowerCase().match(textureRegex) && solarArray[i].toLowerCase().match(nameRegex).join().indexOf("planet_") != -1) {
var textureFileString = solarArray[i].toLowerCase().match(textureRegex)[0].replace(textureFluffStringRegex,"");
solarArchObject.texturePath = planetTextureRootPath + textureFileString + "/01.jpg";
}
if (solarArray[i].toLowerCase().match(solarTypeRegex)) {
solarArchObject.type = solarArray[i].toLowerCase().match(solarTypeRegex)[1];
}
if (solarArray[i].toLowerCase().match(solarRadiusRegex)) {
solarArchObject.radius = solarArray[i].toLowerCase().match(solarRadiusRegex)[1];
}
if (solarArray[i].toLowerCase().match(solarShapeRegex)) {
solarArchObject.shape = solarArray[i].toLowerCase().match(solarShapeRegex)[1];
}
solarArchArray[nicknameString.toLowerCase()] = solarArchObject;
}
}
solarArchArrayState = "ready";
console.log("Solar Archetype lookup array generated");
});
/* systemIdsNameArray maps system nicknames to IDS infocard numbers for their in-game names. */
/* systemPosArray maps system nicknames to their positions on the in-game universe map.
Please note that some of these are overidden manually by using CSS or by replacing
their positions in systemPosArray after generation, as seen with system ev01 below. */
/* systemScaleFactorArray maps system nicknames to their respective system navmap scale factors. */
$.get(universeFile, function(data) {
universeFileGetResult = data.replace(commentRegex,"");
var universeArray = universeFileGetResult.match(systemRegex);
for (i = 0; i < universeArray.length; i++) {
if (universeArray[i].toLowerCase().indexOf("strid_name =") != -1) {
var sysNameIds = universeArray[i].toLowerCase().match(idsSysNameRegex).join().substring(13);
var nameString = universeArray[i].toLowerCase().match(nameRegex).join().substring(11);
systemIdsNameArray[nameString.toLowerCase()] = sysNameIds;
}
if (universeArray[i].toLowerCase().indexOf("pos =") != -1) {
var sysPos = universeArray[i].toLowerCase().match(posRegex).join().substring(6).replace(/ /g,"").split(",");
var nameString = universeArray[i].toLowerCase().match(nameRegex).join().substring(11);
systemPosArray[nameString.toLowerCase()] = sysPos;
}
if (universeArray[i].toLowerCase().indexOf("navmapscale") != -1) {
var scaleFactor = universeArray[i].toLowerCase().match(scaleRegex).join().substring(14);
var nameString = universeArray[i].toLowerCase().match(nameRegex).join().substring(11);
systemScaleFactorArray[nameString.toLowerCase()] = parseFloat(scaleFactor);
}
}
/* manually moved systems, usually oorp/removed ones */
/* 0,0 in upper left corner, first coordinate is x and second is y */
systemPosArray["li09"] = [7,9.25];
systemIdsNameArrayState = "ready";
systemScaleFactorArrayState = "ready";
systemPosArrayState = "ready";
console.log("System scale lookup array generated");
console.log("Universe map position lookup array generated");
console.log("System name infocard number lookup array generated");
});
generateSearchArray();
}
function generateSearchArray() {
/* generates the search lookup array used for the search box and map links. */
if (infocardArrayState != "ready" || systemIdsNameArrayState != "ready") {
setTimeout(function(){generateSearchArray()},10);
} else {
/* add system names to search array */
for (systemNickname in systemIdsNameArray) {
if (systemNickname.toLowerCase().indexOf("sector") == -1 && typeof infocardArray[systemIdsNameArray[systemNickname]] !== "undefined") {
matchArray.push(infocardArray[systemIdsNameArray[systemNickname]]);
searchArray[infocardArray[systemIdsNameArray[systemNickname]]] = systemNickname;
searchArray[infocardArray[systemIdsNameArray[systemNickname]].toLowerCase()] = systemNickname;
}
}
/* add base names to search array */
var universeBaseArray = universeFileGetResult.match(baseRegex);
for (i = 0; i < universeBaseArray.length; i++) {
if (universeBaseArray[i].toLowerCase().indexOf("proxy_base") == -1
&& universeBaseArray[i].toLowerCase().indexOf("miners") == -1
&& universeBaseArray[i].toLowerCase().indexOf("system =") != -1
&& universeBaseArray[i].toLowerCase().indexOf("strid_name") != -1
&& !universeBaseArray[i].toLowerCase().match(ignoreObjectRegex)) {
var baseName = infocardArray[universeBaseArray[i].toLowerCase().match(idsSysNameRegex).join().substring(13)];
var systemNickname = universeBaseArray[i].toLowerCase().match(sysNameRegex).join().substring(9);
if (typeof baseName !== "undefined" && typeof systemNickname !== "undefined") {
baseSystemArray[baseName.toLowerCase()] = systemNickname.toLowerCase();
matchArray.push(baseName);
searchArray[baseName] = systemNickname;
searchArray[baseName.toLowerCase()] = systemNickname;
} else {
console.log(universeBaseArray[i] + "Found a base without a defined system and base name with infocardNumber: "+universeBaseArray[i].toLowerCase().match(idsSysNameRegex).join().substring(13) + " and systemNick "+ systemNickname);
}
}
}
searchArray["Omicron Major"] = "st03";
searchArray["omicron major"] = "st03";
/* temp. manual fixes for duplicate stations */
searchArray["Livadia Shipyard"] = "ew06";
searchArray["livadia shipyard"] = "ew06";
searchArray["Freeport 15"] = "rh09";
searchArray["freeport 15"] = "rh09";
searchArray["Battleship Amenta"] = "ew02";
searchArray["battleship amenta"] = "ew02";
searchArrayState = "ready";
console.log("Base system lookup array generated");
baseSystemArrayState = "ready";
console.log("Search array generated");
}
}
function parseInfocard(infocard) {
/* Parses an MSXML infocard into displayable HTML. */
/* Note: This currently ignores all formatting, and requires a rework. */
console.log(infocard);
if (infocard.toLowerCase().indexOf("<text>") == -1) {
return infocard;
} else {
return infocard.toString().match(textRegex).map(function (textElement) {
if (textElement.toLowerCase().indexOf("<para") != -1) {
return "<br class='infocardBreak'>";
} else {
return "<span class='infocardText'>"+textElement.slice(6,-7)+"</span>";
}
}).join("");
}
}
function closeModal() {
/* Used on the up/close button for the infocard container. */
updateFragment("q",longSystemName);
/*history.replaceState(longSystemName, "Discovery Navmap for "+longSystemName, "#"+encodeURI(longSystemName));*/
$(".infocardContainer").remodal().close();
}
function showObjectInfo(idsNameNumber, idsInfoNumber, classString, zPosition, factionNickname, systemNickname, dynamicCommodity, dynamicDifficulty, dynamicCount, nickname) {
/* Used to generate content for the infocard container when an object or zone is clicked. */
$(".highlighter").remove();
if (typeof searchArray[infocardArray[idsNameNumber]] !== "undefined"
&& searchArray[infocardArray[idsNameNumber]].toLowerCase() == currentSystemNickname.toLowerCase()) {
updateFragment("q",infocardArray[idsNameNumber]);
/*history.replaceState(longSystemName, "Discovery Navmap for "+longSystemName, "#"+encodeURI(infocardArray[idsNameNumber]));*/
} else {
updateFragment("q",longSystemName);
/*history.replaceState(longSystemName, "Discovery Navmap for "+longSystemName, "#"+encodeURI(longSystemName));*/
}
if (clickHandlersEnabled) {
var scaleFactor = 1;
if (typeof systemScaleFactorArray[systemNickname] !== "undefined") {
scaleFactor = parseFloat(systemScaleFactorArray[systemNickname]);
}
var planePosition;
if (zPosition == 0) {
planePosition = "on";
} else if (zPosition > 0) {
planePosition = (Math.round(parseFloat(zPosition)/(scaleFactor*1000)*10) / 10)+"K above";
} else if (zPosition < 0) {
planePosition = (Math.round(parseFloat(zPosition)/(scaleFactor*1000)*-10) / 10)+"K below";
} else {
// :)))
planePosition = "non-standard in relation to";
}
if (typeof factionNickname !== "undefined") {
var ownerString = " It belongs to "+infocardArray[factionNameArray[factionNickname]]+".";
} else {
var ownerString = "";
}
var infoString = "";
var miningString = "";
var scrollUpString = "<div class='scrollUpButton' onclick='closeModal()'><i class='fa fa-times'></i><p>Close</p></div>";
if (typeof dynamicCommodity !== "undefined") {
if (dynamicCount.indexOf("1, 1") == -1) {
amountString = dynamicCount.replace(/\s/g, '').split(",").join(" to ")+" units";
} else {
amountString = "one unit";
}
var commodityName = dynamicCommodity;
var commodityArrayName = infocardArray[commodityNameArray[dynamicCommodity.toLowerCase()]];
if (typeof commodityArrayName !== "undefined") {
commodityName = commodityArrayName;
}
miningString = "<p>This zone drops "+amountString+" of the commodity "+commodityName+" when mined using <a id='miningLink' href='https://discoverygc.com/forums/showthread.php?tid=155629' target='_BLANK'>appropriate equipment</a>.</p>";
}
if (typeof idsInfoNumber !== "undefined") {
if (typeof infocardMapArray[(parseInt(idsInfoNumber)).toString()] !== "undefined" && typeof infocardArray[infocardMapArray[(parseInt(idsInfoNumber)).toString()]] !== "undefined") {
var infocardURI = encodeURI(infocardArray[infocardMapArray[(parseInt(idsInfoNumber)).toString()]]);
document.querySelector(".infocardContainer").innerHTML = "<h2>"+infocardArray[idsNameNumber]+"</h2>"+parseInfocard(infocardArray[idsInfoNumber])+parseInfocard(infocardArray[infocardMapArray[(parseInt(idsInfoNumber)).toString()]])+"<h3>Technical info</h3>"+miningString+"<p class='technicalInfo'>This object with internal nickname "+nickname+" is located "+planePosition+" the plane, and has name infocard number "+idsNameNumber+", infocard number "+idsInfoNumber+" and base description infocard number "+(parseInt(idsInfoNumber)+1).toString()+"."+ownerString+" "+"<a class='editLink' target='_blank'><i class='fa fa-pencil-square-o'></i></a></p>"+scrollUpString;
document.querySelector(".editLink").href = "https://docs.google.com/forms/d/1bIYtQCx0lLgguEF6xWDm0RRFr0IIz-tM1Toh6SyB9wA/viewform?entry.515729986="+(parseInt(idsInfoNumber)+1).toString()+"&entry.628548621="+infocardURI+"&entry.899322418="+infocardURI;
} else {
var infocardURI = encodeURI(infocardArray[idsInfoNumber]);
document.querySelector(".infocardContainer").innerHTML = "<h2>"+infocardArray[idsNameNumber]+"</h2>"+parseInfocard(infocardArray[idsInfoNumber])+"<h3>Technical info</h3>"+miningString+"<p class='technicalInfo'>This object with internal nickname "+nickname+" is located "+planePosition+" the plane, and has name infocard number "+idsNameNumber+" and infocard number "+idsInfoNumber+"."+ownerString+" "+"<a class='editLink' target='_blank'><i class='fa fa-pencil-square-o'></i></a></p>"+scrollUpString;
document.querySelector(".editLink").href = "https://docs.google.com/forms/d/1bIYtQCx0lLgguEF6xWDm0RRFr0IIz-tM1Toh6SyB9wA/viewform?entry.515729986="+idsInfoNumber+"&entry.628548621="+infocardURI+"&entry.899322418="+infocardURI;
}
} else if (typeof dynamicCommodity !== "undefined") {
document.querySelector(".infocardContainer").innerHTML = miningString+scrollUpString;
}
console.log("Infocard "+idsInfoNumber+" for "+infocardArray[idsNameNumber]+" fetched");
$(".remodal.infocardContainer").remodal().open();
}
}
function findObjectName(internalNickname, classString) {
/* Attempts to return an object name based on internal nickname if one cannot be determined by IDS number. */
if (typeof classString !== "undefined" && typeof internalNickname !== "undefined" && classString.indexOf("jump") != -1) {
if (classString.indexOf("hole") != -1) {
var jumpSystems = internalNickname.slice(0,-5).split("_to_");
/*return systemNameArray[jumpSystems[0].toLowerCase()] + " > " + systemNameArray[jumpSystems[1].toLowerCase()] + " Jump Hole";*/
return "Jump Hole";
} else {
var jumpSystems = internalNickname.split("_to_");
/* return systemNameArray[jumpSystems[0].toLowerCase()] + " > " + systemNameArray[jumpSystems[1].toLowerCase()] + " Jump Gate"; */
return "Jump Gate";
}
}
return internalNickname + " (int)";
}
function createLoadAnimation() {
/* Adds the loading overlay. Used on page state transitions and the first load. */
if (document.querySelector(".loadingOverlay") == null) {
$('html, body').animate({ scrollTop: 0 }, 300);
var loader = document.createElement("div");
loader.innerHTML = "<div class='loadTextContainer'><h2 class='loaderTitle'>Loading...</h2><div class='loader'></div></div>";
loader.className = "loadingOverlay";
document.querySelector("body").appendChild(loader);
}
}
$.extend($.expr[":"], {
/* case-insensitive contains filter */
"containsNC": function(elem, i, match, array) {
return (elem.textContent || elem.innerText || "").toLowerCase().indexOf((match[3] || "").toLowerCase()) >= 0;
}
});
function createHighlightAnimation(element) {
/* Adds and sets the animation used to highlight search results or linking to objects. */
$(".highlighter").remove();
console.log("Attempted to create highlight for "+element);
if ($(element).length) {
var highlight = document.createElement("div");
highlight.className = "highlighter";
element.append(highlight);
$('html, body').animate({
scrollTop: $(".highlighter").offset().top-$(window).height()/2,
scrollLeft: $(".highlighter").offset().left-$(window).width()/2
}, 1000);
$(".highlighter").mouseover(function() {
$(".highlighter").remove();
});
}
}
function generateUniverseMap() {
/* Generates the... Well, you get the idea. The rest of the code might be worse. */
createLoadAnimation();
document.querySelector(".navContainer #showUniverseMap").style.display = "none";
$(".grid").children().hide();
document.querySelector(".mapLegend").style.display = "block";
document.querySelector(".navContainer #helpLink").style.display = "block";
document.querySelector("#navSystemTitle").style.display = "none";
if (currentSystemNickname != "Sirius") {
updateFragment("q","");
/*history.replaceState("Sirius", "Discovery Navmap", ".");*/
}
/* checks to see if the map needs generate system connections or not. */
if (document.querySelector(".configOption#connections input").checked) {
if (systemConnectionState = "ready") {
var systemConnectionsEvaluated = true;
} else {
var systemConnectionsEvaluated = false;
}
} else {
var systemConnectionsEvaluated = true;
}
if (infocardArrayState != "ready" || systemScaleFactorArrayState != "ready" || searchArrayState != "ready" || systemConnectionsEvaluated != true || systemNameArrayState != "ready") {
setTimeout(function(){generateUniverseMap()},10);
} else {
if (document.querySelector(".configOption#connections input").checked) {
$(".systemConnectionProp").show();
}
document.querySelector(".loaderTitle").innerHTML = "Generating map...";
document.querySelector("#searchField").value = "";
currentSystemNickname = "Sirius";
document.querySelector(".grid").style.background = "url('images/SiriusMap.jpg') black"
document.querySelector(".grid").style.backgroundSize = "cover !important"
/* empty the map div before doing anything else */
$(".map").children().not(".systemConnectionProp").remove();
while (document.querySelector(".infocardContainer").firstChild) {
document.querySelector(".infocardContainer").removeChild(document.querySelector(".infocardContainer").firstChild);
}
$(".remodal.infocardContainer").remodal().close();
if (document.querySelector(".systemTitle") == null) {
var systemTitle = document.createElement("h2");
document.querySelector(".grid").appendChild(systemTitle);
} else {
var systemTitle = document.querySelector(".systemTitle");
$(".systemTitle").show();
}
if (document.querySelector(".darkOverlay") == null) {
var darkOverlay = document.createElement("div");
darkOverlay.className = "darkOverlay";
document.querySelector(".grid").appendChild(darkOverlay);
}
if (document.querySelector(".mapScale") != null) {
document.querySelector(".grid").removeChild(document.querySelector(".mapScale"));
}
systemTitle.innerHTML = "Sirius";
systemTitle.className = "systemTitle";
/* add all systems to the map */
for (var systemName in systemPosArray) {
if (systemPosArray.hasOwnProperty(systemName)) {
if (typeof systemIdsNameArray[systemName] !== "undefined" && systemName.toLowerCase().indexOf("sector") == -1) {
var system = document.createElement("div");
system.dataset.systemNickname = systemName;
system.className = "system " + systemClassArray[systemName.toLowerCase()];
var systemLabel = document.createElement("label");
systemLabel.innerHTML = infocardArray[systemIdsNameArray[systemName.toLowerCase()]];
system.appendChild(systemLabel);
if (oorpArray.indexOf(systemName) != -1) {
system.className += " oorp";
}
system.style.top = parseFloat(systemPosArray[systemName][1])*6.6-50 + "%";
system.style.left = parseFloat(systemPosArray[systemName][0])*6.6-50 + "%";
system.style.position = "absolute";
document.querySelector(".map").appendChild(system);
system.addEventListener("click", function() {
generateMap(this.dataset.systemNickname);
});
}
}
}
console.log("Universe map generated");
updateConfigClasses();
$(".map div label").hAlign();
document.querySelector("body").removeChild(document.querySelector(".loadingOverlay"));
universeMapState = "ready";
/* check for search field input once we're done generating the map, just in case we missed anything. */
$("#searchField").keyup();
}
}
function generateSystemConnections() {
if (document.querySelector(".systemConnectionProp") == null && document.querySelector(".configOption#connections input").checked) {
if (systemPosArrayState != "ready" || connectionArrayState != "ready" || jgConnectionArrayState != "ready") {
setTimeout(function(){generateSystemConnections()},10);
} else {
for (var system in connectionArray) {
if (connectionArray.hasOwnProperty(system)) {
for (i = 0; i < connectionArray[system].length; i++) {
if (typeof systemPosArray[system] !== "undefined"
&& typeof systemPosArray[connectionArray[system][i]] !== "undefined") {
if (document.querySelector("[data-connected-points~="+connectionArray[system][i]+"]"+"[data-connected-points~="+system+"]") == null) {
x1 = parseFloat(systemPosArray[system][1])*6.6-50;
x2 = parseFloat(systemPosArray[connectionArray[system][i]][1])*6.6-50;
y1 = parseFloat(systemPosArray[system][0])*6.6-50;
y2 = parseFloat(systemPosArray[connectionArray[system][i]][0])*6.6-50;
var propClass = "systemConnectionProp";