Interested in tracking events that fire when a user views a site.

I was wondering if the following can be done:

On my site, I use a lot of jQuery plugins that fire various events that I don't know about.

Is there a way - a program, an add-on for the browser, or something else - so that I can browse the site and get a list of exact javascript events that were fired with every click?

For example, I have a jQuery plugin which, when I right-click on any item, the custom Menu context is displayed, and then when I click on one of the options, other things appear. I need to know exactly what major Javascript events were fired:

 $('input:submit, button:submit').rightClick(function (e) {
    $(this).contextMenu('contextMenuInput', {
        'Capture This': {
            click: function (element) {   // element is the jquery obj clicked on when context menu launched
                doSomething();
            },
            klass: "kgo" // a custom css class for this menu item (usable for styling)
        },
        'Create List': {
            click: function (element) {
            },
            klass: "kfilter kdisabled"
        },
        'Collect Data': {
            click: function (element) {
            },
            klass: "kcapture kdisabled"
        }
    },
    { disable_native_context_menu: true }
);
});

Does anyone have any ideas?

+5
2

, ....

: http://jsfiddle.net/manseuk/CNjs3/

(function($) {
    $.eventReport = function(selector, root) {
        var s = [];
        $(selector || '*', root).andSelf().each(function() {
            var e = $.data(this, 'events');
            if(!e) return;
            s.push(this.tagName);
            if(this.id) s.push('#', this.id);
            if(this.className) s.push('.', this.className);
            for(var p in e) s.push('\n', p);
            s.push('\n\n');
        });
        return s.join('');
    }
    $.fn.eventReport = function(selector) {
        return $.eventReport(selector, this);
    }
})(jQuery);

: >

// all events
alert($.eventReport());

// just events on inputs
alert($.eventReport('input')); 

// just events assigned to this element
alert($.eventReport('#myelement')); 

// events assigned to inputs in this element
alert($.eventReport('input', '#myelement')); 
alert($('#myelement').eventReport('input')); // same result

// just events assigned to this element children
alert($('#myelement').eventReport()); 
alert($.eventReport('*', '#myelement'); // same result

, , → http://www.sprymedia.co.uk/article/Visual+Event

+3

All Articles