linkify image and title
This commit is contained in:
parent
2ee91c9686
commit
034fd7b4ba
@ -11,15 +11,28 @@ function fa_solid_icon(settings, name) {
|
||||
|
||||
const is_mobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
|
||||
|
||||
var AppointmentImage = {
|
||||
const AppointmentLinkify = {
|
||||
view: function(vnode) {
|
||||
const {item, settings} = vnode.attrs;
|
||||
const image_url = item.base.image?.fileUrl ?? (is_mobile ? default_image_mobile : null) ?? settings.default_image;
|
||||
|
||||
const {item} = vnode.attrs;
|
||||
if (!vnode.children || (vnode.children instanceof Array && vnode.children.length === 0)) {
|
||||
return m("[");
|
||||
}
|
||||
let url = item.base.link;
|
||||
if (url && !url.startsWith("http")) {
|
||||
url = "https://" + url;
|
||||
}
|
||||
if (url) {
|
||||
return m("a", {href: url}, vnode.children);
|
||||
} else {
|
||||
return m("[", vnode.children);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var AppointmentImage = {
|
||||
view: function(vnode) {
|
||||
const {item, settings} = vnode.attrs;
|
||||
const image_url = item.base.image?.fileUrl ?? (is_mobile ? default_image_mobile : null) ?? settings.default_image;
|
||||
|
||||
let img = image_url ? m(
|
||||
"img",
|
||||
@ -28,11 +41,8 @@ var AppointmentImage = {
|
||||
alt: item.base.caption,
|
||||
},
|
||||
) : null;
|
||||
if (img && url) {
|
||||
img = m("a", {href: url}, img);
|
||||
}
|
||||
|
||||
return m(".cte-image", img)
|
||||
return m(".cte-image", m(AppointmentLinkify, {item}, img))
|
||||
}
|
||||
}
|
||||
|
||||
@ -194,7 +204,7 @@ var AppointmentDescription = {
|
||||
note_parts.push(item.base.address.meetingAt);
|
||||
}
|
||||
return m(".cte-description", [
|
||||
m("h1", item.base.caption),
|
||||
m("h1", m(AppointmentLinkify, {item, settings}, item.base.caption)),
|
||||
m("h2", note_parts.join(" | ")),
|
||||
format_information(item),
|
||||
m(AppointmentLocation, {item, settings}),
|
||||
|
Loading…
x
Reference in New Issue
Block a user