summaryrefslogtreecommitdiff
path: root/chimere/static/main_map.js
diff options
context:
space:
mode:
Diffstat (limited to 'chimere/static/main_map.js')
-rw-r--r--chimere/static/main_map.js23
1 files changed, 23 insertions, 0 deletions
diff --git a/chimere/static/main_map.js b/chimere/static/main_map.js
index 792021c..5964aea 100644
--- a/chimere/static/main_map.js
+++ b/chimere/static/main_map.js
@@ -467,6 +467,29 @@ function createParams(center, zoom, layers) {
return params;
}
+var tiny_url = '';
+var redirect_url = '';
+
+function processTinyUrl(url){
+ var params = OpenLayers.Util.getParameterString(this.createParams());
+ redirect_url = url;
+ var uri = extra_url + "getTinyUrl/" + params;
+ OpenLayers.loadURL(uri, '', this, getTinyfiedUrl);
+}
+
+/* get a tiny url */
+function getTinyfiedUrl(response){
+ tiny_url = '';
+ if (response.responseText.indexOf('no results') == -1) {
+ var json = new OpenLayers.Format.JSON();
+ var result = json.read(response.responseText);
+ tiny_url = result.url;
+ if (!redirect_url || !tiny_url) return;
+ window.open(redirect_url+tiny_url);
+ }
+}
+
+
/* main initialisation function */
function init(){
/* set the main map */