forked from MapComplete/MapComplete
		
	Full code cleanup
This commit is contained in:
		
							parent
							
								
									8e6ee8c87f
								
							
						
					
					
						commit
						bd21212eba
					
				
					 246 changed files with 19418 additions and 11729 deletions
				
			
		|  | @ -61,43 +61,10 @@ export default class DetermineLayout { | |||
|                 layer.minzoom = Math.max(16, layer.minzoom) | ||||
|             } | ||||
|         } | ||||
|          | ||||
| 
 | ||||
|         return [layoutToUse, undefined] | ||||
|     } | ||||
| 
 | ||||
|     private static async LoadRemoteTheme(link: string): Promise<LayoutConfig | null> { | ||||
|         console.log("Downloading map theme from ", link); | ||||
| 
 | ||||
|         new FixedUiElement(`Downloading the theme from the <a href="${link}">link</a>...`) | ||||
|             .AttachTo("centermessage"); | ||||
| 
 | ||||
|         try { | ||||
| 
 | ||||
|             const parsed = await Utils.downloadJson(link) | ||||
|             console.log("Got ", parsed) | ||||
|             LegacyJsonConvert.fixThemeConfig(parsed) | ||||
|             try { | ||||
|                 parsed.id = link; | ||||
|                 return new LayoutConfig(parsed, false).patchImages(link, JSON.stringify(parsed)); | ||||
|             } catch (e) { | ||||
|                 console.error(e) | ||||
|                 DetermineLayout.ShowErrorOnCustomTheme( | ||||
|                     `<a href="${link}">${link}</a> is invalid:`, | ||||
|                     new FixedUiElement(e) | ||||
|                 ) | ||||
|                 return null; | ||||
|             } | ||||
| 
 | ||||
|         } catch (e) { | ||||
|             console.error(e) | ||||
|             DetermineLayout.ShowErrorOnCustomTheme( | ||||
|                 `<a href="${link}">${link}</a> is invalid - probably not found or invalid JSON:`, | ||||
|                 new FixedUiElement(e) | ||||
|             ) | ||||
|             return null; | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     public static LoadLayoutFromHash( | ||||
|         userLayoutParam: UIEventSource<string> | ||||
|     ): [LayoutConfig, string] | null { | ||||
|  | @ -166,4 +133,37 @@ export default class DetermineLayout { | |||
|             .AttachTo("centermessage"); | ||||
|     } | ||||
| 
 | ||||
|     private static async LoadRemoteTheme(link: string): Promise<LayoutConfig | null> { | ||||
|         console.log("Downloading map theme from ", link); | ||||
| 
 | ||||
|         new FixedUiElement(`Downloading the theme from the <a href="${link}">link</a>...`) | ||||
|             .AttachTo("centermessage"); | ||||
| 
 | ||||
|         try { | ||||
| 
 | ||||
|             const parsed = await Utils.downloadJson(link) | ||||
|             console.log("Got ", parsed) | ||||
|             LegacyJsonConvert.fixThemeConfig(parsed) | ||||
|             try { | ||||
|                 parsed.id = link; | ||||
|                 return new LayoutConfig(parsed, false).patchImages(link, JSON.stringify(parsed)); | ||||
|             } catch (e) { | ||||
|                 console.error(e) | ||||
|                 DetermineLayout.ShowErrorOnCustomTheme( | ||||
|                     `<a href="${link}">${link}</a> is invalid:`, | ||||
|                     new FixedUiElement(e) | ||||
|                 ) | ||||
|                 return null; | ||||
|             } | ||||
| 
 | ||||
|         } catch (e) { | ||||
|             console.error(e) | ||||
|             DetermineLayout.ShowErrorOnCustomTheme( | ||||
|                 `<a href="${link}">${link}</a> is invalid - probably not found or invalid JSON:`, | ||||
|                 new FixedUiElement(e) | ||||
|             ) | ||||
|             return null; | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
| } | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue