show sources
1
assets/favicons/README.md
Normal file
|
@ -0,0 +1 @@
|
||||||
|
All images in this directory belong to their copyright owners and are only used as small icons.
|
BIN
assets/favicons/ggg.at.png
Normal file
After Width: | Height: | Size: 4.9 KiB |
BIN
assets/favicons/ggg.at_redrawn.png
Normal file
After Width: | Height: | Size: 723 B |
BIN
assets/favicons/kurier.at.png
Normal file
After Width: | Height: | Size: 1 KiB |
BIN
assets/favicons/meinbezirk.at.png
Normal file
After Width: | Height: | Size: 2.9 KiB |
BIN
assets/favicons/neos.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
assets/favicons/spoe.png
Normal file
After Width: | Height: | Size: 854 B |
BIN
assets/favicons/wien.gv.at.png
Normal file
After Width: | Height: | Size: 863 B |
7
custom.d.ts
vendored
|
@ -1,4 +1,9 @@
|
||||||
declare module "*.svg" {
|
declare module "*.svg" {
|
||||||
const content: any;
|
const content: string;
|
||||||
|
export default content;
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module "*.png" {
|
||||||
|
const content: string;
|
||||||
export default content;
|
export default content;
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,9 +88,6 @@
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"additionalProperties": false,
|
"additionalProperties": false,
|
||||||
"properties": {
|
"properties": {
|
||||||
"wayID": {
|
|
||||||
"type": "integer"
|
|
||||||
},
|
|
||||||
"coords": {
|
"coords": {
|
||||||
"$ref": "#/definitions/Coordinates"
|
"$ref": "#/definitions/Coordinates"
|
||||||
},
|
},
|
||||||
|
|
|
@ -18,6 +18,12 @@ export interface OSMNodeSource {
|
||||||
nodes: number[]
|
nodes: number[]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface Source {
|
||||||
|
type: "news" | "official" | "proposal" | "streetview" | "in person"
|
||||||
|
date: string
|
||||||
|
url?: string
|
||||||
|
}
|
||||||
|
|
||||||
export interface GeoData {
|
export interface GeoData {
|
||||||
coords: Coords,
|
coords: Coords,
|
||||||
length: number // in meter
|
length: number // in meter
|
||||||
|
@ -27,7 +33,10 @@ export interface Crossing {
|
||||||
id: number
|
id: number
|
||||||
name: string
|
name: string
|
||||||
bezirk: number
|
bezirk: number
|
||||||
|
comment?:string
|
||||||
|
set?:string
|
||||||
type: FlagType
|
type: FlagType
|
||||||
|
sources: Source[]
|
||||||
geosource: OSMWaySource | OSMNodeSource | RawCoordSource,
|
geosource: OSMWaySource | OSMNodeSource | RawCoordSource,
|
||||||
geo?: GeoData
|
geo?: GeoData
|
||||||
}
|
}
|
||||||
|
|
12
src/main.ts
|
@ -19,6 +19,7 @@ import dataURL from "../data/data.json?url"
|
||||||
import {Crossing} from "../interfaces";
|
import {Crossing} from "../interfaces";
|
||||||
import prideFlag from "../assets/prideflag.svg"
|
import prideFlag from "../assets/prideflag.svg"
|
||||||
import transFlag from "../assets/transflag.svg"
|
import transFlag from "../assets/transflag.svg"
|
||||||
|
import {displaySources} from "./text";
|
||||||
|
|
||||||
|
|
||||||
function averageCoords(coords: number[][]): number[] {
|
function averageCoords(coords: number[][]): number[] {
|
||||||
|
@ -179,14 +180,20 @@ map.on('singleclick', function (event) {
|
||||||
if (id > 10000) {
|
if (id > 10000) {
|
||||||
id -= 10000
|
id -= 10000
|
||||||
}
|
}
|
||||||
console.info(id)
|
|
||||||
const crossing = metaData[id]
|
const crossing = metaData[id]
|
||||||
|
|
||||||
content.innerHTML = "";
|
content.innerHTML = "";
|
||||||
const p = document.createElement("p")
|
const p = document.createElement("p")
|
||||||
p.innerText = crossing.name
|
p.innerText = crossing.name
|
||||||
content.appendChild(p)
|
content.appendChild(p)
|
||||||
|
if (crossing.comment) {
|
||||||
|
const p = document.createElement("p")
|
||||||
|
const small = document.createElement("small")
|
||||||
|
small.innerText = crossing.comment
|
||||||
|
p.appendChild(small)
|
||||||
|
content.appendChild(p)
|
||||||
|
}
|
||||||
|
displaySources(crossing.sources, content)
|
||||||
overlay.setPosition(coordinate);
|
overlay.setPosition(coordinate);
|
||||||
|
|
||||||
}, {hitTolerance: 5})
|
}, {hitTolerance: 5})
|
||||||
|
@ -195,4 +202,3 @@ map.on('singleclick', function (event) {
|
||||||
closer.blur();
|
closer.blur();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
console.log(dataURL)
|
|
||||||
|
|
48
src/text.ts
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
import {Source} from "../interfaces";
|
||||||
|
import gggIcon from "../assets/favicons/ggg.at_redrawn.png"
|
||||||
|
import meinBezirkIcon from "../assets/favicons/meinbezirk.at.png"
|
||||||
|
import kurierIcon from "../assets/favicons/kurier.at.png"
|
||||||
|
import spoeIcon from "../assets/favicons/spoe.png"
|
||||||
|
import neosIcon from "../assets/favicons/neos.png"
|
||||||
|
import WienIcon from "../assets/favicons/wien.gv.at.png"
|
||||||
|
|
||||||
|
export function displaySources(sources: Source[], content: HTMLElement) {
|
||||||
|
sources.forEach(s => {
|
||||||
|
if (!s.url) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const img = document.createElement("img")
|
||||||
|
const a = document.createElement("a")
|
||||||
|
a.rel = "noopener"
|
||||||
|
a.target = "_blank"
|
||||||
|
a.title = s.date
|
||||||
|
img.src = ""
|
||||||
|
img.width = img.height = 32
|
||||||
|
a.appendChild(img)
|
||||||
|
a.href = s.url! // TODO: missing url
|
||||||
|
switch (a.hostname) {
|
||||||
|
case "www.ggg.at":
|
||||||
|
img.src = gggIcon
|
||||||
|
break
|
||||||
|
case "www.meinbezirk.at":
|
||||||
|
img.src = meinBezirkIcon
|
||||||
|
break
|
||||||
|
case "kurier.at":
|
||||||
|
img.src = kurierIcon
|
||||||
|
break
|
||||||
|
case "www.neos.eu":
|
||||||
|
img.src = neosIcon
|
||||||
|
break
|
||||||
|
case "www.wien.gv.at":
|
||||||
|
img.src=WienIcon
|
||||||
|
break
|
||||||
|
}
|
||||||
|
if (a.hostname.includes("spoe")) {
|
||||||
|
img.src = spoeIcon
|
||||||
|
}
|
||||||
|
if (img.src === document.URL) {
|
||||||
|
a.innerText = a.hostname
|
||||||
|
}
|
||||||
|
content.appendChild(a)
|
||||||
|
})
|
||||||
|
}
|