Files
Mimante/Mimante/Examples/10€ Idea Shopping +10P - Bidoo_files/buynow.js.download
T
Alby96 79756d878d Aggiornamento asset, UI e funzionalità per aste e player
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.
2025-12-10 12:00:25 +01:00

141 lines
4.0 KiB
Plaintext

var BUYNOW_COUNTDOWN = null;
var BUYNOW_ERRORS = {
already_used: 'Hai usato l’opzione Compralo in quest’asta',
already_won: 'Hai vinto questa Asta.<br>Non puoi usare l&rsquo;opzione Compralo'
};
window.serverTime = () => {
//vado a prendere il valore dalla pagina, precedentemente messo in php
if($('.buynow-countdown-container .product-buynow-countdown').hasClass('time-server')){
return parseInt($('.time-server').attr('data-time-server')) != "NaN" ? parseInt($('.time-server').attr('data-time-server')) : null ;
}else{
return null;
}
}
function startBuynowCountdown(time) {
"use strict";
var element = $(".product-buynow-countdown[data-countdown]");
if('active' == element.attr("data-countdown-status")) {
return false;
}
if('undefined' != typeof time) {
element.attr('data-countdown', time);
}
var countdown = element.attr('data-countdown');
if(countdown && countdown.length > 0) {
BUYNOW_COUNTDOWN = setInterval(function() {
var countdown_value = SimpleCountdown(countdown);
element.text(countdown_value);
/*
Destroy interval
Hide countdown
*/
var timeServer = typeof window.serverTime() != null ? window.serverTime() : (new Date()).getTime() / 1000;
var isExpired = countdown <= parseInt(timeServer);
$(".buyitnow-status p > span.product-value").toggle(isExpired);
$("span.product-buynow-countdown").toggle(!isExpired);
if(isExpired) clearInterval(BUYNOW_COUNTDOWN);
}, 1000);
element.attr("data-countdown-status", "active");
}
}
function setStatusBuynowButton(status, error_type) {
"use strict";
var selector = ".buyitnow-button";
var element = $(selector);
var defaults = "button-default button-full buyitnow-button ripple-button";
var base = "buyitnow-button";
var specific = 'button-blue-gradient';
switch(status) {
default:
case 'enabled': {
bindBuynowTrigger(error_type);
break;
}
case 'engaged': {
$('body').find("[data-buynow-state='engaged']").fadeIn();
bindBuynowTrigger(error_type);
break;
}
case 'disabled': {
specific = "button-gray-flat";
element.off('click');
element.find("[data-buynow-state='engaged']").fadeOut('fast');
break;
}
case 'login': {
element.off('click').on('click', window.parent.showLogin);
break;
}
}
if("undefined"===typeof element[0]) return element;
var oldClass = element[0].className;
var newClass = [defaults, specific, [base, status].join('-')].join(' ');
if(oldClass != newClass) {
$("main.buyitnow").find(selector).each(function(k, item) {
$(item).removeClass();
$(item).addClass(newClass);
});
$(".auction-action-bid-mobile .buyitnow-button")
.toggleClass(specific,true);
}
return element;
}
function bindBuynowTrigger(error_type) {
"use strict";
var selector = ".buyitnow-button";
var element = $('body').find(selector);
element.each(function(k, elem) {
$(elem).off('click').on('click', function(e) {
e.preventDefault();
rippleButton($(elem), e);
if(!error_type) {
var url = "buy_your_product.php"+parseURL(window.location.href).search;
navigateDeepModalURL(url);
return false;
}
$(elem).popover({
html: true,
content: BUYNOW_ERRORS[error_type],
placement: isSmartphoneDevice() ? "top" : "bottom",
selector: selector,
container: "body"
}).on('shown.bs.popover', function() {
setTimeout(function() {
$(selector).popover('destroy');
}, 3000);
}).popover('show');
});
});
}
$(document).ready(function() {
"use strict";
$("body").find(".expenditure-value").each(function(k, item) {
var expenditure = $(item).text();
if(expenditure.length && parseInt(expenditure, 10) > 0) {
updateUserExpenditure(expenditure);
$('[data-buynow-state="engaged"]').fadeIn();
return false;
}
});
});