forked from MapComplete/MapComplete
		
	Fixed #100: allow multiple values in a single wikidata and wikimedia_commons tag
This commit is contained in:
		
							parent
							
								
									02d55dde66
								
							
						
					
					
						commit
						b4f95e5408
					
				
					 4 changed files with 39 additions and 38 deletions
				
			
		|  | @ -38,15 +38,35 @@ export class ImageSearcher extends UIEventSource<string[]> { | |||
| 
 | ||||
|         const self = this; | ||||
|         this._wdItem.addCallback(() => { | ||||
|             // Load the wikidata item, then detect usage on 'commons'
 | ||||
|             let wikidataId = self._wdItem.data; | ||||
|             // @ts-ignore
 | ||||
|             if (wikidataId.startsWith("Q")) { | ||||
|                     wikidataId = wikidataId.substr(1); | ||||
|                 // Load the wikidata item, then detect usage on 'commons'
 | ||||
|                 let allWikidataId = self._wdItem.data.split(";"); | ||||
|                 for (let wikidataId of allWikidataId) { | ||||
|                     // @ts-ignore
 | ||||
|                     if (wikidataId.startsWith("Q")) { | ||||
|                         wikidataId = wikidataId.substr(1); | ||||
|                     } | ||||
|                     Wikimedia.GetWikiData(parseInt(wikidataId), (wd: Wikidata) => { | ||||
|                         self.AddImage(wd.image); | ||||
|                         Wikimedia.GetCategoryFiles(wd.commonsWiki, (images: ImagesInCategory) => { | ||||
|                             for (const image of images.images) { | ||||
|                                 // @ts-ignore
 | ||||
|                                 if (image.startsWith("File:")) { | ||||
|                                     self.AddImage(image); | ||||
|                                 } | ||||
|                             } | ||||
|                         }) | ||||
|                     }) | ||||
|                 } | ||||
|                 Wikimedia.GetWikiData(parseInt(wikidataId), (wd: Wikidata) => { | ||||
|                     self.AddImage(wd.image); | ||||
|                     Wikimedia.GetCategoryFiles(wd.commonsWiki, (images: ImagesInCategory) => { | ||||
|             } | ||||
|         ); | ||||
| 
 | ||||
| 
 | ||||
|         this._commons.addCallback(() => { | ||||
|             const allCommons: string[] = self._commons.data.split(";"); | ||||
|             for (const commons of allCommons) { | ||||
|                 // @ts-ignore
 | ||||
|                 if (commons.startsWith("Category:")) { | ||||
|                     Wikimedia.GetCategoryFiles(commons, (images: ImagesInCategory) => { | ||||
|                         for (const image of images.images) { | ||||
|                             // @ts-ignore
 | ||||
|                             if (image.startsWith("File:")) { | ||||
|  | @ -54,26 +74,10 @@ export class ImageSearcher extends UIEventSource<string[]> { | |||
|                             } | ||||
|                         } | ||||
|                     }) | ||||
|                 }) | ||||
|             } | ||||
|         ); | ||||
| 
 | ||||
| 
 | ||||
|         this._commons.addCallback(() => { | ||||
|             const commons: string = self._commons.data; | ||||
|             // @ts-ignore
 | ||||
|             if (commons.startsWith("Category:")) { | ||||
|                 Wikimedia.GetCategoryFiles(commons, (images: ImagesInCategory) => { | ||||
|                     for (const image of images.images) { | ||||
|                         // @ts-ignore
 | ||||
|                         if (image.startsWith("File:")) { | ||||
|                             self.AddImage(image); | ||||
|                         } | ||||
|                 } else { // @ts-ignore
 | ||||
|                     if (commons.startsWith("File:")) { | ||||
|                         self.AddImage(commons); | ||||
|                     } | ||||
|                 }) | ||||
|             } else { // @ts-ignore
 | ||||
|                 if (commons.startsWith("File:")) { | ||||
|                     self.AddImage(commons); | ||||
|                 } | ||||
|             } | ||||
|         }); | ||||
|  |  | |||
							
								
								
									
										13
									
								
								README.md
									
										
									
									
									
								
							
							
						
						
									
										13
									
								
								README.md
									
										
									
									
									
								
							|  | @ -42,14 +42,15 @@ A typical user journey would be: | |||
| 
 | ||||
| 0. Oh, this is a cool map of _my specific interest_! There is a lot of data already... | ||||
| 
 | ||||
|     * The user might discover the explanation about OSM in the dedicated tab page | ||||
|     * The user might discover the other themes in the other tab | ||||
|     * The user might share the map and/or embed it | ||||
|     * The user might discover the explanation about OSM in the second tab | ||||
|     * The user might share the map and/or embed it in the third tab | ||||
|     * The user might discover the other themes in the last tab | ||||
|      | ||||
| 1. The user clicks that big tempting button 'login' in order to answer questions. The user makes an account - a big step. | ||||
| 1. The user clicks that big tempting button 'login' in order to answer questions - there's enough of these login buttons... The user creates an account. | ||||
| 
 | ||||
| 2. The user answers a question! Hooray! | ||||
|     When at least one question is answered (aka: having one changeset on OSM), adding a new point is unlocked | ||||
| 2. The user answers a question! Hooray! The user transformed into a __contributor__ now. | ||||
|      | ||||
|     * When at least one question is answered (aka: having one changeset on OSM), adding a new point is unlocked | ||||
|      | ||||
| 3. The user adds a new POI somewhere | ||||
| 
 | ||||
|  |  | |||
							
								
								
									
										2
									
								
								State.ts
									
										
									
									
									
								
							
							
						
						
									
										2
									
								
								State.ts
									
										
									
									
									
								
							|  | @ -24,7 +24,7 @@ export class State { | |||
|     // The singleton of the global state
 | ||||
|     public static state: State; | ||||
|      | ||||
|     public static vNumber = "0.0.6b"; | ||||
|     public static vNumber = "0.0.6c"; | ||||
|      | ||||
|     // The user journey states thresholds when a new feature gets unlocked
 | ||||
|     public static userJourney = { | ||||
|  |  | |||
|  | @ -58,10 +58,6 @@ | |||
|       "tagRenderings": [ | ||||
|         { | ||||
|           "mappings": [ | ||||
|             { | ||||
|               "if": "a=b", | ||||
|               "then": "xyz" | ||||
|             }, | ||||
|             { | ||||
|               "if": "artwork_type=architecture", | ||||
|               "then": { | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue