function ajax_load_notification_bubble(){ if(typeof ajax_site_url === "undefined"){ return; } if( jQuery('#premiumpress-body').length > 0 ){ return; } if( jQuery('.no-notifications').length > 0 ){ return; } if(jQuery('.ppt-modal-wrap').css('display') == 'block' ) { return; } if(jQuery(".ppt-card-notice.ppt-notice-open").length == 1 ){ return; } if(jQuery(".card-notice._visible").length == 1 ){ return; } jQuery.ajax({ type: "POST", url: ajax_site_url, dataType: 'json', data: { action: "notification_bubble", }, success: function(response) { // COUNTERS jQuery(".notify-footer .n_count strong").html(response.n_count); if(response.n_count > 0){ jQuery(".notify-footer .n_count").addClass("has_alert"); jQuery(".notify-footer .n_count strong").addClass("bg-danger"); jQuery(".notify-footer .n_count .single-page-edit-button").show().addClass("bg-danger"); jQuery(".notify-footer .n_count .ripple").addClass("bg-danger"); jQuery(".icon-notify .fa-bell").addClass("text-danger"); }else{ jQuery(".notify-footer .n_count").removeClass("has_alert"); jQuery(".notify-footer .n_count .single-page-edit-button").hide(); jQuery(".icon-notify .fa-bell"); } jQuery(".notify-footer .m_count strong").html(response.m_count); if(response.m_count > 0){ jQuery(".notify-footer .m_count").addClass("has_alert"); jQuery(".notify-footer .m_count strong").addClass("bg-danger"); jQuery(".notify-footer .m_count .single-page-edit-button").show().addClass("bg-danger"); jQuery(".notify-footer .m_count .ripple").addClass("bg-danger"); }else{ jQuery(".notify-footer .m_count").removeClass("has_alert"); jQuery(".notify-footer .m_count .single-page-edit-button").hide(); } playAudio = false; jQuery("._msg_login").hide(); jQuery("._msg_logout").hide(); jQuery("._msg_upgrade").hide(); // NEW MESSAGE if(typeof response.popup_msg !== 'undefined' && typeof response.popup_msg.name !== 'undefined'){ // jQuery("#ppt-notice-new-message").find("._username").html(response.popup_msg.name); jQuery("#ppt-notice-new-message").find("._ok").attr('onclick', 'pptNoticeClose(); processMessage('+ response.popup_msg.uid +');'); jQuery("#ppt-notice-new-message").find("._cancel").attr('onclick', 'pptNoticeClose(); processClearLogs();'); jQuery("#ppt-notice-new-message").find(".bg-image").css("background-image", "url(" + response.popup_msg.image + ")"); //pptNoticeShow("#ppt-notice-new-message"); var r = jQuery("#ppt-notice-new-message").html(); pptModal("notice-new-message", r, "modal-bottom-right", "ppt-animate-bouncein w-700", 1); playAudio = true; }else if(response.n_count > 0){ jQuery("#ppt-notice-new-notifications").find("._ok").attr('onclick', 'pptNoticeClose(); processNotificatons();'); jQuery("#ppt-notice-new-notifications").find("._cancel").attr('onclick', 'pptNoticeClose(); processClearLogs();'); var r = jQuery("#ppt-notice-new-notifications").html(); pptModal("notice-new-notify", r, "modal-bottom-right", "ppt-animate-bouncein w-500", 1); playAudio = true; }else if(typeof response.popup_login.name !== 'undefined'){ jQuery("#ppt-notice-new-login").find("._username").html(response.popup_login.name); jQuery("#ppt-notice-new-login").find("._link").attr('href', response.popup_login.link); jQuery("#ppt-notice-new-login").find(".bg-image").css("background-image", "url(" + response.popup_login.image + ")"); jQuery("._msg_login").show(); var r = jQuery("#ppt-notice-new-login").html(); pptModal("notice-new-login", r, "modal-bottom-right", "ppt-animate-bouncein w-500", 1); playAudio = true; }else if(typeof response.popup_logout.name !== 'undefined'){ jQuery("#ppt-notice-new-login").find("._username").html(response.popup_logout.name); jQuery("#ppt-notice-new-login").find("._link").attr('href', response.popup_logout.link); jQuery("#ppt-notice-new-login").find(".bg-image").css("background-image", "url(" + response.popup_logout.image + ")"); var r = jQuery("#ppt-notice-new-login").html(); pptModal("notice-new-login", r, "modal-bottom-right", "ppt-animate-bouncein w-500", 1); jQuery("._msg_logout").show(); playAudio = true; }else if(typeof response.popup_custom.name !== 'undefined'){ jQuery("#ppt-notice-new-custom").find("._username").html(response.popup_custom.name); jQuery("#ppt-notice-new-custom").find("._link").attr('href', response.popup_custom.link); jQuery("#ppt-notice-new-custom").find(".bg-image").css("background-image", "url(" + response.popup_custom.image + ")"); var r = jQuery("#ppt-notice-new-custom").html(); pptModal("notice-new-custom", r, "modal-bottom-right", "ppt-animate-bouncein w-700", 1); jQuery("._msg_upgrade").show(); playAudio = true; if(typeof response.popup_custom.hide !== 'undefined'){ setTimeout(function(){ pptNoticeClose() },8000); } } // PLAY AUDIO if(playAudio){ jQuery("footer").append(''); jQuery('audio #notifyaudiosource').attr('src', ajax_img_url+"audio/notification.mp3"); jQuery('audio').get(0).load(); jQuery('audio').get(0).play(); } if(response.status == "alert" || response.status == "ok" || response.status == "none" ){ setTimeout(function(){ ajax_load_notification_bubble(); },10000); } }, error: function(e) { console.log(e) } }); } /* ============================================================================= Notify ========================================================================== */ function notify(e) { return jQuery.cNotify(e); } (function (e) { e.cNotify = function (t) { var n = { type: "default", title: null, message: null, position: { x: "right", y: "bottom" }, icon: null, size: "normal", plink: "", overlay: false, closeBtn: true, overflowHide: false, spacing: 20, theme: "default", autoHide: true, delay: 10500, onShow: null, onClick: null, onHide: null, template: '