kopia lustrzana https://github.com/manuelkasper/sotlas-frontend
				
				
				
			Accept more (partial) summit code formats that are easier to enter on mobile devices, such as "hb be156" or "be156"
							rodzic
							
								
									d12e613ab7
								
							
						
					
					
						commit
						b3be658a7d
					
				|  | @ -1,6 +1,6 @@ | |||
| <template> | ||||
|   <b-tooltip type="is-info" position="is-bottom" :active="searchTooltipActive" always animated multilined label="Enter a (partial) callsign, summit name, reference, region or coordinates here"> | ||||
|     <b-input class="search-input" ref="query" v-model="myQuery" placeholder="Summit, Callsign, Coords..." type="search" icon-pack="far" icon="search" rounded @keydown.native.enter="doSearch" @focus="searchFocus" @blur="searchBlur" /> | ||||
|     <b-input class="search-input" ref="query" v-model="myQuery" placeholder="Summit, Callsign, Coords..." autocorrect="off" autocapitalize="off" spellcheck="false" type="search" icon-pack="far" icon="search" rounded @keydown.native.enter="doSearch" @focus="searchFocus" @blur="searchBlur" /> | ||||
|   </b-tooltip> | ||||
| </template> | ||||
| 
 | ||||
|  | @ -46,12 +46,23 @@ export default { | |||
|         if (coordMatches) { | ||||
|           this.$router.push('/map/coordinates/' + coordMatches[1] + ',' + coordMatches[2] + '/16.0?popup=1') | ||||
|         } else { | ||||
|           // Region? | ||||
|           let regionMatches = this.myQuery.match(/^[A-Z0-9]{1,3}\/[A-Z]{2}$/i) | ||||
|           if (regionMatches) { | ||||
|             this.$router.push('/summits/' + this.myQuery.toUpperCase()) | ||||
|           // Full summit reference? | ||||
|           let summitRefMatches = this.myQuery.match(/^([A-Z0-9]{1,3})[ /]([A-Z]{2})[ -]?([0-9]{3})$/i) | ||||
|           if (summitRefMatches) { | ||||
|             this.$router.push('/summits/' + summitRefMatches[1].toUpperCase() + '/' + summitRefMatches[2].toUpperCase() + '-' + summitRefMatches[3]) | ||||
|           } else { | ||||
|             this.$router.push('/search?q=' + encodeURIComponent(this.myQuery)) | ||||
|             // Region? | ||||
|             let regionMatches = this.myQuery.match(/^[A-Z0-9]{1,3}\/[A-Z]{2}$/i) | ||||
|             if (regionMatches) { | ||||
|               this.$router.push('/summits/' + this.myQuery.toUpperCase()) | ||||
|             } else { | ||||
|               // Region + number without dash (and without association?) | ||||
|               let regionNumMatches = this.myQuery.match(/^([A-Z]{2})[ -]?([0-9]{3})$/i) | ||||
|               if (regionNumMatches) { | ||||
|                 this.myQuery = regionNumMatches[1].toUpperCase() + '-' + regionNumMatches[2] | ||||
|               } | ||||
|               this.$router.push('/search?q=' + encodeURIComponent(this.myQuery)) | ||||
|             } | ||||
|           } | ||||
|         } | ||||
| 
 | ||||
|  |  | |||
		Ładowanie…
	
		Reference in New Issue
	
	 Manuel Kasper
						Manuel Kasper