Prvi commit: WordPress tema Europe Wonder s CI/CD konfiguracijo

This commit is contained in:
Mark Poljanšek committed 2025-05-18 10:26:22 +02:00
commit 135cc3b4c6
438 files changed
+56454

No files matched your search

+20
View File
@@ -0,0 +1,20 @@
(function($) {
'use strict';
// Posodobi predogled, ko se spremeni vrstni red Experience Journeyev
wp.customize('experience_journey_order', function(setting) {
setting.bind(function(newValue) {
wp.customize.previewer.refresh();
});
});
// Posodobi predogled, ko se spremeni vrstni red Individual Tours v katerem koli Journey
$('option[id^="individual_tour_order_"]').each(function() {
var settingId = $(this).attr('id');
wp.customize(settingId, function(setting) {
setting.bind(function(newValue) {
wp.customize.previewer.refresh();
});
});
});
})(jQuery);
+17
View File
@@ -0,0 +1,17 @@
(function($) {
'use strict';
wp.customize.bind('ready', function() {
$('.sortable-posts-list').sortable({
update: function(event, ui) {
var $list = $(this);
var postIds = [];
$list.find('li').each(function() {
postIds.push($(this).data('post-id'));
});
var $input = $list.closest('.customize-control').find('input[type="hidden"]');
$input.val(postIds.join(',')).trigger('change');
}
});
});
})(jQuery);
+64
View File
@@ -0,0 +1,64 @@
document.addEventListener('DOMContentLoaded', function() {
const menuToggle = document.getElementById('menuToggle');
const mainNav = document.querySelector('.main-nav');
const body = document.body;
// Ustvari overlay element
let overlay = document.querySelector('.menu-overlay');
if (!overlay) {
overlay = document.createElement('div');
overlay.className = 'menu-overlay';
document.body.appendChild(overlay);
}
if (menuToggle && mainNav) {
menuToggle.addEventListener('click', function() {
mainNav.classList.toggle('active');
overlay.classList.toggle('active');
body.classList.toggle('menu-open');
menuToggle.classList.toggle('active');
// Dodaj aria-expanded za dostopnost
const isExpanded = mainNav.classList.contains('active');
menuToggle.setAttribute('aria-expanded', isExpanded);
// Eksplicitno nastavi display stil
mainNav.style.display = isExpanded ? 'block' : 'none';
});
// Zapri meni ob kliku na overlay
overlay.addEventListener('click', function() {
mainNav.classList.remove('active');
overlay.classList.remove('active');
body.classList.remove('menu-open');
menuToggle.classList.remove('active');
menuToggle.setAttribute('aria-expanded', 'false');
mainNav.style.display = 'none';
});
// Zapri meni ob kliku na povezavo v meniju
const menuLinks = mainNav.querySelectorAll('a');
menuLinks.forEach(link => {
link.addEventListener('click', function() {
mainNav.classList.remove('active');
overlay.classList.remove('active');
body.classList.remove('menu-open');
menuToggle.classList.remove('active');
menuToggle.setAttribute('aria-expanded', 'false');
mainNav.style.display = 'none';
});
});
// Zapri meni ob resize-u okna
window.addEventListener('resize', function() {
if (window.innerWidth > 768) {
mainNav.classList.remove('active');
overlay.classList.remove('active');
body.classList.remove('menu-open');
menuToggle.classList.remove('active');
menuToggle.setAttribute('aria-expanded', 'false');
mainNav.style.removeProperty('display');
}
});
}
});
+121
View File
@@ -0,0 +1,121 @@
document.addEventListener('DOMContentLoaded', function() {
if (!localStorage.getItem('popupShown')) {
setTimeout(function() {
document.getElementById('email-popup').style.display = 'flex';
}, 2000); // Show popup after 2 seconds
}
// Dodaj poslušalca za promocijsko kodo v popupu
const popupPromoInput = document.getElementById('popup-promo-code');
const popupApplyButton = document.getElementById('popup-apply-promo');
const popupPromoMessage = document.getElementById('popup-promo-message');
let promoCodeApplied = false;
if (popupPromoInput && popupApplyButton) {
popupApplyButton.addEventListener('click', function(e) {
e.preventDefault();
const promoCode = popupPromoInput.value.trim();
if (promoCode === 'HOLIDAYS25' && !promoCodeApplied) {
// Pridobi trenutni znesek
const totalElement = document.getElementById('popupTotalPrice');
if (totalElement) {
const currentAmount = parseFloat(totalElement.textContent);
const newAmount = currentAmount - 100;
// Posodobi prikaz
totalElement.textContent = newAmount.toFixed(2);
// Posodobi tudi zneske za delno plačilo
const fullPaymentAmount = document.getElementById('full-payment-amount');
const depositAmount = document.getElementById('deposit-amount');
if (fullPaymentAmount) {
fullPaymentAmount.textContent = newAmount.toFixed(2);
}
if (depositAmount) {
depositAmount.textContent = (newAmount * 0.3).toFixed(2);
}
// Dodaj sporočilo o uspehu
popupPromoMessage.innerHTML = '<p class="promo-success">Promotional code successfully applied! We deducted €100.</p>';
// Onemogoči nadaljnje vnose
popupPromoInput.disabled = true;
popupApplyButton.disabled = true;
promoCodeApplied = true;
}
} else {
// Prikaži napako
popupPromoMessage.innerHTML = '<p class="promo-error">Neveljavna promocijska koda.</p>';
// Odstrani sporočilo o napaki po 3 sekundah
setTimeout(() => {
popupPromoMessage.innerHTML = '';
}, 3000);
}
});
}
// Pridobi podatke o vodiču
const guideImage = document.getElementById('guide-image-data')?.getAttribute('data-guide-image');
const guideName = document.getElementById('guide-image-data')?.getAttribute('data-guide-name');
const guideTitle = document.getElementById('guide-image-data')?.getAttribute('data-guide-title');
// Posodobi HTML v obrazcu
if (guideImage && guideName) {
const guideContainer = document.querySelector('.guide-info-container');
if (guideContainer) {
guideContainer.innerHTML = `
<div class="guide-info">
<div class="guide-left">
<div class="guide-image-container">
<img src="${guideImage}" alt="${guideName}" class="guide-image">
<h4 class="guide-name">${guideName}</h4>
</div>
</div>
<div class="guide-contact">
<a href="mailto:info@europewonder.com" class="contact-item">
<i class="fas fa-envelope"></i>
<span>info@europewonder.com</span>
</a>
<a href="tel:+38671548893" class="contact-item">
<i class="fas fa-phone"></i>
<span>+386 (0) 71 548 893</span>
</a>
<a href="https://wa.me/38671548893" class="contact-item" target="_blank">
<i class="fab fa-whatsapp"></i>
<span>WhatsApp chat</span>
</a>
</div>
</div>
`;
}
}
});
function closePopup() {
document.getElementById('email-popup').style.display = 'none';
localStorage.setItem('popupShown', 'true');
}
async function submitEmail(event) {
event.preventDefault();
const email = document.getElementById('popup-email').value;
try {
const response = await fetch('/wp-admin/admin-ajax.php', {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
body: `action=save_popup_email&email=${encodeURIComponent(email)}`
});
if (response.ok) {
document.getElementById('success-message').style.display = 'block';
document.getElementById('email-form').style.display = 'none';
}
} catch (error) {
console.error('Error:', error);
}
}
+362
View File
@@ -0,0 +1,362 @@
document.addEventListener('DOMContentLoaded', function() {
// ---------- MOBILNI MENI ----------
const mainNav = document.querySelector('.main-nav');
const body = document.body;
// Ustvari overlay element
const overlay = document.createElement('div');
overlay.className = 'menu-overlay';
document.body.appendChild(overlay);
if (menuToggle && mainNav) {
menuToggle.addEventListener('click', function() {
menuToggle.classList.toggle('active');
mainNav.classList.toggle('active');
overlay.classList.toggle('active');
body.classList.toggle('menu-open');
});
// Zapri meni ob kliku na overlay
overlay.addEventListener('click', function() {
menuToggle.classList.remove('active');
mainNav.classList.remove('active');
overlay.classList.remove('active');
body.classList.remove('menu-open');
});
// Zapri meni ob kliku na povezavo
mainNav.querySelectorAll('a').forEach(link => {
link.addEventListener('click', function() {
menuToggle.classList.remove('active');
mainNav.classList.remove('active');
overlay.classList.remove('active');
body.classList.remove('menu-open');
});
});
}
// Zapri meni ob resize-u okna
window.addEventListener('resize', function() {
if (window.innerWidth > 768) {
menuToggle.classList.remove('active');
mainNav.classList.remove('active');
overlay.classList.remove('active');
body.classList.remove('menu-open');
}
});
// ---------- PLAVAJOČI GUMB ZA POVPRAŠEVANJE ----------
// Ustvarimo nov HTML element za plavajoči gumb
const floatingButton = document.createElement('a');
floatingButton.className = 'floating-inquiry-btn';
floatingButton.href = '/inquiry/';
floatingButton.innerHTML = '<i class="fas fa-comment-alt"></i> Custom Journey Inquiry';
// Dodamo gumb v body
document.body.appendChild(floatingButton);
// Če obstaja popup element na strani, bomo uporabili ta obstoječi element
let inquiryPopup = document.getElementById('inquiry-popup');
// Če popup ne obstaja na trenutni strani, ga ustvarimo
if (!inquiryPopup) {
// Ustvarimo nov popup
inquiryPopup = document.createElement('div');
inquiryPopup.id = 'inquiry-popup';
inquiryPopup.className = 'inquiry-popup';
// Vsebina popupa
inquiryPopup.innerHTML = `
<div class="inquiry-popup-content">
<span class="inquiry-close">&times;</span>
<h3>Custom Journey Inquiry</h3>
<form id="custom-inquiry-form" class="inquiry-form">
<input type="hidden" name="action" value="custom_inquiry_submit">
<input type="hidden" name="inquiry_security" id="inquiry_security" value="">
<div class="form-group">
<label for="name">Your Name</label>
<input type="text" id="name" name="name" required>
</div>
<div class="form-group">
<label for="email">Email Address</label>
<input type="email" id="email" name="email" required>
</div>
<div class="form-group half">
<label for="travel-date">Planned Travel Date</label>
<input type="date" id="travel-date" name="travel_date">
</div>
<div class="form-group half">
<label for="travelers">Number of Travelers</label>
<input type="number" id="travelers" name="travelers" min="1" value="2">
</div>
<div class="form-group">
<label for="destination">Preferred Destination(s)</label>
<input type="text" id="destination" name="destination" placeholder="e.g. Slovenia, Croatia, Hungary...">
</div>
<div class="form-group">
<label for="message">Your Travel Wishes</label>
<textarea id="message" name="message" rows="4" placeholder="Tell us what you're looking for in your custom journey..."></textarea>
</div>
<button type="submit" class="btn-submit">Submit Inquiry</button>
</form>
</div>
`;
// Dodamo style, če ga še ni
if (!document.getElementById('inquiry-popup-styles')) {
const popupStyles = document.createElement('style');
popupStyles.id = 'inquiry-popup-styles';
popupStyles.textContent = `
/* Popup Styles */
.inquiry-popup {
display: none;
position: fixed;
z-index: 9999;
left: 0;
top: 0;
width: 100%;
height: 100%;
overflow: auto;
background-color: rgba(0, 0, 0, 0.6);
opacity: 0;
transition: opacity 0.3s ease;
}
.inquiry-popup.active {
display: block;
opacity: 1;
}
.inquiry-popup-content {
background-color: white;
margin: 5% auto;
padding: 2rem;
border-radius: 12px;
width: 90%;
max-width: 600px;
box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
transform: translateY(-20px);
transition: transform 0.3s ease;
position: relative;
}
.inquiry-popup.active .inquiry-popup-content {
transform: translateY(0);
}
.inquiry-close {
position: absolute;
top: 1.2rem;
right: 1.5rem;
font-size: 2rem;
color: #aaa;
cursor: pointer;
transition: color 0.3s ease;
}
.inquiry-close:hover {
color: var(--accent);
}
.inquiry-popup h3 {
margin-top: 0;
margin-bottom: 1.5rem;
color: var(--dark);
font-size: 1.8rem;
text-align: center;
}
.inquiry-form .form-group {
margin-bottom: 1.2rem;
}
.inquiry-form .half {
width: 49%;
display: inline-block;
}
.inquiry-form .form-group:nth-child(3) {
margin-right: 2%;
}
.inquiry-form label {
display: block;
margin-bottom: 0.5rem;
color: #555;
font-weight: 500;
}
.inquiry-form input,
.inquiry-form textarea {
width: 100%;
padding: 0.8rem;
border: 1px solid #ddd;
border-radius: 4px;
font-size: 1rem;
transition: border-color 0.3s ease;
}
.inquiry-form input:focus,
.inquiry-form textarea:focus {
border-color: var(--accent);
outline: none;
}
.inquiry-form .btn-submit {
width: 100%;
padding: 1rem;
background-color: var(--accent);
color: white;
border: none;
border-radius: 4px;
cursor: pointer;
font-size: 1.1rem;
font-weight: 600;
transition: background-color 0.3s ease;
margin-top: 1rem;
}
.inquiry-form .btn-submit:hover {
background-color: var(--accent-dark);
}
body.popup-open {
overflow: hidden;
}
@media (max-width: 768px) {
.inquiry-popup-content {
padding: 1.5rem;
margin: 10% auto;
width: 95%;
}
.inquiry-form .half {
width: 100%;
display: block;
}
.inquiry-form .form-group:nth-child(3) {
margin-right: 0;
}
}
`;
document.head.appendChild(popupStyles);
}
// Dodamo popup v body
document.body.appendChild(inquiryPopup);
// Pridobimo varnostni nonce preko AJAX klica
fetch(inquiry_ajax_object.ajax_url, {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
body: 'action=get_inquiry_nonce'
})
.then(response => response.json())
.then(data => {
if (data.success) {
document.getElementById('inquiry_security').value = data.data;
}
})
.catch(error => {
console.error('Error fetching nonce:', error);
});
}
// Poskrbimo, da je popup začetno skrit
inquiryPopup.classList.remove('active');
document.body.classList.remove('popup-open');
// Dodamo "click" poslušalec za odpiranje popupa
floatingButton.addEventListener('click', function() {
inquiryPopup.classList.add('active');
document.body.classList.add('popup-open');
});
// Pridobimo referenco na elemente v popupu
const inquiryClose = inquiryPopup.querySelector('.inquiry-close');
const inquiryForm = inquiryPopup.querySelector('#custom-inquiry-form');
// Zapri popup (X gumb)
inquiryClose.addEventListener('click', function() {
inquiryPopup.classList.remove('active');
document.body.classList.remove('popup-open');
});
// Zapri popup (klik izven obrazca)
inquiryPopup.addEventListener('click', function(e) {
if (e.target === inquiryPopup) {
inquiryPopup.classList.remove('active');
document.body.classList.remove('popup-open');
}
});
// Zapri popup (tipka ESC)
document.addEventListener('keydown', function(e) {
if (e.key === 'Escape' && inquiryPopup.classList.contains('active')) {
inquiryPopup.classList.remove('active');
document.body.classList.remove('popup-open');
}
});
// Pošlji obrazec
inquiryForm.addEventListener('submit', function(e) {
e.preventDefault();
// Prikaži indikator nalaganja
const submitBtn = inquiryForm.querySelector('.btn-submit');
const originalBtnText = submitBtn.textContent;
submitBtn.textContent = 'Sending...';
submitBtn.disabled = true;
// Pridobi podatke iz obrazca
const formData = new FormData(inquiryForm);
const nonce = document.getElementById('inquiry_security').value;
formData.append('security', nonce);
console.log('Sending form data to AJAX endpoint...');
// Pošlji AJAX zahtevek
fetch(inquiry_ajax_object.ajax_url, {
method: 'POST',
body: formData
})
.then(response => {
console.log('Response status:', response.status);
if (!response.ok) {
throw new Error('Network response was not ok: ' + response.status);
}
return response.json();
})
.then(data => {
console.log('Response data:', data);
// Ponastavi gumb
submitBtn.textContent = originalBtnText;
submitBtn.disabled = false;
if (data.success) {
// Uspešno poslano
alert(data.data);
inquiryForm.reset();
inquiryPopup.classList.remove('active');
document.body.classList.remove('popup-open');
} else {
// Napaka
console.error('Form submission error:', data);
alert(data.data || 'There was an error sending your inquiry. Please try again.');
}
})
.catch(error => {
// Ponastavi gumb
submitBtn.textContent = originalBtnText;
submitBtn.disabled = false;
console.error('Error during form submission:', error);
alert('There was an error sending your inquiry: ' + error.message);
});
});
});