Leak Society - The Home Of Nulled Resources.
Forum Beta v1 Now Live!
From a previous suggestion on the Quoting System.
Thead Owner : Psych0-Smil3s, Category : Suggestions & Feedback, 2 Comment, 41 Read
Viewers: 1 Guest(s)
Posting Freak
*****
754
Messages
113
Threads
0
Rep
4 Years of Service
03-13-2014, 03:20 PM
#1
This was mentioned earlier, this is for the notification system i have seen some request for. This will impliment the notifications to let users know they have been quoted in any particular thread.

Code:
jQuery.noConflict();

jQuery(document).ready(function($)
{
    $('body').on({
        click: function(event)
        {
            event.preventDefault();
            var popup_id = $(this).attr('id') + '_popup';

            $('#' + popup_id).attr('top', $(this).height() + 'px').slideToggle('fast', function() {
                var toMarkRead = [];
                $('[id^="alert_row_popup_"]').each(function() {
                    toMarkRead.push($(this).attr('id').substr(16));
                });

                $.get('xmlhttp.php?action=markRead', {
                    my_post_key: my_post_key,
                    toMarkRead: toMarkRead
                }, function(data) {

                });
            });
            return false;
        }
    }, '.myalerts_popup_hook');

    $('.myalerts_popup *').on('click', function(event) {
        event.stopPropagation();
    });

    $("body:not('.myalerts_popup:visible')").on('click', function() {
        $('.myalerts_popup:visible').hide();
    });

    $('#getUnreadAlerts').on('click', function(event) {
        event.preventDefault();
        $.get('xmlhttp.php?action=getNewAlerts', function(data) {
            $('#latestAlertsListing').prepend(data);
        });
    });

    $('.deleteAlertButton').on('click', function(event) {
        event.preventDefault();
        var deleteButton = $(this);

        $.getJSON(deleteButton.attr('href'), {accessMethod: 'js'}, function(data) {
            if (data.success)
            {
                deleteButton.parents('tr').get(0).remove();
                if (data.template)
                {
                    $('#latestAlertsListing').html(data.template);
                }
            }
            else
            {
                alert(data.error);
            }
        });
    });

    if (typeof myalerts_autorefresh !== 'undefined' && myalerts_autorefresh > 0)
    {
        window.setInterval(function() {
            $.get('xmlhttp.php?action=getNewAlerts', function(data) {
                $('#latestAlertsListing').prepend(data);
            });
        }, myalerts_autorefresh * 1000);
    }

    if (typeof unreadAlerts !== 'undefined' && unreadAlerts > 0)
    {
        document.title = document.title + ' (' + unreadAlerts + ')';
    }

});

Code:
Event.observe(window, 'load', function() {
    Event.observe('unreadAlerts_menu', 'click', function(e) {
        Event.stop(e);
        var popup_id = e.target.identify() + '_popup';
        Effect.toggle(popup_id, 'blind', {
            afterFinish: function() {
                var toMarkRead = new Array;
                $$('[id^="alert_row_popup_"]').each(function(s, index) {
                    toMarkRead.push(s.readAttribute('id').substr(16));
                });

                new Ajax.Request('xmlhttp.php?action=markRead',
                {
                    method:'get',
                    parameters: {
                        my_post_key: my_post_key,
                        toMarkRead: Object.toJSON(toMarkRead),
                        js_type: 'prototype'
                    },
                    onSuccess: function() {},
                    onFailure: function() {}
                });
            }
        });
    });

    Event.observe('getUnreadAlerts', 'click', function(e) {
        Event.stop(e);
        new Ajax.Request('xmlhttp.php?action=getNewAlerts',
        {
            method:'get',
            onSuccess: function(transport) {
                Element.insert('latestAlertsListing', { 'top': transport.responseText })
            },
            onFailure: function() {}
        });
    });

    $$('.deleteAlertButton').invoke('observe', 'click', function(e) {
        Event.stop(e);
        var deleteButton = $(this);
        console.log(deleteButton);

        new Ajax.Request(deleteButton.readAttribute('href'),
        {
            method: 'get',
            parameters: {accessMethod: 'js'},
            onSuccess: function(transport, json) {
                var data = transport.responseJSON;
                if (data['success'])
                {
                    deleteButton.up('tr').remove();
                    if (data['template'])
                    {
                        $('latestAlertsListing').replace(data['template']);
                    }
                }
                else
                {
                    alert(data['error']);
                }
            }
        });
    });

    if (typeof myalerts_autorefresh !== 'undefined' && myalerts_autorefresh > 0)
    {
        window.setInterval(function() {
            new Ajax.Request('xmlhttp.php?action=getNewAlerts',
            {
                method:'get',
                onSuccess: function(transport) {
                    Element.insert('latestAlertsListing', { 'top': transport.responseText })
                },
                onFailure: function() {}
            });
        }, myalerts_autorefresh * 1000);
    }

    if (typeof unreadAlerts !== 'undefined' && unreadAlerts > 0)
    {
        document.title = document.title + ' (' + unreadAlerts + ')';
    }
});


Messages In This Thread
From a previous suggestion on the Quoting System. - by Psych0-Smil3s - 03-13-2014, 03:20 PM

Forum Jump: