From 5dce9c5d3705decc41d923c1f6912f6b406867d2 Mon Sep 17 00:00:00 2001 From: Alon Levy Date: Sat, 18 Apr 2015 22:13:46 +0200 Subject: client/buttons: export: export filename to docname-timestamp.json --- src/client/buttons.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/client') 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); }); -- cgit v1.3.1