##// END OF EJS Templates
Remove Equation References/Numbering, Fix Bugs...
Remove Equation References/Numbering, Fix Bugs Equation References and Numbering are not going to be trivial to add, so the code has been removed for now. Important fixes include no-MathJax support (previously, the code was failing), and the generation of unique ids for the rendering content in each cell, tremendously speeding up MathJax rendering. I am still not rendering placeholder text.

File last commit:

r8204:0da04f78
r8660:e2f6593d
Show More
notificationarea.js
141 lines | 5.0 KiB | application/javascript | JavascriptLexer
Matthias BUSSONNIER
beginning notification area
r8011 //----------------------------------------------------------------------------
// Copyright (C) 2012 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.
//----------------------------------------------------------------------------
//============================================================================
// Notification widget
//============================================================================
var IPython = (function (IPython) {
"use strict";
var utils = IPython.utils;
var NotificationArea = function (selector) {
this.selector = selector;
if (this.selector !== undefined) {
this.element = $(selector);
}
Matthias BUSSONNIER
tweek notebook notification behavior
r8074 this.widget_dict = {};
Matthias BUSSONNIER
beginning notification area
r8011 };
NotificationArea.prototype.temp_message = function (msg, timeout, css_class) {
var uuid = utils.uuid();
Matthias BUSSONNIER
jslint 1
r8204 if( css_class == 'danger') {css_class = 'ui-state-error';}
if( css_class == 'warning') {css_class = 'ui-state-highlight';}
Matthias BUSSONNIER
beginning notification area
r8011 var tdiv = $('<div>')
.attr('id',uuid)
Matthias BUSSONNIER
tweek notebook notification behavior
r8074 .addClass('notification_widget ui-widget ui-widget-content ui-corner-all')
Matthias BUSSONNIER
beginning notification area
r8011 .addClass('border-box-sizing')
.addClass(css_class)
.hide()
.text(msg);
$(this.selector).append(tdiv);
Matthias BUSSONNIER
trap undefined timout
r8012 var tmout = Math.max(1500,(timeout||1500));
Matthias BUSSONNIER
beginning notification area
r8011 tdiv.fadeIn(100);
setTimeout(function () {
tdiv.fadeOut(100, function () {tdiv.remove();});
Matthias BUSSONNIER
jslint 1
r8204 }, tmout);
Matthias BUSSONNIER
beginning notification area
r8011 };
Matthias BUSSONNIER
jslint 1
r8204 NotificationArea.prototype.widget = function(name) {
if(this.widget_dict[name] == undefined) {
return this.new_notification_widget(name);
Matthias BUSSONNIER
tweek notebook notification behavior
r8074 }
Matthias BUSSONNIER
jslint 1
r8204 return this.get_widget(name);
};
Matthias BUSSONNIER
tweek notebook notification behavior
r8074
NotificationArea.prototype.get_widget = function(name) {
Matthias BUSSONNIER
jslint 1
r8204 if(this.widget_dict[name] == undefined) {
Matthias BUSSONNIER
tweek notebook notification behavior
r8074 throw('no widgets with this name');
}
return this.widget_dict[name];
Matthias BUSSONNIER
jslint 1
r8204 };
Matthias BUSSONNIER
tweek notebook notification behavior
r8074
Matthias BUSSONNIER
call init method
r8048 NotificationArea.prototype.new_notification_widget = function(name) {
Matthias BUSSONNIER
jslint 1
r8204 if(this.widget_dict[name] != undefined) {
Matthias BUSSONNIER
tweek notebook notification behavior
r8074 throw('widget with that name already exists ! ');
}
Matthias BUSSONNIER
call init method
r8048 var div = $('<div/>').attr('id','notification_'+name);
Matthias BUSSONNIER
jslint 1
r8204 $(this.selector).append(div);
this.widget_dict[name] = new IPython.NotificationWidget('#notification_'+name);
Matthias BUSSONNIER
tweek notebook notification behavior
r8074 return this.widget_dict[name];
Matthias BUSSONNIER
jslint 1
r8204 };
Matthias BUSSONNIER
tweek notebook notification behavior
r8074
NotificationArea.prototype.init_notification_widgets = function() {
var knw = this.new_notification_widget('kernel');
// Kernel events
$([IPython.events]).on('status_idle.Kernel',function () {
IPython.save_widget.update_document_title();
knw.set_message('Kernel Idle',200);
}
);
$([IPython.events]).on('status_busy.Kernel',function () {
window.document.title='(Busy) '+window.document.title;
knw.set_message("Kernel busy");
});
$([IPython.events]).on('status_restarting.Kernel',function () {
IPython.save_widget.update_document_title();
knw.set_message("Restarting kernel",1000);
});
$([IPython.events]).on('status_interrupting.Kernel',function () {
knw.set_message("Interrupting kernel");
});
$([IPython.events]).on('status_dead.Kernel',function () {
var dialog = $('<div/>');
dialog.html('The kernel has died, would you like to restart it? If you do not restart the kernel, you will be able to save the notebook, but running code will not work until the notebook is reopened.');
$(document).append(dialog);
dialog.dialog({
resizable: false,
modal: true,
title: "Dead kernel",
buttons : {
"Restart": function () {
$([IPython.events]).trigger('status_restarting.Kernel');
IPython.notebook.start_kernel();
$(this).dialog('close');
},
"Continue running": function () {
$(this).dialog('close');
}
}
});
});
var nnw = this.new_notification_widget('notebook');
// Notebook events
$([IPython.events]).on('notebook_loading.Notebook', function () {
nnw.set_message("Loading notebook",500);
});
$([IPython.events]).on('notebook_loaded.Notebook', function () {
nnw.set_message("Notebook loaded",500);
});
$([IPython.events]).on('notebook_saving.Notebook', function () {
nnw.set_message("Saving notebook",500);
});
$([IPython.events]).on('notebook_saved.Notebook', function () {
nnw.set_message("Notebook saved",2000);
});
$([IPython.events]).on('notebook_save_failed.Notebook', function () {
nnw.set_message("Notebook save failed");
});
Matthias BUSSONNIER
jslint 1
r8204 };
Matthias BUSSONNIER
call init method
r8048
Matthias BUSSONNIER
beginning notification area
r8011 IPython.NotificationArea = NotificationArea;
return IPython;
}(IPython));