<commit_before>goog.provide('annotorious');

goog.require('goog.array');
goog.require('annotorious.dom');

/**
 * The main entrypoint to the application. The Annotorious object exposes the 
 * external JavaScript API (through the global 'anno' object) and manages
 * a set of 'modules' (each module being responsible for one particular media
 * type - image, deepzoom, etc.)  
 * @constructor
 */
annotorious.Annotorious = function() {
  /** @private **/
  this._modules = [ new annotorious.modules.image.ImageModule() ];
  
  /** @private **/
  this._plugins = [];

  var self = this;
  annotorious.dom.addOnLoadHandler(function() { 
    goog.array.forEach(self._modules, function(module) {
      module.init();
    });

    goog.array.forEach(self._plugins, function(plugin) {
      plugin.initPlugin(self);
    });
  });
}

/**
 * Adds an event handler to Annotorious.
 * @param {annotorious.event.EventType} type the event type
 * @param {function} handler the handler function
 */
annotorious.Annotorious.prototype.addHandler = function(type, handler) {
  goog.array.forEach(this._modules, function(module) {
    module.addHandler(type, handler);
  });
}

/**
 * Adds an annotation to an item on the page.
 * @param {Annotation} annotation the annotation
 */
annotorious.Annotorious.prototype.addAnnotation = function(annotation) {
  // TODO make this more efficient
  goog.array.forEach(this._modules, function(module) {
    module.addAnnotation(annotation);
  });
}

/**
 * Removes an annotation from an item on the page.
 */
annotorious.Annotorious.prototype['removeAnnotation'] = function(annotation) {
  // TODO implement
}

/**
 * Adds a plugin to Annotorious.
 * @param {string} pluginName the plugin name
 * @param {object} opt_config_options an optional associative array with plugin config options
 */
annotorious.Annotorious.prototype['addPlugin'] = function(pluginName, opt_config_options) {
  this._plugins.push(new annotorious.plugin[pluginName](opt_config_options));
}

window['anno'] = new annotorious.Annotorious();

annotorious.Annotorious.prototype['addAnnotation'] = annotorious.Annotorious.prototype.addAnnotation;
annotorious.Annotorious.prototype['removeAnnotation'] = annotorious.Annotorious.prototype.removeAnnotation;


<commit_msg>Minor edit<commit_after>goog.provide('annotorious');

goog.require('goog.array');
goog.require('annotorious.dom');

/**
 * The main entrypoint to the application. The Annotorious object exposes the 
 * external JavaScript API (through the global 'anno' object) and manages
 * a set of 'modules' (each module being responsible for one particular media
 * type - image, deepzoom, etc.)  
 * @constructor
 */
annotorious.Annotorious = function() {
  /** @private **/
  this._modules = [ new annotorious.modules.image.ImageModule() ];
  
  /** @private **/
  this._plugins = [];

  var self = this;
  annotorious.dom.addOnLoadHandler(function() { 
    goog.array.forEach(self._modules, function(module) {
      module.init();
    });

    goog.array.forEach(self._plugins, function(plugin) {
      plugin.initPlugin(self);
    });
  });
}

/**
 * Adds an event handler to Annotorious.
 * @param {annotorious.event.EventType} type the event type
 * @param {function} handler the handler function
 */
annotorious.Annotorious.prototype.addHandler = function(type, handler) {
  goog.array.forEach(this._modules, function(module) {
    module.addHandler(type, handler);
  });
}

/**
 * Adds an annotation to an item on the page.
 * @param {Annotation} annotation the annotation
 */
annotorious.Annotorious.prototype.addAnnotation = function(annotation) {
  // TODO make this more efficient
  goog.array.forEach(this._modules, function(module) {
    module.addAnnotation(annotation);
  });
}

/**
 * Removes an annotation from an item on the page.
 */
annotorious.Annotorious.prototype.removeAnnotation = function(annotation) {
  // TODO make this more efficient
  goog.array.forEach(this._modules, function(module) {
    module.removeAnnotation(annotation);
  });
}

/**
 * Adds a plugin to Annotorious.
 * @param {string} pluginName the plugin name
 * @param {object} opt_config_options an optional associative array with plugin config options
 */
annotorious.Annotorious.prototype['addPlugin'] = function(pluginName, opt_config_options) {
  this._plugins.push(new annotorious.plugin[pluginName](opt_config_options));
}

window['anno'] = new annotorious.Annotorious();

annotorious.Annotorious.prototype['addAnnotation'] = annotorious.Annotorious.prototype.addAnnotation;
annotorious.Annotorious.prototype['removeAnnotation'] = annotorious.Annotorious.prototype.removeAnnotation;



{'fraction_non_alphanumeric': 0.12723743799870607, 'fraction_numerical': 0.0, 'mean_word_length': 4.608222490931076, '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': '2836912', 'n_tokens_mistral': 1354, 'n_tokens_neox': 1306, 'n_words': 317}