79756d878d
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.
622 lines
22 KiB
Plaintext
622 lines
22 KiB
Plaintext
function UserNotifications() {
|
|
"use strict"
|
|
var self = this;
|
|
self.totalScrollHeight = 0;
|
|
self.topNotif = 0;
|
|
self.offSss = false;
|
|
self._tipTimeout = false;
|
|
self.notifBoxHtml;
|
|
self.audio = 1;
|
|
self.undelivN = 0;
|
|
self.HTTP_ENDPOINT = "/checkN.php";
|
|
|
|
self.startIntervals();
|
|
}
|
|
|
|
UserNotifications.prototype.startIntervals = function () {
|
|
"use strict"
|
|
var self = this;
|
|
var intervals = BidooCnf.intervals.user.notifications;
|
|
self.pingNotification();
|
|
setInterval(self.bidping.bind(self, getBidsBonus()), intervals.bidping);
|
|
setInterval(self.updateNotificationsDateTime.bind(self), intervals.updateNotificationsDateTime);
|
|
setInterval(self.pingNotification.bind(self), intervals.pingNotification);
|
|
setInterval(self.updateAuctionsWon.bind(self), intervals.auctionsWon); // [GR] for update badge number for auctions won to pay by user
|
|
}
|
|
|
|
UserNotifications.prototype.updateNotificationsDateTime = function () {
|
|
"use strict"
|
|
var self = this;
|
|
moment.locale('it');
|
|
self.getCorrectNotifSelector().find("abbr").each(function () {
|
|
var abbrTime = parseInt($(this).data("utime"), 10);
|
|
var newTime = parseInt((new Date()).getTime() / 1000, 10);
|
|
var moment_abbr_time = moment(abbrTime, "X");
|
|
var shouldBeFromNow = (newTime - abbrTime) < 21600;
|
|
$(this).data("alt", moment().format());
|
|
$(this).text(shouldBeFromNow ? moment_abbr_time.fromNow() : moment_abbr_time.calendar());
|
|
});
|
|
};
|
|
|
|
UserNotifications.prototype.updateAuctionsWon = function () { // [GR] for update badge number for auctions won to pay by user
|
|
"use strict"
|
|
$.get("/check_auctions_won.php", function (data) {
|
|
if (self.offSss) {
|
|
window.location.reload();
|
|
return;
|
|
}
|
|
$(".navbar-fixed-bottom #bottomAuctionsWonToPay").html(data);
|
|
$(".myBidooDesk #bottomAuctionsWonToPay").html(data);
|
|
$(".myBidooMobile #bottomAuctionsWonToPay").html(data);
|
|
$("#testataAuctionsWonToPay").html(data);
|
|
if (parseInt(data) > 0) {
|
|
$("#bottomAuctionsWonToPay").css("visibility", "visible");
|
|
$("#testataAuctionsWonToPay").css("visibility", "visible");
|
|
} else {
|
|
$("#bottomAuctionsWonToPay").css("visibility", "hidden");
|
|
$("#testataAuctionsWonToPay").css("visibility", "hidden");
|
|
}
|
|
});
|
|
}
|
|
|
|
UserNotifications.prototype.bidping = function (bonus) {
|
|
"use strict"
|
|
var self = this;
|
|
$.get("/bidping.php", function (data) {
|
|
if (self.offSss) {
|
|
window.location.reload();
|
|
return;
|
|
}
|
|
var progressValue = data[0] + "/" + data[1];
|
|
$("#seven_7").html(progressValue);
|
|
$(".bid-challenge [data-spot=0]")
|
|
.html(progressValue)
|
|
.parent()
|
|
.attr("data-progress", progressValue);
|
|
$(".leader-btn .progress-bar-success").css("width", ((data[0] / data[1]) * 100.00).toFixed(2) + "%");
|
|
if (data[0] >= data[1] && data[2] < data[1]) {
|
|
$('.bid-challenge .img-lock-open').hide();
|
|
$('.bid-challenge .img-lock').show();
|
|
$('#auctionBidBottomBar .wrap-progress').hide();
|
|
$('#auctionBidBottomBar .wrap-button-get-bonus').show();
|
|
|
|
}
|
|
|
|
if (data[0] >= data[1] && (typeof getCookie('won') == "undefined")) {
|
|
var expireWonDate = new Date();
|
|
expireWonDate.setTime(getTimeFrames());
|
|
self.wonChallenge(data[0], bonus);
|
|
setValueCookie("won", 1, expireWonDate);
|
|
}
|
|
}).fail(function (jqXHR, textStatus, error) {
|
|
if (jqXHR.status == 403) {
|
|
self.offSss = true;
|
|
$(".btn.leader-btn[data-target=#leader]")
|
|
.html(getSessionExpired(true))
|
|
.attr('data-toggle', null)
|
|
.attr('data-target', null)
|
|
.off("click").on({
|
|
click: showLogin
|
|
});
|
|
}
|
|
});
|
|
self.bidPingProduct();
|
|
}
|
|
|
|
UserNotifications.prototype.bidPingProduct = function () {
|
|
"use strict"
|
|
$.get("/bidping_product.php", function (data) {
|
|
if (self.offSss) {
|
|
window.location.reload();
|
|
return;
|
|
}
|
|
$(".bid-challenge-product").html(data);
|
|
});
|
|
}
|
|
|
|
UserNotifications.prototype.getCallTipMsg = function (credits, bonus) {
|
|
"use strict"
|
|
var html = [
|
|
"<div class='wrap'>",
|
|
"<div>",
|
|
"<img src='/images/razzo.svg'>",
|
|
"</div>",
|
|
"<div>",
|
|
"<strong>Complimenti!</strong>",
|
|
"<div>Hai Vinto " + credits + " Aste di Puntate</div>",
|
|
"</div>",
|
|
"</div>"
|
|
];
|
|
return html.join("");
|
|
}
|
|
|
|
UserNotifications.prototype.callTip = function (credits, bonus, callback) {
|
|
"use strict"
|
|
var self = this;
|
|
var tooltipReach = $(".tooltip.reach");
|
|
$(".leader-btn")
|
|
.tooltip('destroy').tooltip({
|
|
html: true,
|
|
placement: 'top',
|
|
title: self.getCallTipMsg(credits, bonus),
|
|
trigger: 'manual',
|
|
animation: false,
|
|
template: '<div class="tooltip reach" role="tooltip"><div class="tooltip-inner"></div></div>'
|
|
})
|
|
.tooltip("show");
|
|
|
|
tooltipReach.removeClass("bounceOutDown");
|
|
if (self._tipTimeout)
|
|
clearTimeout(self._tipTimeout);
|
|
self._tipTimeout = setTimeout(function () {
|
|
callback();
|
|
}, 10000);
|
|
}
|
|
|
|
UserNotifications.prototype.wonChallenge = function (nAuctions, bonus) {
|
|
"use strict"
|
|
var self = this;
|
|
var selector = $(".leader-btn > div.bid-challenge");
|
|
if (!selector.hasClass("achieved")) {
|
|
self.callTip(nAuctions, bonus);
|
|
}
|
|
}
|
|
|
|
UserNotifications.prototype.pingNotification = function () {
|
|
"use strict"
|
|
var self = this;
|
|
$.get(self.HTTP_ENDPOINT, {_t: 1}, function (r) {
|
|
if (r.count > 0) {
|
|
$(".bubble_desktop, .bubble_mobile, .toggle_bar_mobile").html(r.count).show();
|
|
if ($("#notifBox").is(":visible") || $("#notifBoxMobile").is(":visible")) {
|
|
self.loadNotification(true);
|
|
}
|
|
if (typeof r.undeliv != "undefined" && (Object.keys(r.undeliv).length > 0 && self.undelivN != Object.keys(r.undeliv).length)) {
|
|
var audioCookie = getCookie('audioN');
|
|
if (self.audio && ("undefined" == typeof audioCookie || audioCookie < r.count)) {
|
|
self
|
|
.playSound(r.audio)
|
|
.then(setCookieMinutes.bind(null, 'audioN', r.count, 5))
|
|
.catch(function () {
|
|
$(document)
|
|
.off('touchstart click')
|
|
.on('touchstart click', function () {
|
|
self.playSound(r.audio);
|
|
$(document).off('touchstart click');
|
|
});
|
|
});
|
|
}
|
|
self.undelivN = Object.keys(r.undeliv).length;
|
|
}
|
|
} else {
|
|
delCookie('audioN');
|
|
$(".bubble_desktop, .bubble_mobile").hide();
|
|
}
|
|
});
|
|
}
|
|
|
|
UserNotifications.prototype.playSound = function (audioSrc) {
|
|
"use strict"
|
|
var audio = $("#push");
|
|
if (audio.length)
|
|
audio.remove();
|
|
var aSound = document.createElement('audio');
|
|
aSound.id = 'push';
|
|
aSound.setAttribute('src', audioSrc + "?chk=" + (new Date()).getTime());
|
|
return aSound.play();
|
|
}
|
|
|
|
UserNotifications.prototype.toggleAudio = function (audioSetting) {
|
|
"use strict"
|
|
var self = this;
|
|
var isNotArgPassed = "undefined" == typeof audioSetting;
|
|
var snd = self.getCorrectNotifSelector().find(".sAudio");
|
|
var snData = !!(isNotArgPassed ? parseInt(snd.attr("data-audio")) : audioSetting);
|
|
snd.attr("data-audio", (!snData | 0))
|
|
.toggleClass("disabled glyphicon-volume-off", !snData)
|
|
.toggleClass("enabled glyphicon-volume-up", snData);
|
|
if (isNotArgPassed)
|
|
$.get(self.HTTP_ENDPOINT, {_s: (snData | 0)});
|
|
}
|
|
|
|
UserNotifications.prototype.loadSettings = function (shouldSetCheckOptions) {
|
|
"use strict"
|
|
var self = this;
|
|
$.get(self.HTTP_ENDPOINT, {_load: 0}, function (settings) {
|
|
self.audio = settings.audio;
|
|
self.toggleAudio(self.audio);
|
|
if (shouldSetCheckOptions) {
|
|
$("#ticketMail").prop("checked", !!+settings["1"]);
|
|
$("#creditMail").prop("checked", !!+settings["2"]);
|
|
$("#packageMail").prop("checked", !!+settings["3"]);
|
|
}
|
|
});
|
|
}
|
|
|
|
UserNotifications.prototype.cleanData = function (dirtyString) {
|
|
"use strict"
|
|
dirtyString = dirtyString.replace(/&/g, "&");
|
|
dirtyString = dirtyString.replace(/>/g, ">");
|
|
dirtyString = dirtyString.replace(/</g, "<");
|
|
dirtyString = dirtyString.replace(/"/g, "\"");
|
|
dirtyString = dirtyString.replace("</i>", "</i><p class='paragraph-notification'>");
|
|
dirtyString = dirtyString.replace("</a>", "</p></a>");
|
|
dirtyString = dirtyString.replace("data-href", "data-mobile-fullscreen='true' data-no-padding-modal-body='true' data-href");
|
|
dirtyString = dirtyString.replace("//it.bidoo.com", "");
|
|
return dirtyString;
|
|
}
|
|
|
|
UserNotifications.prototype.getNotificationItem = function (data) {
|
|
"use strict"
|
|
var self = this;
|
|
var flag = parseInt(data.readFlag, 10);
|
|
var classNotif = 2 == flag ? "class='read wrap-notif'" : (1 == flag ? "class='deliv wrap-notif'" : "");
|
|
var item = [
|
|
"<li id='notification_" + data.id + "' data-type='" + data.type + "' " + classNotif + ">",
|
|
"<div class='notif-sx'>"+self.cleanData(data.content)+"</div>",
|
|
"<div class='notif-dx'><abbr data-utime='" + data.created_at + "'></abbr>",
|
|
"<i class='fa fa-clock-o clock-notification' aria-hidden='true'></i></div>",
|
|
"</li>"
|
|
];
|
|
return item.join("");
|
|
}
|
|
|
|
UserNotifications.prototype.getEmptyNotifications = function () {
|
|
"use strict"
|
|
var notif = [
|
|
'<li class="text-center empty-notification">',
|
|
'<p>Non hai alcuna notifica.</p>',
|
|
'</li>'
|
|
];
|
|
return notif.join("");
|
|
}
|
|
|
|
UserNotifications.prototype._renderN = function (data, more) {
|
|
"use strict"
|
|
var self = this;
|
|
var list = [];
|
|
var selector = this.getCorrectNotifSelector().find("ul");
|
|
if (data.length) {
|
|
$.each(data, function (i, item) {
|
|
if ("object" == typeof item) {
|
|
selector.append(self.getNotificationItem(item));
|
|
if (parseInt(item.readFlag, 10) < 2 && item.type != '1') {
|
|
list.push(item.id);
|
|
}
|
|
}
|
|
});
|
|
self.updateNotificationsDateTime();
|
|
} else {
|
|
if (more === undefined || more === false) {
|
|
selector.append(self.getEmptyNotifications());
|
|
}
|
|
}
|
|
return list;
|
|
}
|
|
|
|
UserNotifications.prototype._renderFoot = function (shouldLoadMore, paging) {
|
|
"use strict"
|
|
|
|
var loader = [
|
|
"<a href='javascript:void(0)' onclick='BidooCnf.instances.user.notifications.loadMore(" + paging + ");' class='load-more load-more-notif'>",
|
|
"Vedi altre",
|
|
"</a>"
|
|
].join("");
|
|
var footer = [
|
|
"<div class='whatelse nFoot text-center' id='more'>",
|
|
shouldLoadMore ? loader : "",
|
|
"</div>"
|
|
];
|
|
return footer.join("");
|
|
}
|
|
|
|
UserNotifications.prototype.loadMore = function (id) {
|
|
"use strict"
|
|
var self = this;
|
|
$.get(self.HTTP_ENDPOINT, {f: id, m: 5}, function (r) {
|
|
var selector = self.getCorrectNotifSelector();
|
|
var listNotif = selector.find("ul");
|
|
selector.find(".whatelse").remove();
|
|
if (Object.keys(r.elements).length > 0) {
|
|
var list = self._renderN(r.elements, true);
|
|
var welse = self._renderFoot(r.shexc, r.elements[Object.keys(r.elements).length - 1].id);
|
|
listNotif.append(welse);
|
|
if (listNotif.height() <= selector.find("#notifBoxContainer").height()) {
|
|
//selector.find("#more").find("a").click();
|
|
}
|
|
}
|
|
if (typeof list != "undefined" && list.length > 0) {
|
|
self.sendReadReq(list);
|
|
}
|
|
self.loadCustomScrollbar();
|
|
return false;
|
|
});
|
|
return false;
|
|
}
|
|
$("body").click(function (event) {
|
|
window.elementSelected = event.target.classList[0];
|
|
if ($('.bidooBell').hasClass('active')) {
|
|
$('.bidooBell').removeClass('active');
|
|
} else {
|
|
$('.bidooBell').addClass('active');
|
|
}
|
|
});
|
|
UserNotifications.prototype.loadNotification = function (forceFetchNotif) {
|
|
"use strict"
|
|
var self = this;
|
|
var isMobile = $(window).width() <= 991;
|
|
var selector = self.getCorrectNotifSelector();
|
|
self.topNotif = 0;
|
|
if (selector.is(":visible") && !forceFetchNotif) {
|
|
stopBodyScroll(false);
|
|
if (window.elementSelected == "bidooBell") {
|
|
selector.hide();
|
|
$("#tickNotif").hide();
|
|
}
|
|
if (isMobile) {
|
|
$('#notifBoxMobile').hide();
|
|
$('#menuModal #btn-1 span').addClass('fa-plus');
|
|
$('#menuModal #btn-1 span').removeClass('fa-minus');
|
|
$('#menuModal #submenu1').css('display', 'none');
|
|
}
|
|
self.totalScrollHeight = 0;
|
|
} else {
|
|
selector.empty().show();
|
|
if (isMobile)
|
|
self.hideModalHeaderNotifications(true);
|
|
self.composeNotificationsUI(isMobile, function (jqXHR, textStatus, errorThrown) {
|
|
var isError = jqXHR && textStatus && errorThrown;
|
|
if (!isError) {
|
|
self.loadCustomScrollbar();
|
|
$("#notifBox").show(); // [GR] ADD
|
|
if (isMobile) {
|
|
var titleSelector = selector.find(".nTitle");
|
|
var realHeightNotificationShade = (titleSelector.height() + parseInt(titleSelector.css("padding-top")));
|
|
var heightNotifDialog = ($(window).height() - realHeightNotificationShade);
|
|
selector.find("#notifBoxContainer").css("height", "auto");
|
|
selector.find("#more").find("a").click();
|
|
}
|
|
}
|
|
$("#tickNotif").show();
|
|
});
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
UserNotifications.prototype.getNotificationsStructure = function (mobile, isFirstLoadNotifications, isSettings) {
|
|
"use strict"
|
|
var arrow_left = [
|
|
'<a href="javascript:void();" onclick="BidooCnf.instances.user.notifications.back();" id="arrow_left">',
|
|
'<img src="images/arrow-left.png" width="12">',
|
|
'</a>'
|
|
].join("");
|
|
var structure = [
|
|
'<div class="nTitle">',
|
|
mobile || isSettings ? arrow_left : "",
|
|
'<p style="display: inline-block;">' + (isSettings ? "Impostazioni" : "Notifiche") + '</p>',
|
|
'<span class="sAudio glyphicon glyphicon-volume-up" onclick="BidooCnf.instances.user.notifications.toggleAudio();"></span>',
|
|
'<span class="sNotif glyphicon glyphicon-cog" onclick="BidooCnf.instances.user.notifications.toggleSettings();"></span>',
|
|
'</div>',
|
|
'<div id="notifBoxContainer">',
|
|
isFirstLoadNotifications ? "<img src='/images/loader_card.gif' class='loader-notifications'>" : "",
|
|
'<ul class="not"></ul>',
|
|
'</div>'
|
|
]
|
|
return structure.join("");
|
|
}
|
|
|
|
UserNotifications.prototype.composeNotificationsUI = function (mobile, callback) {
|
|
"use strict"
|
|
var self = this;
|
|
var selector = self.getCorrectNotifSelector();
|
|
selector.html(self.getNotificationsStructure(mobile, true));
|
|
$.get(self.HTTP_ENDPOINT, function (r) {
|
|
$(".bubble_desktop, .bubble_mobile, .toggle_bar_mobile").hide();
|
|
self.delivReadReq();
|
|
var mobile = $(window).width() <= 991;
|
|
var selectorList = selector.find("ul");
|
|
selector.find(".loader-notifications").remove();
|
|
if (r !== null) {
|
|
var list = self._renderN(r.elements);
|
|
if (Object.keys(r.elements).length > 0) {
|
|
var footer = self._renderFoot(r.shexc, r.elements[Object.keys(r.elements).length - 1].id);
|
|
selectorList.append(footer);
|
|
}
|
|
if (typeof list != "undefined" && list.length > 0) {
|
|
self.sendReadReq(list);
|
|
}
|
|
self.loadSettings();
|
|
} else {
|
|
selectorList.html(getSessionExpired());
|
|
}
|
|
callback();
|
|
}).fail(callback);
|
|
}
|
|
|
|
UserNotifications.prototype.sendReadReq = function (list) {
|
|
"use strict"
|
|
var self = this;
|
|
if (typeof list !== undefined && list.length > 0) {
|
|
$.get(self.HTTP_ENDPOINT, {_r: 1, l: list.join(',')});
|
|
}
|
|
}
|
|
|
|
UserNotifications.prototype.delivReadReq = function () {
|
|
"use strict"
|
|
$.get(this.HTTP_ENDPOINT, {_d: 1});
|
|
}
|
|
|
|
UserNotifications.prototype.getSettings = function () {
|
|
"use strict"
|
|
var html = [
|
|
'<div class="settingBox">',
|
|
'<form role="form" style="opacity: 1;">',
|
|
'<div class="title-settings"><b>Notifiche Email</b></div>',
|
|
'<div class="checkbox">',
|
|
'<label for="ticketMail">',
|
|
'<input type="checkbox" name="ticketMail" id="ticketMail">',
|
|
'<span class="notif-settings-label">Ricevi email per nuovi Ticket</span>',
|
|
'</label>',
|
|
'</div>',
|
|
'<div class="checkbox">',
|
|
'<label for="packageMail">',
|
|
'<input type="checkbox" name="packageMail" id="packageMail">',
|
|
'<span class="notif-settings-label">Ricevi Email per aggiornamenti spedizione</span>',
|
|
'</label>',
|
|
'</div>',
|
|
'<div class="checkbox">',
|
|
'<label for="creditMail">',
|
|
'<input type="checkbox" name="creditMail" id="creditMail">',
|
|
'<span class="notif-settings-label">Ricevi Email per accrediti di Puntate Gratis</span>',
|
|
'</label>',
|
|
'</div>',
|
|
'<a class="btn btn-block btn-primary" href="javascript:void(0);" onclick="BidooCnf.instances.user.notifications.saveSettings();"><b>Salva Impostazioni</b></a>',
|
|
'</form>',
|
|
'</div>'
|
|
];
|
|
return html.join("");
|
|
}
|
|
|
|
UserNotifications.prototype.showSettingNotification = function () {
|
|
"use strict"
|
|
var self = this;
|
|
var selector = self.getCorrectNotifSelector();
|
|
if (selector.length) {
|
|
self.notifBoxHtml = selector.html();
|
|
selector.html(self.getNotificationsStructure(true, false, true))
|
|
.find("#notifBoxContainer")
|
|
.append(self.getSettings());
|
|
self.loadSettings(true);
|
|
document.querySelector('#notifBoxMobile #notifBoxContainer .not').remove();
|
|
}
|
|
}
|
|
|
|
UserNotifications.prototype.back = function () {
|
|
"use strict"
|
|
var self = this;
|
|
var selector = self.getCorrectNotifSelector();
|
|
if ($(window).width() <= 991 && !selector.find(".settingBox").length) {
|
|
self.hideModalHeaderNotifications(false);
|
|
backMobile();
|
|
return;
|
|
}
|
|
selector.html(self.notifBoxHtml);
|
|
self.loadCustomScrollbar(true);
|
|
}
|
|
|
|
UserNotifications.prototype.toggleSettings = function () {
|
|
"use strict"
|
|
var self = this;
|
|
var selector = self.getCorrectNotifSelector();
|
|
if (!selector.is(":visible")) {
|
|
selector.show();
|
|
self.loadNotification();
|
|
} else {
|
|
self.showSettingNotification();
|
|
}
|
|
return true;
|
|
}
|
|
|
|
UserNotifications.prototype.saveSettings = function () {
|
|
"use strict"
|
|
var self = this;
|
|
var mail = +$("#ticketMail").is(":checked");
|
|
var pack = +$("#packageMail").is(":checked");
|
|
var accr = +$("#creditMail").is(":checked");
|
|
var data = [
|
|
'm', mail,
|
|
'p', pack,
|
|
'a', accr
|
|
];
|
|
$.get(self.HTTP_ENDPOINT, {_set: data.join("|")}, function () {
|
|
self.back();
|
|
});
|
|
}
|
|
|
|
UserNotifications.prototype.loadCustomScrollbar = function (forceReload) {
|
|
"use strict"
|
|
var self = this;
|
|
var notif_box_selector = self.getCorrectNotifSelector().find("#notifBoxContainer");
|
|
|
|
if ($(window).width() <= 991) {
|
|
notif_box_selector.off("scroll").scroll(function () {
|
|
if ($(this).scrollTop() + $(this).innerHeight() >= $(this)[0].scrollHeight) {
|
|
self.topNotif = $(this).scrollTop();
|
|
//notif_box_selector.find("#more").find("a").click();
|
|
}
|
|
});
|
|
notif_box_selector.scrollTop(self.topNotif);
|
|
} else if (forceReload || !notif_box_selector.hasClass("mCustomScrollbar")) {
|
|
if (forceReload) {
|
|
var list = notif_box_selector.find("ul").clone();
|
|
notif_box_selector.empty().append(list);
|
|
self.totalScrollHeight = 0;
|
|
}
|
|
notif_box_selector.mCustomScrollbar({
|
|
documentTouchScroll: true,
|
|
contentTouchScroll: 1,
|
|
callbacks: {
|
|
onTotalScroll: function () {
|
|
var more_notif_selector = notif_box_selector.find("#more");
|
|
if (more_notif_selector.is(":visible") && more_notif_selector.children().length) {
|
|
// more_notif_selector.find("a").click();
|
|
self.totalScrollHeight += 5 * 70;
|
|
}
|
|
},
|
|
onInit: function () {
|
|
if (self.totalScrollHeight != 0) {
|
|
notif_box_selector.mCustomScrollbar("scrollTo", self.totalScrollHeight, {
|
|
scrollInertia: 0
|
|
});
|
|
}
|
|
|
|
}
|
|
}
|
|
});
|
|
}
|
|
notif_box_selector
|
|
.off("mouseover")
|
|
.mouseover(true, stopBodyScroll)
|
|
.off("mouseout")
|
|
.mouseout(false, stopBodyScroll);
|
|
bindModalCall("#notifBoxContainer", true);
|
|
}
|
|
|
|
UserNotifications.prototype.getCorrectNotifSelector = function () {
|
|
"use strict"
|
|
var notifMobile = $("#notifBoxMobile");
|
|
return $(window).width() <= 991 ? notifMobile : $("#notifBox");
|
|
}
|
|
|
|
UserNotifications.prototype.hideModalHeaderNotifications = function (shouldHide) {
|
|
"use strict"
|
|
var self = this;
|
|
self.getCorrectNotifSelector().parent()
|
|
.parent()
|
|
.find(".modal-header")
|
|
.toggleClass("hidden", shouldHide);
|
|
}
|
|
|
|
UserNotifications.prototype.closeAll = function () {
|
|
"use strict"
|
|
var self = this;
|
|
var selector = self.getCorrectNotifSelector();
|
|
if (!selector.is(":visible"))
|
|
return;
|
|
if (selector.find(".settingBox").is(":visible"))
|
|
self.back();
|
|
self.back();
|
|
}
|
|
|
|
function bidping() {
|
|
"use strict"
|
|
if (BidooCnf.modules.exist(UserNotifications))
|
|
BidooCnf.instances.user.notifications.bidping(getBidsBonus());
|
|
}
|
|
|
|
$(document).ready(function () {
|
|
"use strict"
|
|
BidooCnf.modules.notifications = UserNotifications;
|
|
BidooCnf.instances.user.notifications = new UserNotifications();
|
|
}); |