From ca2274372672058caf060447571a350588dbfcf8 Mon Sep 17 00:00:00 2001 From: Oliver Hamlet Date: Sun, 27 Dec 2015 12:33:13 +0000 Subject: [PATCH] Move handleUnappliedChangesClose --- src/gui/html/js/events.js | 21 +++++++++++++++++++++ src/gui/html/js/helpers.js | 21 --------------------- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/gui/html/js/events.js b/src/gui/html/js/events.js index 1318c91a..e6088e12 100644 --- a/src/gui/html/js/events.js +++ b/src/gui/html/js/events.js @@ -623,6 +623,27 @@ function onSidebarClick(evt) { } } } +function handleUnappliedChangesClose(change) { + loot.Dialog.askQuestion('', loot.l10n.translate('You have not yet applied or cancelled your %s. Are you sure you want to quit?', change), loot.l10n.translate('Quit'), (result) => { + if (!result) { + return; + } + /* Cancel any sorting and close any editors. Cheat by sending a + cancelSort query for as many times as necessary. */ + const queries = []; + let numQueries = 0; + if (!document.getElementById('applySortButton').classList.contains('hidden')) { + numQueries += 1; + } + numQueries += document.body.getAttribute('data-editors'); + for (let i = 0; i < numQueries; ++i) { + queries.push(loot.query('cancelSort')); + } + Promise.all(queries).then(() => { + window.close(); + }).catch(handlePromiseError); + }); +} function onQuit(evt) { if (!document.getElementById('applySortButton').classList.contains('hidden')) { handleUnappliedChangesClose(loot.l10n.translate('sorted load order')); diff --git a/src/gui/html/js/helpers.js b/src/gui/html/js/helpers.js index cfe8cd99..d84ce2af 100644 --- a/src/gui/html/js/helpers.js +++ b/src/gui/html/js/helpers.js @@ -16,27 +16,6 @@ function hideElement(element) { element.classList.toggle('hidden', true); } } -function handleUnappliedChangesClose(change) { - loot.Dialog.askQuestion('', loot.l10n.translate('You have not yet applied or cancelled your %s. Are you sure you want to quit?', change), loot.l10n.translate('Quit'), (result) => { - if (!result) { - return; - } - /* Cancel any sorting and close any editors. Cheat by sending a - cancelSort query for as many times as necessary. */ - const queries = []; - let numQueries = 0; - if (!document.getElementById('applySortButton').classList.contains('hidden')) { - numQueries += 1; - } - numQueries += document.body.getAttribute('data-editors'); - for (let i = 0; i < numQueries; ++i) { - queries.push(loot.query('cancelSort')); - } - Promise.all(queries).then(() => { - window.close(); - }).catch(handlePromiseError); - }); -} function getConflictingPlugins(pluginName) { if (!pluginName) { return Promise.resolve([]);