From e7175c261af3c3fcb0753c9a2d6ec2a351e38d0c Mon Sep 17 00:00:00 2001 From: tophf Date: Fri, 24 Nov 2017 19:40:18 +0300 Subject: [PATCH] don't confirm on clicking "install" for a new usercss --- install-usercss/install-usercss.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/install-usercss/install-usercss.js b/install-usercss/install-usercss.js index cc6c4fb4..fbfc3a73 100644 --- a/install-usercss/install-usercss.js +++ b/install-usercss/install-usercss.js @@ -227,14 +227,17 @@ ); } $('button.install').onclick = () => { - messageBox.confirm(dup ? - t('styleInstallOverwrite', [data.name, dupData.version, data.version]) : - t('styleInstall', [data.name]) + (!dup ? + Promise.resolve(true) : + messageBox.confirm(t('styleInstallOverwrite', [ + data.name, + dupData.version, + data.version, + ])) ).then(ok => ok && sendMessage(Object.assign(style, {method: 'saveUsercss', reason: 'update'})) .then(install) - .catch(err => messageBox.alert(t('styleInstallFailed', err))) - ); + .catch(err => messageBox.alert(t('styleInstallFailed', err)))); }; // set updateUrl