diff --git a/_locales/en/messages.json b/_locales/en/messages.json index 5cab08ba..2e2be027 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -585,7 +585,7 @@ "description": "Label for install button" }, "installButtonInstalled": { - "message": "Style installed", + "message": "Style is installed", "description": "Text displayed when the style is successfully installed" }, "installButtonReinstall": { diff --git a/install-usercss.html b/install-usercss.html index 98cd0eec..03c78549 100644 --- a/install-usercss.html +++ b/install-usercss.html @@ -33,7 +33,7 @@
-

+ @@ -50,6 +50,11 @@ +

diff --git a/install-usercss/install-usercss.css b/install-usercss/install-usercss.css index efc088e3..65ea5552 100644 --- a/install-usercss/install-usercss.css +++ b/install-usercss/install-usercss.css @@ -213,16 +213,21 @@ h1 small { filter: hue-rotate(-18deg) brightness(.7) contrast(2); } -.install.installed, -h2.installed { +.install.installed { display: none; } h2.installed.active { display: inline-block; font-weight: bold; - margin-bottom: 1ex; margin-top: 0; + color: darkcyan; +} +h2.installed.active ~ .configure-usercss svg { + fill: hsl(180, 100%, 20%); +} +h2.installed.active ~ .configure-usercss:hover svg { + fill: hsl(180, 100%, 30%); } .actions label input { diff --git a/install-usercss/install-usercss.js b/install-usercss/install-usercss.js index 6645e882..8c978a0d 100644 --- a/install-usercss/install-usercss.js +++ b/install-usercss/install-usercss.js @@ -208,6 +208,7 @@ function updateMeta(style, dup = installedDup) { setTimeout(() => $$remove('.lds-spinner'), 1000); showError(''); requestAnimationFrame(adjustCodeHeight); + if (dup) enablePostActions(); function makeAuthor(text) { const match = text.match(/^(.+?)(?:\s+<(.+?)>)?(?:\s+\((.+?)\))?$/); @@ -298,21 +299,26 @@ function install(style) { $('.set-update-url input[type=checkbox]').disabled = true; $('.set-update-url').title = style.updateUrl ? t('installUpdateFrom', style.updateUrl) : ''; - + enablePostActions(); updateMeta(style); +} - if (!liveReload.enabled && !prefs.get('openEditInWindow')) { - location.href = '/edit.html?id=' + style.id; - } else { - API.openEditor({id: style.id}); - if (!liveReload.enabled) { +function enablePostActions() { + const {id} = installed || installedDup; + sessionStorage.justEditedStyleId = id; + $('h2.installed').hidden = !installed; + $('.installed-actions').hidden = false; + $('.installed-actions a[href*="edit.html"]').search = `?id=${id}`; + $('#delete').onclick = async () => { + if (await messageBox.confirm(t('deleteStyleConfirm'), 'danger center', t('confirmDelete'))) { + await API.styles.delete(id); if (tabId < 0 && history.length > 1) { history.back(); } else { closeCurrentTab(); } } - } + }; } async function getAppliesTo(style) {