2020-07-21 00:07:04 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								import  { FixedUiElement }  from  "./UI/Base/FixedUiElement" ;  
						 
					
						
							
								
									
										
										
										
											2020-08-17 17:23:15 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								import  { QueryParameters }  from  "./Logic/Web/QueryParameters" ;  
						 
					
						
							
								
									
										
										
										
											2021-01-22 01:03:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								import  Combine  from  "./UI/Base/Combine" ;  
						 
					
						
							
								
									
										
										
										
											2021-07-20 01:33:58 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								import  AvailableBaseLayers  from  "./Logic/Actors/AvailableBaseLayers" ;  
						 
					
						
							
								
									
										
										
										
											2021-09-21 02:10:42 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								import  MinimapImplementation  from  "./UI/Base/MinimapImplementation" ;  
						 
					
						
							
								
									
										
										
										
											2021-10-03 01:57:36 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								import  CountryCoder  from  "latlon2country/index" ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								import  SimpleMetaTagger  from  "./Logic/SimpleMetaTagger" ;  
						 
					
						
							
								
									
										
										
										
											2021-10-15 05:20:02 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								import  { Utils }  from  "./Utils" ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								import  AllThemesGui  from  "./UI/AllThemesGui" ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								import  DetermineLayout  from  "./Logic/DetermineLayout" ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								import  LayoutConfig  from  "./Models/ThemeConfig/LayoutConfig" ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								import  DefaultGUI ,  { DefaultGuiState }  from  "./UI/DefaultGUI" ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								import  State  from  "./State" ;  
						 
					
						
							
								
									
										
										
										
											2021-10-15 14:52:11 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								import  AvailableBaseLayersImplementation  from  "./Logic/Actors/AvailableBaseLayersImplementation" ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								import  ShowOverlayLayerImplementation  from  "./UI/ShowDataLayer/ShowOverlayLayerImplementation" ;  
						 
					
						
							
								
									
										
										
										
											2021-03-22 02:45:22 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-10-15 14:52:11 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								// Workaround for a stupid crash: inject some functions which would give stupid circular dependencies or crash the other nodejs scripts running from console
  
						 
					
						
							
								
									
										
										
										
											2021-09-21 02:10:42 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								MinimapImplementation . initialize ( )  
						 
					
						
							
								
									
										
										
										
											2021-10-15 14:52:11 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								AvailableBaseLayers . implement ( new  AvailableBaseLayersImplementation ( ) )  
						 
					
						
							
								
									
										
										
										
											2021-10-04 00:18:08 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								SimpleMetaTagger . coder  =  new  CountryCoder ( "https://pietervdvn.github.io/latlon2country/" ) ;  
						 
					
						
							
								
									
										
										
										
											2021-10-15 14:52:11 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								ShowOverlayLayerImplementation . Implement ( ) ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								// Miscelleanous
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-10-15 05:20:02 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								Utils . DisableLongPresses ( )  
						 
					
						
							
								
									
										
										
										
											2021-03-22 02:45:22 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-07-24 01:12:57 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								// --------------------- Special actions based on the parameters -----------------
  
						 
					
						
							
								
									
										
										
										
											2020-07-12 23:19:05 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								// @ts-ignore
  
						 
					
						
							
								
									
										
										
										
											2020-07-15 14:03:44 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								if  ( location . href . startsWith ( "http://buurtnatuur.be" ) )  {  
						 
					
						
							
								
									
										
										
										
											2020-07-11 11:50:03 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    // Reload the https version. This is important for the 'locate me' button
 
							 
						 
					
						
							
								
									
										
										
										
											2020-07-15 14:03:44 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    window . location . replace ( "https://buurtnatuur.be" ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-07-11 11:50:03 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-11-06 01:58:26 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-10-15 05:20:02 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								class  Init  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    public  static  Init ( layoutToUse : LayoutConfig ,  encoded : string )  { 
							 
						 
					
						
							
								
									
										
										
										
											2020-06-24 00:35:19 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-10-15 05:20:02 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        if ( layoutToUse  ===  null ) { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            // Something went wrong, error message is already on screen
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        if  ( layoutToUse  ===  undefined )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            // No layout found
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            new  AllThemesGui ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
									
										
										
										
											2020-06-24 00:35:19 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-10-15 05:20:02 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        // Workaround/legacy to keep the old paramters working as I renamed some of them
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        if  ( layoutToUse ? . id  ===  "cyclofix" )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            const  legacy  =  QueryParameters . GetQueryParameter ( "layer-bike_shops" ,  "true" ,  "Legacy - keep De Fietsambassade working" ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            const  correct  =  QueryParameters . GetQueryParameter ( "layer-bike_shop" ,  "true" ,  "Legacy - keep De Fietsambassade working" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            if  ( legacy . data  !==  "true" )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                correct . setData ( legacy . data ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            console . log ( "layer-bike_shop toggles: legacy:" ,  legacy . data ,  "new:" ,  correct . data ) 
							 
						 
					
						
							
								
									
										
										
										
											2020-06-24 00:35:19 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-10-15 05:20:02 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            const  legacyCafe  =  QueryParameters . GetQueryParameter ( "layer-bike_cafes" ,  "true" ,  "Legacy - keep De Fietsambassade working" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            const  correctCafe  =  QueryParameters . GetQueryParameter ( "layer-bike_cafe" ,  "true" ,  "Legacy - keep De Fietsambassade working" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            if  ( legacyCafe . data  !==  "true" )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                correctCafe . setData ( legacy . data ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-18 22:23:49 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-08-08 17:50:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-10-15 05:20:02 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        const  guiState  =  new  DefaultGuiState ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        State . state  =  new  State ( layoutToUse ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        // This 'leaks' the global state via the window object, useful for debugging
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        // @ts-ignore
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        window . mapcomplete_state  =  State . state ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        new  DefaultGUI ( State . state ,  guiState ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        if  ( encoded  !==  undefined  &&  encoded . length  >  10 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            // We save the layout to the user settings and local storage
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            State . state . osmConnection . OnLoggedIn ( ( )  = >  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                State . state . osmConnection 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    . GetLongPreference ( "installed-theme-"  +  layoutToUse . id ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    . setData ( encoded ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            } ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
									
										
										
										
											2021-05-03 16:04:35 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2021-10-15 05:20:02 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-05-28 12:59:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-10-15 05:20:02 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								document . getElementById ( "decoration-desktop" ) . remove ( ) ;  
						 
					
						
							
								
									
										
										
										
											2021-05-28 12:59:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								new  Combine ( [ "Initializing... <br/>" ,  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    new  FixedUiElement ( "<a>If this message persist, something went wrong - click here to try again</a>" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        . SetClass ( "link-underline small" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        . onClick ( ( )  = >  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-06-17 00:37:57 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            localStorage . clear ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-05-28 12:59:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            window . location . reload ( true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } ) ] ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    . AttachTo ( "centermessage" ) ;  // Add an initialization and reset button if something goes wrong
 
							 
						 
					
						
							
								
									
										
										
										
											2021-01-18 19:36:19 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-10-15 05:20:02 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								DetermineLayout . GetLayout ( ) . then ( value  = >  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    console . log ( "Got " ,  value ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    Init . Init ( value [ 0 ] ,  value [ 1 ] ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								} ) . catch ( err  = >  {  
						 
					
						
							
								
									
										
										
										
											2021-10-15 18:48:33 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    console . error ( "Error while initializing: " ,  err ,  err . stack ) 
							 
						 
					
						
							
								
									
										
										
										
											2021-10-15 05:20:02 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								} )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-05-28 12:59:48 +02:00