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.
258 lines
8.8 KiB
Plaintext
258 lines
8.8 KiB
Plaintext
$(document).ready(function() {
|
|
"use strict";
|
|
var _bT = 0;
|
|
var _acceptInsert = true;
|
|
BidooCnf.modules.auction.reservation = ConfirmReservation;
|
|
BidooCnf.instances.auction.reservation = new ConfirmReservation();
|
|
|
|
function notify(message, error, _self) {
|
|
showErrorTooltip(_self,{
|
|
title: message,
|
|
html: true,
|
|
trigger: "manual",
|
|
placement: "top",
|
|
template: getTemplateTooltip(error ? "error" : "regular")
|
|
},3000);
|
|
}
|
|
|
|
function downCredit(p, f) {
|
|
p = parseInt(p, 10);
|
|
f = parseInt(f, 10);
|
|
|
|
var pp = parseInt($("#boxBid_pg").text(), 10);
|
|
var ff = parseInt($("#boxBid_gr").text(), 10);
|
|
|
|
var op = pp - p;
|
|
var of = ff - f;
|
|
$("#boxBid_pg").text(op);
|
|
$("#boxBid_gr").text( of );
|
|
|
|
var t = op + of ;
|
|
$("#divSaldoBid").text(t);
|
|
$("#divSaldoBidMobile").text(t);
|
|
$("#divSaldoBidMobile", parent.document).text(t);
|
|
}
|
|
|
|
$(".budget .seatSet, button.stripe").on({
|
|
click: function(e) {
|
|
if(_acceptInsert) {
|
|
e.preventDefault();
|
|
|
|
var _self = $(this);
|
|
var seatParams = getSeatParams(_self);
|
|
$(this).button("loading");
|
|
$.ajax({
|
|
url: "_seat.php?q=set",
|
|
type: "POST",
|
|
data: {
|
|
"auction": stage.id,
|
|
"in": seatParams._in,
|
|
"out": seatParams._out,
|
|
"type": seatParams._type,
|
|
"cash": seatParams._cash
|
|
}
|
|
}).success(function(data) {
|
|
_self.button("reset");
|
|
if(data.js !== undefined) {
|
|
window[data.js].apply(this, data.args);
|
|
} else if(data.error !== undefined) {
|
|
if(data.error==1){
|
|
$("#open_seat_confirm_modal").modal("hide");
|
|
showNoSlotsModal(null,true);
|
|
}else notify(data.error, true, _self);
|
|
} else if(data.result === true) {
|
|
if(!BidooCnf.instances.auction.reservation.isVisible && "credit"!=_self.data("confirm-case")) return BidooCnf.instances.auction.reservation.showReservation(seatParams._in,seatParams._out,seatParams._type,seatParams._cash,stage.id,getUrlParam('e') || getUrlParam('err'));
|
|
|
|
if(_self.hasClass("seatSet")) {
|
|
$("[data-stage=2] [data-card=0]").hide();
|
|
$("[data-stage=2] [data-card=1]").fadeIn();
|
|
$(".budgetSeated [data-bought='0']").show();
|
|
$(".budgetSeated [data-bought='1']").hide();
|
|
$(".favorite").click();
|
|
updateAuctionsAttributes();
|
|
} else {
|
|
$("[data-workflow=1], [data-workflow=2]").hide();
|
|
$("[data-workflow=0]").show();
|
|
$(".budgetSeated [data-bought='1']").show();
|
|
$(".budgetSeated [data-bought='0']").hide();
|
|
}
|
|
|
|
$('.modal').modal('hide');
|
|
stage.leaveSeat();
|
|
stage.takeSeat(parseInt(data.budget.total, 10));
|
|
|
|
downCredit(data.out.paid, data.out.free);
|
|
BidooCnf.instances.user.details.updateUserFunds();
|
|
if (data['in'] > 1) {
|
|
var _msg = "Hai prenotato altre <span class='fg-mint'>" + data['in'] + " Puntate</span> da utilizzare solo in questa Asta!";
|
|
} else {
|
|
var _msg = "Hai prenotato un\'altra <span class='fg-mint'>Puntata</span> da utilizzare solo in questa Asta!";
|
|
}
|
|
// notify(_msg, false, _self);
|
|
if(_self.hasClass("seatSet")) {
|
|
$(".updateBudget").show();
|
|
$(".user-remaining-bids-container").toggleClass("hidden",false);
|
|
$(".js-switch.autobid-seat-switch").trigger('click');
|
|
if(isSmartphoneDevice()) setAutobidUI(true);
|
|
} else {
|
|
$(".updateBudget").hide();
|
|
$(".increase-budget-confirm [data-workflow=0]").hide();
|
|
$(".increase-budget-confirm [data-workflow=1] .message").html(_msg);
|
|
$(".increase-budget-confirm [data-workflow=1]").fadeIn();
|
|
|
|
if($('.js-switch.autobid-seat-switch').eq(0).is(':checked')) {
|
|
window._autoController.setAutobid('delete', null, function() {
|
|
window.stage.getUpdate(function(update) {
|
|
window._autoController.setAutobid('create', update.me.budget.total, function() {
|
|
setAutobid();
|
|
});
|
|
});
|
|
});
|
|
}else{
|
|
$(".js-switch.autobid-seat-switch").trigger('click');
|
|
}
|
|
}
|
|
} else {
|
|
notify("Qalcosa è andato storto!", true, _self);
|
|
}
|
|
_acceptInsert = true;
|
|
});
|
|
}
|
|
}
|
|
});
|
|
|
|
if(typeof stage != "undefined") {
|
|
stage.getUpdate(stageUpdates);
|
|
setInterval(function(st) {
|
|
st.getUpdate(stageUpdates);
|
|
}, 2000, stage);
|
|
}
|
|
|
|
$(".askSet").on({
|
|
click: function(e) {
|
|
e.preventDefault();
|
|
if($("#NickLoggato").length <= 0) {
|
|
window['showLogin']();
|
|
return false;
|
|
}
|
|
var cash = typeof $(this).attr("data-cash") != "undefined",
|
|
t = cash ? 1 : 0;
|
|
if(isIOSDeepModal()){
|
|
$("#boxcontent").toggleClass("ios-scroll-fix-iframe",false);
|
|
$("#open_seat_confirm_modal")
|
|
.off("hide.bs.modal")
|
|
.on("hide.bs.modal",function(){
|
|
$("#boxcontent").toggleClass("ios-scroll-fix-iframe",true);
|
|
});
|
|
}
|
|
$("#open_seat_confirm").click();
|
|
$("#open_seat_confirm_modal [data-confirm-case='credit']").toggle(!cash);
|
|
$("#open_seat_confirm_modal [data-confirm-case='pay']").toggle(cash);
|
|
}
|
|
});
|
|
|
|
$(".choices > div").on({
|
|
click: function() {
|
|
var _self = $(this);
|
|
$(_self).addClass("active");
|
|
$(_self).siblings().removeClass("active");
|
|
$(".increase-budget-confirm [data-workflow=0]").show();
|
|
$("[data-workflow=1], .increase-budget-confirm [data-workflow=2]").hide();
|
|
if($(".increase-budget-confirm").is(":hidden")) {
|
|
$(".increase-budget-confirm").slideDown();
|
|
}
|
|
|
|
var amount = _self.find(".increase-budget-amount").text();
|
|
var free = _self.find(".increase-budget-free").text();
|
|
var cost = _self.find(".increase-budget-cost").text();
|
|
|
|
$(".increase-budget-confirm .pay").text(amount);
|
|
$(".increase-budget-confirm .plus").text(free);
|
|
$(".increase-budget-confirm .cost").text(cost);
|
|
$(".increase-budget-confirm button.button-default.stripe").attr("data-type", "stripe");
|
|
$(".increase-budget-confirm button.button-default.stripe").attr("data-in", amount);
|
|
$(".increase-budget-confirm button.button-default.stripe").attr("data-out", cost);
|
|
}
|
|
});
|
|
});
|
|
window.redirectPaypal = function(destination) {
|
|
window.location.href = destination;
|
|
};
|
|
function stageUpdates(update){
|
|
"use strict"
|
|
$(".auction-action-bid-mobile .auction-btn-bid, .auction-autobid-button").prop("disabled",(1==update.type && !update.me.seated))
|
|
}
|
|
function ConfirmReservation(){
|
|
"use strict"
|
|
var self = this;
|
|
self.selectors = {
|
|
seat: $(".budget .payReservation"),
|
|
reservationModal: $("#open_seat_confirm_modal"),
|
|
ingenicoModal: $("#modal")
|
|
};
|
|
}
|
|
ConfirmReservation.prototype.showReservation = function(_in,_out,_type,_cash,_auction,error){
|
|
"use strict"
|
|
var self = this;
|
|
if(!self.isVisible){
|
|
var url = parseURL(window.location.href);
|
|
var params = url.search.split("&")
|
|
var referrer = [
|
|
url.pathname,
|
|
[params[0],params.splice(3,params.length).join("&")].join("&"),
|
|
"&in=",_in,
|
|
"&out=",_out,
|
|
"&type=",_type,
|
|
"&cash=",_cash,
|
|
"&auction=",_auction,
|
|
"&q=set"
|
|
].join("");
|
|
var id_product = getUrlParam("a").split("_").reverse()[0];
|
|
error = error ? '&err=1' : '';
|
|
self.selectors.reservationModal.modal("hide");
|
|
self.interceptModalVisibility();
|
|
launchEasyModalPay(id_product,_cash,encodeURIComponent(referrer),"pay","showLoader",error);
|
|
self.isVisible = true;
|
|
}
|
|
}
|
|
ConfirmReservation.prototype.interceptModalVisibility = function(){
|
|
"use strict"
|
|
var self = this;
|
|
self.selectors.ingenicoModal.on("hidden.bs.modal",function(){
|
|
$(this).off("hidden.bs.modal");
|
|
self.isVisible = false;
|
|
})
|
|
}
|
|
ConfirmReservation.prototype.showLoader = function(){
|
|
"use strict"
|
|
var self = this;
|
|
self.selectors.reservationModal.modal("show");
|
|
self.selectors.seat.button("loading");
|
|
}
|
|
ConfirmReservation.prototype.payWithPayPal = function(){
|
|
"use strict"
|
|
var self = this;
|
|
self.isVisible = true;
|
|
self.selectors.seat.attr("data-type","paypal");
|
|
self.selectors.seat.click();
|
|
self.isVisible = false;
|
|
}
|
|
function showLoader(){
|
|
"use strict"
|
|
BidooCnf.instances.auction.reservation.showLoader();
|
|
}
|
|
function pay(){
|
|
"use strict"
|
|
BidooCnf.instances.auction.reservation.payWithPayPal();
|
|
}
|
|
|
|
function getSeatParams(scope){
|
|
"use strict"
|
|
return {
|
|
_in: parseInt($(scope).attr("data-in"), 10),
|
|
_out: parseInt($(scope).attr("data-out"), 10),
|
|
_type: $(scope).attr("data-type"),
|
|
_cash: $(scope).attr("data-cash")
|
|
};
|
|
}
|