diff --git a/_locales/en/messages.json b/_locales/en/messages.json index 2552b60b..5cab08ba 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -625,6 +625,18 @@ "message": "Get styles", "description": "Help link text on the manage page e.g. https://userstyles.org" }, + "linkGetStylesInfo": { + "message": "This archive site was created by a userstyle community member to back up the slow and unresponsive userstyles.org. The archive updates its contents approximately once a day.", + "description": "Info shown when clicking the (i) icon of the uso-archive link in the manager" + }, + "linkGetShareStyles": { + "message": "Get and share styles", + "description": "Link text for https://userstyles.world/ on the manage page" + }, + "linkGetShareStylesInfo": { + "message": "The new community-driven userstyles.world site is created by userstyle authors in order to replace userstyles.org, which has been so slow and unresponsive for the past year that many authors stopped updating their styles.", + "description": "Info shown when clicking the (i) icon of the userstyles.world link in the manager" + }, "linkStylusWiki": { "message": "Wiki", "description": "Wiki link text on the manage page e.g. https://github.com/openstyles/stylus/wiki" @@ -633,10 +645,6 @@ "message": "Translate", "description": "Transifex link text on the manage page" }, - "linkUSW": { - "message": "Upload and discover styles on userstyles.world", - "description": "Link text for https://userstyles.world/ on the manage page" - }, "linterCSSLintIncompatible": { "message": "CSSLint doesn't support $preprocessorname$ preprocessor", "placeholders": { diff --git a/install-usercss.html b/install-usercss.html index 9ed75523..98cd0eec 100644 --- a/install-usercss.html +++ b/install-usercss.html @@ -35,6 +35,9 @@

+ + +
@@ -354,7 +362,6 @@ - diff --git a/manage/filters.js b/manage/filters.js index ad53d320..f5fe5f77 100644 --- a/manage/filters.js +++ b/manage/filters.js @@ -36,7 +36,7 @@ function initFilters() { $('#search-help').onclick = event => { event.preventDefault(); messageBoxProxy.show({ - className: 'help-text', + className: 'help-text center-dialog', title: t('search'), contents: $create('ul', diff --git a/manage/manage.css b/manage/manage.css index 6f1042a3..98f28d71 100644 --- a/manage/manage.css +++ b/manage/manage.css @@ -432,33 +432,17 @@ a:hover { #manage-text { display: flex; flex-wrap: wrap; - align-items: baseline; padding-top: .35rem; } - +#manage-text > * { + display: flex; + align-items: center; +} #manage-text > :not(:last-child):after { content: "|"; margin: 0 .5em; } -#link-usw { - display: flex; - align-items: center; - margin-top: .5em; -} - -#link-usw img { - max-width: 2.5em; - max-height: 2.5em; - margin-right: .75em; - filter: grayscale(1); - transition: filter .5s; -} - -#link-usw:hover img { - filter: none; -} - .newUI .entry .svg-icon.checked, .newUI .entry:hover .svg-icon.checked { fill: #000; diff --git a/manage/sorter.js b/manage/sorter.js index 9a181e47..97963e54 100644 --- a/manage/sorter.js +++ b/manage/sorter.js @@ -189,7 +189,7 @@ const sorter = (() => { async function showHelp(event) { event.preventDefault(); messageBoxProxy.show({ - className: 'help-text', + className: 'help-text center-dialog', title: t('sortStylesHelpTitle'), contents: $create('div', diff --git a/options/options.js b/options/options.js index 107c02fc..3c15538f 100644 --- a/options/options.js +++ b/options/options.js @@ -25,7 +25,6 @@ setupLivePrefs(); setupRadioButtons(); $$('input[min], input[max]').forEach(enforceInputRange); -setTimeout(splitLongTooltips); if (CHROME_POPUP_BORDER_BUG) { const borderOption = $('.chrome-no-popup-border'); @@ -87,15 +86,6 @@ document.onclick = e => { .filter(input => prefs.knownKeys.includes(input.id)) .forEach(input => prefs.reset(input.id)); break; - - case 'note': { - e.preventDefault(); - messageBoxProxy.show({ - className: 'note', - contents: target.dataset.title, - buttons: [t('confirmClose')], - }); - } } }; @@ -229,22 +219,6 @@ function setupRadioButtons() { }); } -function splitLongTooltips() { - for (const el of $$('[title]')) { - el.dataset.title = el.title; - el.title = el.title.replace(/<\/?\w+>/g, ''); // strip html tags - if (el.title.length < 50) { - continue; - } - const newTitle = el.title - .split('\n') - .map(s => s.replace(/([^.][.。?!]|.{50,60},)\s+/g, '$1\n')) - .map(s => s.replace(/(.{50,80}(?=.{40,}))\s+/g, '$1\n')) - .join('\n'); - if (newTitle !== el.title) el.title = newTitle; - } -} - function customizeHotkeys() { // command name -> i18n id const hotkeys = new Map([ diff --git a/popup/search.css b/popup/search.css index bd67d940..dba75ef3 100644 --- a/popup/search.css +++ b/popup/search.css @@ -76,8 +76,9 @@ body.search-results-shown { } .search-result-title { + display: flex; + align-items: center; margin-bottom: .5em; - display: block; color: #555; overflow-wrap: break-word; } @@ -196,7 +197,8 @@ body.search-results-shown { color: darkred; } -.search-result-meta [data-type="rating"][data-class="none"] dd { +/* Keeping an empty rule so customizers can easily tweak it */ +search-result-meta [data-type="rating"][data-class="none"] dd { } .search-result-meta [data-type="weekly"], @@ -228,6 +230,28 @@ body.search-results-shown { cursor: help; } +[data-error], +[data-error]:hover { + border: calc(var(--pad) / 2) solid red; + border-radius: var(--pad); + padding: calc(var(--pad) / 2); + background: hsl(0, 90%, 85%); +} +[data-error]::after { + content: attr(data-error); + display: block; + color: hsl(0, 100%, 8%); + font-weight: bold; + padding-top: var(--pad); + hyphens: auto; +} +[data-error] .search-result-description { + display: none; +} +[data-error] .search-result-meta { + background: hsla(0, 100%, 90%, .80); +} + .search-results-nav { flex-direction: row; text-align: center; diff --git a/popup/search.js b/popup/search.js index 7c424ff2..5cee8367 100644 --- a/popup/search.js +++ b/popup/search.js @@ -54,6 +54,13 @@ let totalPages = 1; let ready; + let imgType = '.jpg'; + // detect WebP support + $create('img', { + src: 'data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA=', + onload: () => (imgType = '.webp'), + }); + const $class = sel => (sel instanceof Node ? sel : $(sel)).classList; const show = sel => $class(sel).remove('hidden'); const hide = sel => $class(sel).add('hidden'); @@ -301,7 +308,9 @@ // screenshot const elShot = $('.search-result-screenshot', entry); if (isUsw) { - elShot.src = /^https?:/i.test(shotName) ? shotName : BLANK_PIXEL; + elShot.src = !/^https?:/i.test(shotName) ? BLANK_PIXEL : + imgType !== '.jpg' ? shotName.replace(/\.jpg$/, imgType) : + shotName; } else { const auto = URLS.uso + `auto_style_screenshots/${id}${USO_AUTO_PIC_SUFFIX}`; Object.assign(elShot, { @@ -432,6 +441,7 @@ saveScrollPosition(entry); installButton.disabled = true; entry.style.setProperty('pointer-events', 'none', 'important'); + delete entry.dataset.error; if (!isUsw) { // FIXME: move this to background page and create an API like installUSOStyle result.pingbackTimer = setTimeout(download, PINGBACK_DELAY, @@ -445,7 +455,8 @@ const style = await API.usercss.install({sourceCode, updateUrl}); renderFullInfo(entry, style); } catch (reason) { - error(`Error while downloading usoID:${id}\nReason: ${reason}`); + entry.dataset.error = `${t('genericError')}: ${reason}`; + entry.scrollIntoView({behavior: 'smooth', block: 'nearest'}); } $remove('.lds-spinner', entry); installButton.disabled = false;