// Copyright (C) 2014 Jean-Christophe Jaskula // // Distributed under the terms of the BSD License. //---------------------------------------------------------------------------- // // Execute timings - display when a cell has been executed lastly and how long it took // A double click on the box makes it disappear define(["require", "jquery", "base/js/namespace", "base/js/events"], function (require, $, IPython, events) { "use strict"; var firstExecTime=null; var execCells=[]; var toggle_all = null; var month_names = ["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]; var day_names = ["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]; var patchCodecellExecute = function() { console.log('patching codecell to trigger ExecuteCell.ExecuteTime'); IPython.CodeCell.prototype.old_execute = IPython.CodeCell.prototype.execute; IPython.CodeCell.prototype.execute = function () { this.old_execute(arguments); events.trigger('ExecuteCell.ExecuteTime'); }; } var toggleDisplay = function() { var cell = IPython.notebook.get_selected_cell(); // get the selected cell if (cell instanceof IPython.CodeCell) { var ce=cell.element; var timing_area=ce.find(".timing_area"); var vis=timing_area.is(':visible'); if (vis) { ce.find(".input_area").css('border-radius','4px'); timing_area.hide(); } else { ce.find(".input_area").css('border-radius','4px 4px 0 0'); timing_area.show(); } } }; var create_menu = function() { var link_current=$("").text("Current").click(toggleDisplay); var link_all=$("").text("All").click(function(){ var ncells = IPython.notebook.ncells() var cells = IPython.notebook.get_cells(); for (var i=0; i").addClass("dropdown-submenu").attr("id","toggle_timings").append($("").text("Toggle timings")); cmenu.append(toggle_timings_menu); var timings_submenu=$("