mirror of
https://github.com/rr-/szurubooru.git
synced 2025-07-17 08:26:24 +00:00
client/pools: stacked thumbnail appearance for pool list page
This commit is contained in:
@ -40,12 +40,12 @@ function makeRelativeTime(time) {
|
||||
);
|
||||
}
|
||||
|
||||
function makeThumbnail(url) {
|
||||
function makeThumbnail(url, klass) {
|
||||
return makeElement(
|
||||
"span",
|
||||
url
|
||||
? {
|
||||
class: "thumbnail",
|
||||
class: klass || "thumbnail",
|
||||
style: `background-image: url(\'${url}\')`,
|
||||
}
|
||||
: { class: "thumbnail empty" },
|
||||
@ -53,6 +53,23 @@ function makeThumbnail(url) {
|
||||
);
|
||||
}
|
||||
|
||||
function makePoolThumbnails(posts, postFlow) {
|
||||
if (posts.length == 0) {
|
||||
return makeThumbnail(null);
|
||||
}
|
||||
if (postFlow) {
|
||||
return makeThumbnail(posts.at(0).thumbnailUrl);
|
||||
}
|
||||
|
||||
let s = "";
|
||||
|
||||
for (let i = 0; i < Math.min(3, posts.length); i++) {
|
||||
s += makeThumbnail(posts.at(i).thumbnailUrl, "thumbnail thumbnail-" + (i+1));
|
||||
}
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
function makeRadio(options) {
|
||||
_imbueId(options);
|
||||
return makeElement(
|
||||
@ -254,7 +271,7 @@ function makePoolLink(id, includeHash, includeCount, pool, name) {
|
||||
misc.escapeHtml(text)
|
||||
)
|
||||
: makeElement(
|
||||
"span",
|
||||
"div",
|
||||
{ class: misc.makeCssName(category, "pool") },
|
||||
misc.escapeHtml(text)
|
||||
);
|
||||
@ -436,6 +453,7 @@ function getTemplate(templatePath) {
|
||||
makeFileSize: makeFileSize,
|
||||
makeMarkdown: makeMarkdown,
|
||||
makeThumbnail: makeThumbnail,
|
||||
makePoolThumbnails: makePoolThumbnails,
|
||||
makeRadio: makeRadio,
|
||||
makeCheckbox: makeCheckbox,
|
||||
makeSelect: makeSelect,
|
||||
|
Reference in New Issue
Block a user