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);
|
.then(decide);
|
||||||
|
|
||||||
function maybeCalcDigest() {
|
function maybeCalcDigest() {
|
||||||
if (reason === 'update' || reason === 'update-digest') {
|
if (['install', 'update', 'update-digest'].includes(reason)) {
|
||||||
return calcStyleDigest(style).then(digest => {
|
return calcStyleDigest(style).then(digest => {
|
||||||
style.originalDigest = digest;
|
style.originalDigest = digest;
|
||||||
});
|
});
|
||||||
|
|
|
@ -132,7 +132,8 @@
|
||||||
|
|
||||||
function saveStyleCode(message, name, addProps) {
|
function saveStyleCode(message, name, addProps) {
|
||||||
return new Promise((resolve, reject) => {
|
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]))) {
|
if (needsConfirmation && !confirm(chrome.i18n.getMessage(message, [name]))) {
|
||||||
reject();
|
reject();
|
||||||
return;
|
return;
|
||||||
|
@ -148,10 +149,10 @@
|
||||||
chrome.runtime.sendMessage(
|
chrome.runtime.sendMessage(
|
||||||
Object.assign(json, addProps, {
|
Object.assign(json, addProps, {
|
||||||
method: 'saveStyle',
|
method: 'saveStyle',
|
||||||
reason: 'update',
|
reason: isNew ? 'install' : 'update',
|
||||||
}),
|
}),
|
||||||
style => {
|
style => {
|
||||||
if (message === 'styleUpdate' && style.updateUrl.includes('?')) {
|
if (!isNew && style.updateUrl.includes('?')) {
|
||||||
enableUpdateButton(true);
|
enableUpdateButton(true);
|
||||||
} else {
|
} else {
|
||||||
sendEvent('styleInstalledChrome');
|
sendEvent('styleInstalledChrome');
|
||||||
|
|
|
@ -371,6 +371,11 @@ label.nobreak input {
|
||||||
display: inline;
|
display: inline;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.newUI .up-to-date svg,
|
||||||
|
.newUI .updated svg {
|
||||||
|
cursor: auto;
|
||||||
|
}
|
||||||
|
|
||||||
.newUI .update-done .updated svg {
|
.newUI .update-done .updated svg {
|
||||||
top: -4px;
|
top: -4px;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|
|
@ -400,8 +400,8 @@ function handleUpdate(style, {reason, method} = {}) {
|
||||||
oldEntry.remove();
|
oldEntry.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (reason === 'update' && entry.matches('.updatable')) {
|
if (reason === 'update' || reason === 'install' && entry.matches('.updatable')) {
|
||||||
handleUpdateInstalled(entry);
|
handleUpdateInstalled(entry, reason);
|
||||||
}
|
}
|
||||||
filterAndAppend({entry});
|
filterAndAppend({entry});
|
||||||
if (!entry.matches('.hidden') && reason !== 'import') {
|
if (!entry.matches('.hidden') && reason !== 'import') {
|
||||||
|
|
|
@ -185,9 +185,12 @@ function showUpdateHistory() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function handleUpdateInstalled(entry) {
|
function handleUpdateInstalled(entry, reason) {
|
||||||
entry.classList.add('update-done');
|
const isNew = reason === 'install';
|
||||||
|
const note = t(isNew ? 'installButtonInstalled' : 'updateCompleted');
|
||||||
|
entry.classList.add('update-done', ...(isNew ? ['install-done'] : []));
|
||||||
entry.classList.remove('can-update', 'updatable');
|
entry.classList.remove('can-update', 'updatable');
|
||||||
$('.update-note', entry).textContent = t('updateCompleted');
|
$('.update-note', entry).textContent = note;
|
||||||
|
$('.updated', entry).title = note;
|
||||||
renderUpdatesOnlyFilter();
|
renderUpdatesOnlyFilter();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user