summaryrefslogtreecommitdiff
path: root/scripts/buttons.js
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/buttons.js')
-rw-r--r--scripts/buttons.js23
1 files changed, 12 insertions, 11 deletions
diff --git a/scripts/buttons.js b/scripts/buttons.js
index 346e576b..957b1515 100644
--- a/scripts/buttons.js
+++ b/scripts/buttons.js
@@ -17,20 +17,21 @@ $('.saveToFile').click(function() {
location.href = 'data:text/json;base64,' + window.btoa(json);
});
-$('.load').click(function(){
- var acceptLoad=true;
-
- if (nodes.length>0){
- acceptLoad = confirm('All unsaved changes will be deleted, are you sure?');
+var really_load = function() {
+ if (nodes.length > 0){
+ return confirm('All unsaved changes will be deleted, are you sure?');
}
+ return true;
+}
- if(acceptLoad){
- links=[]; // TODO - not global
- nodes=[]; // TODO - not global
- var json_blob = localStorage.getItem(key)
- graph.load_from_json(json_blob);
+$('.load').click(function(){
+ if (!really_load()){
+ return;
}
-
+ links=[]; // TODO - not global
+ nodes=[]; // TODO - not global
+ var json_blob = localStorage.getItem(key)
+ graph.load_from_json(json_blob);
});
$('.deliverabletest').click(function(){