X-Git-Url: https://dev.renevier.net/?a=blobdiff_plain;f=public%2Fjs%2Fsyj.js;h=e76acccebffee2dd278672072f1ae905b1a7b152;hb=facf74e6972eafb727833b85b38b061215dea833;hp=85db31ac775e901508f4b65116bf498449d94fcb;hpb=d52fa81549b32a16a59b17732adb19a0c6559cc1;p=syj.git diff --git a/public/js/syj.js b/public/js/syj.js index 85db31a..e76accc 100644 --- a/public/js/syj.js +++ b/public/js/syj.js @@ -1,11 +1,15 @@ /* This file is part of Syj, Copyright (c) 2010-2011 Arnaud Renevier, and is published under the AGPL license. */ +"use strict"; + // avoid openlayers alerts OpenLayers.Console.userError = function(error) { SYJView.messenger.setMessage(error, "error"); }; +OpenLayers.Layer.Vector.prototype.renderers = ["SVG2", "VML", "Canvas"]; + var SyjSaveUI = { status: "unknown", @@ -292,7 +296,7 @@ var SYJView = { 'http://a.tile.openstreetmap.org/${z}/${x}/${y}.png', 'http://b.tile.openstreetmap.org/${z}/${x}/${y}.png', 'http://c.tile.openstreetmap.org/${z}/${x}/${y}.png'], - { wrapDateLine: true , attribution: SyjStrings.osmAttribution }); + { attribution: SyjStrings.osmAttribution }); layerOptions = {format: OpenLayers.Format.WKT, projection: WGS84, @@ -305,7 +309,7 @@ var SYJView = { if ($("edit-btn")) { $("edit-btn").observe('click', function() { $("geom_submit").value = SyjStrings.editAction; - this.messenger.hide(); + this.messenger.clearMessages(); this.editMode(); this.mode = 'edit'; }.bind(this)); @@ -314,7 +318,7 @@ var SYJView = { if ($("create-btn")) { $("create-btn").observe('click', function() { $("geom_submit").value = SyjStrings.createAction; - this.messenger.hide(); + this.messenger.clearMessages(); this.editMode(); this.mode = 'create'; }.bind(this)); @@ -324,7 +328,7 @@ var SYJView = { $("clone-btn").observe('click', function() { $("geom_submit").value = SyjStrings.cloneAction; $("geom_title").value = ""; - this.messenger.hide(); + this.messenger.clearMessages(); this.editMode(); this.mode = 'create'; }.bind(this)); @@ -450,18 +454,11 @@ 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) { if (evt.eventName === "simplebox:shown" && evt.memo.element !== $("termsofusearea")) { - this.messenger.hide(); + this.messenger.clearMessages(); } }, @@ -497,7 +494,7 @@ var SYJView = { } this.needsFormResubmit = false; SyjSaveUI.disable.bind(SyjSaveUI).defer(); - this.messenger.hide(); + this.messenger.clearMessages(); return true; }, @@ -576,7 +573,7 @@ var SYJView = { } }, create: function(f, line) { - this.messenger.hide(); + this.messenger.clearMessages(); $("geom_upload_container").hide(); }.bind(this) }, @@ -745,7 +742,7 @@ var SYJModalClass = Class.create({ }, reset: function() { - this.messenger.hide(); + this.messenger.clearMessages(); this.area.select('.message').invoke('setMessageStatus', null); } }); @@ -803,7 +800,7 @@ var SYJUserClass = Class.create(SYJModalClass, { }, presubmit: function() { - this.messenger.hide(); + this.messenger.clearMessages(); PseudoChecker.reset(); if (!(this.checkNotEmpty("user_pseudo", SyjStrings.userEmptyWarn))) { return false; @@ -921,7 +918,7 @@ var SYJLoginClass = Class.create(SYJModalClass, { }, presubmit: function() { - this.messenger.hide(); + this.messenger.clearMessages(); if (!(this.checkNotEmpty("login_user", SyjStrings.userEmptyWarn))) { return false; } @@ -1293,7 +1290,3 @@ window.onbeforeunload = function() { return undefined; } }; - -window.onresize = function() { - SYJView.resizeMap(); -};