Link trade fair names to source pages

This commit is contained in:
2026-03-07 19:15:14 +01:00
parent 94fdb5aa0d
commit 0f9bbe160c
2 changed files with 57 additions and 22 deletions

View File

@@ -1663,23 +1663,23 @@
linksWrap.className = 'bookmark-subpage__messe-links';
bookmarkQueries.forEach((query, index) => {
const button = document.createElement('button');
button.type = 'button';
button.className = 'bookmark-subpage__messe-link';
button.textContent = query;
button.title = getTradeFairHoverTitle(row);
const handleOpenTradeFair = () => {
const opened = openTradeFairSearch(row, query);
if (opened > 0) {
button.title = getTradeFairHoverTitle(row);
render();
}
};
button.addEventListener('click', handleOpenTradeFair);
if (typeof window.bindMiddleMouseOpen === 'function') {
window.bindMiddleMouseOpen(button, handleOpenTradeFair);
const hasHomepage = typeof row.quelle_homepage === 'string' && row.quelle_homepage.trim();
let linkLikeElement = null;
if (hasHomepage) {
const link = document.createElement('a');
link.className = 'bookmark-subpage__messe-link';
link.href = row.quelle_homepage;
link.target = '_blank';
link.rel = 'noopener';
link.textContent = query;
linkLikeElement = link;
} else {
const span = document.createElement('span');
span.className = 'bookmark-subpage__messe-link bookmark-subpage__messe-link--static';
span.textContent = query;
linkLikeElement = span;
}
linksWrap.appendChild(button);
linksWrap.appendChild(linkLikeElement);
if (index < bookmarkQueries.length - 1) {
const separator = document.createElement('span');
@@ -1689,6 +1689,24 @@
}
});
const searchButton = document.createElement('button');
searchButton.type = 'button';
searchButton.className = 'bookmark-subpage__messe-search';
searchButton.textContent = 'Suche';
searchButton.title = getTradeFairHoverTitle(row);
const handleOpenTradeFair = () => {
const opened = openTradeFairSearch(row);
if (opened > 0) {
searchButton.title = getTradeFairHoverTitle(row);
render();
}
};
searchButton.addEventListener('click', handleOpenTradeFair);
if (typeof window.bindMiddleMouseOpen === 'function') {
window.bindMiddleMouseOpen(searchButton, handleOpenTradeFair);
}
linksWrap.appendChild(searchButton);
td.appendChild(linksWrap);
return td;
}