<commit_before>function Exporter(container_selector, export_svg_selector, export_png_selector) {
  var self = this;
  var handle_click = function(export_callback) {
    return function() {
      var svg = $(this).parents('.subject').find('svg');
      var styles = self._get_styles(window.document);
      var serialized = self._serialize_svg(svg.get(0), styles);

      var subject_label = $(this).parents('.row').prev().find('.subject-name').text();
      export_callback.call(self, svg, serialized, subject_label);
    };
  };

  var container = $(container_selector);
  container.on('click', export_svg_selector, handle_click(this._export_svg));
  container.on('click', export_png_selector, handle_click(this._export_png));
}

Exporter.prototype._get_styles = function(doc) {
  // Based on https://github.com/NYTimes/svg-crowbar.
  var styles      = '';

  // Note that doc.styleSheets is only array-like and not an actual array, so
  // can't use forEach with it.
  for(var i = 0; i < doc.styleSheets.length; i++) {
    process_ss(doc.styleSheets[i]);
  }

  function process_ss(ss) {
    // "svg-css" class indicates that this stylesheet's rules *should* be
    // included in the exported SVG.
    if(ss.ownerNode.className.indexOf('svg-css') === -1)
      return;
<commit_msg>Fix page scrolling to top after exporting SVG or PNG.<commit_after>function Exporter(container_selector, export_svg_selector, export_png_selector) {
  var self = this;
  var handle_click = function(export_callback) {
    return function() {
      var svg = $(this).parents('.subject').find('svg');
      var styles = self._get_styles(window.document);
      var serialized = self._serialize_svg(svg.get(0), styles);

      var subject_label = $(this).parents('.row').prev().find('.subject-name').text();
      export_callback.call(self, svg, serialized, subject_label);
      return false;
    };
  };

  var container = $(container_selector);
  container.on('click', export_svg_selector, handle_click(this._export_svg));
  container.on('click', export_png_selector, handle_click(this._export_png));
}

Exporter.prototype._get_styles = function(doc) {
  // Based on https://github.com/NYTimes/svg-crowbar.
  var styles      = '';

  // Note that doc.styleSheets is only array-like and not an actual array, so
  // can't use forEach with it.
  for(var i = 0; i < doc.styleSheets.length; i++) {
    process_ss(doc.styleSheets[i]);
  }

  function process_ss(ss) {
    // "svg-css" class indicates that this stylesheet's rules *should* be
    // included in the exported SVG.
    if(ss.ownerNode.className.indexOf('svg-css') === -1)
      return;

{'fraction_non_alphanumeric': 0.1430745814307458, 'fraction_numerical': 0.00228310502283105, 'mean_word_length': 3.8238532110091743, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 2, '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': '3547011', 'n_tokens_mistral': 829, 'n_tokens_neox': 808, 'n_words': 187}