shorten shotName to shot

This commit is contained in:
tophf 2021-08-12 20:18:16 +03:00
parent d81c612678
commit 41dd2d1ef3

View File

@ -278,7 +278,7 @@
ai: authorId, ai: authorId,
an: author, an: author,
sa: shotArchived, sa: shotArchived,
sn: shotName, sn: shot,
isUsw, isUsw,
} = entry._result = result; } = entry._result = result;
entry.id = RESULT_ID_PREFIX + id; entry.id = RESULT_ID_PREFIX + id;
@ -293,14 +293,14 @@
// screenshot // screenshot
const elShot = $('.search-result-screenshot', entry); const elShot = $('.search-result-screenshot', entry);
if (isUsw) { if (isUsw) {
elShot.src = !/^https?:/i.test(shotName) ? BLANK_PIXEL : elShot.src = !/^https?:/i.test(shot) ? BLANK_PIXEL :
imgType !== '.jpg' ? shotName.replace(/\.jpg$/, imgType) : imgType !== '.jpg' ? shot.replace(/\.jpg$/, imgType) :
shotName; shot;
} else { } else {
const auto = URLS.uso + `auto_style_screenshots/${id}${USO_AUTO_PIC_SUFFIX}`; const auto = URLS.uso + `auto_style_screenshots/${id}${USO_AUTO_PIC_SUFFIX}`;
Object.assign(elShot, { Object.assign(elShot, {
src: shotName && !shotName.endsWith(USO_AUTO_PIC_SUFFIX) src: shot && !shot.endsWith(USO_AUTO_PIC_SUFFIX)
? `${shotArchived ? URLS.usoArchiveRaw[0] : URLS.uso + 'style_'}screenshots/${shotName}` ? `${shotArchived ? URLS.usoArchiveRaw[0] : URLS.uso + 'style_'}screenshots/${shot}`
: auto, : auto,
_src: auto, _src: auto,
onerror: fixScreenshot, onerror: fixScreenshot,
@ -310,9 +310,8 @@
Object.assign($('[data-type="author"] a', entry), { Object.assign($('[data-type="author"] a', entry), {
textContent: author, textContent: author,
title: author, title: author,
href: isUsw href: isUsw ? `${URLS.usw}user/${encodeURIComponent(author)}` :
? `${URLS.usw}user/${encodeURIComponent(author)}` `${URLS.usoArchive}browse/styles/?search=%40${authorId}`,
: `${URLS.usoArchive}browse/styles/?search=%40${authorId}`,
onclick: Events.openURLandHide, onclick: Events.openURLandHide,
}); });
// rating // rating