client/js/full-json.js
changeset 62 f9019462465a
parent 36 d249d36ecc37
child 67 d341117f9370
--- a/client/js/full-json.js	Thu Feb 14 12:25:58 2013 +0100
+++ b/client/js/full-json.js	Thu Feb 14 17:39:52 2013 +0100
@@ -11,27 +11,32 @@
             _renkan.renderer.autoScale();
         });
     }
-    var _save = function() {
-        var _data = _proj.toJSON();
-        Rkns.$.ajax({
-            type: _opts.http_method,
-            url: _opts.url,
-            contentType: "application/json",
-            data: JSON.stringify(_data),
-            success: function(data, textStatus, jqXHR) {
-            }
-        });
-        
-    }
-    var _thrSave = Rkns._.throttle(
-        function() {
-            setTimeout(_save, 100)
-        }, 1000);
-    _load();
-    _proj.on("add:nodes add:edges add:users", function(_model) {
-        _model.on("change remove", function(_model) {
+    if (!_renkan.read_only) {
+        var _save = function() {
+            var _data = _proj.toJSON();
+            Rkns.$.ajax({
+                type: _opts.http_method,
+                url: _opts.url,
+                contentType: "application/json",
+                data: JSON.stringify(_data),
+                success: function(data, textStatus, jqXHR) {
+                }
+            });
+            
+        }
+        var _thrSave = Rkns._.throttle(
+            function() {
+                setTimeout(_save, 100)
+            }, 1000);
+        _proj.on("add:nodes add:edges add:users", function(_model) {
+            _model.on("change remove", function(_model) {
+                _thrSave();
+            });
             _thrSave();
         });
-        _thrSave();
-    });
+        _proj.on("change", function() {
+            _thrSave();
+        });
+    }
+    _load();
 }