From be067e4ebcecede9e512b4ddac382735a3864215 Mon Sep 17 00:00:00 2001 From: Oliver Hamlet Date: Sun, 9 Nov 2014 16:09:53 +0000 Subject: [PATCH] Reworded unsaved changes dialog button. For #327. --- resources/report/html/plugin-card.html | 2 +- resources/report/js/script.js | 14 +++++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/resources/report/html/plugin-card.html b/resources/report/html/plugin-card.html index 0f58f371..b944b6db 100644 --- a/resources/report/html/plugin-card.html +++ b/resources/report/html/plugin-card.html @@ -766,7 +766,7 @@ var pluginCardProto = Object.create(HTMLElement.prototype, { value: function(evt) { var pluginCard = evt.target.parentElement.parentElement.parentElement.parentElement.parentNode.host; - showMessageDialog('Clear Plugin Metadata', 'Are you sure you want to clear all existing user-added metadata from "' + pluginCard.getName() + '"?', function(result){ + showMessageDialog('Clear Plugin Metadata', 'Are you sure you want to clear all existing user-added metadata from "' + pluginCard.getName() + '"?', false, function(result){ if (result) { var request = JSON.stringify({ name: 'clearPluginMetadata', diff --git a/resources/report/js/script.js b/resources/report/js/script.js index b602b9fd..7fbdfeb6 100644 --- a/resources/report/js/script.js +++ b/resources/report/js/script.js @@ -534,9 +534,13 @@ function applyFilters(evt) { document.getElementById('hiddenPluginNo').textContent = hiddenPluginNo; }); } -function showMessageDialog(title, text, closeCallback) { +function showMessageDialog(title, text, yesNo, closeCallback) { var dialog = document.createElement('loot-message-dialog'); - dialog.setButtonText(l10n.jed.translate('Yes').fetch(), l10n.jed.translate('Cancel').fetch()); + if (yesNo) { + dialog.setButtonText(l10n.jed.translate('Yes').fetch(), l10n.jed.translate('No').fetch()); + } else { + dialog.setButtonText(l10n.jed.translate('Yes').fetch(), l10n.jed.translate('Cancel').fetch()); + } dialog.showModal(title, text, closeCallback); document.body.appendChild(dialog); } @@ -897,7 +901,7 @@ function redatePlugins(evt) { return; } - showMessageDialog('Redate Plugins', 'This feature is provided so that modders using the Creation Kit may set the load order it uses. A side-effect is that any subscribed Steam Workshop mods will be re-downloaded by Steam. Do you wish to continue?', function(result){ + showMessageDialog('Redate Plugins', 'This feature is provided so that modders using the Creation Kit may set the load order it uses. A side-effect is that any subscribed Steam Workshop mods will be re-downloaded by Steam. Do you wish to continue?', false, function(result){ if (result) { loot.query('redatePlugins').then(function(response){ showMessageBox('Redate Plugins', 'Plugins were successfully redated.'); @@ -906,7 +910,7 @@ function redatePlugins(evt) { }); } function clearAllMetadata(evt) { - showMessageDialog('Clear All Metadata', 'Are you sure you want to clear all existing user-added metadata from all plugins?', function(result){ + showMessageDialog('Clear All Metadata', 'Are you sure you want to clear all existing user-added metadata from all plugins?', false, function(result){ if (result) { loot.query('clearAllMetadata').then(JSON.parse).then(function(result){ if (result) { @@ -1168,7 +1172,7 @@ function focusSearch(evt) { } } function handleUnappliedChangesClose() { - showMessageDialog('Unapplied Sorting Changes', 'You have not yet applied or cancelled your sorted load order. Apply your load order before quitting?', function(result){ + showMessageDialog('Unapplied Sorting Changes', 'You have not yet applied or cancelled your sorted load order. Apply your load order before quitting?', true, function(result){ if (result) { applySort().then(function(){ window.close();