mirror of
https://github.com/Dvorinka/PPve.git
synced 2026-06-05 04:52:58 +00:00
img fetch
This commit is contained in:
+30
-3
@@ -104,10 +104,11 @@
|
|||||||
`;
|
`;
|
||||||
|
|
||||||
// Create image container
|
// Create image container
|
||||||
let imgContainer = `
|
const imgContainer = `
|
||||||
<div class="banner-image-container" style="
|
<div class="banner-image-container" style="
|
||||||
display: inline-block;
|
display: block;
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
|
text-align: center;
|
||||||
${imagePosition === 'top' || imagePosition === 'bottom' ? 'margin-bottom: 20px;' : ''}
|
${imagePosition === 'top' || imagePosition === 'bottom' ? 'margin-bottom: 20px;' : ''}
|
||||||
">
|
">
|
||||||
<img
|
<img
|
||||||
@@ -115,9 +116,13 @@
|
|||||||
style="${imgStyle}"
|
style="${imgStyle}"
|
||||||
alt="Banner obrázek"
|
alt="Banner obrázek"
|
||||||
class="banner-image"
|
class="banner-image"
|
||||||
|
onerror="console.error('Failed to load banner image:', this.src)"
|
||||||
>
|
>
|
||||||
</div>`;
|
</div>`;
|
||||||
|
|
||||||
|
// Add image to content
|
||||||
|
content += imgContainer;
|
||||||
|
|
||||||
// Wrap image with link if URL is provided
|
// Wrap image with link if URL is provided
|
||||||
if (bannerLink) {
|
if (bannerLink) {
|
||||||
imgContainer = `
|
imgContainer = `
|
||||||
@@ -190,7 +195,29 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Close the banner content container
|
// Add text if it exists
|
||||||
|
if (bannerText) {
|
||||||
|
const textStyle = `
|
||||||
|
margin: 0;
|
||||||
|
padding: 10px;
|
||||||
|
line-height: 1.6;
|
||||||
|
color: ${textColor};
|
||||||
|
text-align: ${textAlign};
|
||||||
|
font-size: ${fontSize};
|
||||||
|
`;
|
||||||
|
|
||||||
|
// Wrap text in link if URL is provided
|
||||||
|
const textElement = bannerLink
|
||||||
|
? `<a href="${bannerLink}" target="_blank" style="color: inherit; text-decoration: none;">${bannerText}</a>`
|
||||||
|
: bannerText;
|
||||||
|
|
||||||
|
content += `
|
||||||
|
<div class="banner-text" style="${textStyle}">
|
||||||
|
${textElement}
|
||||||
|
</div>`;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set the content and make banner visible
|
||||||
bannerContent.innerHTML = content;
|
bannerContent.innerHTML = content;
|
||||||
|
|
||||||
// Log the content for debugging
|
// Log the content for debugging
|
||||||
|
|||||||
Reference in New Issue
Block a user