From 15ea225d109a53a5bee985c2c492428ad5b78b18 Mon Sep 17 00:00:00 2001 From: Kevin Date: Wed, 10 Apr 2013 03:49:23 -0700 Subject: [PATCH] Fix url links for zoom, add ll param support from stock intel link button --- code/location.js | 13 ++++++++++--- code/utils_misc.js | 2 +- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/code/location.js b/code/location.js index 2860a9a5..efa85586 100644 --- a/code/location.js +++ b/code/location.js @@ -21,11 +21,18 @@ window.storeMapPosition = function() { // returns a map that shows the whole world. window.getPosition = function() { if(getURLParam('latE6') && getURLParam('lngE6')) { - console.log("mappos: reading URL params"); + console.log("mappos: reading email URL params"); var lat = parseInt(getURLParam('latE6'))/1E6 || 0.0; var lng = parseInt(getURLParam('lngE6'))/1E6 || 0.0; - // google seems to zoom in far more than leaflet - var z = parseInt(getURLParam('z'))+1 || 17; + var z = parseInt(getURLParam('z')) || 17; + return {center: new L.LatLng(lat, lng), zoom: z > 18 ? 18 : z}; + } + + if(getURLParam('ll')) { + console.log("mappos: reading stock Intel URL params"); + var lat = parseFloat(getURLParam('ll').split(",")[0]) || 0.0; + var lng = parseFloat(getURLParam('ll').split(",")[1]) || 0.0; + var z = parseInt(getURLParam('z')) || 17; return {center: new L.LatLng(lat, lng), zoom: z > 18 ? 18 : z}; } diff --git a/code/utils_misc.js b/code/utils_misc.js index f97ffdf6..51e61030 100644 --- a/code/utils_misc.js +++ b/code/utils_misc.js @@ -257,7 +257,7 @@ window.setPermaLink = function(elm) { var c = map.getCenter(); var lat = Math.round(c.lat*1E6); var lng = Math.round(c.lng*1E6); - var qry = 'latE6='+lat+'&lngE6='+lng+'&z=' + (map.getZoom()-1); + var qry = 'latE6='+lat+'&lngE6='+lng+'&z=' + map.getZoom(); $(elm).attr('href', '/intel?' + qry); }