##// END OF EJS Templates
Finishing work on "Make a Copy" functionality.
Finishing work on "Make a Copy" functionality.

File last commit:

r5857:da3131e4
r5861:63d57ffb
Show More
notebookmain.js
141 lines | 6.1 KiB | application/javascript | JavascriptLexer
Brian E. Granger
More review changes....
r4609 //----------------------------------------------------------------------------
// 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.
//----------------------------------------------------------------------------
Brian E. Granger
Splitting notebook.js into muliple files for development ease.
r4349
//============================================================================
// On document ready
//============================================================================
$(document).ready(function () {
MinRK
adjust missing mathjax handling per review...
r5557 if (window.MathJax){
// MathJax loaded
MinRK
allow the notebook to run without MathJax...
r5547 MathJax.Hub.Config({
tex2jax: {
inlineMath: [ ['$','$'], ["\\(","\\)"] ],
displayMath: [ ['$$','$$'], ["\\[","\\]"] ]
},
displayAlign: 'left', // Change this to 'center' to center equations.
"HTML-CSS": {
styles: {'.MathJax_Display': {"margin": 0}}
}
});
MinRK
adjust missing mathjax handling per review...
r5557 }else if (window.mathjax_url != ""){
// Don't have MathJax, but should. Show dialog.
var dialog = $('<div></div>')
.append(
$("<p></p>").addClass('dialog').html(
MinRK
add server/permission info in failed-mathjax dialog...
r5568 "Math/LaTeX rendering will be disabled."
MinRK
adjust missing mathjax handling per review...
r5557 )
).append(
$("<p></p>").addClass('dialog').html(
MinRK
add server/permission info in failed-mathjax dialog...
r5568 "If you have administrative access to the notebook server and" +
" a working internet connection, you can install a local copy" +
" of MathJax for offline use with the following command on the server" +
" at a Python or IPython prompt:"
MinRK
adjust missing mathjax handling per review...
r5557 )
).append(
$("<pre></pre>").addClass('dialog').html(
">>> from IPython.external import mathjax; mathjax.install_mathjax()"
)
).append(
$("<p></p>").addClass('dialog').html(
MinRK
add server/permission info in failed-mathjax dialog...
r5568 "This will try to install MathJax into the IPython source directory."
)
).append(
$("<p></p>").addClass('dialog').html(
"If IPython is installed to a location that requires" +
" administrative privileges to write, you will need to make this call as" +
MinRK
adjust missing mathjax handling per review...
r5557 " an administrator, via 'sudo'."
)
).append(
$("<p></p>").addClass('dialog').html(
MinRK
add server/permission info in failed-mathjax dialog...
r5568 "When you start the notebook server, you can instruct it to disable MathJax support altogether:"
MinRK
adjust missing mathjax handling per review...
r5557 )
).append(
$("<pre></pre>").addClass('dialog').html(
"$ ipython notebook --no-mathjax"
)
).append(
$("<p></p>").addClass('dialog').html(
"which will prevent this dialog from appearing."
)
).dialog({
title: "Failed to retrieve MathJax from '" + window.mathjax_url + "'",
width: "70%",
modal: true,
})
MinRK
allow the notebook to run without MathJax...
r5547 }else{
MinRK
adjust missing mathjax handling per review...
r5557 // No MathJax, but none expected. No dialog.
MinRK
allow the notebook to run without MathJax...
r5547 }
Brian E. Granger
Starting work on a Markdown cell.
r4507 IPython.markdown_converter = new Markdown.Converter();
MinRK
move read_only flag to page-level...
r5213 IPython.read_only = $('meta[name=read_only]').attr("content") == 'True';
Brian E. Granger
Splitting notebook.js into muliple files for development ease.
r4349
Brian E. Granger
Work on save widget, kernel status widget and notebook section.
r4372 $('div#header').addClass('border-box-sizing');
Brian E. Granger
Implemented basic notebook browser and fixed numerous bugs.
r4488 $('div#main_app').addClass('border-box-sizing ui-widget ui-widget-content');
Brian E. Granger
Left panel is now working.
r4363 $('div#notebook_panel').addClass('border-box-sizing ui-widget');
Brian E. Granger
Splitting notebook.js into muliple files for development ease.
r4349
Brian E. Granger
Left panel is now working.
r4363 IPython.layout_manager = new IPython.LayoutManager();
Brian E. Granger
Refactoring pager into its own class.
r4357 IPython.pager = new IPython.Pager('div#pager', 'div#pager_splitter');
Brian E. Granger
Work on save widget, kernel status widget and notebook section.
r4372 IPython.save_widget = new IPython.SaveWidget('span#save_widget');
MinRK
fix quickhelp widget...
r5066 IPython.quick_help = new IPython.QuickHelp('span#quick_help_area');
MinRK
add read-only view for notebooks...
r5200 IPython.login_widget = new IPython.LoginWidget('span#login_widget');
Brian Granger
Implemented menu based UI using Wijmo.
r5857 IPython.print_widget = new IPython.PrintWidget();
Brian E. Granger
Left panel is now working.
r4363 IPython.notebook = new IPython.Notebook('div#notebook');
Brian E. Granger
Work on save widget, kernel status widget and notebook section.
r4372 IPython.kernel_status_widget = new IPython.KernelStatusWidget('#kernel_status');
Brian Granger
Implemented menu based UI using Wijmo.
r5857 IPython.menubar = new IPython.MenuBar('#menubar')
Brian E. Granger
Work on save widget, kernel status widget and notebook section.
r4372 IPython.kernel_status_widget.status_idle();
Brian E. Granger
Refactoring pager into its own class.
r4357
Brian E. Granger
Updating font-sizing to use the YUI protocol.
r4379 IPython.layout_manager.do_resize();
Brian E. Granger
Hacks to prevent FLOUC (flash of unformatted content).
r4395
// These have display: none in the css file and are made visible here to prevent FLOUC.
$('div#header').css('display','block');
MinRK
move read_only flag to page-level...
r5213
if(IPython.read_only){
// hide various elements from read-only view
IPython.save_widget.element.find('button#save_notebook').addClass('hidden');
IPython.quick_help.element.addClass('hidden'); // shortcuts are disabled in read_only
Matthias BUSSONNIER
totally remove pager when read only...
r5655 $('div#pager').remove();
$('div#pager_splitter').remove();
MinRK
move read_only flag to page-level...
r5213 $('button#new_notebook').addClass('hidden');
$('div#cell_section').addClass('hidden');
Matthias BUSSONNIER
Improve tooltip tringgering,make it configurable...
r5399 $('div#config_section').addClass('hidden');
MinRK
move read_only flag to page-level...
r5213 $('div#kernel_section').addClass('hidden');
$('span#login_widget').removeClass('hidden');
Matthias BUSSONNIER
[notebook] read-only: disable name field
r5659
// set the notebook name field as not modifiable
$('#notebook_name').attr('disabled','disabled')
MinRK
move read_only flag to page-level...
r5213 // left panel starts collapsed, but the collapse must happen after
// elements start drawing. Don't draw contents of the panel until
// after they are collapsed
IPython.left_panel.left_panel_element.css('visibility', 'hidden');
}
Brian E. Granger
Implemented basic notebook browser and fixed numerous bugs.
r4488 $('div#main_app').css('display','block');
Brian E. Granger
Massive work on the notebook document format....
r4484
// Perform these actions after the notebook has been loaded.
Brian E. Granger
Implemented basic notebook browser and fixed numerous bugs.
r4488 // We wait 100 milliseconds because the notebook scrolls to the top after a load
// is completed and we need to wait for that to mostly finish.
IPython.notebook.load_notebook(function () {
setTimeout(function () {
IPython.save_widget.update_url();
IPython.layout_manager.do_resize();
IPython.pager.collapse();
MinRK
move read_only flag to page-level...
r5213 if(IPython.read_only){
// collapse the left panel on read-only
IPython.left_panel.collapse();
// and finally unhide the panel contents after collapse
setTimeout(function(){
IPython.left_panel.left_panel_element.css('visibility', 'visible');
Stefan van der Walt
Clean up javascript based on js2-mode feedback.
r5479 }, 200);
MinRK
move read_only flag to page-level...
r5213 }
Brian E. Granger
Implemented basic notebook browser and fixed numerous bugs.
r4488 },100);
});
Brian E. Granger
Splitting notebook.js into muliple files for development ease.
r4349 });