show "Style installed" in manager for styles added while it's open
This commit is contained in:
parent
536064ae9a
commit
7de3e37a51
|
@ -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;
|
||||
});
|
||||
|
|
|
@ -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');
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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') {
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user