(function() {
    function init() {
        $(document)
            .off('click.show-on-click', '.show-on-click')
            .on('click.show-on-click', '.show-on-click', function(_e) {
                if($(this).text() === $(this).attr('data-value')) {
                    $(this).text('Click to view');
                }
                else {
                    $(this).text($(this).attr('data-value'));

                    // fire pro event
                    $.post('/api/proEvent/create', {
                        proUid: $(this).attr('data-pro-uid'),
                        event: $(this).attr('data-event'),
                    }, () => {}, 'json');
                }
                return false;
            });
    }
    addMCInitializer('show-on-click', init);
})();
