X-Git-Url: https://dev.renevier.net/?a=blobdiff_plain;f=public%2Fjs%2Fsyj.js;h=a72dbb71ff6a99d114bf93c1985f1da665cc59f3;hb=36fd88b7c9509509dc20070dae48883abe01a3fa;hp=6c4fabe79a206c7193ce0072684b3e8572314a62;hpb=a73afe740db490814c19e8a0023480b11b867db2;p=syj.git diff --git a/public/js/syj.js b/public/js/syj.js index 6c4fabe..a72dbb7 100644 --- a/public/js/syj.js +++ b/public/js/syj.js @@ -1,4 +1,4 @@ -/* This file is part of Syj, Copyright (c) 2010 Arnaud Renevier, +/* This file is part of Syj, Copyright (c) 2010-2011 Arnaud Renevier, and is published under the AGPL license. */ // avoid openlayers alerts @@ -427,7 +427,7 @@ var SYJView = { if (aPos.hasOwnProperty('lon') && aPos.hasOwnProperty('lat') && aPos.hasOwnProperty('zoom')) { center = new OpenLayers.LonLat(parseFloat(aPos.lon), parseFloat(aPos.lat)).transform(WGS84, Mercator); - zoom = parseInt(aPos.zoom); + zoom = parseInt(aPos.zoom, 10); } else if (aPos.hasOwnProperty('minlon') && aPos.hasOwnProperty('minlat') && aPos.hasOwnProperty('maxlon') && aPos.hasOwnProperty('maxlat')) { extent = new OpenLayers.Bounds(aPos.minlon, aPos.minlat, aPos.maxlon, aPos.maxlat) @@ -441,6 +441,13 @@ var SYJView = { } else { this.map.setCenter(center, zoom); } + this.resizeMap(); + }, + + resizeMap: function() { + var map = $('map'); + map.style.width = map.offsetWidth.toString() + 'px'; + map.style.height = map.offsetHeight.toString() + 'px'; }, observer: function(evt) { @@ -611,15 +618,6 @@ var SYJView = { case 400: case 404: message = SyjStrings.requestError; - if (transport.responseJSON) { - switch (transport.responseJSON.message) { - case "uniquepath": - message = SyjStrings.uniquePathError; - break; - default: - break; - } - } break; case 403: message = ""; @@ -693,7 +691,7 @@ var SYJModalClass = Class.create({ input = this.area.select('input[type="text"]')[0]; (function () { input.activate(); - }).defer(); + }.defer()); } else { this.modalbox.hide(); } @@ -1281,3 +1279,7 @@ window.onbeforeunload = function() { return undefined; } }; + +window.onresize = function() { + SYJView.resizeMap(); +};