-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpagecontroller.js
3731 lines (3608 loc) · 114 KB
/
pagecontroller.js
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
// Copyright 2018-2019 Campbell Crowley. All rights reserved.
// Author: Campbell Crowley (web@campbellcrowley.com)
/**
* The base class for all TraX related things.
* @class TraX
*/
(function(TraX, undefined) {
/**
* Prevent navigating away from page if not all data was sent saved.
* @return {?string}
*/
window.onbeforeunload = function() {
if (!isPaused) {
return 'You are still recording data, are you sure you wish to leave?';
}
if (sendBuffer.length > 0) {
return 'Not all data has been sent to the server, ' +
'are you sure you wish to leave?';
}
return null;
};
// Constants //
/**
* Milliseconds to retry sending missed chunks.
* @default
* @constant
* @private
* @type {number}
*/
const successTimeout = 10000;
/**
* Milliseconds to check for stale data.
* @default
* @constant
* @private
* @type {number}
*/
const staleDataFlushFrequency = 100;
/**
* Milliseconds to check filesize on server.
* @default
* @constant
* @private
* @type {number}
*/
const filesizeCheckFrequency = 10000;
/**
* Milliseconds to update HUD.
* @default
* @constant
* @private
* @type {number}
*/
const realtimeClockUpdateFrequency = 51;
/**
* Milliseconds of minimum allowable delta between gps updates.
* @default
* @constant
* @private
* @type {number}
*/
const gpsMinFrequency = 5000;
// Screen size (x/y) in pixels.
/* let w = window;
let d = document;
let e = d.documentElement;
let g = d.getElementsByTagName('body')[0];
let x = w.innerWidth || e.clientWidth || g.clientWidth;
let y = w.innerHeight || e.clientHeight || g.clientHeight; */
// Settings/Events/Intervals/Timeouts //
/**
* All scripts loaded and initialized.
* @default
* @public
* @readonly
* @type {boolean}
*/
TraX.initialized = false;
/**
* Debug setting used across scripts for additional logging and additional UI
* sections that most users do not wish to see.
* @default
* @public
* @type {number}
* @todo Change back to 0. Set to 2 to force debugging by default.
*/
TraX.debugMode = 2;
/**
* Timeout until heartbeat hasn't happened for too long and we can assume
* death of sensors.
* @private
* @type {Timeout}
*/
let heartbeatTimeout;
/**
* Timeout until heartbeat hasn't happened for too long and we can assume
* death of GPS updates.
* @private
* @type {Timeout}
*/
let gpsHeartbeatTimeout;
/**
* Heartbeat from server
* @private
* @type {Timeout}
*/
let serverTimeout;
/**
* Watch Position ID. For GPS update watching.
* @private
* @type {number}
*/
let wpid;
/**
* If data sending to server is paused or recording.
* @default
* @private
* @type {boolean}
*/
let isPaused = true;
/**
* If we have prevented sending to server via options or setting. Not flipped
* due to errors or invalid state.
* @default
* @private
* @type {boolean}
*/
let preventSend = false;
/**
* If we have sent the user's login token to server at least once. If the
* token is empty this will also be false.
* @default
* @private
* @type {boolean}
*/
let tokenSent = false;
/**
* How often to save data in milliseconds.
* @private
* @type {number}
*/
let updateFrequency;
/**
* Number of heartbeats we have received since starting getting data to
* determine if this device has usable sensors.
* @private
* @type {number}
*/
let heartbeatCount;
/**
* Previous setting the user had chosen for frequency of sending data to
* server.
* @default
* @private
* @type {number}
*/
let previousUpdateFrequency = Math.Infinity;
/**
* Interval to check for data to pop from preSendBuffer and send to server.
* @private
* @type {Interval}
*/
let updateInterval;
/**
* Interval to update clocks in live data view.
* @private
* @type {Interval}
*/
let realtimeDataClockInterval;
/**
* Interval to update the realtime timers HUD.
* @private
* @type {Interval}
*/
let updateTimersInterval;
/**
* Options to pass into watching GPS.
* @default
* @constant
* @private
* @type {PositionOptions}
*/
const geoOptions = {
enableHighAccuracy: true,
maximumAge: 0,
timeout: Infinity,
};
// UI States //
/**
* Are the mini status lights currently visible.
* @default
* @private
* @type {boolean}
*/
let statusLightsVisible = false;
/**
* Is the options menu open.
* @private
* @default
* @type {boolean}
*/
let optionsMenuOpen = false;
/**
* Is the sensors view open.
* @private
* @default
* @type {boolean}
*/
let realtimeViewOpen = false;
/**
* Is the friends overlay open.
* @private
* @default
* @type {boolean}
*/
let friendViewOpen = false;
/**
* Is the map visible.
* @private
* @default
* @type {boolean}
*/
let friendmapEnabled = false;
/**
* Current google.maps.Map object.
* @private
* @default
* @type {?google.maps.Map}
*/
let friendmap = null;
/**
* The currently visible HUD.
* @private
* @default
* @type {number}
*/
let visibleHUD = 1;
// Socket //
/**
* Whether we are connected to the server or not.
* @private
* @default
* @type {boolean}
*/
let isConnected = false;
/**
* The session we are recording right now.
* @private
* @default
* @type {string}
*/
let sessionId = '';
/**
* The previous session id we were recording for.
* @private
* @default
* @type {string}
*/
const previousSessionId = '';
/**
* The name of the session we are recording now.
* @private
* @default
* @type {string}
*/
let sessionName = '';
/**
* ID of the currently selected track.
* @private
* @type {string|number}
*/
let trackId;
/**
* The id of the user who owns the track data.
* @private
* @type {string}
*/
let trackOwnerId;
/**
* The id of the currently selected track configuration.
* @private
* @type {string|number}
*/
let configId;
/**
* The id of the user who owns the config data, currently is ignored and must
* be the same as trackOwnerId.
* @private
* @type {string}
*/
let configOwnerId;
/**
* Queue of messages to send once we have connected to the server.
* @private
* @default
* @type {Array}
*/
let socketMessageQueue = [];
/**
* App version.
* @private
* @default
* @type {string}
*/
let versionNum = 'Unknown';
// HTML Elements
let redLight;
let greenLight;
let absoluteDom;
let compassAlphaDom;
let alphaDom;
let betaDom;
let gammaDom;
let accelerationDom;
let accelIncGravDom;
let rotationRateDom;
let intervalDom;
let longitudeDom;
let latitudeDom;
let posInfoDom;
let pausePlayButton;
let pausedGreenLight;
let pausedRedLight;
let debugDom;
let updateFrequencyDom;
let sendBufferDom;
let greenLightConnected;
let redLightConnected;
let friendmapDom;
let greenLightSending;
let yellowLightSending;
let redLightSending;
let greenLightWriting;
let redLightWriting;
let filesizeDom;
let needIMUDom;
let needAccountDom;
let sessionInputDom;
let trackNameSelectDom;
let configNameSelectDom;
let optionsMenuDom;
let realtimeDataDom;
let realtimeDeviceClockDom;
let realtimeGPSClockDom;
let realtimeSensorClockDom;
let largeGreenLight;
let largeYellowLight;
let largeRedLight;
let largeProcessingLight;
let statusLightListDom;
let greenLightGPS;
let redLightGPS;
let greenLightScripts;
let redLightScripts;
let xAxisFlipDom;
let yAxisFlipDom;
let zAxisFlipDom;
let realtimeDeviceTypeDom;
let realtimeDeviceBrowserDom;
let friendmapToggleDom;
let optionsToggleDom;
let realtimeDataToggleDom;
let toggleDebugDom;
let trackNameEditButton;
let configNameEditButton;
let bigButtonModeButton;
let timerModeButton;
// let customModeButton;
let timersHUDDom;
let bigButtonHUDDom;
// let customHUDDom;
let bigTimerDom;
let littleTimerTopDom;
let littleTimerLeftDom;
let littleTimerRightDom;
let littleTimerLeftTopDom;
let littleTimerRightTopDom;
let doCompressionDom;
let timersTrackTitleDom;
let debugBluetoothDom;
let friendsViewToggleDom;
let friendsViewDom;
let friendsUsernameDom;
let friendsListDom;
let friendsIdDom;
let friendsIdInputDom;
let friendsRequestListDom;
let blockedListDom;
let extraDataDom;
let dataViewButtonDom;
let streamIsPublicDom;
let secretURLDom;
// Device Info //
// Buffered data to send
let longitude;
let latitude;
let accuracy;
let altitude;
let altAccuracy;
let heading;
let speed;
let timestamp;
let absolute;
let compassAlpha;
let acceleration;
let accelIncGrav;
let rotationRate;
let interval;
let asBar;
let bsBar;
let gsBar;
let acBar;
let bcBar;
let gcBar;
let alpha;
let beta;
let gamma;
/**
* Debugging messages to send along with the data chunks.
* @private
* @type {Array.<string>}
*/
let messages;
/**
* Number of sensors readings received to average.
* @private
* @type {number}
*/
let orientationCount;
/**
* Number of sensors readings received to average.
* @private
* @type {number}
*/
let accelerationCount;
/**
* User agent of current browser.
* @private
* @type {string}
*/
let userAgent;
/**
* Should we reset buffered gyro data since data changes periodically but the
* value doesn't necessarily change.
* @default
* @private
* @type {boolean}
*/
let doGyroDataReset = true;
/**
* Rotation with -Z pointing towards the Earth.
* @default
* @public
* @readonly
* @type {{a: number, b: number, g: number}}
*/
TraX.downRotation = {a: 0, b: 0, g: 0};
/**
* Number of received sensor values with minimal acceleration.
* @default
* @private
* @type {number}
*/
let resetDownCount = 0;
/**
* The last time we attempted to pop the preSendBuffer.
* @private
* @type {number}
*/
let previousUpdate;
/**
* Collection of buffered data chunks to send to server.
* @private
* @default
* @type {Array.<Object>}
*/
const sendBuffer = [];
/**
* Current rotation of device screen only used for realtime canvases.
* @default
* @private
* @type {{angle: number}}
*/
let currentScreenOrientation = {angle: 0};
// Message Box //
/**
* Number of message boxes shown for warning the user their device is slow.
* @default
* @private
* @type {number}
*/
let popMessageWarningCount = 0;
// Code status //
/**
* No sensor data received for too long.
* @default
* @private
* @type {boolean}
*/
let sensorsDead = false;
/**
* No gps data received for too long.
* @default
* @private
* @type {boolean}
*/
let gpsDead = false;
/**
* Socket.io thinks the server connection died.
* @default
* @private
* @type {boolean}
*/
let connectionDead = true;
/**
* No data from server received for too long.
* @default
* @private
* @type {boolean}
*/
// let serverDead = true;
/**
* A script failed to load.
* @default
* @private
* @type {boolean}
*/
let scriptsDead = false; // eslint-disable-line prefer-const
/**
* If the user is not signed in.
* @default
* @private
* @type {boolean}
*/
let accountDead = true;
/**
* Override to force the big light to red. Set if we're sure sensors don't
* work
* and we're not getting enough data to function minimally.
* @default
* @private
* @type {boolean}
*/
let forceDead = false;
// Timers Data view //
/**
* The time when Record was pressed.
* @default
* @private
* @type {number}
*/
let sessionStartTime = 0;
/**
* The time when the start line was crossed.
* @default
* @private
* @type {number}
*/
let lapStartTime = 0;
/**
* The time the previous lap started to allow for processing laps while data
* overlaps.
* @default
* @private
* @type {number}
*/
let previousLapStartTime = 0;
/**
* Previous lap duration in milliseconds.
* @default
* @private
* @type {number}
*/
let previousLapDuration = 0;
/**
* The best lap duration in milliseconds.
* @default
* @private
* @type {number}
*/
let bestLapDuration = 0;
/**
* The predicted milliseconds the current lap will take.
* @default
* @private
* @type {number}
*/
let predictedLapDuration = 0;
/**
* Driver has crossed start but not finish yet.
* @default
* @private
* @type {boolean}
*/
let currentlyRacing = false;
/**
* Just crossed the start line and haven't left the threshold radius yet.
* @default
* @private
* @type {boolean}
*/
let justStartedRacing = false;
/**
* Just crossed the finish line and haven't left the threshold radius yet.
* @default
* @private
* @type {boolean}
*/
let justFinishedRacing = false;
/**
* Just crossed the start and finish line and haven't left the threshold
* radius
* yet, but are transitioning to next lap.
* @default
* @private
* @type {boolean}
*/
let inTransition = false;
/**
* Are we currently in a lap.
* @default
* @private
* @type {boolean}
*/
let currentLapState = false;
/**
* Previous received coordinate.
* @default
* @private
* @type {{lat: number, lng: number}}
*/
let previousCoord = {lat: 0, lng: 0};
/**
* Previous previously received coordinate.
* @default
* @private
* @type {{lat: number, lng: number}}
*/
let previousPreviousCoord = {lat: 0, lng: 0};
/**
* Times at distances driven during the best lap.
* @default
* @private
* @type {Array.<Object>}
*/
let bestLapData = [];
/**
* Times at distances through lap driven (Starts at start line).
* @default
* @private
* @type {Array.<Object>}
*/
let previousLapData = [];
/**
* Current lap times at distances since start line.
* @default
* @private
* @type {Array.<Object>}
*/
let currentLapData = [];
/**
* Current lap distance driven since start line.
* @default
* @private
* @type {number}
*/
let currentDistanceDriven = 0;
/**
* Number of laps driven this session.
* @default
* @private
* @type {number}
*/
let lapNum = 0;
/**
* Number of nonlaps driven this session.
* @default
* @private
* @type {number}
*/
let nonLapNum = 1;
// Friends //
/**
* All of user's friends.
* @default
* @public
* @type {Array.<Object>}
*/
TraX.friendsList = [];
/**
* All users with a relationship to user.
* @default
* @private
* @type {Array.<Object>}
*/
let allRelations = [];
/**
* Locations of friends who are currently sharing location.
* @default
* @private
* @type {Array.<Object>}
*/
const friendPositions = [];
/**
* Array of markers on map of each friend position.
* @default
* @private
* @type {Array.<google.maps.Marker>}
*/
let friendMarkers = [];
/**
* The user's current secret.
* @private
* @default
* @type {string}
*/
let secret = '';
/**
* List of available tracks to select
* @default
* @private
* @type {Array.<Object>}
*/
let trackList = [];
/**
* List of available configs to select.
* @default
* @private
* @type {Array.<Object>}
*/
const configList = [];
/**
* Current amount of data the user has stored on the server for TraX in bytes.
* @default
* @private
* @type {number}
*/
let datasize = 0;
/**
* The maximum amount of data the user may store on the server in bytes.
* @default
* @private
* @type {number}
*/
let datalimit = 0;
/**
* Resume receiving data and sending.
*
* @private
*/
function resume() {
// Event Listeners / Data collection
if (!realtimeViewOpen) {
window.addEventListener('deviceorientation', handleOrientation, true);
window.addEventListener('devicemotion', handleMotion, true);
if (!friendmapEnabled) {
if (!navigator.geolocation) {
TraX.showMessageBox(
'Your current browser does not allow me to view geolocation.');
} else {
wpid = navigator.geolocation.watchPosition(
handleNewPosition, handlePosError, geoOptions);
}
}
}
// TraX.triggerHUDFullscreen();
// Buffer management
updateInterval = setInterval(popPreSendBuffer, updateFrequency);
// Session management
sessionName = sessionInputDom.value;
sessionId = 'S' + Date.now() +
(TraX.socket.id || Math.random().toString(36).substring(2, 15));
// UI updates. Disable options that could be distracting while driving.
sessionInputDom.disabled = true;
TraX.sessionInputChange();
trackNameSelectDom.disabled = true;
configNameSelectDom.disabled = true;
trackNameEditButton.disabled = true;
configNameEditButton.disabled = true;
doCompressionDom.disabled = true;
optionsToggleDom.disabled = true;
friendsViewToggleDom.disabled = true;
realtimeDataToggleDom.disabled = true;
dataViewButtonDom.disabled = true;
// Ensure UIs are closed while driving.
TraX.toggleOptionsMenu(false);
TraX.toggleFriendsView(false);
// Create new session for recording we are starting.
if (!preventSend && TraX.isSignedIn) {
if (isConnected) {
TraX.socket.emit(
'newsession', sessionName, trackId, trackOwnerId, configId,
configOwnerId, sessionId);
} else {
socketMessageQueue.push([
'newsession',
sessionName,
trackId,
trackOwnerId,
configId,
configOwnerId,
sessionId,
]);
}
} else if (!preventSend) {
socketMessageQueue.push([
'newsession',
sessionName,
trackId,
trackOwnerId,
configId,
configOwnerId,
sessionId,
]);
}
// Reset timers since we are starting a new session.
resetTimersHUD();
lapNum = 0;
nonLapNum = 1;
sessionStartTime = Date.now();
updateTimersInterval =
setInterval(updateTimersHUD, realtimeClockUpdateFrequency);
popMessageWarningCount = 0;
// Reset values to show we have resumed.
pausePlayButton.innerHTML = 'Stop';
isPaused = false;
heartbeatCount = 0;
updateServerLights();
// Prevent device from sleeping.
KeepAwake.keepAwake(true);
// Record video.
if (TraX.Video) TraX.Video.startRecording();
}
/**
* Pause/Stop data collection
*
* @private
*/
function pause() {
// Stop data collection to save device resources
if (!realtimeViewOpen) {
window.removeEventListener('deviceorientation', handleOrientation, true);
window.removeEventListener('devicemotion', handleMotion, true);
if (!friendmapEnabled) {
if (navigator.geolocation) {
navigator.geolocation.clearWatch(wpid);
}
}
}
clearInterval(updateInterval);
// Reset timers and freeze on current display.
resetTimersHUD(true);
// Re-enable UI
sessionInputDom.disabled = false;
sessionId = '';
TraX.sessionInputChange();
trackNameSelectDom.disabled = false;
configNameSelectDom.disabled = false;
trackNameEditButton.disabled = false;
configNameEditButton.disabled = false;
doCompressionDom.disabled = false;
optionsToggleDom.disabled = false;
friendsViewToggleDom.disabled = false;
realtimeDataToggleDom.disabled = false;
dataViewButtonDom.disabled = false;
// Show user data collection has stopped.
pausePlayButton.innerHTML =
previousSessionId.length <= 0 ? 'Record' : 'Resume';
pausedRedLight.style.display = 'inline-block';
pausedGreenLight.style.display = 'none';
isPaused = true;
updateServerLights();
// Allow device to sleep.
KeepAwake.keepAwake(false);
// End video recording.
if (TraX.Video) TraX.Video.stopRecording();
}
/**
* Toggle recording of data.
*
* @public
* @param {?boolean} [force=undefined] Force state, or toggle with undefined.
*/
TraX.togglePause = function(force) {
if (typeof force === 'boolean') {
if (force == isPaused) return;
}
if (isPaused) {
resume();
} else {
pause();
}
};
/**
* Initialize script
*
* @public
*/
TraX.init = function() {
redLight = document.getElementById('redLightStatus');
greenLight = document.getElementById('greenLightStatus');
absoluteDom = document.getElementById('absolute');
compassAlphaDom = document.getElementById('compassAlpha');
alphaDom = document.getElementById('alpha');
betaDom = document.getElementById('beta');
gammaDom = document.getElementById('gamma');
accelerationDom = document.getElementById('acceleration');
accelIncGravDom = document.getElementById('accelIncGrav');
rotationRateDom = document.getElementById('rotationRate');
intervalDom = document.getElementById('interval');
longitudeDom = document.getElementById('longitude');
latitudeDom = document.getElementById('latitude');
posInfoDom = document.getElementById('posinfo');
pausePlayButton = document.getElementById('pausePlay');
pausedGreenLight = document.getElementById('greenLightPaused');
pausedRedLight = document.getElementById('redLightPaused');
debugDom = document.getElementById('debug');
sendBufferDom = document.getElementById('sendBuffer');
updateFrequencyDom = document.getElementById('updateFrequency');
redLightConnected = document.getElementById('redLightConnected');
greenLightConnected = document.getElementById('greenLightConnected');
redLightSending = document.getElementById('redLightSending');
yellowLightSending = document.getElementById('yellowLightSending');
greenLightSending = document.getElementById('greenLightSending');
redLightWriting = document.getElementById('redLightWriting');
greenLightWriting = document.getElementById('greenLightWriting');
friendmapDom = document.getElementById('friendmap');
filesizeDom = document.getElementById('filesize');
needIMUDom = document.getElementById('needIMU');
needAccountDom = document.getElementById('needAccount');
sessionInputDom = document.getElementById('sessionInput');
trackNameSelectDom = document.getElementById('sessionTrackNameSelect');
configNameSelectDom = document.getElementById('sessionConfigNameSelect');
optionsMenuDom = document.getElementById('optionsMenu');
realtimeDataDom = document.getElementById('realtimeData');
realtimeLngDom = document.getElementById('realtimeLongitude');
realtimeLatDom = document.getElementById('realtimeLatitude');
realtimeAltDom = document.getElementById('realtimeAltitude');
realtimeSpdDom = document.getElementById('realtimeGPSSpeed');
realtimeHedDom = document.getElementById('realtimeGPSHeading');
realtimeDeviceClockDom = document.getElementById('realtimeDeviceClock');
realtimeGPSClockDom = document.getElementById('realtimeGPSClock');
realtimeSensorClockDom = document.getElementById('realtimeSensorClock');
realtimeDeviceTypeDom = document.getElementById('realtimeDeviceType');
realtimeDeviceBrowserDom = document.getElementById('realtimeDeviceBrowser');
largeGreenLight = document.getElementById('greenLightLarge');
largeYellowLight = document.getElementById('yellowLightLarge');
largeRedLight = document.getElementById('redLightLarge');
largeProcessingLight = document.getElementById('processingLightLarge');
statusLightListDom = document.getElementById('statusLightList');
greenLightGPS = document.getElementById('greenLightGPS');
redLightGPS = document.getElementById('redLightGPS');
greenLightScripts = document.getElementById('greenLightScripts');
redLightScripts = document.getElementById('redLightScripts');
xAxisFlipDom = document.getElementById('flipXAxisButton');
yAxisFlipDom = document.getElementById('flipYAxisButton');
zAxisFlipDom = document.getElementById('flipZAxisButton');
// TraX.unitDropdownDom = document.getElementById("unitDropdown");
friendmapToggleDom = document.getElementById('mapToggle');
optionsToggleDom = document.getElementById('optionsMenuToggle');
realtimeDataToggleDom = document.getElementById('realtimeDataToggle');
toggleDebugDom = document.getElementById('debugMode');
trackNameEditButton = document.getElementById('sessionTrackNameEdit');
configNameEditButton = document.getElementById('sessionConfigNameEdit');
bigButtonModeButton = document.getElementById('chooseBigButton');
timerModeButton = document.getElementById('chooseTimers');