2013-09-03 10:37:59 +00:00
define ( [
2014-08-10 23:43:46 +00:00
'underscore' ,
'jquery' ,
'storage' ,
'classes/Extension' ,
'bootstrap-tour'
2013-11-07 23:10:38 +00:00
] , function ( _ , $ , storage , Extension , Tour ) {
2013-09-03 10:37:59 +00:00
2014-08-10 23:43:46 +00:00
var welcomeTour = new Extension ( 'welcomeTour' , 'Welcome tour' , false , true ) ;
2014-04-21 01:12:57 +00:00
2014-08-10 23:43:46 +00:00
var eventMgr ;
welcomeTour . onEventMgrCreated = function ( eventMgrParam ) {
eventMgr = eventMgrParam ;
} ;
2013-09-03 10:37:59 +00:00
2014-08-10 23:43:46 +00:00
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' ) ;
2014-08-27 23:04:27 +00:00
} , 30000 ) ;
2014-08-10 23:43:46 +00:00
}
2013-09-03 10:37:59 +00:00
2014-08-10 23:43:46 +00:00
var tour = new Tour ( {
keyboard : false ,
storage : {
getItem : function ( ) {
} ,
setItem : function ( ) {
} ,
removeItem : function ( ) {
}
} ,
onEnd : function ( ) {
2017-09-27 19:59:14 +00:00
storage . welcomeTour _1 = 'done' ;
2014-08-10 23:43:46 +00:00
infoTooltip ( '.drag-me' , 'Drag me!' , 'left' ) ;
infoTooltip ( '.layout-toggler-preview' , 'Toggle preview' , 'right' ) ;
} ,
template : [
'<div class="popover tour">' ,
' <div class="arrow"></div>' ,
' <h3 class="popover-title"></h3>' ,
' <div class="popover-content"></div>' ,
' <nav class="popover-navigation">' ,
' <button class="btn btn-primary" data-role="next">Next</button>' ,
' <button class="btn btn-default" data-role="end">Got it!</button>' ,
' </nav>' ,
'</div>'
] . join ( "" )
} ) ;
tour . addSteps ( [
{
element : '.navbar-inner' ,
2017-09-27 19:59:14 +00:00
title : 'StackEdit 5 is coming...' ,
2014-08-10 23:43:46 +00:00
content : [
2017-09-27 19:59:14 +00:00
'<p>A new version of StackEdit is on its way and <a href="app" target="_blank">you can try it here</a>!</p>' ,
'<p>It\'s still in beta. Some of the features may not be available just yet.</p>' ,
'You can always click <b>Next</b> to go through the StackEdit 4 tour.'
2014-08-10 23:43:46 +00:00
] . join ( "" ) ,
placement : 'bottom'
} ,
{
element : '.document-panel .toggle-button' ,
title : 'Documents' ,
content : [
'<p>The <i class="icon-folder-open"></i> <b>document panel</b> allows you to manage your local documents.</p>' ,
'<b>Tip:</b> Use <kbd>Ctrl+[</kbd> and <kbd>Ctrl+]</kbd> to toggle documents.'
] . join ( "" ) ,
placement : 'left' ,
reflex : true
} ,
{
element : '.menu-panel .toggle-button' ,
title : 'Menu' ,
content : [
'<p>The <i class="icon-provider-stackedit"></i> <b>menu panel</b> allows you to synchronize your documents on <i class="icon-provider-gdrive"></i> Google Drive, <i class="icon-provider-dropbox"></i> Dropbox or to publish them on <i class="icon-provider-github"></i> GitHub, <i class="icon-provider-blogger"></i> Blogger...</p>' ,
'<b>Tip:</b> Use the <i class="icon-provider-stackedit"></i> <b>menu panel</b> 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 : [
'<p>New in StackEdit 4: the <i class="icon-comment-alt"></i> <b>comments</b> button lets you create inline discussions!</p>' ,
2014-09-25 23:25:01 +00:00
'<b>Tip:</b> Reopen the Hello! document from Settings>Utils to discover other new features.'
2014-08-10 23:43:46 +00:00
] . join ( "" ) ,
placement : 'right' ,
2014-08-19 08:17:59 +00:00
reflex : true
2014-08-10 23:43:46 +00:00
} ,
{
element : '.navbar-inner' ,
title : 'Happy StackWriting!' ,
content : [
'<p>Enjoy, and don\'t forget to rate 5 stars on the <a target="_blank" href="https://chrome.google.com/webstore/detail/stackedit/iiooodelglhkcpgbajoejffhijaclcdg/reviews">Chrome Web Store</a>...</p>' ,
2014-08-19 08:17:59 +00:00
'<a href="https://twitter.com/share" class="twitter-share-button" data-url="https://stackedit.io" data-text="Great #markdown editor!" data-via="stackedit" data-size="large"></a>'
2014-08-10 23:43:46 +00:00
] . join ( "" ) ,
placement : 'bottom' ,
onShown : function ( ) {
eventMgr . onTweet ( ) ;
}
2014-08-19 08:17:59 +00:00
}
2014-08-10 23:43:46 +00:00
] ) ;
2017-09-27 19:59:14 +00:00
if ( ! _ . has ( storage , 'welcomeTour_1' ) ) {
2014-08-10 23:43:46 +00:00
tour . start ( ) ;
}
$ ( '.action-welcome-tour' ) . click ( function ( ) {
tour . restart ( ) ;
} ) ;
} ;
return welcomeTour ;
2013-09-03 10:37:59 +00:00
2014-04-21 01:12:57 +00:00
} ) ;