2013-09-03 10:37:59 +00:00
define ( [
2013-10-19 16:37:16 +00:00
'underscore' ,
'jquery' ,
2013-11-05 23:03:38 +00:00
'storage' ,
2013-10-19 16:37:16 +00:00
'classes/Extension' ,
'bootstrap-tour'
2013-11-07 23:10:38 +00:00
] , function ( _ , $ , storage , Extension , Tour ) {
2013-09-03 10:37:59 +00:00
2013-10-19 16:37:16 +00:00
var welcomeTour = new Extension ( 'welcomeTour' , 'Welcome tour' , false , true ) ;
2014-04-21 01:12:57 +00:00
2014-02-02 21:00:05 +00:00
var eventMgr ;
welcomeTour . onEventMgrCreated = function ( eventMgrParam ) {
eventMgr = eventMgrParam ;
} ;
2013-09-03 10:37:59 +00:00
welcomeTour . onReady = function ( ) {
2014-04-21 01:12:57 +00:00
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 ) ;
}
2013-09-03 10:37:59 +00:00
var tour = new Tour ( {
2013-10-19 16:37:16 +00:00
keyboard : false ,
2013-09-03 10:37:59 +00:00
storage : {
getItem : function ( ) {
} ,
setItem : function ( ) {
} ,
removeItem : function ( ) {
}
} ,
2013-11-07 23:10:38 +00:00
onEnd : function ( ) {
2013-11-05 23:03:38 +00:00
storage . welcomeTour = 'done' ;
2014-04-21 01:12:57 +00:00
infoTooltip ( '.menu-panel .toggle-button *' , 'Synchronize, publish and more...' , 'right' ) ;
infoTooltip ( '.document-panel .toggle-button *' , 'Create and manage documents' , 'left' ) ;
infoTooltip ( '.extension-preview-buttons .btn-group:first' , 'Need help with Markdown syntax?' , 'left' ) ;
infoTooltip ( '.layout-toggler-preview' , 'Toggle preview' , 'right' ) ;
2013-09-03 10:37:59 +00:00
} ,
template : [
2013-10-19 16:37:16 +00:00
'<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>'
2013-12-25 22:14:23 +00:00
] . join ( "" ) ,
2013-09-03 10:37:59 +00:00
} ) ;
tour . addSteps ( [
{
2013-10-19 16:37:16 +00:00
element : '.navbar-inner' ,
2014-04-21 01:12:57 +00:00
title : 'StackEdit 4 beta preview!' ,
2013-11-20 21:47:18 +00:00
content : [
2014-04-21 01:12:57 +00:00
'<p><strong>What\'s new?</strong></p>' ,
'<ul>' ,
' <li>New contenteditable based editor (credit to Dabblet, Editorially...)</li>' ,
' <li>New layout with CSS3 transitions (lighter supposedly)</li>' ,
' <li>Comments/discussions support (see the new icon in the navigation bar)</li>' ,
' <li>Auto-merge and conflict detection using standard synchronization</li>' ,
' <li>Dropped real time sync support :( since you can collaborate simultaneously using standard synchronization</li>' ,
'</ul>' ,
2014-04-21 17:29:07 +00:00
'<p>Please <a target="_blank" href="https://github.com/benweet/stackedit/issues/385">provide your feedback here</a> and declare issues on GitHub... Thanks!</p>' ,
2014-02-02 22:00:28 +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>' ,
2013-11-20 21:47:18 +00:00
] . join ( "" ) ,
placement : 'bottom' ,
2014-02-02 21:00:05 +00:00
onShown : function ( ) {
eventMgr . onTweet ( ) ;
}
2013-11-20 21:47:18 +00:00
} ,
2013-09-03 10:37:59 +00:00
] ) ;
2013-11-05 23:03:38 +00:00
if ( ! _ . has ( storage , 'welcomeTour' ) ) {
2013-09-03 10:37:59 +00:00
tour . start ( ) ;
}
$ ( '.action-welcome-tour' ) . click ( function ( ) {
tour . restart ( ) ;
} ) ;
} ;
return welcomeTour ;
2014-04-21 01:12:57 +00:00
} ) ;