From 4e794232ab06a1e00868b7b2acd082710dfc020c Mon Sep 17 00:00:00 2001 From: jonsowman Date: Fri, 11 Jun 2010 15:17:56 +0100 Subject: [PATCH] Moved initialisation sequences to pred.js and slightly improved hash string checking --- predict/index.php | 30 +----------------------------- predict/js/pred.js | 30 +++++++++++++++++++++++++++++- 2 files changed, 30 insertions(+), 30 deletions(-) diff --git a/predict/index.php b/predict/index.php index 4c8d47d..970847c 100644 --- a/predict/index.php +++ b/predict/index.php @@ -42,37 +42,9 @@ var burst_img = "images/pop-marker.png"; var clickListener; var clickMarker; -function initialize() { - // are we trying to display an old prediction? - if(window.location.hash != "") { - var ln = window.location.hash.split("="); - current_uuid = ln[1]; - } - - initMap(52, 0, 8); - populateLaunchSite(); - setupEventHandlers(); - // make launch card draggable - $("#input_form").draggable({containment: '#map_canvas'}); - - // see if we want an old prediction displayed - if ( current_uuid != '0' ) { - appendDebug("Got an old UUID to plot:
" + current_uuid); - appendDebug("Trying to populate form with scenario data..."); - populateFormByUUID(current_uuid); - appendDebug("Trying to get flight path from server..."); - getCSV(current_uuid); - } - - // plot the initial launch location - plotClick(); -} - - - - +
diff --git a/predict/js/pred.js b/predict/js/pred.js index c4eca07..69a0a0c 100644 --- a/predict/js/pred.js +++ b/predict/js/pred.js @@ -9,7 +9,35 @@ */ $(document).ready(function() { - // do nothing + // are we trying to display an old prediction? + if(window.location.hash != "") { + var ln = window.location.hash.split("="); + var posteq = ln[1]; + if ( posteq.length != 40 ) { + throwError("The supplied hashstring was not a valid UUID."); + appendDebug("The hashstring was not the expected length"); + } else { + current_uuid = posteq; + } + } + + initMap(52, 0, 8); + populateLaunchSite(); + setupEventHandlers(); + // make launch card draggable + $("#input_form").draggable({containment: '#map_canvas'}); + + // see if we want an old prediction displayed + if ( current_uuid != '0' ) { + appendDebug("Got an old UUID to plot:
" + current_uuid); + appendDebug("Trying to populate form with scenario data..."); + populateFormByUUID(current_uuid); + appendDebug("Trying to get flight path from server..."); + getCSV(current_uuid); + } + + // plot the initial launch location + plotClick(); }); function predSub() {