adapt to #installed having a persistent child now

This commit is contained in:
tophf 2017-12-12 17:09:42 +03:00
parent dc126e1b58
commit 3ffbce0bc7
2 changed files with 3 additions and 9 deletions

View File

@ -194,7 +194,6 @@ function showStyles(styles) {
return; return;
} }
if (!styles.length) { if (!styles.length) {
installed.textContent = '';
installed.appendChild(template.noStyles.cloneNode(true)); installed.appendChild(template.noStyles.cloneNode(true));
window.dispatchEvent(new Event('showStyles:done')); window.dispatchEvent(new Event('showStyles:done'));
return; return;
@ -345,12 +344,7 @@ Object.assign(handleEvent, {
}); });
if (ok) { if (ok) {
deleteStyleSafe({id}).then(() => { deleteStyleSafe({id}).then(() => {
// don't wait for the async notifyAllTabs as we check the children right away
handleDelete(id); handleDelete(id);
// update view with 'No styles installed for this site' message
if (!installed.children.length) {
showStyles([]);
}
}); });
} }
} }
@ -468,7 +462,7 @@ function handleUpdate(style) {
function handleDelete(id) { function handleDelete(id) {
$.remove(ENTRY_ID_PREFIX + id); $.remove(ENTRY_ID_PREFIX + id);
if (!installed.firstElementChild) { if (!$('.entry')) {
installed.appendChild(template.noStyles.cloneNode(true)); installed.appendChild(template.noStyles.cloneNode(true));
} }
} }

View File

@ -226,9 +226,9 @@ body.search-results-shown {
#search-results .search-results-nav button { #search-results .search-results-nav button {
background: none; background: none;
border: none; border: none;
padding: .25rem 1rem; padding: 0 1rem;
margin: 0 .5rem; margin: 0 .5rem;
font-size: 200%; font-size: 150%;
line-height: 24px; line-height: 24px;
vertical-align: middle; vertical-align: middle;
cursor: pointer; cursor: pointer;