2023-07-23 00:23:10 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								$ ( function ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									function  SortByQrg ( a ,  b ) { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										var  a  =  a . frequency ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										var  b  =  b . frequency ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return  ( ( a <  b )  ?  - 1  :  ( ( a >  b )  ?  1  :  0 ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-07-26 16:22:53 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									function  get _dtable  ( )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										var  table  =  $ ( '.spottable' ) . DataTable ( { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											"retrieve" : true , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											'columnDefs' :  [ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													'targets' :  1 ,  "type" : "num" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													'createdCell' :   function  ( td ,  cellData ,  rowData ,  row ,  col )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														$ ( td ) . addClass ( "kHz" ) ;  
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
									
										
										
										
											2023-07-27 00:38:38 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												} , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													'targets' :  2 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													'createdCell' :   function  ( td ,  cellData ,  rowData ,  row ,  col )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														$ ( td ) . addClass ( "spotted_call" ) ;  
							 
						 
					
						
							
								
									
										
										
										
											2023-07-27 19:17:00 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														$ ( td ) . attr (  "title" ,  "Click to prepare logging"  ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-07-27 00:38:38 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
									
										
										
										
											2023-07-26 16:22:53 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											] 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return  table ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2023-07-23 00:23:10 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-07-23 17:29:04 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									function  fill _list ( band , de , maxAgeMinutes )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-07-26 16:22:53 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										// var table = $('.spottable').DataTable();
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										var  table  =  get _dtable ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-07-25 13:42:02 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( ( band  !=  '' )  &&  ( band  !==  undefined ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											let  dxurl  =  dxcluster _provider  +  "/spots/"  +  band  +  "/"  + maxAgeMinutes  +  "/"  +  de ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$ . ajax ( { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												url :  dxurl , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												cache :  false , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												dataType :  "json" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} ) . done ( function ( dxspots )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												table . page . len ( 50 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												let  oldtable = table . data ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												table . clear ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( dxspots . length > 0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													dxspots . sort ( SortByQrg ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													dxspots . forEach ( ( single )  =>  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														var  data = [ ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-14 22:53:48 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														if  ( single . cnfmd _call )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															addon _class = "text-success" ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														}  else  if  ( single . worked _call )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															addon _class = "text-warning" ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															addon _class = "" ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														} 
							 
						 
					
						
							
								
									
										
										
										
											2023-07-25 13:42:02 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														data [ 0 ] = [ ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														data [ 0 ] . push ( single . when _pretty ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-07-26 16:22:53 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														data [ 0 ] . push ( single . frequency * 1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-14 22:53:48 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														data [ 0 ] . push ( ( addon _class  !=  ''  ? '<span class="' + addon _class + '">'  :  '' ) + single . spotted + ( addon _class  !=  ''  ?  '</span>'  :  '' ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-07-25 13:42:02 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														data [ 0 ] . push ( single . dxcc _spotted . entity ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														data [ 0 ] . push ( single . spotter ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														if  ( oldtable . length  >  0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															let  update = false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															oldtable . each (  function  ( srow )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																if  ( JSON . stringify ( srow )  ===  JSON . stringify ( data [ 0 ] ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																	update = true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																}  
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															} ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															if  ( ! update )  {  	// Sth. Fresh? So highlight
 
							 
						 
					
						
							
								
									
										
										
										
											2023-12-20 15:12:49 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
																table . rows . add ( data ) . draw ( ) . nodes ( ) . to$ ( ) . addClass ( "fresh table-info" ) ;  
							 
						 
					
						
							
								
									
										
										
										
											2023-07-25 13:42:02 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
															}  else  {  
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																table . rows . add ( data ) . draw ( ) ;  
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															table . rows . add ( data ) . draw ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-07-23 16:55:45 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														} 
							 
						 
					
						
							
								
									
										
										
										
											2023-07-25 13:42:02 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													} ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													setTimeout ( function ( ) { 	// Remove Highlights within 15sec
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														$ ( ".fresh" ) . removeClass ( "bg-info" ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} , 1000 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											table . clear ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											table . draw ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2023-07-23 00:23:10 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-07-23 19:40:47 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									function  highlight _current _qrg ( qrg )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-07-26 16:22:53 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										var  table = get _dtable ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										// var table=$('.spottable').DataTable();
 
							 
						 
					
						
							
								
									
										
										
										
											2023-07-23 19:40:47 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										table . rows ( ) . every ( function ( )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											var  d = this . data ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-07-26 18:33:10 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											var  distance = Math . abs ( parseInt ( d [ 1 ] ) - qrg ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-07-23 19:40:47 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( distance <= 20 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												distance ++ ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												alpha = ( . 5 / distance ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-12-20 14:26:32 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												this . nodes ( ) . to$ ( ) . css ( '--bs-table-bg' ,  'rgba(0,0,255,'  +  alpha  +  ')' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												this . nodes ( ) . to$ ( ) . css ( '--bs-table-accent-bg' ,  'rgba(0,0,255,'  +  alpha  +  ')' ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-07-23 19:40:47 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-12-20 14:26:32 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												this . nodes ( ) . to$ ( ) . css ( '--bs-table-bg' ,  '' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												this . nodes ( ) . to$ ( ) . css ( '--bs-table-accent-bg' ,  '' ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-07-23 19:40:47 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-07-26 16:22:53 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									var  table = get _dtable ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									table . order ( [ 1 ,  'asc' ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									table . clear ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-07-24 17:57:03 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									fill _list ( $ ( '#band option:selected' ) . val ( ) ,  $ ( '#decontSelect option:selected' ) . val ( ) , dxcluster _maxage ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									setInterval ( function  ( )  {  fill _list ( $ ( '#band option:selected' ) . val ( ) ,  $ ( '#decontSelect option:selected' ) . val ( ) , dxcluster _maxage ) ;  } , 60000 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-07-23 17:29:04 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									$ ( "#decontSelect" ) . on ( "change" , function ( )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-07-26 16:22:53 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										table . clear ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-07-24 17:57:03 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										fill _list ( $ ( '#band option:selected' ) . val ( ) ,  $ ( '#decontSelect option:selected' ) . val ( ) , dxcluster _maxage ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-07-23 17:29:04 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-07-23 00:23:10 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									$ ( "#band" ) . on ( "change" , function ( )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-07-26 16:22:53 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										table . clear ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-07-24 17:57:03 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										fill _list ( $ ( '#band option:selected' ) . val ( ) ,  $ ( '#decontSelect option:selected' ) . val ( ) , dxcluster _maxage ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-07-23 00:23:10 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-07-24 02:48:03 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									$ ( "#spottertoggle" ) . on ( "click" ,  function ( )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-07-26 16:22:53 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( table . column ( 4 ) . visible ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											table . column ( 4 ) . visible ( false ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-07-24 02:48:03 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-07-26 16:22:53 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											table . column ( 4 ) . visible ( true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-07-24 02:48:03 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-07-27 01:55:35 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									var  qso _window _last _seen = Date . now ( ) - 3600 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									var  bc _qsowin  =  new  BroadcastChannel ( 'qso_window' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									bc _qsowin . onmessage  =  function  ( ev )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( ev . data  ==  'pong' )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											qso _window _last _seen = Date . now ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									setInterval ( function  ( )  {  bc _qsowin . postMessage ( 'ping' )  } , 500 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									var  bc2qso  =  new  BroadcastChannel ( 'qso_wish' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-07-27 00:38:38 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									$ ( document ) . on ( 'click' , '.spotted_call' ,  function ( )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-07-27 01:55:35 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( Date . now ( ) - qso _window _last _seen  <  2000 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-07-27 03:50:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											bc2qso . postMessage ( {  frequency :  this . parentNode . cells [ 1 ] . textContent * 1000 ,  call :  this . innerText  } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-07-27 01:55:35 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-07-27 03:50:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											let  cl = { } ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											cl . qrg = this . parentNode . cells [ 1 ] . textContent * 1000 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											cl . call = this . innerText ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-07-27 23:13:16 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											window . open ( base _url  +  'index.php/qso?manual=0' , '_blank' ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-07-27 03:50:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											setTimeout ( function  ( )  {  
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												bc2qso . postMessage ( {  frequency :  cl . qrg ,  call :  cl . call  } )  
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} , 2500 ) ; 	// Wait at least 2500ms for new-Window to appear, before posting data to it
 
							 
						 
					
						
							
								
									
										
										
										
											2023-07-27 01:55:35 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2023-07-27 00:38:38 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-07-24 00:38:26 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									$ ( "#menutoggle" ) . on ( "click" ,  function ( )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( $ ( '.navbar' ) . is ( ":hidden" ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$ ( '.navbar' ) . show ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-07-24 00:46:16 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											$ ( '#dxtabs' ) . show ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$ ( '#dxtitle' ) . show ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-07-24 00:38:26 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											$ ( '#menutoggle_i' ) . removeClass ( 'fa-arrow-down' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$ ( '#menutoggle_i' ) . addClass ( 'fa-arrow-up' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$ ( '.navbar' ) . hide ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-07-24 00:46:16 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											$ ( '#dxtabs' ) . hide ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$ ( '#dxtitle' ) . hide ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-07-24 00:38:26 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											$ ( '#menutoggle_i' ) . removeClass ( 'fa-arrow-up' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											$ ( '#menutoggle_i' ) . addClass ( 'fa-arrow-down' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-07-23 00:23:10 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									var  updateFromCAT  =  function ( )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if ( $ ( 'select.radios option:selected' ) . val ( )  !=  '0' )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										radioID  =  $ ( 'select.radios option:selected' ) . val ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-07-27 23:13:16 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										$ . getJSON (  base _url + "index.php/radio/json/"  +  radioID ,  function (  data  )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-07-23 00:23:10 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( data . error )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( data . error  ==  'not_logged_in' )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													$ ( ".radio_cat_state"  ) . remove ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													if ( $ ( '.radio_login_error' ) . length  ==  0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														$ ( '.messages' ) . prepend ( '<div class="alert alert-danger radio_login_error" role="alert"><i class="fas fa-broadcast-tower"></i> You\'re not logged it. Please <a href="' + base _url + '">login</a></div>' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												// Put future Errorhandling here
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if ( $ ( '.radio_login_error' ) . length  !=  0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													$ ( ".radio_login_error"  ) . remove ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												var  band  =  frequencyToBand ( data . frequency ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( band  !==  $ ( "#band" ) . val ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													$ ( "#band" ) . val ( band ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													$ ( "#band" ) . trigger ( "change" ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												var  minutes  =  Math . floor ( cat _timeout _interval  /  60 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if ( data . updated _minutes _ago  >  minutes )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													$ ( ".radio_cat_state"  ) . remove ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													if ( $ ( '.radio_timeout_error' ) . length  ==  0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														$ ( '.messages' ) . prepend ( '<div class="alert alert-danger radio_timeout_error" role="alert"><i class="fas fa-broadcast-tower"></i> Radio connection timed-out: '  +  $ ( 'select.radios option:selected' ) . text ( )  +  ' data is '  +  data . updated _minutes _ago  +  ' minutes old.</div>' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														$ ( '.radio_timeout_error' ) . html ( 'Radio connection timed-out: '  +  $ ( 'select.radios option:selected' ) . text ( )  +  ' data is '  +  data . updated _minutes _ago  +  ' minutes old.' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													$ ( ".radio_timeout_error"  ) . remove ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													text  =  '<i class="fas fa-broadcast-tower"></i><span style="margin-left:10px;"></span><b>TX:</b> ' + ( Math . round ( parseInt ( data . frequency ) / 100 ) / 10000 ) . toFixed ( 4 ) + ' MHz' ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-07-24 02:02:04 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													highlight _current _qrg ( ( parseInt ( data . frequency ) ) / 1000 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-07-23 00:23:10 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
													if ( data . mode  !=  null )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														text  =  text + '<span style="margin-left:10px"></span>' + data . mode ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													if ( data . power  !=  null  &&  data . power  !=  0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														text  =  text + '<span style="margin-left:10px"></span>' + data . power + ' W' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													if  ( !  $ ( '#radio_cat_state' ) . length )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														$ ( '.messages' ) . prepend ( '<div aria-hidden="true"><div id="radio_cat_state" class="alert alert-success radio_cat_state" role="alert">' + text + '</div></div>' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														$ ( '#radio_cat_state' ) . html ( text ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								} ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-07-23 14:12:11 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								$ . fn . dataTable . moment ( custom _date _format  +  ' HH:mm' ) ;  
						 
					
						
							
								
									
										
										
										
											2023-07-23 00:23:10 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								// Update frequency every three second
  
						 
					
						
							
								
									
										
										
										
											2023-07-23 19:40:47 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								setInterval ( updateFromCAT ,  3000 ) ;  
						 
					
						
							
								
									
										
										
										
											2023-07-23 00:23:10 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								// If a radios selected from drop down select radio update.
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								$ ( '.radios' ) . change ( updateFromCAT ) ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								} ) ;