# taskbuilder/6.0.6/asset/js/notification.js

Taskbuilder – Project Management &amp; Task Management Tool With Kanban Board, version 6.0.6. 68 lines.

- Page: https://pluginprobe.com/plugins/taskbuilder/6.0.6/code/asset/js/notification.js
- Raw: https://pluginprobe.com/plugins/taskbuilder/6.0.6/raw/asset/js/notification.js
- Modified: 2026-08-26T12:08:58+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/taskbuilder/6.0.6/code/asset/js/notification.js#L10-L20`.

```javascript
jQuery(document).ready(function() {
    // Load notification count when the page loads
    wppm_loadNotifications();
    // Refresh every 30 seconds
    setInterval(function () {
        if (!document.hidden) {
            wppm_loadNotifications();
        }
    }, 60000);
});

jQuery(document).on('click', function (e) {
    if (
        !jQuery(e.target).closest('#wppm_notification_bell').length &&
        !jQuery(e.target).closest('#wppm-notification-container').length
    ) {
        jQuery('#wppm-notification-container').hide();
    }
});

function wppm_loadNotifications() {
    jQuery.ajax({
        url: wppm_notification.ajax_url,
        type: "POST",
        data: {
            action: "wppm_get_notifications"
        },
        dataType: "json",
        success: function(response) {
                if(response.length > 0){
                jQuery("#wppm_notification_bell").addClass("wppm-has-notification");
                jQuery(".wppm-badge").text(response.length).show();
            }else{
                jQuery("#wppm_notification_bell").removeClass("wppm-has-notification");
                jQuery(".wppm-badge").text("0").show();
            }
            var html = "";
            if(response.length > 0){
                jQuery.each(response, function(i, notification){
                    html += '<div class="wppm-notification-item" data-id="' + notification.id + '" data-link="' + notification.link + '">';
                    html += '<div class="wppm-notification-message">'+notification.message+'</div>';
                    html += '<small>'+notification.created_at+'</small>';
                    html += '</div>';
                });
            }else{
                html = '<div class="wppm-no-notification">No new notifications</div>';
            }
            jQuery("#wppm-notification-container").html(html);
        }
    });
}

jQuery(document).on("click", ".wppm-notification-item", function () {
    var id = jQuery(this).data("id");
    jQuery.ajax({
        url: wppm_notification.ajax_url,
        type: "POST",
        data: {
            action: "wppm_mark_notification_read",
            id: id
        }
    });
    // Then open the task
});
jQuery(document).on('click', '#wppm_notification_bell', function () {
    wppm_loadNotifications();
    jQuery('#wppm-notification-container').toggle();
});
```
