// Setup the product walkthrough tour var productTourSteps = [ { title: 'Product Navigation', description: 'Over here you will find the main product navigation options. Explore each tab to find out more about that section.', position: 'right', element: '#product-sidebar-nav' }, { title: 'Manage Subscription', description: 'Click here to change your subscription setup. You can also go to your account settings to easily change your alert settings (e-mails and text messages).', position: 'right', element: '#manage-subscription' }, { title: 'Leave a Review', description: 'Once you have spent some time with the product, I would really appreciate if you could leave a review!', position: 'left', element: '#leave-review' }, { title: 'Message Me', description: 'I am always reachable if you have any questions, my #1 goal is to make sure your experience with this product is flawless. Don\'t ever hesitate to send me a message. Hopefully, I\'ll talk to you soon.', position: 'left', element: '#message-me' } ]; var open_message_modal = function (data) { // Can't message self if (data.id == currentUser.id) { return; } $('#recp-id').val(data.id); $('#recp-name').text(data.username); $('#recp-img').attr('src', data.image); var modal = $('#messageModal'); modal.find('h2').text('Send Message to ' + data.username); modal.modal('show'); }; var open_block_or_message_modal = function (data) { // Can't message/block self if (data.id == currentUser.id) { return; } $('#recp-id').val(data.id); $('#recp-name').text(data.username); $('#recp-img').attr('src', data.image); var modal = $('#blockormessageModal'); modal.find('#recp-name').text(" " + data.username); modal.find('#recp-img').attr('src', data.image); modal.modal('show'); }; $(function () { // Initialize products var productId = $('.platform').data('product'); $('[data-toggle=tooltip]').tooltip(); $('.walkthrough-skip').click(function () { $.post('/api/v2/account/flags/', {flag: 'tour-' + productId, value: 2}); }); // Getting Started checkboxes $(document).on('click', '.start-list-item', function() { $(this).addClass('completed'); var url = $(this).attr('href'); $.post('/api/v2/account/flags/', {flag: 'completebox-' + productId + '_' + $(this).attr("data-checkbox"), value: 1}); if (!$(this).data('toggle')) { setTimeout(function () { window.location = url; }, 500); } return false; }); $(document).on('click', '.hide-link', function() { $.post('/api/v2/account/flags/', {flag: 'completebox-' + productId + '_dismissed', value: 1}, function (data) { $('.product-start-list').remove(); }); return false; }); var productTour = new Tour(productTourSteps, function () { $.post('/api/v2/account/flags/', {flag: 'tour-' + productId, value: 1}); }); $('#start-tour, #start-tour-link').click(function () { productTour.start(); }); $('.send-msg').click(function () { open_message_modal($(this).data()); return false; }); });