mirror of
https://github.com/Dvorinka/PPve.git
synced 2026-06-04 04:22:58 +00:00
s
This commit is contained in:
+24
-16
@@ -1303,16 +1303,15 @@ function updateBannerPreview() {
|
||||
const imageX = currentImageX || '0';
|
||||
const imageY = currentImageY || '0';
|
||||
|
||||
// Update banner container styles to match index.html
|
||||
// Update banner container styles to exactly match index.html
|
||||
bannerPreview.style.display = 'block';
|
||||
bannerPreview.style.width = '100%';
|
||||
bannerPreview.style.transition = 'all 0.3s ease';
|
||||
bannerPreview.style.margin = '0 auto';
|
||||
bannerPreview.style.maxWidth = '100%';
|
||||
bannerPreview.style.padding = '0';
|
||||
bannerPreview.style.borderRadius = `${bannerBorderRadius}px`;
|
||||
bannerPreview.style.maxWidth = '1200px';
|
||||
bannerPreview.style.padding = '0 1rem';
|
||||
|
||||
// Update banner content styles to match index.html
|
||||
// Update banner content styles to exactly match index.html
|
||||
Object.assign(bannerPreviewContent.style, {
|
||||
backgroundColor: bannerBgColor,
|
||||
color: bannerTextColor,
|
||||
@@ -1322,9 +1321,7 @@ function updateBannerPreview() {
|
||||
margin: `${bannerMargin}px 0`,
|
||||
borderRadius: `${bannerBorderRadius}px`,
|
||||
boxShadow: '0 2px 4px rgba(0,0,0,0.1)',
|
||||
display: 'block',
|
||||
position: 'relative',
|
||||
zIndex: '2'
|
||||
display: 'block'
|
||||
});
|
||||
|
||||
// Handle content and image like in index.html
|
||||
@@ -1344,8 +1341,11 @@ function updateBannerPreview() {
|
||||
});
|
||||
}
|
||||
|
||||
// Determine image style based on position
|
||||
let imageStyle = '';
|
||||
// Apply the same border radius to the image as to the container
|
||||
const imageRadius = Math.max(bannerBorderRadius, 0);
|
||||
|
||||
// Determine image style based on position - exactly match index.html
|
||||
let imageStyle = `max-width: 100%; max-height: 200px; border-radius: ${imageRadius}px;`;
|
||||
let containerStyle = 'margin-bottom: 15px;';
|
||||
|
||||
switch(imagePosition) {
|
||||
@@ -1356,18 +1356,20 @@ function updateBannerPreview() {
|
||||
containerStyle += 'text-align: right; float: right; margin-left: 15px;';
|
||||
break;
|
||||
case 'custom':
|
||||
containerStyle += `position: relative;`;
|
||||
imageStyle = `position: relative; left: ${imageX}px; top: ${imageY}px;`;
|
||||
containerStyle += 'position: relative;';
|
||||
// For custom position, use absolute positioning to ensure exact placement
|
||||
imageStyle += `position: absolute; left: ${imageX}px; top: ${imageY}px;`;
|
||||
break;
|
||||
default: // center
|
||||
containerStyle += `text-align: ${bannerTextAlign};`;
|
||||
containerStyle += 'text-align: center; display: block;';
|
||||
break;
|
||||
}
|
||||
|
||||
// Format content with image like in index.html
|
||||
// Format content with image exactly like in index.html
|
||||
content = `
|
||||
<div style="${containerStyle}" class="banner-image-container">
|
||||
<img src="${currentImage}"
|
||||
style="max-width: 100%; max-height: 200px; border-radius: 4px; ${imageStyle}"
|
||||
style="${imageStyle}"
|
||||
class="${imagePosition === 'custom' ? 'draggable-image' : ''}"
|
||||
data-position="${imagePosition}"
|
||||
data-x="${imageX}"
|
||||
@@ -1381,6 +1383,9 @@ function updateBannerPreview() {
|
||||
imagePreview.src = currentImage;
|
||||
imagePreviewContainer.style.display = 'block';
|
||||
}
|
||||
|
||||
// Add the with-image class to the banner preview for proper spacing
|
||||
bannerPreview.classList.add('with-image');
|
||||
} else {
|
||||
// Hide the image preview container if no image
|
||||
if (imagePreviewContainer) {
|
||||
@@ -1391,9 +1396,12 @@ function updateBannerPreview() {
|
||||
if (imagePositionControls) {
|
||||
imagePositionControls.style.display = 'none';
|
||||
}
|
||||
|
||||
// Remove the with-image class from the banner preview
|
||||
bannerPreview.classList.remove('with-image');
|
||||
}
|
||||
|
||||
// Wrap in link if provided
|
||||
// Wrap in link if provided - exactly match index.html
|
||||
if (bannerLink) {
|
||||
content = `<a href="${bannerLink}" style="color: inherit; text-decoration: none; display: block;">${content}</a>`;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user