<commit_before>/**
* Module that contains JSAV core.
*/
/*global JSAV, jQuery, Raphael */
(function($) {
  "use strict";
  var JSAV = function() {
    create.apply(this, arguments);
  };
  JSAV.position = function(elem) {
    var $el = $(elem),
      offset = $el.position(),
      translate = null;//$el.css("transform").translate; // requires jquery.transform.light.js!!
    if (translate) {
      return {left: offset.left + translate[0], top: offset.top + translate[1]};
    } else { return offset; }
  };
  var jsavproto = JSAV.prototype;
  jsavproto.getSvg = function() {
    if (!this.svg) { // lazily create the SVG overlay only when needed
      this.svg = Raphael(this.canvas[0]);
//      this.svg.renderfix();
      var style = this.svg.canvas.style;
      style.position = "absolute";
    }
    return this.svg;
  };
  jsavproto.id = function() {
    var id = this.container[0].id;
    if (!id) {
      id = JSAV.utils.createUUID();
      this.container[0].id = id;
    }
    return id;
  };
  JSAV._types = {}; // for exposing types of JSAV for customization
  JSAV.ext = {}; // for extensions
  JSAV.init = function(f) { // for initialization functions
    JSAV.init.functions.push(f);
  };
  JSAV.init.functions = [];
  
  var AV = function() {},
    create = function() {
      if (typeof arguments[0] === "string") {
        this.container = $(document.getElementById(arguments[0]));
      } else {
        this.container = $(arguments[0]); // make sure it is jQuery object
      }
      var initialHTML = this.container.clone().wrap("<p/>").parent().html();
      this.container.addClass("jsavcontainer");
      this.canvas = this.container.find(".jsavcanvas");
      if (this.canvas.size() === 0) {
        this.canvas = $("<div />").addClass("jsavcanvas").appendTo(this.container);
      }
      // element used to block events when animating
      var shutter = $("<div class='jsavshutter' />").appendTo(this.container);
      this._shutter = shutter;

      this.options = $.extend({}, window.JSAV_OPTIONS, arguments[1]);
      this.RECORD = true;
      jQuery.fx.off = true; // by default we are recording changes, not animating them
      // initialize stuff from init namespace
      initializations(this, this.options);
      // add all plugins from ext namespace
      extensions(this, this, JSAV.ext);

      this.logEvent({ type: "jsav-init", initialHTML: initialHTML });
    };
  function initializations(jsav, options) {
    var fs = JSAV.init.functions;
    for (var i = 0; i < fs.length; i++) {
      if ($.isFunction(fs[i])) {
        fs[i].call(jsav, options);
      }
    }
  }
  function extensions(jsav, con, add) {
    for (var prop in add) {
      if (add.hasOwnProperty(prop) && !(prop in con)) {
        switch (typeof add[prop]) {
          case "function":
            (function (f) {
              con[prop] = con === jsav ? f : function () { return f.apply(jsav, arguments); };
            }(add[prop]));
            break;
          case "object":
            con[prop] = con[prop] || {};
            extensions(jsav, con[prop], add[prop]);
            break;
          default:
            con[prop] = add[prop];
            break;
        }
      }
    }
  }
  if (window) {
    window.JSAV = JSAV;
  }
}(jQuery));<commit_msg>Code cleanup, mainly whitespace fixes<commit_after>/**
* Module that contains JSAV core.
*/
/*global JSAV, jQuery, Raphael */
(function($) {
  "use strict";
  var JSAV = function() {
    create.apply(this, arguments);
  };
  JSAV.position = function(elem) {
    var $el = $(elem),
      offset = $el.position(),
      translate = null;//$el.css("transform").translate; // requires jquery.transform.light.js!!
    if (translate) {
      return {left: offset.left + translate[0], top: offset.top + translate[1]};
    } else { return offset; }
  };
  var jsavproto = JSAV.prototype;
  jsavproto.getSvg = function() {
    if (!this.svg) { // lazily create the SVG overlay only when needed
      this.svg = Raphael(this.canvas[0]);
//      this.svg.renderfix();
      var style = this.svg.canvas.style;
      style.position = "absolute";
    }
    return this.svg;
  };
  jsavproto.id = function() {
    var id = this.container[0].id;
    if (!id) {
      id = JSAV.utils.createUUID();
      this.container[0].id = id;
    }
    return id;
  };
  JSAV._types = {}; // for exposing types of JSAV for customization
  JSAV.ext = {}; // for extensions
  JSAV.init = function(f) { // for initialization functions
    JSAV.init.functions.push(f);
  };
  JSAV.init.functions = [];
  
  var create = function() {
    // this will point to a newly-created JSAV instance
    if (typeof arguments[0] === "string") {
      this.container = $(document.getElementById(arguments[0]));
    } else {
      this.container = $(arguments[0]); // make sure it is jQuery object
    }
    var initialHTML = this.container.clone().wrap("<p/>").parent().html();
    this.container.addClass("jsavcontainer");
    this.canvas = this.container.find(".jsavcanvas");
    if (this.canvas.size() === 0) {
      this.canvas = $("<div />").addClass("jsavcanvas").appendTo(this.container);
    }
    // element used to block events when animating
    var shutter = $("<div class='jsavshutter' />").appendTo(this.container);
    this._shutter = shutter;

    this.options = $.extend({autoresize: true}, window.JSAV_OPTIONS, arguments[1]);
    this.RECORD = true;
    jQuery.fx.off = true; // by default we are recording changes, not animating them
    // initialize stuff from init namespace
    initializations(this, this.options);
    // add all plugins from ext namespace
    extensions(this, this, JSAV.ext);

    this.logEvent({ type: "jsav-init", initialHTML: initialHTML });
  };
  function initializations(jsav, options) {
    var fs = JSAV.init.functions;
    for (var i = 0; i < fs.length; i++) {
      if ($.isFunction(fs[i])) {
        fs[i].call(jsav, options);
      }
    }
  }
  function extensions(jsav, con, add) {
    for (var prop in add) {
      if (add.hasOwnProperty(prop) && !(prop in con)) {
        switch (typeof add[prop]) {
          case "function":
            (function (f) {
              con[prop] = con === jsav ? f : function () { return f.apply(jsav, arguments); };
            }(add[prop]));
            break;
          case "object":
            con[prop] = con[prop] || {};
            extensions(jsav, con[prop], add[prop]);
            break;
          default:
            con[prop] = add[prop];
            break;
        }
      }
    }
  }

  if (window) {
    window.JSAV = JSAV;
  }
}(jQuery));
{'fraction_non_alphanumeric': 0.16192793066747757, 'fraction_numerical': 0.003344990117074654, 'mean_word_length': 2.4242581988547633, 'pattern_counts': {'":': 4, '<': 11, '<?xml version=': 0, '>': 9, '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': '3247476', 'n_tokens_mistral': 2092, 'n_tokens_neox': 2071, 'n_words': 502}