define([ 'jquery', 'base/js/namespace', 'base/js/events', 'notebook/js/outputarea', 'notebook/js/codecell' ], function ( $, IPython, events, oa, codecell ) { "use strict"; var prev_threshold = 0; var action_full_name; // will be set when registering the action // define default values for config parameters var params = { autoscroll_set_on_load : false, autoscroll_starting_threshold : 100, autoscroll_show_selector : true, autoscroll_show_button : false }; // update params with any specified in the server's config file var update_params = function() { var config = IPython.notebook.config; for (var key in params) { if (config.data.hasOwnProperty(key)) params[key] = config.data[key]; } }; var initAutoScroll = function() { if (IPython.notebook === undefined) return; var cells = IPython.notebook.get_cells(); var ncells = IPython.notebook.ncells(); for (var i=0; i 0) { prev_threshold = oa.OutputArea.auto_scroll_threshold; oa.OutputArea.auto_scroll_threshold = -1; } else { var new_thr = prev_threshold <= 0 ? 1 : prev_threshold; prev_threshold = oa.OutputArea.auto_scroll_threshold; oa.OutputArea.auto_scroll_threshold = new_thr; } $('#autoscroll_selector').val(oa.OutputArea.auto_scroll_threshold); $('.btn[data-jupyter-action="' + action_full_name + '"]') .toggleClass('active', oa.OutputArea.auto_scroll_threshold <= 0) .blur(); initAutoScroll(); }; var initialize = function() { update_params(); var thresholds = [-1, 1, 10, 20, 50, 100, 200, 500, 1000]; if (params.autoscroll_set_on_load) { var st = params.autoscroll_starting_threshold; oa.OutputArea.auto_scroll_threshold = st; if (thresholds.includes(st) === false) thresholds.push(st); } thresholds.sort(function(a, b){ return a-b; }); if (params.autoscroll_show_selector) { var select = $('