File tree 2 files changed +30
-1
lines changed
2 files changed +30
-1
lines changed Original file line number Diff line number Diff line change 49
49
</section >
50
50
</g:if >
51
51
52
- <h2 id =" occurrenceRecords" >Occurrence records</h2 >
52
+ <h2 id =" occurrenceRecords" >Occurrence records < span id = " totalRecords " ></ span > </h2 >
53
53
</div >
54
54
</div >
55
55
Original file line number Diff line number Diff line change @@ -61,6 +61,33 @@ var region = {
61
61
else {
62
62
return regionFid + ':"' + regionName + '"' ;
63
63
}
64
+ } ,
65
+
66
+ /**
67
+ * Formats numbers as human readable. Handles numbers in the millions.
68
+ * @param count the number
69
+ */
70
+ format : function ( count ) {
71
+ if ( count >= 1000000 ) {
72
+ return count . numberFormat ( "#,#0,,.00 million" ) ;
73
+ }
74
+ return region . addCommas ( count ) ;
75
+ } ,
76
+
77
+ /**
78
+ * Inserts commas into a number for display.
79
+ * @param nStr
80
+ */
81
+ addCommas : function ( nStr ) {
82
+ nStr += '' ;
83
+ x = nStr . split ( '.' ) ;
84
+ x1 = x [ 0 ] ;
85
+ x2 = x . length > 1 ? '.' + x [ 1 ] : '' ;
86
+ var rgx = / ( \d + ) ( \d { 3 } ) / ;
87
+ while ( rgx . test ( x1 ) ) {
88
+ x1 = x1 . replace ( rgx , '$1' + ',' + '$2' ) ;
89
+ }
90
+ return x1 + x2 ;
64
91
}
65
92
} ;
66
93
@@ -366,6 +393,8 @@ var RegionWidget = function (config) {
366
393
367
394
speciesLoaded : function ( ) {
368
395
$ ( '#species' ) . effect ( 'highlight' , 2000 ) ;
396
+ $ ( '#totalRecords' ) . text ( '(' + region . format ( parseInt ( $ ( '#moreSpeciesZone' ) . attr ( 'totalRecords' ) ) ) + ')' ) ;
397
+ $ ( '#occurrenceRecords' ) . effect ( 'highlight' , 2000 ) ;
369
398
} ,
370
399
371
400
showMoreSpecies : function ( ) {
You can’t perform that action at this time.
0 commit comments