Sono stati aggiunti numerosi nuovi file JavaScript, CSS, SVG e PNG per migliorare la grafica, la responsività e le funzionalità delle pagine di aste, login, notifiche e player video. Introdotte nuove librerie (OneSignal, Bootstrap, Font Awesome, Vue.js, Slick Carousel, ProgressBar.js, CryptoJS, mCustomScrollbar, Switchery) e script per la gestione di notifiche push, tracciamento eventi (Facebook Pixel, TikTok Pixel, Google Ads, Smartech), pagamenti Ingenico, modali, banner promozionali, preferiti, auto-puntate, e gestione utente inattivo. Ampliata la logica del player embedded YouTube con nuovi hook, logging avanzato, gestione ciclo di vita, storage e challenge di attestation. Aggiunti nuovi stili CSS per layout responsive, componenti UI, modali, badge, bottoni, progress bar, e ottimizzazioni mobile. Integrate nuove immagini e icone per arricchire l’interfaccia grafica. Non sono state apportate modifiche al file `www-player.css` e ad altri file specificati. Queste modifiche migliorano la sicurezza, la tracciabilità, l’esperienza utente e la flessibilità dell’applicazione.
136 lines
4.0 KiB
Plaintext
136 lines
4.0 KiB
Plaintext
const { createApp } = Vue;
|
|
|
|
let container = window.innerWidth > 576 ? "#appVariants" : "#appVariantsMobile";
|
|
|
|
createApp({
|
|
data() {
|
|
return {
|
|
showElement: false,
|
|
title: "",
|
|
content: "",
|
|
variants: []
|
|
}
|
|
},
|
|
mounted(){
|
|
let idProduct = document.querySelector('body').getAttribute('data-idProduct');
|
|
fetch('/ajax/get_variants.php?' + new URLSearchParams({
|
|
product: idProduct
|
|
})).then((response) => response.json())
|
|
.then((data) => {
|
|
|
|
this.showElement = !!Object.keys(data).length && data.isvalid === true && data.products.length > 0;
|
|
this.title = data.title_detail;
|
|
this.variants = data.products;
|
|
});
|
|
|
|
}
|
|
|
|
}).mount(container);
|
|
|
|
|
|
createApp({
|
|
data() {
|
|
return {
|
|
showElement: false,
|
|
title: "",
|
|
showErrorMsg: false,
|
|
errorMsg: "",
|
|
variants: [],
|
|
btnClassLists: ['.pay-btn','.btn-blue-proceed','.pay-with-a-card', '.btn-green'],
|
|
choose: "",
|
|
chooseId: null,
|
|
defaultText: "",
|
|
showDropdown: false
|
|
|
|
}
|
|
},
|
|
created(){
|
|
this.disablePayButton();
|
|
},
|
|
mounted(e) {
|
|
|
|
this.addListenerPayButton();
|
|
let data = JSON.parse(atob(document.querySelector('#variantsModule').getAttribute('data-content')));
|
|
|
|
this.showElement = this.setupApp(data);
|
|
this.title = data.title_checkout;
|
|
this.defaultText = data.label_option_selectbox_default;
|
|
this.variants = data.products;
|
|
|
|
this.errorMsg = data.label_error_msg_selectbox;
|
|
|
|
|
|
},
|
|
methods: {
|
|
setupApp(data){
|
|
|
|
if(data.isvalid === false){
|
|
this.activePayButton();
|
|
return false;
|
|
}
|
|
|
|
if(data.isvalid && data.products.length === 0){
|
|
this.activePayButton();
|
|
return false;
|
|
}
|
|
|
|
if(data.isvalid === true){
|
|
this.disablePayButton();
|
|
return !!Object.keys(data).length && data.products.length;
|
|
}
|
|
|
|
},
|
|
selectVariant(e){
|
|
this.chooseId = e.target.querySelector('.variant-id').textContent;
|
|
this.choose = e.target.querySelector('.variant-name').textContent;
|
|
this.defaultText = "";
|
|
this.hideDropdown();
|
|
this.hideError();
|
|
this.removeListenerPayButton();
|
|
this.activePayButton();
|
|
},
|
|
chooseVariant(){
|
|
this.hideError();
|
|
this.hideDropdown();
|
|
},
|
|
hideDropdown(){
|
|
this.showDropdown = !this.showDropdown;
|
|
},
|
|
activePayButton(){
|
|
this.btnClassLists.forEach((element) => {
|
|
document.querySelector(element).classList.remove('disabled');
|
|
});
|
|
},
|
|
disablePayButton(){
|
|
this.btnClassLists.forEach((element) => {
|
|
document.querySelector(element).classList.add('disabled');
|
|
});
|
|
},
|
|
addListenerPayButton(){
|
|
this.btnClassLists.forEach((element) => {
|
|
document.querySelector(element).addEventListener('click', (e) => {
|
|
if(document.querySelector(element).classList.contains('disabled')){
|
|
e.preventDefault();
|
|
this.showError();
|
|
}
|
|
});
|
|
});
|
|
},
|
|
removeListenerPayButton(){
|
|
this.btnClassLists.forEach((element) => {
|
|
document.querySelector(element).removeEventListener('click', () => {});
|
|
});
|
|
},
|
|
showError(){
|
|
document.querySelector('.variantSelected').classList.add('error');
|
|
window.scrollTo({ top: 0, behavior: 'smooth' });
|
|
this.showErrorMsg = true;
|
|
},
|
|
hideError(){
|
|
document.querySelector('.variantSelected').classList.remove('error');
|
|
this.showErrorMsg = false;
|
|
}
|
|
|
|
}
|
|
|
|
}).mount('#appVariantsCheckout'); |