<commit_before>(function(app) {
  'use strict';

  var IScroll = require('iscroll');
  var helper = app.helper || require('../helper.js');
  var dom = app.dom || require('../dom.js');
  var Component = app.Component || require('./component.js');
  var SidebarModule = app.SidebarModule || require('./sidebar-module.js');

  var SidebarContent = Component.inherits(function(props) {
    this.modules = this.prop([]);

    this.scrollable = new IScroll(this.element(), {
      disableMouse: true,
      disablePointer: true,
      fadeScrollbars: dom.supportsTouch(),
      interactiveScrollbars: !dom.supportsTouch(),
      mouseWheel: true,
      scrollbars: true,
    });

    this.dragStarter = props.dragStarter;
    this.dragEnder = props.dragEnder;
    this.dropper = props.dropper;

    this.registerPointListener();
  });

  SidebarContent.prototype.registerPointListener = function() {
    dom.on(this.element(), dom.eventType('start'), function() {
      dom.removeFocus();
    });
  };

  SidebarContent.prototype.createModule = function(props) {
    return new SidebarModule(helper.extend(helper.clone(props), {
      parentElement: this.childElement('.sidebar-module-container'),
      dragStarter: this.dragStarter,
      dragEnder: this.dragEnder,
      dropper: this.dropper,
    }));
  };

  SidebarContent.prototype.appendModule = function(props) {
    var module = this.createModule(props);
    module.markDirty();
    this.modules().push(module);
    this.markDirty();
  };

  SidebarContent.prototype.clear = function() {
    this.modules().forEach(function(module) {
      module.delete();
    });
    this.modules([]);
  };

  SidebarContent.prototype.setModules = function(entries) {
    this.clear();
    entries.forEach(function(entry) {
      this.appendModule({
        title: entry.label,
        content: entry.description,
        name: entry.name,
      });
    }.bind(this));
  };

  SidebarContent.prototype.scrollEnabled = function(enabled) {
    if (enabled) {
      this.scrollable.enable();
    } else {
      this.scrollable.disable();
    }
  };

  SidebarContent.prototype.redraw = function() {
    // XXX: zero timeout to wait for the repaint of iScroll
    setTimeout(function() {
      this.scrollable.refresh();
    }.bind(this), 0);
  };
<commit_msg>Modify initialization of sidebar-content<commit_after>(function(app) {
  'use strict';

  var IScroll = require('iscroll');
  var helper = app.helper || require('../helper.js');
  var dom = app.dom || require('../dom.js');
  var Component = app.Component || require('./component.js');
  var SidebarModule = app.SidebarModule || require('./sidebar-module.js');

  var SidebarContent = Component.inherits(function(props) {
    this.modules = this.prop([]);

    this.scrollable = new IScroll(this.element(), {
      disableMouse: true,
      disablePointer: true,
      fadeScrollbars: dom.supportsTouch(),
      interactiveScrollbars: !dom.supportsTouch(),
      mouseWheel: true,
      scrollbars: true,
    });

    this.dragStarter = props.dragStarter;
    this.dragEnder = props.dragEnder;
    this.dropper = props.dropper;
  });

  SidebarContent.prototype.createModule = function(props) {
    return new SidebarModule(helper.extend(helper.clone(props), {
      parentElement: this.childElement('.sidebar-module-container'),
      dragStarter: this.dragStarter,
      dragEnder: this.dragEnder,
      dropper: this.dropper,
    }));
  };

  SidebarContent.prototype.appendModule = function(props) {
    var module = this.createModule(props);
    module.markDirty();
    this.modules().push(module);
    this.markDirty();
  };

  SidebarContent.prototype.clear = function() {
    this.modules().forEach(function(module) {
      module.delete();
    });
    this.modules([]);
  };

  SidebarContent.prototype.setModules = function(entries) {
    this.clear();
    entries.forEach(function(entry) {
      this.appendModule({
        title: entry.label,
        content: entry.description,
        name: entry.name,
      });
    }.bind(this));
  };

  SidebarContent.prototype.scrollEnabled = function(enabled) {
    if (enabled) {
      this.scrollable.enable();
    } else {
      this.scrollable.disable();
    }
  };

  SidebarContent.prototype.redraw = function() {
    // XXX: zero timeout to wait for the repaint of iScroll
    setTimeout(function() {
      this.scrollable.refresh();
    }.bind(this), 0);
  };

  SidebarContent.prototype.oninit = function() {
    dom.on(this.element(), dom.eventType('start'), function() {
      dom.removeFocus();
    });
  };

{'fraction_non_alphanumeric': 0.15042697613312897, 'fraction_numerical': 0.0004379242391066346, 'mean_word_length': 3.183150183150183, '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': '646549', 'n_tokens_mistral': 1386, 'n_tokens_neox': 1367, 'n_words': 234}