GitBucket
4.21.2
Toggle navigation
Snippets
Sign in
Files
Branches
1
Releases
Issues
Pull requests
Labels
Priorities
Milestones
Wiki
Forks
nigel.stanger
/
Digital_Repository
Browse code
- Added initial code for CSS map version.
master
1 parent
34b9201
commit
b88829bbe5cbdbd6ce69b3e80bcabe739573e034
nstanger
authored
on 13 May 2006
Patch
Showing
2 changed files
Repositories/Maps/css_map.js
Repositories/Maps/css_map.php
Ignore Space
Show notes
View
Repositories/Maps/css_map.js
0 → 100755
// Global XMLHttpRequest object. var httpRequest = new XMLHttpRequest(); function load( startMillis, numEntries ) { // Open the request. Setting the third argument to TRUE makes the // request asynchronous, i.e., the browser doesn't wait. http.open('GET', 'css_map.php?top=' + numEntries, true); // When we hear something from the server, call the handleResponse() // function to find out what happened. http.onreadystatechange = function () { if(http.readyState == 4) { if (http.status == 200) // Did it work? { // Grab the response content. var response = http.responseText; } else { // Do some sort of error handling. } } }; // Send the request. http.send(null); GDownloadUrl( "google_map_generate_data.pl?top=" + numEntries, function( data, responseCode ) { var xml = GXml.parse( data ); var markerlist = xml.documentElement.getElementsByTagName( "marker" ); for ( var i = 0; i < markerlist.length; i++ ) { var point = new GLatLng( parseFloat( markerlist[i].getAttribute( "lat" ) ), parseFloat( markerlist[i].getAttribute( "long" ) ) ); map.addOverlay( createMarker( point, markerlist[i].getAttribute( "city" ), markerlist[i].getAttribute( "abs" ), markerlist[i].getAttribute( "dl" ) ) ); } // Grab finishing time. We have to do this here rather than in // the main part of the load() function because the map data // are loaded asynchronously. var endTime = new Date(); var numUA = xml.documentElement.getAttribute( "ua" ); var numUD = xml.documentElement.getAttribute( "ud" ); document.getElementById( "timer" ).innerHTML = '<span style="color:red;">' + xml.documentElement.getAttribute( "dl" ) + ' downloads' + ( ( numUD > 0 ) ? ( ' (+' + numUD + ' unmappable)' ) : '' ) + '</span> & <span style="color:blue;">' + xml.documentElement.getAttribute( "abs" ) + ' abstracts' + ( ( numUD > 0 ) ? ( ' (+' + numUA + ' unmappable)' ) : '' ) + '</span> from ' + markerlist.length + ' cities (' + xml.documentElement.getAttribute( "ips" ) + ' IP addresses), page generated in ' + ( endTime - startMillis ) + ' ms.'; } ); } }
Ignore Space
Show notes
View
Repositories/Maps/css_map.php
0 → 100755
<?php list( $start_micro, $start_sec ) = explode( " ", microtime() ); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html> <head> <title>Repository hit visualisation using CSS</title> <meta name="generator" content="BBEdit 8.2" /> <script type="text/javascript" src="css_map.js"></script> </head> <?php echo '<body onload="load(' . ( ( (float)$start_micro + (float)$start_sec ) * 1000 ) . ',' . ( ( isset( $_REQUEST['top'] ) ) ? $_REQUEST['top'] : 10 ) . ')">'; ?> <h1>Repository hit visualisation using CSS</h1> <p>Stats current as of early afternoon 8 May 2006.</p> <div id="timer">Loading…</div> <div id="map" style="background-image:map_1024x520.jpg; width:1024px; height:520px;"> </div> </body> </html>
Show line notes below