define([ 'underscore', 'jquery', 'storage', 'classes/Extension', 'bootstrap-tour' ], function(_, $, storage, Extension, Tour) { var welcomeTour = new Extension('welcomeTour', 'Welcome tour', false, true); var eventMgr; welcomeTour.onEventMgrCreated = function(eventMgrParam) { eventMgr = eventMgrParam; }; welcomeTour.onReady = function() { function infoTooltip(btnSelector, title, placement) { var tooltip = $(btnSelector).tooltip({ html: true, //container: $('.extension-preview-buttons'), placement: placement, trigger: 'manual', title: title }).tooltip('show').addClass('info-tooltip'); tooltip.parent().addClass('info-tooltip-container'); tooltip.one('click', function() { tooltip.tooltip('hide').removeClass('info-tooltip').parent().removeClass('info-tooltip-container'); }); setTimeout(function() { tooltip.tooltip('hide').removeClass('info-tooltip').parent().removeClass('info-tooltip-container'); }, 30000); } var tour = new Tour({ keyboard: false, storage: { getItem: function() { }, setItem: function() { }, removeItem: function() { } }, onEnd: function() { storage.welcomeTour_1 = 'done'; infoTooltip('.drag-me', 'Drag me!', 'left'); infoTooltip('.layout-toggler-preview', 'Toggle preview', 'right'); }, template: [ '
', '
', '

', '
', ' ', '
' ].join("") }); tour.addSteps([ { element: '.navbar-inner', title: 'StackEdit 5 is coming...', content: [ '

A new version of StackEdit is on its way and you can try it here!

', '

It\'s still in beta. Some of the features may not be available just yet.

', 'You can always click Next to go through the StackEdit 4 tour.' ].join(""), placement: 'bottom' }, { element: '.document-panel .toggle-button', title: 'Documents', content: [ '

The document panel allows you to manage your local documents.

', 'Tip: Use Ctrl+[ and Ctrl+] to toggle documents.' ].join(""), placement: 'left', reflex: true }, { element: '.menu-panel .toggle-button', title: 'Menu', content: [ '

The menu panel allows you to synchronize your documents on Google Drive, Dropbox or to publish them on GitHub, Blogger...

', 'Tip: Use the menu panel to access the settings.' ].join(""), placement: 'right', reflex: true }, { element: '.navbar-inner > .nav .button-open-discussion, .navbar .buttons-dropdown > .nav > .btn:not(:hidden)', title: 'Comments/discussions', content: [ '

New in StackEdit 4: the comments button lets you create inline discussions!

', 'Tip: Reopen the Hello! document from Settings>Utils to discover other new features.' ].join(""), placement: 'right', reflex: true }, { element: '.navbar-inner', title: 'Happy StackWriting!', content: [ '

Enjoy, and don\'t forget to rate 5 stars on the Chrome Web Store...

', '' ].join(""), placement: 'bottom', onShown: function() { eventMgr.onTweet(); } } ]); if(!_.has(storage, 'welcomeTour_1')) { tour.start(); } $('.action-welcome-tour').click(function() { tour.restart(); }); }; return welcomeTour; });