##// END OF EJS Templates
make global css change on command/edit mode
make global css change on command/edit mode

File last commit:

r18238:4ab90e82
r19671:5fe94896
Show More
tour.js
173 lines | 7.5 KiB | application/javascript | JavascriptLexer
Jonathan Frederic
Almost done!...
r17198 // Copyright (c) IPython Development Team.
// Distributed under the terms of the Modified BSD License.
Paul Ivanov
initial bootstrap tour...
r15564
Jonathan Frederic
Almost done!...
r17198 define([
'base/js/namespace',
Jonathan Frederic
MWE,...
r17200 'jquery',
Jonathan Frederic
Some JS test fixes
r17212 'bootstraptour',
jon
Added some nice comments,...
r17211 ], function(IPython, $, Tour) {
Jonathan Frederic
Almost done!...
r17198 "use strict";
Paul Ivanov
initial bootstrap tour...
r15564
Jonathan Frederic
Almost done!...
r17198 var tour_style = "<div class='popover tour'>\n" +
"<div class='arrow'></div>\n" +
"<div style='position:absolute; top:7px; right:7px'>\n" +
Jessica B. Hamrick
Fix button alignment/size
r18174 "<button class='btn btn-default btn-sm fa fa-times' data-role='end'></button>\n" +
Jonathan Frederic
Almost done!...
r17198 "</div><h3 class='popover-title'></h3>\n" +
"<div class='popover-content'></div>\n" +
"<div class='popover-navigation'>\n" +
Jessica B. Hamrick
Fix button alignment/size
r18174 "<button class='btn btn-default fa fa-step-backward' data-role='prev'></button>\n" +
"<button class='btn btn-default fa fa-step-forward pull-right' data-role='next'></button>\n" +
"<button id='tour-pause' class='btn btn-sm btn-default fa fa-pause' data-resume-text='' data-pause-text='' data-role='pause-resume'></button>\n" +
Jonathan Frederic
Almost done!...
r17198 "</div>\n" +
"</div>";
Paul Ivanov
more work on the tour
r15567
Jonathan Frederic
Almost done!...
r17198 var NotebookTour = function (notebook, events) {
var that = this;
Jonathan Frederic
Fix all the bugs!
r17203 this.notebook = notebook;
Paul Ivanov
don't automatically advance the tour
r15577 this.step_duration = 0;
Jonathan Frederic
Fix all the bugs!
r17203 this.events = events;
Jonathan Frederic
Almost done!...
r17198 this.tour_steps = [
{
title: "Welcome to the Notebook Tour",
placement: 'bottom',
orphan: true,
Jessica B. Hamrick
Fix icons and typos in ui tour
r18171 content: "You can use the left and right arrow keys to go backwards and forwards."
Jonathan Frederic
Almost done!...
r17198 }, {
element: "#notebook_name",
title: "Filename",
placement: 'bottom',
content: "Click here to change the filename for this notebook."
}, {
element: $("#menus").parent(),
placement: 'bottom',
backdrop: true,
title: "Notebook Menubar",
content: "The menubar has menus for actions on the notebook, its cells, and the kernel it communicates with."
}, {
element: "#maintoolbar",
placement: 'bottom',
backdrop: true,
title: "Notebook Toolbar",
content: "The toolbar has buttons for the most common actions. Hover your mouse over each button for more information."
}, {
element: "#modal_indicator",
title: "Mode Indicator",
placement: 'bottom',
content: "The Notebook has two modes: Edit Mode and Command Mode. In this area, an indicator can appear to tell you which mode you are in.",
Jonathan Frederic
Fix all the bugs!
r17203 onShow: function(tour) { that.command_icon_hack(); }
Jonathan Frederic
Almost done!...
r17198 }, {
element: "#modal_indicator",
title: "Command Mode",
placement: 'bottom',
Jonathan Frederic
Fix all the bugs!
r17203 onShow: function(tour) { notebook.command_mode(); that.command_icon_hack(); },
onNext: function(tour) { that.edit_mode(); },
Jonathan Frederic
Almost done!...
r17198 content: "Right now you are in Command Mode, and many keyboard shortcuts are available. In this mode, no icon is displayed in the indicator area."
}, {
element: "#modal_indicator",
title: "Edit Mode",
placement: 'bottom',
Jonathan Frederic
Fix all the bugs!
r17203 onShow: function(tour) { that.edit_mode(); },
Jonathan Frederic
Almost done!...
r17198 content: "Pressing <code>Enter</code> or clicking in the input text area of the cell switches to Edit Mode."
}, {
element: '.selected',
title: "Edit Mode",
placement: 'bottom',
Jonathan Frederic
Fix all the bugs!
r17203 onShow: function(tour) { that.edit_mode(); },
Jonathan Frederic
Almost done!...
r17198 content: "Notice that the border around the currently active cell changed color. Typing will insert text into the currently active cell."
}, {
element: '.selected',
title: "Back to Command Mode",
placement: 'bottom',
Jonathan Frederic
Fix all the bugs!
r17203 onShow: function(tour) { notebook.command_mode(); },
Jonathan Frederic
Almost done!...
r17198 onHide: function(tour) { $('#help_menu').parent().children('a').click(); },
content: "Pressing <code>Esc</code> or clicking outside of the input text area takes you back to Command Mode."
}, {
element: '#keyboard_shortcuts',
title: "Keyboard Shortcuts",
placement: 'bottom',
onHide: function(tour) { $('#help_menu').parent().children('a').click(); },
content: "You can click here to get a list of all of the keyboard shortcuts."
}, {
element: "#kernel_indicator",
title: "Kernel Indicator",
placement: 'bottom',
Jessica B. Hamrick
Rename all status_event to kernel_event
r18238 onShow: function(tour) { events.trigger('kernel_idle.Kernel');},
Jessica B. Hamrick
Fix icons and typos in ui tour
r18171 content: "This is the Kernel indicator. It looks like this when the Kernel is idle."
Jonathan Frederic
Almost done!...
r17198 }, {
element: "#kernel_indicator",
title: "Kernel Indicator",
placement: 'bottom',
Jessica B. Hamrick
Rename all status_event to kernel_event
r18238 onShow: function(tour) { events.trigger('kernel_busy.Kernel'); },
Jessica B. Hamrick
Fix icons and typos in ui tour
r18171 content: "The Kernel indicator looks like this when the Kernel is busy."
Jonathan Frederic
Almost done!...
r17198 }, {
Jessica B. Hamrick
Fix icons and typos in ui tour
r18171 element: ".fa-stop",
Jonathan Frederic
Almost done!...
r17198 placement: 'bottom',
title: "Interrupting the Kernel",
Jessica B. Hamrick
Rename all status_event to kernel_event
r18238 onHide: function(tour) { events.trigger('kernel_idle.Kernel'); },
Jonathan Frederic
Almost done!...
r17198 content: "To cancel a computation in progress, you can click here."
}, {
element: "#notification_kernel",
placement: 'bottom',
Jessica B. Hamrick
Fix icons and typos in ui tour
r18171 onShow: function(tour) { $('.fa-stop').click(); },
Jonathan Frederic
Almost done!...
r17198 title: "Notification Area",
content: "Messages in response to user actions (Save, Interrupt, etc) appear here."
}, {
title: "Fin.",
placement: 'bottom',
orphan: true,
Jessica B. Hamrick
Fix icons and typos in ui tour
r18171 content: "This concludes the IPython Notebook User Interface Tour. Happy hacking!"
Jonathan Frederic
Almost done!...
r17198 }
];
Paul Ivanov
starting the tour from the menu works now...
r15568 this.tour = new Tour({
//orphan: true,
storage: false, // start tour from beginning every time
//element: $("#ipython_notebook"),
debug: true,
reflex: true, // click on element to continue tour
//backdrop: true, // show dark behind popover
animation: false,
duration: this.step_duration,
onStart: function() { console.log('tour started'); },
Paul Ivanov
pause/play buttons for starting/stopping the tour
r15572 // TODO: remove the onPause/onResume logic once pi's patch has been
// merged upstream to make this work via data-resume-class and
// data-resume-text attributes.
Jonathan Frederic
MWE,...
r17200 onPause: this.toggle_pause_play,
onResume: this.toggle_pause_play,
Paul Ivanov
starting the tour from the menu works now...
r15568 steps: this.tour_steps,
Jonathan Frederic
Bootstrap Tour related fixes
r16972 template: tour_style,
orphan: true
Paul Ivanov
starting the tour from the menu works now...
r15568 });
Paul Ivanov
closes #5336
r15816
Paul Ivanov
starting the tour from the menu works now...
r15568 };
Paul Ivanov
initial bootstrap tour...
r15564
Paul Ivanov
starting the tour from the menu works now...
r15568 NotebookTour.prototype.start = function () {
console.log("let's start the tour");
Paul Ivanov
closes #5336
r15816 this.tour.init();
Paul Ivanov
starting the tour from the menu works now...
r15568 this.tour.start();
Paul Ivanov
allow tour restarting
r15570 if (this.tour.ended())
{
this.tour.restart();
}
Paul Ivanov
starting the tour from the menu works now...
r15568 };
Jonathan Frederic
Almost done!...
r17198 NotebookTour.prototype.command_icon_hack = function() {
$('#modal_indicator').css('min-height', 20);
};
NotebookTour.prototype.toggle_pause_play = function () {
Jessica B. Hamrick
Fix icons and typos in ui tour
r18171 $('#tour-pause').toggleClass('fa-pause fa-play');
Jonathan Frederic
Almost done!...
r17198 };
NotebookTour.prototype.edit_mode = function() {
this.notebook.focus_cell();
this.notebook.edit_mode();
};
// For backwards compatability.
Paul Ivanov
starting the tour from the menu works now...
r15568 IPython.NotebookTour = NotebookTour;
Jonathan Frederic
Fix imports of "modules",...
r17202 return {'Tour': NotebookTour};
Jonathan Frederic
Almost done!...
r17198
});
Paul Ivanov
starting the tour from the menu works now...
r15568