-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
62 lines (49 loc) · 2.11 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<!doctype html><html><head>
<meta charset="utf-8"/>
<title>Achavi changeset analysis</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1">
<style>body{margin:1em auto;max-width:40em;padding:0 1em;font:1.2em/1.6em sans-serif;text-align: center;}</style>
</head><body onload="init()">
<div>
Please enter an <a href="https://www.openstreetmap.org/about">OpenStreetMap</a>
changeset ID or URL to analyze it with <a href="https://wiki.openstreetmap.org/wiki/Achavi">Achavi</a>
</div>
<div>
<input type="text" id="in"/>
<button id="but">Analyze</button>
</div>
<div style="color: #F00;" id="out"></div>
<div style="margin-top: 2em; display: inline-block;">... You can also use this <a href="https://en.wikipedia.org/wiki/Bookmarklet">bookmarklet</a>:
<div style="background-color: #DDD; font-family: monospace; text-align: left;">
javascript:(function(){id=location.href.match(/www\.openstreetmap\.org\/changeset\/(\d+)/);if(id!=null){window.open('https://overpass-api.de/achavi/?changeset='+id[1]);}else{alert('This%20is%20not%20a%20valid%20OSM%20changeset%20page.')}})()
</div>
Drag and drop <a href="javascript:(function(){id=location.href.match(/www\.openstreetmap\.org\/changeset\/(\d+)/);if(id!=null){window.open('https://overpass-api.de/achavi/?changeset='+id[1]);}else{alert('This%20is%20not%20a%20valid%20OSM%20changeset%20page.')}})()">this link</a> to your bookmark bar to install it. Some browsers also allow right-clicking the link, then clicking "bookmark this link".
</div>
<script>
var elIn, elOut, elButton;
function init()
{
elIn=document.getElementById("in");
elOut=document.getElementById("out");
elButton=document.getElementById("but");
but.onclick = run;
}
function run()
{
var changeset = elIn.value;
if (isNaN(changeset))
{
changeset = changeset.replace(/https?\:\/\/www.openstreetmap.org\/changeset\/([0-9]+)(\#.*)?/, "$1");
}
if (isNaN(changeset))
{
message("Not a valid changeset Id");
}
else window.location = 'https://overpass-api.de/achavi/?changeset=' + changeset;
}
function message(str)
{
elOut.innerHTML = str;
}
</script>
</body></html>