//---------------------------------------------------------------------------- // Copyright (C) 2008-2011 The IPython Development Team // // Distributed under the terms of the BSD License. The full license is in // the file COPYING, distributed as part of this software. //---------------------------------------------------------------------------- //============================================================================ // QuickHelp button //============================================================================ var IPython = (function (IPython) { "use strict"; var QuickHelp = function (selector) { }; QuickHelp.prototype.show_keyboard_shortcuts = function () { // toggles display of keyboard shortcut dialog var that = this; if ( this.shortcut_dialog ){ // if dialog is already shown, close it $(this.shortcut_dialog).modal("toggle"); return; } var command_shortcuts = IPython.keyboard_manager.command_shortcuts.help(); var edit_shortcuts = IPython.keyboard_manager.edit_shortcuts.help(); var help, shortcut; var i, half, n; var element = $('
'); // The documentation var doc = $('').addClass('alert'); doc.append( $('').addClass('close').attr('data-dismiss','alert').html('×') ).append( 'The IPython Notebook has two different keyboard input modes. Edit mode '+ 'allows you to type code/text into a cell and is indicated by a green cell '+ 'border. Command mode binds the keyboard to notebook level actions '+ 'and is indicated by a grey cell border.' ) element.append(doc); // Command mode var cmd_div = this.build_command_help(); element.append(cmd_div); // Edit mode var edit_div = this.build_edit_help(); element.append(edit_div); this.shortcut_dialog = IPython.dialog.modal({ title : "Keyboard shortcuts", body : element, destroy : false, buttons : { Close : {} } }); }; QuickHelp.prototype.build_command_help = function () { var command_shortcuts = IPython.keyboard_manager.command_shortcuts.help(); var help, shortcut; var i, half, n; // Command mode var cmd_div = $('').append($('