add "configure" button in the old UI

This commit is contained in:
tophf 2018-01-04 22:35:12 +03:00
parent 1c432b2868
commit 392ca4c988
2 changed files with 5 additions and 1 deletions

View File

@ -48,6 +48,7 @@
<button class="delete" i18n-text="deleteStyleLabel"></button> <button class="delete" i18n-text="deleteStyleLabel"></button>
<button class="check-update" i18n-text="checkForUpdate"></button> <button class="check-update" i18n-text="checkForUpdate"></button>
<button class="update" i18n-text="installUpdate"></button> <button class="update" i18n-text="installUpdate"></button>
<button class="configure-usercss" i18n-text="configureStyle"></button>
<span class="update-note"></span> <span class="update-note"></span>
</p> </p>
</div> </div>

View File

@ -193,16 +193,19 @@ function createStyleElement({style, name, index}) {
regexpsBefore: '/', regexpsBefore: '/',
regexpsAfter: '/', regexpsAfter: '/',
}, },
oldConfigure: !newUI.enabled && $('.configure-usercss', entry),
oldCheckUpdate: !newUI.enabled && $('.check-update', entry), oldCheckUpdate: !newUI.enabled && $('.check-update', entry),
oldUpdate: !newUI.enabled && $('.update', entry), oldUpdate: !newUI.enabled && $('.update', entry),
}; };
} }
const parts = createStyleElement.parts; const parts = createStyleElement.parts;
const configurable = style.usercssData && Object.keys(style.usercssData.vars).length > 0;
parts.checker.checked = style.enabled; parts.checker.checked = style.enabled;
parts.nameLink.textContent = tWordBreak(style.name); parts.nameLink.textContent = tWordBreak(style.name);
parts.nameLink.href = parts.editLink.href = parts.editHrefBase + style.id; parts.nameLink.href = parts.editLink.href = parts.editHrefBase + style.id;
parts.homepage.href = parts.homepage.title = style.url || ''; parts.homepage.href = parts.homepage.title = style.url || '';
if (!newUI.enabled) { if (!newUI.enabled) {
parts.oldConfigure.classList.toggle('hidden', !configurable);
parts.oldCheckUpdate.classList.toggle('hidden', !style.updateUrl); parts.oldCheckUpdate.classList.toggle('hidden', !style.updateUrl);
parts.oldUpdate.classList.toggle('hidden', !style.updateUrl); parts.oldUpdate.classList.toggle('hidden', !style.updateUrl);
} }
@ -224,7 +227,7 @@ function createStyleElement({style, name, index}) {
if (style.updateUrl && newUI.enabled) { if (style.updateUrl && newUI.enabled) {
$('.actions', entry).appendChild(template.updaterIcons.cloneNode(true)); $('.actions', entry).appendChild(template.updaterIcons.cloneNode(true));
} }
if (style.usercssData && Object.keys(style.usercssData.vars).length > 0 && newUI.enabled) { if (configurable && newUI.enabled) {
$('.actions', entry).appendChild(template.configureIcon.cloneNode(true)); $('.actions', entry).appendChild(template.configureIcon.cloneNode(true));
} }