2 import { refresh_page } from '../lib/stores.js';
4 export let extra_classes = '';
5 export let feature = null;
9 function formatShortOSMType(sType) {
10 if (sType === 'node') return 'N';
11 if (sType === 'way') return 'W';
12 if (sType === 'relation') return 'R';
16 function handleClick() {
17 window.history.pushState([], '', 'details.html' + url_params);
22 if (feature !== null && feature.osm_type) {
23 let param = '?osmtype=';
24 if (feature.osm_type.length == 1) {
25 param += encodeURIComponent(feature.osm_type);
27 param += formatShortOSMType(feature.osm_type);
29 param += '&osmid=' + encodeURIComponent(feature.osm_id);
31 param += '&class=' + encodeURIComponent(feature.class);
32 } else if (feature.category) {
33 param += '&class=' + encodeURIComponent(feature.category);
42 <a on:click|preventDefault|stopPropagation={handleClick} href="details.html{url_params}" class={extra_classes}><slot></slot></a>