diff --git a/public/res/extensions/welcomeTour.js b/public/res/extensions/welcomeTour.js index 2cb952a6..8fc36046 100644 --- a/public/res/extensions/welcomeTour.js +++ b/public/res/extensions/welcomeTour.js @@ -1,94 +1,125 @@ define([ - 'underscore', - 'jquery', - 'storage', - 'classes/Extension', - 'bootstrap-tour' + 'underscore', + 'jquery', + 'storage', + 'classes/Extension', + 'bootstrap-tour' ], function(_, $, storage, Extension, Tour) { - var welcomeTour = new Extension('welcomeTour', 'Welcome tour', false, true); + var welcomeTour = new Extension('welcomeTour', 'Welcome tour', false, true); - var eventMgr; - welcomeTour.onEventMgrCreated = function(eventMgrParam) { - eventMgr = eventMgrParam; - }; + 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.one('click', function() { - tooltip.tooltip('hide').removeClass('info-tooltip'); - }); - setTimeout(function() { - tooltip.tooltip('hide').removeClass('info-tooltip'); - }, 20000); - } - var tour = new Tour({ - keyboard: false, - storage: { - getItem: function() { - }, - setItem: function() { - }, - removeItem: function() { - } - }, - onEnd: function() { - storage.welcomeTour = 'done'; - infoTooltip('.menu-panel .toggle-button *', 'Synchronize, publish...', 'right'); - infoTooltip('.document-panel .toggle-button *', 'Create, manage documents', 'left'); - infoTooltip('.drag-me', 'Drag me!', 'left'); - infoTooltip('.layout-toggler-preview', 'Toggle preview', 'right'); - }, - template: [ - '
What\'s new?
', - 'Please provide your feedback here... Thanks!
', - '', - ].join(""), - placement: 'bottom', - onShown: function() { - eventMgr.onTweet(); - } - }, - ]); - if(!_.has(storage, 'welcomeTour')) { - tour.start(); - } - $('.action-welcome-tour').click(function() { - tour.restart(); - }); - }; + 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'); + }, 20000); + } - return welcomeTour; + var tour = new Tour({ + keyboard: false, + storage: { + getItem: function() { + }, + setItem: function() { + }, + removeItem: function() { + } + }, + onEnd: function() { + storage.welcomeTour = 'done'; + infoTooltip('.drag-me', 'Drag me!', 'left'); + infoTooltip('.layout-toggler-preview', 'Toggle preview', 'right'); + }, + template: [ + 'I\'m very pleased to welcome you here!
', + 'StackEdit keeps getting better and I hope you appreciate it.
', + 'Please click Next to take a quick 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 Welcome 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')) { + tour.start(); + } + $('.action-welcome-tour').click(function() { + tour.restart(); + }); + }; + + return welcomeTour; });