diff --git a/Repositories/Maps/gd_map.js b/Repositories/Maps/gd_map.js index eb1d269..e89c51d 100755 --- a/Repositories/Maps/gd_map.js +++ b/Repositories/Maps/gd_map.js @@ -1,79 +1,9 @@ -/****************************************************************************** - * Code adapted from Rasmus' 30 second AJAX Tutorial at: - * http://rajshekhar.net/blog/archives/85-Rasmus-30-second-AJAX-Tutorial.html - ******************************************************************************/ +// Grab page initialisation time. +var startTime = new Date(); -/****************************************************************************** - * Create XMLHttpRequest object. This happens once when the page - * is loaded. - */ -function createRequestObject() +function imageLoaded() { - var ro; - var browser = navigator.appName; - // In typical fashion, Microsoft does things differently. - if (browser == "Microsoft Internet Explorer") - { - ro = new ActiveXObject("Microsoft.XMLHTTP"); - } - else - { - ro = new XMLHttpRequest(); - } - return ro; + var endTime = new Date(); + document.getElementById( "timer" ).innerHTML = 'Page generated in ' + ( endTime - startTime ) + ' ms.'; } -// Global XMLHttpRequest object. -var http = createRequestObject(); - -/****************************************************************************** - * Send a request to the back end application (written in PHP here, but - * could be ASP, Java servlets, etc.). To use this, attach it to an (X)HTML - * element either as a direct link, e.g.: - * - * [foo] - * - * or via an onclick event, e.g.: - * - * - * - * If you need different handlers for different things, just create them as - * separate PHP files on the back end, and dispatch appropriately from here. - * For example, if you want a separate handler for database operations, you - * could add another function called "sendDBRequest", or something similar. - */ -function load() -{ - // Somewhere to write the timing information to. - var timer = document.getElementById( "timer" ); - timer.innerHTML = "Loading..."; - - // Grab start time. - var startTime = new Date(); - - // Open the request. - http.open('GET', 'coordinates.pl?width=900&height=457', true); - - // Set callback function. - http.onreadystatechange = - function() - { - if(http.readyState == 4) - { - if (http.status == 200) // Did it work? - { - // Grab the response content. - var response = http.responseText; - document.getElementById( "timer" ).innerHTML = ''; - } - } - // 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(); - timer.innerHTML = 'Generated in ' + ( endTime - startTime ) + ' ms.'; - }; - - // Send the request. - http.send(null); -}