11let db = firebase . firestore ( ) ;
22let auth = firebase . auth ( ) ;
33
4- document . addEventListener ( 'DOMContentLoaded' , function ( ) {
5- const currentDate = new Date ( ) ;
6- const lastMonth = new Date ( currentDate . getFullYear ( ) , currentDate . getMonth ( ) - 1 , currentDate . getDate ( ) ) ;
4+ document . addEventListener ( "DOMContentLoaded" , function ( ) {
5+ const currentDate = new Date ( ) ;
6+ const lastMonth = new Date (
7+ currentDate . getFullYear ( ) ,
8+ currentDate . getMonth ( ) - 1 ,
9+ currentDate . getDate ( )
10+ ) ;
711
8- setTimeout ( ( ) => {
9- db . collection ( ' Users' )
10- . where ( ' lastActive' , '>=' , lastMonth )
11- . get ( )
12- . then ( querySnapshot => {
13- animateValue ( ' monthly-active-users' , 0 , querySnapshot . size , 500 )
14- } ) ;
12+ setTimeout ( ( ) => {
13+ db . collection ( " Users" )
14+ . where ( " lastActive" , ">=" , lastMonth )
15+ . get ( )
16+ . then ( ( querySnapshot ) => {
17+ animateValue ( " monthly-active-users" , 0 , querySnapshot . size , 500 ) ;
18+ } ) ;
1519
20+ db . collection ( "Statistics" )
21+ . doc ( "website-views" )
22+ . get ( )
23+ . then ( ( doc ) => {
24+ if ( doc . exists ) {
25+ const data = doc . data ( ) ;
26+ animateValue ( "website-views" , 0 , data . views , 50 ) ;
27+ } else {
28+ console . error ( "No document exists." ) ;
29+ }
30+ } )
31+ . catch ( ( error ) => {
32+ console . error ( error ) ;
33+ } ) ;
1634
17- db . collection ( 'Statistics' ) . doc ( 'website-views' ) . get ( )
18- . then ( doc => {
19- if ( doc . exists ) {
20- const data = doc . data ( ) ;
21- animateValue ( 'website-views' , 0 , data . views , 50 )
22- } else {
23- console . error ( 'No document exists.' )
24- }
25- } )
26- . catch ( error => {
27- console . error ( error ) ;
28- } )
29-
30- db . collection ( 'Messages' )
31- . get ( )
32- . then ( querySnapshot => {
33- animateValue ( 'messages-sent' , 0 , querySnapshot . size , 500 )
34- } ) ;
35- } , 500 ) ;
35+ db . collection ( "Messages" )
36+ . get ( )
37+ . then ( ( querySnapshot ) => {
38+ animateValue ( "messages-sent" , 0 , querySnapshot . size , 500 ) ;
39+ } ) ;
40+ } , 500 ) ;
3641
37- // if (window.mobileCheck()) {
38- // document.getElementById('members-container').classList.replace('grid', 'grid-cols-2', 'gap-6')
39- // console.log('Mobile')
40- // } else {
41- // document.getElementById('members-container').classList.replace('grid', 'grid-cols-4', 'gap-6')
42- // }
42+ // if (window.mobileCheck()) {
43+ // document.getElementById('members-container').classList.replace('grid', 'grid-cols-2', 'gap-6')
44+ // console.log('Mobile')
45+ // } else {
46+ // document.getElementById('members-container').classList.replace('grid', 'grid-cols-4', 'gap-6')
47+ // }
4348} ) ;
4449
4550window . mobileCheck = function ( ) {
46- let check = false ;
47- ( function ( a ) { if ( / ( a n d r o i d | b b \d + | m e e g o ) .+ m o b i l e | a v a n t g o | b a d a \/ | b l a c k b e r r y | b l a z e r | c o m p a l | e l a i n e | f e n n e c | h i p t o p | i e m o b i l e | i p ( h o n e | o d ) | i r i s | k i n d l e | l g e | m a e m o | m i d p | m m p | m o b i l e .+ f i r e f o x | n e t f r o n t | o p e r a m ( o b | i n ) i | p a l m ( o s ) ? | p h o n e | p ( i x i | r e ) \/ | p l u c k e r | p o c k e t | p s p | s e r i e s ( 4 | 6 ) 0 | s y m b i a n | t r e o | u p \. ( b r o w s e r | l i n k ) | v o d a f o n e | w a p | w i n d o w s c e | x d a | x i i n o / i. test ( a ) || / 1 2 0 7 | 6 3 1 0 | 6 5 9 0 | 3 g s o | 4 t h p | 5 0 [ 1 - 6 ] i | 7 7 0 s | 8 0 2 s | a w a | a b a c | a c ( e r | o o | s \- ) | a i ( k o | r n ) | a l ( a v | c a | c o ) | a m o i | a n ( e x | n y | y w ) | a p t u | a r ( c h | g o ) | a s ( t e | u s ) | a t t w | a u ( d i | \- m | r | s ) | a v a n | b e ( c k | l l | n q ) | b i ( l b | r d ) | b l ( a c | a z ) | b r ( e | v ) w | b u m b | b w \- ( n | u ) | c 5 5 \/ | c a p i | c c w a | c d m \- | c e l l | c h t m | c l d c | c m d \- | c o ( m p | n d ) | c r a w | d a ( i t | l l | n g ) | d b t e | d c \- s | d e v i | d i c a | d m o b | d o ( c | p ) o | d s ( 1 2 | \- d ) | e l ( 4 9 | a i ) | e m ( l 2 | u l ) | e r ( i c | k 0 ) | e s l 8 | e z ( [ 4 - 7 ] 0 | o s | w a | z e ) | f e t c | f l y ( \- | _ ) | g 1 u | g 5 6 0 | g e n e | g f \- 5 | g \- m o | g o ( \. w | o d ) | g r ( a d | u n ) | h a i e | h c i t | h d \- ( m | p | t ) | h e i \- | h i ( p t | t a ) | h p ( i | i p ) | h s \- c | h t ( c ( \- | | _ | a | g | p | s | t ) | t p ) | h u ( a w | t c ) | i \- ( 2 0 | g o | m a ) | i 2 3 0 | i a c ( | \- | \/ ) | i b r o | i d e a | i g 0 1 | i k o m | i m 1 k | i n n o | i p a q | i r i s | j a ( t | v ) a | j b r o | j e m u | j i g s | k d d i | k e j i | k g t ( | \/ ) | k l o n | k p t | k w c \- | k y o ( c | k ) | l e ( n o | x i ) | l g ( g | \/ ( k | l | u ) | 5 0 | 5 4 | \- [ a - w ] ) | l i b w | l y n x | m 1 \- w | m 3 g a | m 5 0 \/ | m a ( t e | u i | x o ) | m c ( 0 1 | 2 1 | c a ) | m \- c r | m e ( r c | r i ) | m i ( o 8 | o a | t s ) | m m e f | m o ( 0 1 | 0 2 | b i | d e | d o | t ( \- | | o | v ) | z z ) | m t ( 5 0 | p 1 | v ) | m w b p | m y w a | n 1 0 [ 0 - 2 ] | n 2 0 [ 2 - 3 ] | n 3 0 ( 0 | 2 ) | n 5 0 ( 0 | 2 | 5 ) | n 7 ( 0 ( 0 | 1 ) | 1 0 ) | n e ( ( c | m ) \- | o n | t f | w f | w g | w t ) | n o k ( 6 | i ) | n z p h | o 2 i m | o p ( t i | w v ) | o r a n | o w g 1 | p 8 0 0 | p a n ( a | d | t ) | p d x g | p g ( 1 3 | \- ( [ 1 - 8 ] | c ) ) | p h i l | p i r e | p l ( a y | u c ) | p n \- 2 | p o ( c k | r t | s e ) | p r o x | p s i o | p t \- g | q a \- a | q c ( 0 7 | 1 2 | 2 1 | 3 2 | 6 0 | \- [ 2 - 7 ] | i \- ) | q t e k | r 3 8 0 | r 6 0 0 | r a k s | r i m 9 | r o ( v e | z o ) | s 5 5 \/ | s a ( g e | m a | m m | m s | n y | v a ) | s c ( 0 1 | h \- | o o | p \- ) | s d k \/ | s e ( c ( \- | 0 | 1 ) | 4 7 | m c | n d | r i ) | s g h \- | s h a r | s i e ( \- | m ) | s k \- 0 | s l ( 4 5 | i d ) | s m ( a l | a r | b 3 | i t | t 5 ) | s o ( f t | n y ) | s p ( 0 1 | h \- | v \- | v ) | s y ( 0 1 | m b ) | t 2 ( 1 8 | 5 0 ) | t 6 ( 0 0 | 1 0 | 1 8 ) | t a ( g t | l k ) | t c l \- | t d g \- | t e l ( i | m ) | t i m \- | t \- m o | t o ( p l | s h ) | t s ( 7 0 | m \- | m 3 | m 5 ) | t x \- 9 | u p ( \. b | g 1 | s i ) | u t s t | v 4 0 0 | v 7 5 0 | v e r i | v i ( r g | t e ) | v k ( 4 0 | 5 [ 0 - 3 ] | \- v ) | v m 4 0 | v o d a | v u l c | v x ( 5 2 | 5 3 | 6 0 | 6 1 | 7 0 | 8 0 | 8 1 | 8 3 | 8 5 | 9 8 ) | w 3 c ( \- | ) | w e b c | w h i t | w i ( g | n c | n w ) | w m l b | w o n u | x 7 0 0 | y a s \- | y o u r | z e t o | z t e \- / i. test ( a . substr ( 0 , 4 ) ) ) check = true ; } ) ( navigator . userAgent || navigator . vendor || window . opera ) ;
48- return check ;
51+ let check = false ;
52+ ( function ( a ) {
53+ if (
54+ / ( a n d r o i d | b b \d + | m e e g o ) .+ m o b i l e | a v a n t g o | b a d a \/ | b l a c k b e r r y | b l a z e r | c o m p a l | e l a i n e | f e n n e c | h i p t o p | i e m o b i l e | i p ( h o n e | o d ) | i r i s | k i n d l e | l g e | m a e m o | m i d p | m m p | m o b i l e .+ f i r e f o x | n e t f r o n t | o p e r a m ( o b | i n ) i | p a l m ( o s ) ? | p h o n e | p ( i x i | r e ) \/ | p l u c k e r | p o c k e t | p s p | s e r i e s ( 4 | 6 ) 0 | s y m b i a n | t r e o | u p \. ( b r o w s e r | l i n k ) | v o d a f o n e | w a p | w i n d o w s c e | x d a | x i i n o / i. test (
55+ a
56+ ) ||
57+ / 1 2 0 7 | 6 3 1 0 | 6 5 9 0 | 3 g s o | 4 t h p | 5 0 [ 1 - 6 ] i | 7 7 0 s | 8 0 2 s | a w a | a b a c | a c ( e r | o o | s \- ) | a i ( k o | r n ) | a l ( a v | c a | c o ) | a m o i | a n ( e x | n y | y w ) | a p t u | a r ( c h | g o ) | a s ( t e | u s ) | a t t w | a u ( d i | \- m | r | s ) | a v a n | b e ( c k | l l | n q ) | b i ( l b | r d ) | b l ( a c | a z ) | b r ( e | v ) w | b u m b | b w \- ( n | u ) | c 5 5 \/ | c a p i | c c w a | c d m \- | c e l l | c h t m | c l d c | c m d \- | c o ( m p | n d ) | c r a w | d a ( i t | l l | n g ) | d b t e | d c \- s | d e v i | d i c a | d m o b | d o ( c | p ) o | d s ( 1 2 | \- d ) | e l ( 4 9 | a i ) | e m ( l 2 | u l ) | e r ( i c | k 0 ) | e s l 8 | e z ( [ 4 - 7 ] 0 | o s | w a | z e ) | f e t c | f l y ( \- | _ ) | g 1 u | g 5 6 0 | g e n e | g f \- 5 | g \- m o | g o ( \. w | o d ) | g r ( a d | u n ) | h a i e | h c i t | h d \- ( m | p | t ) | h e i \- | h i ( p t | t a ) | h p ( i | i p ) | h s \- c | h t ( c ( \- | | _ | a | g | p | s | t ) | t p ) | h u ( a w | t c ) | i \- ( 2 0 | g o | m a ) | i 2 3 0 | i a c ( | \- | \/ ) | i b r o | i d e a | i g 0 1 | i k o m | i m 1 k | i n n o | i p a q | i r i s | j a ( t | v ) a | j b r o | j e m u | j i g s | k d d i | k e j i | k g t ( | \/ ) | k l o n | k p t | k w c \- | k y o ( c | k ) | l e ( n o | x i ) | l g ( g | \/ ( k | l | u ) | 5 0 | 5 4 | \- [ a - w ] ) | l i b w | l y n x | m 1 \- w | m 3 g a | m 5 0 \/ | m a ( t e | u i | x o ) | m c ( 0 1 | 2 1 | c a ) | m \- c r | m e ( r c | r i ) | m i ( o 8 | o a | t s ) | m m e f | m o ( 0 1 | 0 2 | b i | d e | d o | t ( \- | | o | v ) | z z ) | m t ( 5 0 | p 1 | v ) | m w b p | m y w a | n 1 0 [ 0 - 2 ] | n 2 0 [ 2 - 3 ] | n 3 0 ( 0 | 2 ) | n 5 0 ( 0 | 2 | 5 ) | n 7 ( 0 ( 0 | 1 ) | 1 0 ) | n e ( ( c | m ) \- | o n | t f | w f | w g | w t ) | n o k ( 6 | i ) | n z p h | o 2 i m | o p ( t i | w v ) | o r a n | o w g 1 | p 8 0 0 | p a n ( a | d | t ) | p d x g | p g ( 1 3 | \- ( [ 1 - 8 ] | c ) ) | p h i l | p i r e | p l ( a y | u c ) | p n \- 2 | p o ( c k | r t | s e ) | p r o x | p s i o | p t \- g | q a \- a | q c ( 0 7 | 1 2 | 2 1 | 3 2 | 6 0 | \- [ 2 - 7 ] | i \- ) | q t e k | r 3 8 0 | r 6 0 0 | r a k s | r i m 9 | r o ( v e | z o ) | s 5 5 \/ | s a ( g e | m a | m m | m s | n y | v a ) | s c ( 0 1 | h \- | o o | p \- ) | s d k \/ | s e ( c ( \- | 0 | 1 ) | 4 7 | m c | n d | r i ) | s g h \- | s h a r | s i e ( \- | m ) | s k \- 0 | s l ( 4 5 | i d ) | s m ( a l | a r | b 3 | i t | t 5 ) | s o ( f t | n y ) | s p ( 0 1 | h \- | v \- | v ) | s y ( 0 1 | m b ) | t 2 ( 1 8 | 5 0 ) | t 6 ( 0 0 | 1 0 | 1 8 ) | t a ( g t | l k ) | t c l \- | t d g \- | t e l ( i | m ) | t i m \- | t \- m o | t o ( p l | s h ) | t s ( 7 0 | m \- | m 3 | m 5 ) | t x \- 9 | u p ( \. b | g 1 | s i ) | u t s t | v 4 0 0 | v 7 5 0 | v e r i | v i ( r g | t e ) | v k ( 4 0 | 5 [ 0 - 3 ] | \- v ) | v m 4 0 | v o d a | v u l c | v x ( 5 2 | 5 3 | 6 0 | 6 1 | 7 0 | 8 0 | 8 1 | 8 3 | 8 5 | 9 8 ) | w 3 c ( \- | ) | w e b c | w h i t | w i ( g | n c | n w ) | w m l b | w o n u | x 7 0 0 | y a s \- | y o u r | z e t o | z t e \- / i. test (
58+ a . substr ( 0 , 4 )
59+ )
60+ )
61+ check = true ;
62+ } ) ( navigator . userAgent || navigator . vendor || window . opera ) ;
63+ return check ;
4964} ;
5065
5166function animateValue ( id , start , end , duration ) {
52- let range = start - end
53- let current = start ;
54- let increment = end > start ? 1 : - 1 ;
55- let stepTime = Math . abs ( Math . floor ( duration / range ) ) ;
56- let obj = document . getElementById ( id ) ;
67+ let range = start - end ;
68+ let current = start ;
69+ let increment = end > start ? 1 : - 1 ;
70+ let stepTime = Math . abs ( Math . floor ( duration / range ) ) ;
71+ let obj = document . getElementById ( id ) ;
5772
58- let timer = setInterval ( function ( ) {
59- current += increment ;
60- obj . innerText = current . toLocaleString ( ) ;
61- if ( current === end ) {
62- obj . innerText = obj . innerHTML + '+' ;
63- clearInterval ( timer ) ;
64- }
65- } , stepTime )
73+ let timer = setInterval ( function ( ) {
74+ current += increment ;
75+ obj . innerText = current . toLocaleString ( ) ;
76+ if ( current === end ) {
77+ obj . innerText = obj . innerHTML + "+" ;
78+ clearInterval ( timer ) ;
79+ }
80+ } , stepTime ) ;
6681}
6782
6883function addToNewsletter ( ) {
69- const emailRegex = / ^ [ ^ \s @ ] + @ [ ^ \s @ ] + \. [ ^ \s @ ] + $ / ;
70- const email = document . getElementById ( ' newsletter-email' ) . value
84+ const emailRegex = / ^ [ ^ \s @ ] + @ [ ^ \s @ ] + \. [ ^ \s @ ] + $ / ;
85+ const email = document . getElementById ( " newsletter-email" ) . value ;
7186
72- if ( email === '' || ! emailRegex . test ( email ) ) {
73- alert ( ' Please enter a valid email address.' ) ;
74- } else {
75- db . collection ( ' ReceivesNewsletter' ) . add ( {
76- email : email ,
77- addedDate : new Date ( ) ,
78- pageAddedFrom : window . location . href
79- } )
87+ if ( email === "" || ! emailRegex . test ( email ) ) {
88+ alert ( " Please enter a valid email address." ) ;
89+ } else {
90+ db . collection ( " ReceivesNewsletter" ) . add ( {
91+ email : email ,
92+ addedDate : new Date ( ) ,
93+ pageAddedFrom : window . location . href ,
94+ } ) ;
8095
81- alert ( ' You have been added to the newsletter.' )
82- }
83- }
96+ alert ( " You have been added to the newsletter." ) ;
97+ }
98+ }
0 commit comments