From: Arno Renevier Date: Thu, 11 Aug 2011 13:00:17 +0000 (+0200) Subject: js strict mode in development files X-Git-Tag: v.0.3.5~4 X-Git-Url: https://dev.renevier.net/?p=syj.git;a=commitdiff_plain;h=facf74e6972eafb727833b85b38b061215dea833 js strict mode in development files --- diff --git a/public/js/account.js b/public/js/account.js index 20b893c..c543532 100644 --- a/public/js/account.js +++ b/public/js/account.js @@ -1,6 +1,8 @@ /* This file is part of Syj, Copyright (c) 2010-2011 Arnaud Renevier, and is published under the AGPL license. */ +"use strict"; + document.observe("dom:loaded", function() { var currentmail = $("account_email").value, form = $("accountform"); diff --git a/public/js/contact.js b/public/js/contact.js index d3528dc..eb8cf92 100644 --- a/public/js/contact.js +++ b/public/js/contact.js @@ -1,6 +1,8 @@ /* This file is part of Syj, Copyright (c) 2010-2011 Arnaud Renevier, and is published under the AGPL license. */ +"use strict"; + document.observe("dom:loaded", function() { var form = $("contactform"); form.setfocus(); diff --git a/public/js/list.js b/public/js/list.js index 017eb29..c30fa33 100644 --- a/public/js/list.js +++ b/public/js/list.js @@ -1,3 +1,5 @@ +"use strict"; + var WGS84 = new OpenLayers.Projection("EPSG:4326"); var Mercator = new OpenLayers.Projection("EPSG:900913"); diff --git a/public/js/login.js b/public/js/login.js index 25562ed..491bfad 100644 --- a/public/js/login.js +++ b/public/js/login.js @@ -1,6 +1,8 @@ /* This file is part of Syj, Copyright (c) 2010-2011 Arnaud Renevier, and is published under the AGPL license. */ +"use strict"; + document.observe("dom:loaded", function() { var form = $("loginform"); form.setfocus(); diff --git a/public/js/newpwd.js b/public/js/newpwd.js index 977e995..9faf70b 100644 --- a/public/js/newpwd.js +++ b/public/js/newpwd.js @@ -1,5 +1,8 @@ /* This file is part of Syj, Copyright (c) 2010-2011 Arnaud Renevier, and is published under the AGPL license. */ + +"use strict"; + function insertErrorBefore(elt, messageError) { var message = new Element("div", {className: 'error'}).update(messageError); elt.insert({before: message}); diff --git a/public/js/syj.js b/public/js/syj.js index 4b62b84..e76accc 100644 --- a/public/js/syj.js +++ b/public/js/syj.js @@ -1,6 +1,8 @@ /* 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"); diff --git a/public/js/syjraw.js b/public/js/syjraw.js index 3606018..46a44c2 100644 --- a/public/js/syjraw.js +++ b/public/js/syjraw.js @@ -1,3 +1,5 @@ +"use strict"; + var WGS84 = new OpenLayers.Projection("EPSG:4326"); var Mercator = new OpenLayers.Projection("EPSG:900913"); @@ -37,7 +39,7 @@ function init() { map.addLayers([baseLayer, viewLayer]); viewLayer.addFeatures([wkt.read(gInitialGeom.data)]); - extent = viewLayer.getDataExtent(); + var extent = viewLayer.getDataExtent(); map.updateSize(); map.zoomToExtent(extent); resizeMap(); diff --git a/public/js/utils.js b/public/js/utils.js index e2126f5..eab837d 100644 --- a/public/js/utils.js +++ b/public/js/utils.js @@ -1,6 +1,8 @@ /* This file is part of Syj, Copyright (c) 2010-2011 Arnaud Renevier, and is published under the AGPL license. */ +"use strict"; + var CloseBtn = Class.create({ initialize: function(elt, options) { var btn, imgsrc, style; diff --git a/scripts/release.py b/scripts/release.py index a567d85..9a1b4d2 100755 --- a/scripts/release.py +++ b/scripts/release.py @@ -40,7 +40,17 @@ def genscripts(): # copy scripts OpenLayers.js for path in glob.glob('public/js/*.js'): - shutil.copy(path, tmpdir) + if os.path.islink(path): + shutil.copy(path, tmpdir) + else: + # remove "use strict"; directive + with open(path) as inp: + dest = pathjoin(tmpdir, os.path.basename(path)) + with open(dest, "w") as out: + for line in inp: + sline = line.strip() + if sline != '"use strict"' and sline != '"use strict";': + out.write(line) # build OpenLayers.js subprocess.call(['python', 'buildUncompressed.py',