Stackedit/public/res/extensions/welcomeTour.js

100 lines
4.1 KiB
JavaScript
Raw Normal View History

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);
2013-09-03 10:37:59 +00:00
welcomeTour.onReady = function() {
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';
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>'
].join("")
2013-09-03 10:37:59 +00:00
});
tour.addSteps([
{
2013-10-19 16:37:16 +00:00
element: '.navbar-inner',
title: 'Welcome to StackEdit!',
content: [
'<i class="icon-lock pull-left"></i>',
2013-10-20 14:00:08 +00:00
'<p><strong>You are using the new secured platform.</strong> If you want to recover your documents from the old platform <a target="_blank" href="http://benweet.github.io/stackedit/recovery.html">click here</a>.</p>',
2013-10-19 16:37:16 +00:00
'Please click <code>Next</code> to take a quick tour.'
].join(""),
placement: 'bottom',
2013-09-03 10:37:59 +00:00
},
{
2013-10-19 16:37:16 +00:00
element: '.navbar .action-create-file',
title: 'New document',
content: 'Click the <i class="icon-file"></i> <code>New document</code> button to create a new document.',
placement: 'left',
2013-09-03 10:37:59 +00:00
reflex: true,
},
{
2013-10-19 16:37:16 +00:00
element: '.document-panel .collapse-button',
title: 'Toggle document',
2013-09-03 10:37:59 +00:00
content: [
2013-10-19 16:37:16 +00:00
'<p>Click the <i class="icon-folder-open"></i> <code>Select document</code> button to switch to another document.</p>',
'<b>NOTE: </b>Use <code>Ctrl+[</code> and <code>Ctrl+]</code> shortcuts to toggle quickly.'
].join(""),
placement: 'left',
2013-09-03 10:37:59 +00:00
reflex: true,
},
{
2013-10-19 16:37:16 +00:00
element: '.menu-panel .collapse-button',
title: 'Menu',
2013-09-03 10:37:59 +00:00
content: [
2013-10-19 16:37:16 +00:00
'<p>Use the <i class="icon-provider-stackedit"></i> menu to synchronize your document on <i class="icon-provider-gdrive"></i> <code>Google Drive</code> or <i class="icon-provider-dropbox"></i> <code>Dropbox</code>.</p>',
'Use also this menu to publish your document on <i class="icon-provider-github"></i> <code>GitHub</code>, <i class="icon-provider-blogger"></i> <code>Blogger</code>...'
].join(""),
placement: 'right',
2013-09-03 10:37:59 +00:00
reflex: true,
},
{
2013-10-19 16:37:16 +00:00
element: '#extension-buttons .button-synchronize',
title: 'Synchronize',
content: '<p>Once imported/exported, use the <i class="icon-refresh"></i> <code>Synchronize</code> button to force the synchronization (this is done automatically every 3 minutes).</p>',
placement: 'bottom',
2013-10-06 14:34:40 +00:00
reflex: true,
},
{
2013-10-19 16:37:16 +00:00
element: '#extension-buttons .button-publish',
title: 'Update publications',
content: 'Once published, use the <i class="icon-share"></i> <code>Publish</code> button to update your publication.',
placement: 'bottom',
2013-09-03 10:37:59 +00:00
reflex: true,
},
]);
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;
});