<commit_before>// Adds a button to hide the input part of the currently selected cells


var hide_input = function () {
  // find the selected cell
  var cell = IPython.notebook.get_selected_cell();
  // toggle visibility of the input div
  cell.element.find("div.input").toggle('slow')

    if ( cell.metadata.input_collapsed ) {
      cell.metadata.input_collapsed = false;
    } else {
      cell.metadata.input_collapsed = true;
    }
};

init_hide_input = function(){

  // collapse all cells that are marked as hidden
  var cells = IPython.notebook.get_cells();
  cells.forEach( function(cell){
    if( cell.metadata.input_collapsed ){
      cell.element.find("div.input").toggle(0);
    }
  }
  );

  console.log("hide_input cell extension loaded correctly");
}


// add a button to the toolbar
IPython.toolbar.add_buttons_group([{
  label:'hide input',
  icon:'ui-icon-carrat-1-n',
  callback:hide_input,
}]);

// The following line somehow seems not to
//$([IPython.events]).on('notebook_loaded.Notebook', init_hide_input);
// work-around:
init_hide_input();<commit_msg>Change icon. Move registration of button to init_hide_input.<commit_after>// Adds a button to hide the input part of the currently selected cells


var hide_input = function () {

  // Find the selected cell
  var cell = IPython.notebook.get_selected_cell();
  // Toggle visibility of the input div
  cell.element.find("div.input").toggle('slow')

    if ( cell.metadata.input_collapsed ) {
      cell.metadata.input_collapsed = false;
    } else {
      cell.metadata.input_collapsed = true;
    }
};


init_hide_input = function(){

  // Add a button to the toolbar
  IPython.toolbar.add_buttons_group([{
    label:'hide input',
    icon:'icon-chevron-up',
    callback:hide_input,
  }]);

  // Collapse all cells that are marked as hidden
  var cells = IPython.notebook.get_cells();
  cells.forEach( function(cell){
    if( cell.metadata.input_collapsed ){
      cell.element.find("div.input").toggle(0);
    }
  }
  );

  // Write a message to the console to confirm the extension loaded
  console.log("hide_input cell extension loaded correctly");
}


// The following line somehow seems not to
//$([IPython.events]).on('notebook_loaded.Notebook', init_hide_input);
// work-around:
init_hide_input();
{'fraction_non_alphanumeric': 0.12609457092819615, 'fraction_numerical': 0.0013134851138353765, 'mean_word_length': 3.5883534136546187, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2702033', 'n_tokens_mistral': 726, 'n_tokens_neox': 705, 'n_words': 183}