diff --git a/background/storage.js b/background/storage.js index a7238d0b..eee6a011 100644 --- a/background/storage.js +++ b/background/storage.js @@ -395,7 +395,7 @@ function saveStyle(style) { .then(decide); function maybeCalcDigest() { - if (reason === 'update' || reason === 'update-digest') { + if (['install', 'update', 'update-digest'].includes(reason)) { return calcStyleDigest(style).then(digest => { style.originalDigest = digest; }); diff --git a/content/install-hook-userstyles.js b/content/install-hook-userstyles.js index 2eb9aca2..a7c80dae 100644 --- a/content/install-hook-userstyles.js +++ b/content/install-hook-userstyles.js @@ -132,7 +132,8 @@ function saveStyleCode(message, name, addProps) { return new Promise((resolve, reject) => { - const needsConfirmation = message === 'styleInstall' || !saveStyleCode.confirmed; + const isNew = message === 'styleInstall'; + const needsConfirmation = isNew || !saveStyleCode.confirmed; if (needsConfirmation && !confirm(chrome.i18n.getMessage(message, [name]))) { reject(); return; @@ -148,10 +149,10 @@ chrome.runtime.sendMessage( Object.assign(json, addProps, { method: 'saveStyle', - reason: 'update', + reason: isNew ? 'install' : 'update', }), style => { - if (message === 'styleUpdate' && style.updateUrl.includes('?')) { + if (!isNew && style.updateUrl.includes('?')) { enableUpdateButton(true); } else { sendEvent('styleInstalledChrome'); diff --git a/manage/manage.css b/manage/manage.css index 2d112ad6..fcf8b041 100644 --- a/manage/manage.css +++ b/manage/manage.css @@ -371,6 +371,11 @@ label.nobreak input { display: inline; } +.newUI .up-to-date svg, +.newUI .updated svg { + cursor: auto; +} + .newUI .update-done .updated svg { top: -4px; position: relative; diff --git a/manage/manage.js b/manage/manage.js index 230e14a4..e8fc983a 100644 --- a/manage/manage.js +++ b/manage/manage.js @@ -400,8 +400,8 @@ function handleUpdate(style, {reason, method} = {}) { oldEntry.remove(); } } - if (reason === 'update' && entry.matches('.updatable')) { - handleUpdateInstalled(entry); + if (reason === 'update' || reason === 'install' && entry.matches('.updatable')) { + handleUpdateInstalled(entry, reason); } filterAndAppend({entry}); if (!entry.matches('.hidden') && reason !== 'import') { diff --git a/manage/updater-ui.js b/manage/updater-ui.js index b48b9d73..3f4b5292 100644 --- a/manage/updater-ui.js +++ b/manage/updater-ui.js @@ -185,9 +185,12 @@ function showUpdateHistory() { } -function handleUpdateInstalled(entry) { - entry.classList.add('update-done'); +function handleUpdateInstalled(entry, reason) { + const isNew = reason === 'install'; + const note = t(isNew ? 'installButtonInstalled' : 'updateCompleted'); + entry.classList.add('update-done', ...(isNew ? ['install-done'] : [])); entry.classList.remove('can-update', 'updatable'); - $('.update-note', entry).textContent = t('updateCompleted'); + $('.update-note', entry).textContent = note; + $('.updated', entry).title = note; renderUpdatesOnlyFilter(); }