link unterhalb "forum post" auch klickbar

This commit is contained in:
sbp-jm 2026-07-28 08:01:26 +00:00
parent 227b4cd194
commit 9c5ec6af4b
1 changed files with 7 additions and 23 deletions

View File

@ -6,7 +6,7 @@
function showTarget(targetValue) { function showTarget(targetValue) {
var targetUrl; var targetUrl;
var forumLink; var forumLink;
var targetUrlLabel; var targetUrlLink;
var postPanel; var postPanel;
var fallbackPanel; var fallbackPanel;
@ -22,7 +22,6 @@
'Rejected forum target with unexpected origin:', 'Rejected forum target with unexpected origin:',
targetUrl.origin targetUrl.origin
); );
return false; return false;
} }
@ -31,30 +30,29 @@
'Rejected forum target with unexpected path:', 'Rejected forum target with unexpected path:',
targetUrl.pathname targetUrl.pathname
); );
return false; return false;
} }
forumLink = document.getElementById('forum-link'); forumLink = document.getElementById('forum-link');
targetUrlLabel = document.getElementById('target-url'); targetUrlLink = document.getElementById('target-url');
postPanel = document.getElementById('post-panel'); postPanel = document.getElementById('post-panel');
fallbackPanel = document.getElementById('fallback-panel'); fallbackPanel = document.getElementById('fallback-panel');
if ( if (
!forumLink || !forumLink ||
!targetUrlLabel || !targetUrlLink ||
!postPanel || !postPanel ||
!fallbackPanel !fallbackPanel
) { ) {
console.warn( console.warn(
'Required landing-page elements were not found.' 'Required landing-page elements were not found.'
); );
return false; return false;
} }
forumLink.href = targetUrl.href; forumLink.href = targetUrl.href;
targetUrlLabel.textContent = targetUrl.href; targetUrlLink.href = targetUrl.href;
targetUrlLink.textContent = targetUrl.href;
postPanel.hidden = false; postPanel.hidden = false;
fallbackPanel.hidden = true; fallbackPanel.hidden = true;
@ -65,7 +63,6 @@
'The forum target URL is invalid.', 'The forum target URL is invalid.',
error error
); );
return false; return false;
} }
} }
@ -76,23 +73,13 @@
var context; var context;
var subPageId; var subPageId;
parameters = new URLSearchParams( parameters = new URLSearchParams(window.location.search);
window.location.search
);
queryTarget = parameters.get('target'); queryTarget = parameters.get('target');
/*
* Allow direct browser tests with ?target=...
*/
if (showTarget(queryTarget)) { if (showTarget(queryTarget)) {
return; return;
} }
/*
* In Microsoft Teams the target is passed as subEntityId.
* TeamsJS v2 exposes that value as context.page.subPageId.
*/
if ( if (
!window.microsoftTeams || !window.microsoftTeams ||
!window.microsoftTeams.app !window.microsoftTeams.app
@ -100,15 +87,12 @@
console.info( console.info(
'TeamsJS is unavailable; showing the notifications fallback.' 'TeamsJS is unavailable; showing the notifications fallback.'
); );
return; return;
} }
try { try {
await window.microsoftTeams.app.initialize(); await window.microsoftTeams.app.initialize();
context = await window.microsoftTeams.app.getContext();
context =
await window.microsoftTeams.app.getContext();
subPageId = subPageId =
context && context &&