diff options
| author | LV-426 <lv-426@taproot.org.il> | 2015-05-22 01:36:09 +0300 |
|---|---|---|
| committer | LV-426 <lv-426@taproot.org.il> | 2015-05-22 02:26:12 +0300 |
| commit | 8e2f5c8d854a8df2b110077055617f57e2d32402 (patch) | |
| tree | f40870151c624f6d0db3563ede596123513403ca /src | |
| parent | 0f78a324eb3a9273ac3f45d7cdec41d8c48ce28b (diff) | |
buttons.js: misc
Diffstat (limited to 'src')
| -rw-r--r-- | src/client/buttons.js | 68 |
1 files changed, 1 insertions, 67 deletions
diff --git a/src/client/buttons.js b/src/client/buttons.js index 3d275f67..9bb4159d 100644 --- a/src/client/buttons.js +++ b/src/client/buttons.js @@ -6,73 +6,7 @@ $('.tutorial').click(function(){}); var key="#47989379"; - -$('.save a').click(function(){ - var json = rz_core.main_graph.save_to_json(); - console.log('saving to local storage ' + json.length + ' bytes'); - localStorage.setItem(key, json); -}); - -$('#btn_export').click(function() { - 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); -}); - -$('.url-copy a').click(function() { - var json = rz_core.main_graph.save_to_json(); - // TODO use jquery BBQ $.param({json: json}); - var encoded = document.location.origin + '/?json=' + encodeURIComponent(json); - window.prompt('Copy to clipboard: Ctrl-C, Enter (or Cmd-C for Mac)', encoded); -}); - -var really_load = function() { - if (!rz_core.main_graph.empty()) { - return confirm('Current work will be merged with the new import, are you sure?'); - } - return true; -} - -$('.file-import').on('change', function(event) { - var file = event.target.files[0]; - var reader; - - if (!really_load()) { - return; - } - if (file === undefined) { - return; - } - console.log(file); - reader = new FileReader(); - reader.onload = (function(theFile) { - return function(e) { - var result = e.target.result; - if (e.target.readyState === FileReader.DONE) { - console.log('done reading ' + theFile.name); - console.log('got #' + result.length + ' bytes in ' + typeof(result)); - rz_core.load_from_json(result); - } - } - })(file); - reader.readAsText(file, "text/javascript"); -}); - -$('.local-storage-load a').click(function(){ - if (!really_load()) { - return; - } - var json_blob = localStorage.getItem(key) - rz_core.load_from_json(json_blob); -}); - -var logout_button = $('#btn-logout'); +var logout_button = $('#top-bar__logout-btn'); logout_button.click(function() { $.ajax({ type: "POST", |
