Widget:GOV-Test: Unterschied zwischen den Versionen
Aus Altes Köln
Keine Bearbeitungszusammenfassung |
Keine Bearbeitungszusammenfassung |
||
| Zeile 4: | Zeile 4: | ||
<script> | <script> | ||
const serverBaseURL = "https://gov.genealogy.net"; | const serverBaseURL = "https://gov.genealogy.net"; | ||
| Zeile 10: | Zeile 9: | ||
.then(response => response.text()) | .then(response => response.text()) | ||
.then(html => { | .then(html => { | ||
const tempDiv = document.createElement('div'); | const tempDiv = document.createElement('div'); | ||
tempDiv.innerHTML = html; | tempDiv.innerHTML = html; | ||
// Alle Links | // Alle Links und Bilder anpassen | ||
const links = tempDiv.querySelectorAll('a[href^="/"]'); | const links = tempDiv.querySelectorAll('a[href^="/"]'); | ||
links.forEach(link => { | links.forEach(link => { | ||
link.href = serverBaseURL + link.getAttribute('href'); | link.href = serverBaseURL + link.getAttribute('href'); | ||
}); | }); | ||
const images = tempDiv.querySelectorAll('img[src^="/"]'); | |||
const images = tempDiv.querySelectorAll('img[src^="/"]'); | |||
images.forEach(img => { | images.forEach(img => { | ||
img.src = serverBaseURL + img.getAttribute('src'); | img.src = serverBaseURL + img.getAttribute('src'); | ||
}); | }); | ||
// | // Grafik mit Zoom-Effekt anpassen | ||
const zoomImage = tempDiv.querySelector('td a[href*="relationshipGraph"] img'); | |||
if (zoomImage) { | |||
const wrapper = document.createElement('div'); | |||
wrapper.className = 'zoomable'; | |||
zoomImage.parentElement.replaceWith(wrapper); | |||
wrapper.appendChild(zoomImage); | |||
} | |||
document.getElementById('content').innerHTML = tempDiv.innerHTML; | document.getElementById('content').innerHTML = tempDiv.innerHTML; | ||
| Zeile 38: | Zeile 42: | ||
.catch(error => console.error('Error loading content:', error)); | .catch(error => console.error('Error loading content:', error)); | ||
</script> | </script> | ||
<style> | |||
/* Styling für zoombare Bilder */ | |||
.zoomable { | |||
position: relative; | |||
display: inline-block; | |||
overflow: hidden; | |||
cursor: zoom-in; | |||
max-width: 100%; /* Begrenzung auf Elternbreite */ | |||
} | |||
.zoomable img { | |||
transition: transform 0.3s ease; | |||
width: 100%; /* Standardgröße */ | |||
height: auto; | |||
} | |||
.zoomable:hover img { | |||
transform: scale(1.5); /* Zoom-Level */ | |||
cursor: zoom-out; | |||
} | |||
</style> | |||
Version vom 19. Januar 2025, 22:03 Uhr
Ajax-Variante mit wiki
<script>
const serverBaseURL = "https://gov.genealogy.net";
fetch('https://gov.genealogy.net/item/wikihtml/SCHERGJO54EJ')
.then(response => response.text())
.then(html => {
const tempDiv = document.createElement('div');
tempDiv.innerHTML = html;
// Alle Links und Bilder anpassen
const links = tempDiv.querySelectorAll('a[href^="/"]');
links.forEach(link => {
link.href = serverBaseURL + link.getAttribute('href');
});
const images = tempDiv.querySelectorAll('img[src^="/"]');
images.forEach(img => {
img.src = serverBaseURL + img.getAttribute('src');
});
// Grafik mit Zoom-Effekt anpassen
const zoomImage = tempDiv.querySelector('td a[href*="relationshipGraph"] img');
if (zoomImage) {
const wrapper = document.createElement('div');
wrapper.className = 'zoomable';
zoomImage.parentElement.replaceWith(wrapper);
wrapper.appendChild(zoomImage);
}
document.getElementById('content').innerHTML = tempDiv.innerHTML;
// Beispiel für Styling
const table = document.querySelector('#content table');
if (table) {
table.style.width = '100%';
table.style.fontFamily = 'Arial, sans-serif';
}
})
.catch(error => console.error('Error loading content:', error));
</script>
<style>
/* Styling für zoombare Bilder */
.zoomable {
position: relative;
display: inline-block;
overflow: hidden;
cursor: zoom-in;
max-width: 100%; /* Begrenzung auf Elternbreite */
}
.zoomable img {
transition: transform 0.3s ease;
width: 100%; /* Standardgröße */
height: auto;
}
.zoomable:hover img {
transform: scale(1.5); /* Zoom-Level */
cursor: zoom-out;
}
</style>
Variante: Einfacher iframe mit
Variante: responsiv mit
<style>
body {
margin: 0;
padding: 0;
font-family: Arial, sans-serif;
}
.iframe-container {
width: 100%; /* Container hat immer die volle Breite des Viewports */
position: relative; /* Wichtig für absolute Positionierung */
padding-top: 56.25%; /* Seitenverhältnis 16:9 */
}
iframe {
position: absolute;
top: 0;
left: 0;
width: 100vw; /* Breite des Viewports */
height: calc(100vw * 0.5625); /* Höhe proportional zur Breite (16:9) */
transform-origin: top left; /* Skalierung startet oben links */
}
/* Media Queries für kleinere Bildschirme */
@media (max-width: 768px) {
iframe {
transform: scale(0.9); /* Skaliere den iframe-Inhalt */
}
}
@media (max-width: 480px) {
iframe {
transform: scale(0.8); /* Weitere Skalierung für kleine Geräte */
}
}
</style>
