1
- // TODO: Move default location to settings
2
- var defaultLat = 41.5507768 ;
3
- var defaultLng = - 70.6593102 ;
4
- var minLatitude = - 180 ;
5
- var minLongitude = - 180 ;
6
- var zoomLevel = 6 ;
7
- var GPS_PRECISION = 4 ;
8
- var DEPTH_PRECISION = 1 ;
9
- var PLOT_X_DEFAULT = "roi_x" ;
10
- var PLOT_Y_DEFAULT = "roi_y" ;
11
- var MAX_SELECTABLE_IMAGES = 25 ;
12
- var _binFilterMode = "timeline" ;
13
-
14
- $ ( function ( ) {
15
- $ ( "#dataset-switcher" ) . change ( function ( ) {
1
+ // These values are populated from app settings
2
+ let defaultLat = undefined ;
3
+ let defaultLng = undefined ;
4
+ let zoomLevel = undefined ;
5
+
6
+ // Constants
7
+ const minLatitude = - 180 ;
8
+ const minLongitude = - 180 ;
9
+ const GPS_PRECISION = 4 ;
10
+ const DEPTH_PRECISION = 1 ;
11
+ const PLOT_X_DEFAULT = "roi_x" ;
12
+ const PLOT_Y_DEFAULT = "roi_y" ;
13
+ const MAX_SELECTABLE_IMAGES = 25 ;
14
+
15
+ let _binFilterMode = "timeline" ;
16
+
17
+ function initDashboard ( appSettings ) {
18
+ defaultLat = appSettings . default_latitude ;
19
+ defaultLng = appSettings . default_longitude ;
20
+ zoomLevel = appSettings . default_zoom_level ;
21
+
22
+ $ ( '[data-toggle="tooltip"]' ) . tooltip ( ) ;
23
+
24
+ $ ( '.navbar-toggler' ) . on ( 'click' , function ( ) {
25
+ $ ( '.animated-burger' ) . toggleClass ( 'open' ) ;
26
+ } ) ;
27
+
28
+ // hide navbar after a bit of scrolling
29
+ $ ( window ) . scroll ( function ( e ) {
30
+ var scroll = $ ( window ) . scrollTop ( ) ;
31
+ if ( scroll >= 150 ) {
32
+ $ ( '.navbar' ) . addClass ( "navbar-hide" ) ;
33
+ } else {
34
+ $ ( '.navbar' ) . removeClass ( "navbar-hide" ) ;
35
+ }
36
+ } ) ;
37
+
38
+ $ ( "#dataset-switcher" ) . change ( function ( ) {
16
39
location . href = "/timeline?dataset=" + $ ( this ) . val ( ) ;
17
40
} ) ;
18
41
19
- $ ( "#go-to-bin" ) . click ( function ( ) {
42
+ $ ( "#go-to-bin" ) . click ( function ( ) {
20
43
goToBin ( $ ( "#go-to-bid-pid" ) . val ( ) ) ;
21
44
} ) ;
22
45
23
- $ ( "#go-to-bid-pid" ) . keypress ( function ( e ) {
46
+ $ ( "#go-to-bid-pid" ) . keypress ( function ( e ) {
24
47
if ( e . which == 13 /* Enter */ ) {
25
48
goToBin ( $ ( this ) . val ( ) ) ;
26
49
}
@@ -33,7 +56,7 @@ $(function(){
33
56
$ ( '[data-toggle="popover"]' ) . popover ( 'hide' ) ;
34
57
}
35
58
} ) ;
36
- } )
59
+ }
37
60
38
61
function isKnownLocation ( lat , lng ) {
39
62
return parseFloat ( lat ) >= minLatitude && parseFloat ( lng ) >= minLongitude ;
@@ -339,17 +362,6 @@ function changeImage(img, src, blobImg, outlineImg){
339
362
} ) ;
340
363
}
341
364
342
- /* Deprecated */
343
- /*
344
- function buildColorArray(dataPoints, index) {
345
- var colors = $.map(dataPoints, function(){ return "#1f77b4"; });
346
- if (index >= 0 && index < dataPoints.length)
347
- colors[index] = "#bb0000";
348
-
349
- return colors;
350
- }
351
- */
352
-
353
365
function highlightSelectedBinByDate ( ) {
354
366
if ( _binTimestamp == null )
355
367
return ;
@@ -566,6 +578,7 @@ function isFilteringUsed() {
566
578
if ( _sampleType != "" && _sampleType != "null" )
567
579
return true ;
568
580
}
581
+
569
582
$ ( function ( ) {
570
583
$ ( '#dataset-popover' ) . popover ( {
571
584
container : 'body' ,
0 commit comments