mirror of
https://github.com/Dvorinka/PPve.git
synced 2026-06-04 20:42:59 +00:00
f
This commit is contained in:
+20
-11
@@ -1450,8 +1450,17 @@ let template = {
|
|||||||
|
|
||||||
// Initialize when DOM is loaded
|
// Initialize when DOM is loaded
|
||||||
document.addEventListener('DOMContentLoaded', () => {
|
document.addEventListener('DOMContentLoaded', () => {
|
||||||
|
// Initialize template configurations
|
||||||
|
window.templateConfigs = {
|
||||||
|
'default': {
|
||||||
|
name: 'Výchozí',
|
||||||
|
background: 'linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%)',
|
||||||
|
textColor: '#212529',
|
||||||
|
textAlign: 'left'
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// Initialize banner preview elements
|
// Initialize banner preview elements
|
||||||
bannerVisible = document.getElementById('bannerVisibility');
|
|
||||||
bannerBgColor = document.getElementById('bannerBgColor');
|
bannerBgColor = document.getElementById('bannerBgColor');
|
||||||
bannerTextColor = document.getElementById('bannerTextColor');
|
bannerTextColor = document.getElementById('bannerTextColor');
|
||||||
bannerText = document.getElementById('bannerText');
|
bannerText = document.getElementById('bannerText');
|
||||||
@@ -1462,16 +1471,16 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||||||
bannerBorderRadius = document.getElementById('bannerBorderRadius');
|
bannerBorderRadius = document.getElementById('bannerBorderRadius');
|
||||||
bannerPreview = document.getElementById('bannerPreview');
|
bannerPreview = document.getElementById('bannerPreview');
|
||||||
|
|
||||||
|
// Initialize banner visibility
|
||||||
|
const bannerVisibilityElement = document.getElementById('bannerVisibility');
|
||||||
|
if (bannerVisibilityElement) {
|
||||||
|
window.bannerVisible = bannerVisibilityElement.checked;
|
||||||
|
}
|
||||||
|
|
||||||
// Initialize drag and drop and image upload
|
// Initialize drag and drop and image upload
|
||||||
initDragAndDrop();
|
initDragAndDrop();
|
||||||
|
|
||||||
// Set up file input change event
|
// Initialize banner event listeners
|
||||||
const bannerImageInput = document.getElementById('bannerImage');
|
|
||||||
if (bannerImageInput) {
|
|
||||||
bannerImageInput.addEventListener('change', handleImageUpload);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set up event listeners for preview updates
|
|
||||||
function setupBannerEventListeners() {
|
function setupBannerEventListeners() {
|
||||||
const bannerTextElement = document.getElementById('bannerText');
|
const bannerTextElement = document.getElementById('bannerText');
|
||||||
if (bannerTextElement) {
|
if (bannerTextElement) {
|
||||||
@@ -3284,14 +3293,14 @@ function updateBannerPreview() {
|
|||||||
const bannerPreviewContent = document.getElementById('bannerPreviewContent');
|
const bannerPreviewContent = document.getElementById('bannerPreviewContent');
|
||||||
const bannerTextElement = document.getElementById('bannerText');
|
const bannerTextElement = document.getElementById('bannerText');
|
||||||
const bannerText = bannerTextElement ? bannerTextElement.innerText || bannerTextElement.textContent : '';
|
const bannerText = bannerTextElement ? bannerTextElement.innerText || bannerTextElement.textContent : '';
|
||||||
const bannerVisible = document.getElementById('bannerVisible')?.checked !== false;
|
const bannerVisible = window.bannerVisible || false;
|
||||||
const bannerTemplates = document.getElementById('bannerTemplates');
|
const bannerTemplates = document.getElementById('bannerTemplates');
|
||||||
const imagePreview = document.getElementById('imagePreview');
|
const imagePreview = document.getElementById('imagePreview');
|
||||||
const imagePreviewContainer = document.getElementById('imagePreviewContainer');
|
const imagePreviewContainer = document.getElementById('imagePreviewContainer');
|
||||||
|
|
||||||
// Get the current template config or use default if none selected
|
// Get the current template config or use default if none selected
|
||||||
const defaultTemplate = templateConfigs['default'] || {};
|
const defaultTemplate = window.templateConfigs?.['default'] || {};
|
||||||
const template = currentTemplate ? (templateConfigs[currentTemplate] || defaultTemplate) : defaultTemplate;
|
const template = currentTemplate ? (window.templateConfigs?.[currentTemplate] || defaultTemplate) : defaultTemplate;
|
||||||
const fileInput = document.getElementById('bannerImage');
|
const fileInput = document.getElementById('bannerImage');
|
||||||
const hasImage = Boolean(currentImage || (fileInput && fileInput.files && fileInput.files.length > 0));
|
const hasImage = Boolean(currentImage || (fileInput && fileInput.files && fileInput.files.length > 0));
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user