]> dev.renevier.net Git - syj.git/commitdiff
js strict mode in development files
authorArno Renevier <arno@renevier.net>
Thu, 11 Aug 2011 13:00:17 +0000 (15:00 +0200)
committerArno Renevier <arno@renevier.net>
Thu, 11 Aug 2011 13:00:17 +0000 (15:00 +0200)
public/js/account.js
public/js/contact.js
public/js/list.js
public/js/login.js
public/js/newpwd.js
public/js/syj.js
public/js/syjraw.js
public/js/utils.js
scripts/release.py

index 20b893cf713f2fa0ba832108280d79835de9c9ba..c54353268ea3d410d7f38a739869fdba90d9f0fe 100644 (file)
@@ -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");
 
index d3528dc5a9149b45e4bff0065c2230a495671a42..eb8cf921b25d5c103066958487bda4f2db442243 100644 (file)
@@ -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();
index 017eb299feabe2061432543531c05702f53903de..c30fa334aec09efeaca88f4a412c4d850bce9b9c 100644 (file)
@@ -1,3 +1,5 @@
+"use strict";
+
 var WGS84 = new OpenLayers.Projection("EPSG:4326");
 var Mercator = new OpenLayers.Projection("EPSG:900913");
 
index 25562ed14b3382a02c9a6653a62213acaa068dbe..491bfad6d75455f01b5399d962880f5c8be601a4 100644 (file)
@@ -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();
index 977e9959a7418aa7dc463543f654332d54b32b02..9faf70b5f103c787fa76f4e3f2080fa7a296d6aa 100644 (file)
@@ -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});
index 4b62b84e1faccc90b9a538fd9393f018636598f2..e76acccebffee2dd278672072f1ae905b1a7b152 100644 (file)
@@ -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");
index 3606018658cb7560ab22918a3227e589ac221396..46a44c255e12e5a60a0b51a456259eda11d09705 100644 (file)
@@ -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();
index e2126f5950a9d553590c2e0731a59c9172f69a2e..eab837dc2b4e099000f7c2779a15a486b41a05ac 100644 (file)
@@ -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;
index a567d8539bc2d455cedc74d7f4ee63812113992a..9a1b4d2959fc65726bdf282827dc35bbcc6147e8 100755 (executable)
@@ -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',