index already has ai

This commit is contained in:
tophf 2021-08-12 20:15:20 +03:00
parent 4435a44291
commit d81c612678

View File

@ -64,7 +64,6 @@
const $class = sel => (sel instanceof Node ? sel : $(sel)).classList; const $class = sel => (sel instanceof Node ? sel : $(sel)).classList;
const show = sel => $class(sel).remove('hidden'); const show = sel => $class(sel).remove('hidden');
const hide = sel => $class(sel).add('hidden'); const hide = sel => $class(sel).add('hidden');
const makeUsoArchiveAuthorUrl = a => `${URLS.usoArchive}browse/styles/?search=%40${a}`;
Object.assign(Events, { Object.assign(Events, {
/** /**
@ -85,21 +84,6 @@
calcCategory(); calcCategory();
ready = start(); ready = start();
}, },
usoArchive: {
async openAuthor(event) {
event.preventDefault();
await Events.usoArchive.prefetchAuthorId.call(this);
Events.openURLandHide.call(this, event);
},
async prefetchAuthorId() {
return this._fetch || (
this._fetch = fetch(`${URLS.usoArchiveRaw[0]}styles/${this._id}.json`)
.then(r => r.json())
.then(json => (this.href = makeUsoArchiveAuthorUrl(json.info.author.id)))
);
},
},
}); });
function init() { function init() {
@ -291,6 +275,7 @@
u: updateTime, u: updateTime,
w: weeklyInstalls, w: weeklyInstalls,
t: totalInstalls, t: totalInstalls,
ai: authorId,
an: author, an: author,
sa: shotArchived, sa: shotArchived,
sn: shotName, sn: shotName,
@ -322,18 +307,13 @@
}); });
} }
// author // author
const eAuthor = encodeURIComponent(author);
Object.assign($('[data-type="author"] a', entry), { Object.assign($('[data-type="author"] a', entry), {
textContent: author, textContent: author,
title: author, title: author,
}, isUsw ? { href: isUsw
href: `${URLS.usw}user/${eAuthor}`, ? `${URLS.usw}user/${encodeURIComponent(author)}`
: `${URLS.usoArchive}browse/styles/?search=%40${authorId}`,
onclick: Events.openURLandHide, onclick: Events.openURLandHide,
} : {
_id: id,
href: makeUsoArchiveAuthorUrl(eAuthor),
onclick: Events.usoArchive.openAuthor,
onmousedown: Events.usoArchive.prefetchAuthorId,
}); });
// rating // rating
$('[data-type="rating"]', entry).dataset.class = $('[data-type="rating"]', entry).dataset.class =