source: trunk/npemap.org.uk/static/postcodeine/index.html @ 286

Last change on this file since 286 was 286, checked in by David Sheldon, 13 years ago

Home link.

File size: 6.0 KB
Line 
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2<html>
3<!--
4    index.html:
5    HTML for postcodeine
6
7    Copyright (c) 2006 UK Citizens Online Democracy. All rights reserved.
8    Email: chris@mysociety.org; WWW: http://www.mysociety.org/
9   
10                According to http://www.mysociety.org/?p=109 this is licenced under
11                the Affero GPL http://www.affero.org/oagpl.html
12
13    # Changed 2006/11/01 David Sheldon to change the path to the CGI
14                # and change the text on the page.
15
16
17-->
18<head>
19<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
20<title>
21Postcodeine
22</title>
23
24<script type="text/javascript">
25<!--
26
27var updateTimerId = false;
28var panTimerId = false;
29
30var xmlhttp1 = false;
31var xmlhttp2 = false;
32
33var current_x = 451;
34var current_y = 600;
35
36var target_x = current_x;
37var target_y = current_y;
38
39function panZoom() {
40    if (Math.abs(current_x - target_x) < 1
41        && Math.abs(current_y - target_y) < 1)
42        return;
43    current_x = Math.round((current_x + target_x) / 2);
44    current_y = Math.round((current_y + target_y) / 2);
45   
46    var x = Math.round(200 - current_x);
47    var y = Math.round(200 - current_y);
48    /* This is the pixel coordinate in the big map where we want the center
49     * of the zoomed region to be. */
50    var style = "position: relative; top: " + y + "; left: " + x + ";";
51   
52    document.getElementById("p1200b").setAttribute("style", style);
53    document.getElementById("p1200").setAttribute("style", style);
54   
55    if (panTimerId) window.clearTimeout(panTimerId);
56    panTimerId = window.setTimeout(panZoom, 50);
57}
58
59function processCoords() {
60    var t;
61    if (xmlhttp1.readyState != 4 || xmlhttp1.status != 200) return;
62    t = xmlhttp1.responseText;
63
64    var cc = t.split(",");
65    x = parseFloat(cc[0]);
66    y = parseFloat(cc[1]);
67    if (!isNaN(x) && !isNaN(y)) {
68        if (x == 0 && y == 0)
69            return;
70        x *= 902;
71        y *= 1200;
72
73        target_x = x;
74        target_y = y;
75
76        if (panTimerId) window.clearTimeout(panTimerId);
77        panTimerId = window.setTimeout(panZoom, 10);
78    }
79}
80
81function processZones() {
82    if (xmlhttp2.readyState != 4 || xmlhttp2.status != 200) return;
83    document.getElementById("zonelist").innerHTML = xmlhttp2.responseText;
84}
85
86function doUpdate() {
87    if (!xmlhttp1) {
88        /* from http://developer.apple.com/internet/webcontent/xmlhttpreq.html */
89        if (window.XMLHttpRequest) {
90            try {
91                xmlhttp1 = new XMLHttpRequest();
92                xmlhttp2 = new XMLHttpRequest();
93            } catch(e) {
94                xmlhttp1 = false;
95                xmlhttp2 = false;
96            }
97        } else if(window.ActiveXObject) {
98            try {
99                xmlhttp1 = new ActiveXObject("Msxml2.XMLHTTP");
100                xmlhttp2 = new ActiveXObject("Msxml2.XMLHTTP");
101            } catch(e) {
102                try {
103                    xmlhttp1 = new ActiveXObject("Microsoft.XMLHTTP");
104                    xmlhttp2 = new ActiveXObject("Microsoft.XMLHTTP");
105                } catch(e) {
106                    xmlhttp1 = false;
107                    xmlhttp2 = false;
108                }
109            }
110        }
111    }
112    var p = document.getElementById("pc").value.toUpperCase();
113    var prefix = "";
114    for (var i = 0; i < p.length; ++i) {
115        var c = p.substr(i, 1);
116        if ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".indexOf(c) != -1)
117            prefix += c;
118    }
119   
120    xmlhttp1.abort();
121    xmlhttp1.onreadystatechange = processCoords;
122    xmlhttp1.open("GET", "../../cgi/postcodeine.fcgi?X" + prefix, true);
123    xmlhttp1.send("");
124
125    xmlhttp2.abort();
126    xmlhttp2.onreadystatechange = processZones;
127    xmlhttp2.open("GET", "../../cgi/postcodeine.fcgi?Z" + prefix, true);
128    xmlhttp2.send("");
129   
130    document.getElementById("p400").src = "../../cgi/postcodeine.fcgi?S" + prefix;
131    document.getElementById("p1200").src = "../../cgi/postcodeine.fcgi?B" + prefix;
132}
133//-->
134</script>
135
136</head>
137<body onload="document.getElementById('pc').focus(); doUpdate();">
138
139
140<div id="content">
141<!-- overview basemap -->
142<div style="position: absolute; left: 0; top: 0; z-index: 4;">
143<img src="basemap-400px.png" alt="" width="301" height="400">
144</div>
145
146<div style="position: absolute; left: 0; top: 0; z-index: 5;">
147<img src="../../cgi/postcodeine.fcgi?S" id="p400" alt="" width="301" height="400">
148</div>
149
150<!-- zoom basemap -->
151<div style="position: absolute; left: 306; top: 0; z-index: 4; width: 400; height: 400; overflow: hidden;">
152<img src="basemap-1200px.png" id="p1200b" alt="" width="902" height="1200" style="position: relative; left: -251; top: -400;">
153</div>
154
155<div style="position: absolute; left: 306; top: 0; z-index: 5; width: 400; height: 400; overflow: hidden;">
156<img src="../../cgi/postcodeine.fcgi?B" id="p1200" alt="" width="902" height="1200" style="position: relative; left: -251; top: -400;">
157</div>
158
159<!-- list of zones -->
160<div id="zonelist" style="position: absolute; left: 706; top: 0; z-index: 5; width: 15em; height: 400; overflow: hidden;">
161</div>
162
163<div id="edit" style="position: absolute; top: 420; max-width: 800px;">
164<h1>Postcodeine - Showing progress - <a href="/">Home</a></h1>
165
166<div style="background: #eee; padding: 1.5em; font-weight: bold;">
167<input type="text" id="pc" name="pc" onkeydown="if (updateTimerId) window.clearTimeout(updateTimerId); updateTimerId = window.setTimeout(doUpdate, 10); return true;" autocomplete="off">
168&#x2190; start typing any postcode in the box
169</div>
170
171<p>The data on this page is updated nightly.  It will be integrated with the rest of the site
172better at some point.</p>
173
174<hr>
175
176<p>Based on original <a href="http://www.mysociety.org/">mySociety</a> code by <a href="http://ex-parrot.com/~chris/">Chris Lightfoot</a>.
177<a href="source.tar.gz">Code</a> | <a href="http://www.mysociety.org/?p=109">Learn more</a>
178</p>
179
180</div>
181
182</div>
183
184<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
185</script>
186<script type="text/javascript">
187_uacct = "UA-732621-2";
188if (typeof urchinTracker == 'function') urchinTracker();
189</script>
190</body>
191</html>
Note: See TracBrowser for help on using the repository browser.