Widget:GOV
Zur Navigation springen
Zur Suche springen
<noscript>
⚠ JavaScript wird benötigt, um diese Inhalte anzuzeigen.
</noscript>
???? Lade GOV-Daten... Falls nichts erscheint, ist JavaScript deaktiviert.
Um das GOV-Objekt direkt im GOV aufzurufen, <a href="https://gov.genealogy.net/item/show/" target="_blank">klicken Sie hier</a>
<script>
(function () { const govId = ""; const checkURL = `https://gov.genealogy.net/api/checkObjectId?itemId=${govId}`; const baseURL = "https://gov.genealogy.net";
const containerId = `widget-container-${govId}`; const contentId = `widget-content-${govId}`; const warningId = `js-warning-${govId}`; const headerId = `gov-header-${govId}`;
const widgetContainer = document.getElementById(containerId); const contentContainer = document.getElementById(contentId); const jsWarning = document.getElementById(warningId); const govHeader = document.getElementById(headerId);
if (!widgetContainer || !contentContainer || !govHeader) { console.error("Fehler: Container für GOV-ID nicht gefunden:", govId); return; }
if (jsWarning) jsWarning.style.display = "none";
let govIdNew = null;
fetch(checkURL) .then(response => { console.debug(`Fetching checkURL: ${checkURL}, Response Status: ${response.status}`); if (response.status === 200) { return response.text().then(() => govId); } else if (response.status === 301) { return response.text().then(body => { console.debug(`Raw Check-Response Body:`, body); const match = body.match(/^\S+/); govIdNew = match ? match[0] : null; console.debug(`Check-Response Body (bereinigt GOV-ID):`, govIdNew);
if (govIdNew) { if (govHeader) { govHeader.innerHTML = `Das GOV-Objekt ${govId} existiert nicht mehr. Es wurde durch ${govIdNew} ersetzt. <a href="https://gov.genealogy.net/item/show/${govIdNew}" target="_blank"> klicken Sie hier</a>, um Näheres zu erfahren.`; }
widgetContainer.innerHTML += `
Die GOV-ID ${govId} ist nicht mehr gültig und wurde durch ${govIdNew} ersetzt.
`;
} return govIdNew || govId; }); } else if (response.status === 302) { if (govHeader) { govHeader.innerHTML = `Das GOV-Objekt ${govId} existiert nicht mehr. <a href="https://gov.genealogy.net/item/show/${govId}" target="_blank"> klicken Sie hier</a>, um Näheres zu erfahren.`; }
widgetContainer.innerHTML += `
Die GOV-ID ${govId} ist nicht mehr gültig und wurde durch eine andere ersetzt.
`;
throw new Error("GOV-ID ersetzt"); } else if (response.status === 404) {
widgetContainer.innerHTML = `
${govId} ist keine gültige GOV-ID!
`;
throw new Error("GOV-ID nicht gültig"); } else { throw new Error(`Unerwarteter Status: ${response.status}`); } }) .then(newGovId => { console.debug(`Using GOV-ID for fetch:`, newGovId); return fetch(`https://gov.genealogy.net/item/wikihtml/${newGovId}`); }) .then(response => { if (!response.ok) { throw new Error(`HTTP-Fehler! Status: ${response.status}`); } return response.text(); }) .then(html => { console.debug("Fetched HTML Content:", html.length > 100 ? html.substring(0, 100) + "..." : html); if (!html.trim()) { console.error("Fehler: Geladener HTML-Inhalt ist leer!"); return; } console.debug("Received HTML content, inserting into widget."); const shadow = contentContainer.attachShadow({ mode: 'open' }); const content = document.createElement('div'); content.innerHTML = html; const style = document.createElement('style'); style.textContent = ` :host { all: initial; display: block; max-width: 1200px; margin: 20px auto; font-family: Arial, sans-serif; } table { width: 100%; border-collapse: collapse; margin: 10px 0; border: 1px solid #ccc; } th, td { border: 1px solid #ddd; padding: 10px; text-align: left; } a { color: #007BFF; text-decoration: none; } a:hover { text-decoration: underline; } `;
shadow.appendChild(style); shadow.appendChild(content); }) .catch(error => { console.error("Fehler beim Laden:", error); }); })();
</script>