<commit_before>/**
 * Module dependencies
 */

var
  Emitter   = require('emitter'),
  events    = require('event'),
  domify    = require('domify'),
  rotate    = require('rotate'),
  extend    = require('extend'),
  template  = require('./template');

/**
 * Expose `Dial`
 */

module.exports = Dial;

/**
 * A constructor for a Dial object,
 * creating a radial UI dial controlling
 * an input field
 *
 * Options
 *
 * - `min` minimum value
 * - `max` maximum value
 * - `float` boolean determing whether floats are allowed
 * - `increment` value to increment by
 * - `value` starting value
 *
 * @param {HTMLInputElement} input
 * @param {Object} options
 * @api public
 */

function Dial (input, options) {
  this.input = input;
  this.options = extend(false,
    Dial.defaults,
    optionsFromAttrs(this.input),
    options
  );

  this.value = this.options.value;

  this
    .setDefaultIncrement()
    .render()
    .bind()
    .hideInput();

  this.input.parentNode.appendChild(this.el);
  this.rotate();
}

/**
 * Inherits from `Emitter.prototype`
 */

Dial.prototype.__proto__ = Emitter.prototype;

/**
 * Defaults for each dial.
 * Increment is handled in setDefaultIncrement
 */

Dial.defaults = {
  min: 0,
  max: 10,
  value: 5,
  float: false,
  increment: null
};

/**
 * Creates the dial's `el` property
 *
 * @return {Dial}
 * @api public
 */

Dial.prototype.render = function () {
  this.el = domify(template)[0];
  return this;
};

/**
 * Binds mouse events for the dial element,
 * and on document if not already bound
 *
 * @return {Dial}<commit_msg>Use Emitter's mixin method rather than inheritence to work in IE9<commit_after>/**
 * Module dependencies
 */

var
  Emitter   = require('emitter'),
  events    = require('event'),
  domify    = require('domify'),
  rotate    = require('rotate'),
  extend    = require('extend'),
  template  = require('./template');

/**
 * Expose `Dial`
 */

module.exports = Dial;

/**
 * A constructor for a Dial object,
 * creating a radial UI dial controlling
 * an input field
 *
 * Options
 *
 * - `min` minimum value
 * - `max` maximum value
 * - `float` boolean determing whether floats are allowed
 * - `increment` value to increment by
 * - `value` starting value
 *
 * @param {HTMLInputElement} input
 * @param {Object} options
 * @api public
 */

function Dial (input, options) {
  this.input = input;
  this.options = extend(false,
    Dial.defaults,
    optionsFromAttrs(this.input),
    options
  );

  Emitter(this);

  this.value = this.options.value;

  this
    .setDefaultIncrement()
    .render()
    .bind()
    .hideInput();

  this.input.parentNode.appendChild(this.el);
  this.rotate();
}

/**
 * Defaults for each dial.
 * Increment is handled in setDefaultIncrement
 */

Dial.defaults = {
  min: 0,
  max: 10,
  value: 5,
  float: false,
  increment: null
};

/**
 * Creates the dial's `el` property
 *
 * @return {Dial}
 * @api public
 */

Dial.prototype.render = function () {
  this.el = domify(template)[0];
  return this;
};

/**
 * Binds mouse events for the dial element,
 * and on document if not already bound
 *
 * @return {Dial}
{'fraction_non_alphanumeric': 0.14336, 'fraction_numerical': 0.00352, 'mean_word_length': 3.0809399477806787, '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': '6897091', 'n_tokens_mistral': 1039, 'n_tokens_neox': 1013, 'n_words': 287}