source: trunk/npemap.org.uk/static/distantPostcodes.html @ 416

Last change on this file since 416 was 289, checked in by Dominic Hargreaves, 14 years ago

Some more conversions.

File size: 2.1 KB
Line 
1<!--#set var="title" value="Distant Postcodes" -->
2<!--#set var="link" value="/distantPostcodes.html" -->
3<!--#set var="shownav" value="yes" -->
4<!--#include virtual="inc/header.shtml" -->
5
6
7<div id="actions">
8</div>
9
10<br />
11
12<div id="distant">
13</div>
14
15<script type="text/javascript">
16var actions = document.getElementById("actions");
17var distant = document.getElementById("distant");
18
19function addProblem(id,postcode,matchpart,easting,northing,avg_e,avg_n,source_id,source_name) {
20        var disp_source = "NPE Submission";
21        if(source_id == 1) {
22                disp_source = "FreeThePostcode";
23        }
24
25        var div = document.createElement("div");
26        div.appendChild(document.createTextNode(postcode + " (" + id + " - " + disp_source + "), matched from " + matchpart + ", was at "));
27
28        var pl = document.createElement("a");
29        pl.appendChild(document.createTextNode(easting + " " + northing));
30        pl.href = "tiles/map.html#" + Math.round(easting/1000) + "," + Math.round(northing/1000) + ",1";
31        div.appendChild(pl);
32
33        div.appendChild(document.createTextNode(", instead of at "));
34
35        var al = document.createElement("a");
36        al.appendChild(document.createTextNode(avg_e + " " + avg_e));
37        al.href = "tiles/map.html#" + Math.round(avg_e/1000) + "," + Math.round(avg_n/1000) + ",1";
38        div.appendChild(al);
39
40        var e_km = Math.abs(Math.round((easting-avg_e)/1000));
41        var n_km = Math.abs(Math.round((northing-avg_n)/1000));
42        div.appendChild(document.createTextNode(", out by " + e_km + "km and " + n_km + "km"));
43
44        distant.appendChild(div);
45}
46
47// How should we call the script?
48var cgi = "/cgi/get-distant-postcodes.fcgi";
49var oLink = document.createElement("a");
50if(location.href.indexOf("?outer1") > 0) {
51        cgi = cgi + "?outer1=yes";
52        oLink.href = "?";
53        oLink.appendChild(document.createTextNode("Match only by outer parts"));
54} else {
55        oLink.href = "?outer1=yes";
56        oLink.appendChild(document.createTextNode("Match by outer in 1st inner"));
57}
58actions.appendChild(oLink);
59
60// Include the script
61var sc = document.createElement("script");
62sc.type = "text/javascript";
63sc.src = cgi;
64actions.appendChild(sc);
65</script>
66<!--#include virtual="inc/footer.shtml" -->
67
Note: See TracBrowser for help on using the repository browser.