diff options
| author | Alon Levy <alon@pobox.com> | 2015-04-18 22:13:46 +0200 |
|---|---|---|
| committer | Alon Levy <alon@pobox.com> | 2015-04-21 23:51:29 +0300 |
| commit | 5dce9c5d3705decc41d923c1f6912f6b406867d2 (patch) | |
| tree | f9d889992d1f92d3b765e20343573704d32b251d /src/client | |
| parent | 0c80da82374ec10009d17f23175b8cd3faffe0f5 (diff) | |
client/buttons: export: export filename to docname-timestamp.json
Diffstat (limited to 'src/client')
| -rw-r--r-- | src/client/buttons.js | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/client/buttons.js b/src/client/buttons.js index a7b12ffc..cb7f70b1 100644 --- a/src/client/buttons.js +++ b/src/client/buttons.js @@ -14,9 +14,13 @@ $('.save a').click(function(){ }); $('#btn_export').click(function() { - var json = rz_core.main_graph.save_to_json(); - var filename = 'graph.json'; - var blob = new Blob([json], {type: 'application/json'}); + var json = rz_core.main_graph.save_to_json(), + blob = new Blob([json], {type: 'application/json'}), + now = new Date(), + date_string = ('' + now.getYear() + now.getMonth() + now.getDay() + '-' + + now.getHours() + now.getMinutes() + now.getSeconds()), + filename = rz_config.rzdoc_cur__name + '-' + date_string + '.json'; + console.log('saving ' + json.length + ' bytes to ' + filename); saveAs(blob, filename); }); |
