diff --git a/src/js/Constants.js b/src/js/Constants.js index 64f32e2e..943b0310 100644 --- a/src/js/Constants.js +++ b/src/js/Constants.js @@ -58,6 +58,9 @@ var Constants = { // The datastore limit is 1 MiB, which we roughly approximate to 1 million characters. APPENGINE_SAVE_LIMIT : 1 * 1024 * 1024, + // Message displayed when an action will lead to erase the current animation. + CONFIRM_OVERWRITE: 'This will replace your current animation, are you sure you want to continue?', + // SERVICE URLS APPENGINE_SAVE_URL : 'save', IMAGE_SERVICE_UPLOAD_URL : 'http://piskel-imgstore-b.appspot.com/__/upload', diff --git a/src/js/controller/dialogs/backups/steps/SessionDetails.js b/src/js/controller/dialogs/backups/steps/SessionDetails.js index 8336d6ea..861fea7d 100644 --- a/src/js/controller/dialogs/backups/steps/SessionDetails.js +++ b/src/js/controller/dialogs/backups/steps/SessionDetails.js @@ -56,7 +56,7 @@ ns.SessionDetails.prototype.onContainerClick_ = function (evt) { var action = evt.target.dataset.action; - if (action == 'load') { + if (action == 'load' && window.confirm(Constants.CONFIRM_OVERWRITE)) { var snapshotId = evt.target.dataset.snapshotId * 1; pskl.app.backupService.loadSnapshotById(snapshotId).then(function () { $.publish(Events.DIALOG_HIDE); diff --git a/src/js/controller/dialogs/importwizard/ImportWizard.js b/src/js/controller/dialogs/importwizard/ImportWizard.js index 224add4e..4de7ad06 100644 --- a/src/js/controller/dialogs/importwizard/ImportWizard.js +++ b/src/js/controller/dialogs/importwizard/ImportWizard.js @@ -144,9 +144,7 @@ if (mode === ns.steps.SelectMode.MODES.REPLACE) { // Replace the current piskel and close the dialog. - var message = 'This will replace your current animation,' + - ' are you sure you want to continue?'; - if (window.confirm(message)) { + if (window.confirm(Constants.CONFIRM_OVERWRITE)) { this.piskelController.setPiskel(piskel); this.closeDialog(); } diff --git a/src/js/service/FileDropperService.js b/src/js/service/FileDropperService.js index b9b975f5..2eb5c348 100644 --- a/src/js/service/FileDropperService.js +++ b/src/js/service/FileDropperService.js @@ -52,7 +52,7 @@ }; ns.FileDropperService.prototype.onPiskelFileLoaded_ = function (piskel) { - if (window.confirm('This will replace your current animation')) { + if (window.confirm(Constants.CONFIRM_OVERWRITE)) { pskl.app.piskelController.setPiskel(piskel); } };