diff options
| author | LV-426 <lv-426@taproot.org.il> | 2014-11-11 01:49:00 +0200 |
|---|---|---|
| committer | Alon Levy <alon@pobox.com> | 2014-11-11 14:30:09 +0200 |
| commit | b17a3151234bdff9db3abc12a4267e7ae7704813 (patch) | |
| tree | 45ca6ae7c2135bed09016a8dcd5d992dccffbc3d /scripts | |
| parent | 76712d524d4df4a3bcef485d68630e466c54dbc8 (diff) | |
model/graph: cleanup module function definition, return block
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/model/graph.js | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/scripts/model/graph.js b/scripts/model/graph.js index 34f778c2..80a4d7f5 100644 --- a/scripts/model/graph.js +++ b/scripts/model/graph.js @@ -537,7 +537,7 @@ function Graph(el) { rz_api_backend.clone(0, on_success); } - function load_from_json(json) { + this.load_from_json = function(json) { var data = JSON.parse(json); var i, node, link; @@ -565,9 +565,8 @@ function Graph(el) { } this.clear_history(); } - this.load_from_json = load_from_json; - function save_to_json() { + this.save_to_json = function() { var d = {"nodes":[], "links":[]}; for(var i = 0 ; i < nodes.length ; i++){ var node = nodes[i]; @@ -594,20 +593,19 @@ function Graph(el) { } return JSON.stringify(d); } - this.save_to_json = save_to_json; - function set_user(user) { + this.set_user = function(user) { this.user = user; this.history = new History(this.user, $('svg g.zoom')[0]); console.log('new user: ' + user); } - this.set_user = set_user; function clear_history() { if (this.history !== undefined) { this.history.clear(); } } + this.clear_history = clear_history; var get_nodes = function() { return nodes; }; @@ -615,9 +613,11 @@ function Graph(el) { var get_links = function() { return links; }; this.links = get_links; + +} + +return { + Graph: Graph, }; - return { - Graph: Graph, - }; }); |
