Example #1
0
function LandingParty() {
  this.redshirts = [];
  this.crewmembers = {};
  this.all = [];

  bindAll(this);
}
/**
 * Creates a new Colorpicker
 * @param {Object} options
 * @param {String|Number|Object} options.color The default color that the colorpicker will display. Default is #FFFFFF. It can be a hexadecimal number or an hex String.
 * @param {String|Number|Object} options.background The background color of the colorpicker. Default is transparent. It can be a hexadecimal number or an hex String.
 * @param {DomElement} options.el A dom node to add the colorpicker to. You can also use `colorPicker.appendTo(domNode)` afterwards if you prefer.
 * @param {Number} options.width Desired width of the color picker. Default is 175.
 * @param {Number} options.height Desired height of the color picker. Default is 150.
 */
function SimpleColorPicker(options) {
  // options
  options = options || {};

  // properties
  this.color = null;
  this.width = 0;
  this.height = 0;
  this.hue = 0;
  this.choosing = false;
  this.position = {x: 0, y: 0};
  this.huePosition = 0;
  this.saturationWidth = 0;
  this.maxHue = 0;
  this.inputIsNumber = false;

  // bind methods to scope (only if needed)
  bindAll(this, '_onSaturationMouseMove', '_onSaturationMouseDown', '_onSaturationMouseUp', '_onHueMouseDown', '_onHueMouseUp', '_onHueMouseMove');

  // create dom
  this.$el = document.createElement('div');
  this.$el.className = 'Scp';
  this.$el.innerHTML = [
    '<div class="Scp-saturation">',
      '<div class="Scp-brightness"></div>',
      '<div class="Scp-sbSelector"></div>',
    '</div>',
    '<div class="Scp-hue">',
      '<div class="Scp-hSelector"></div>',
    '</div>'
  ].join('\n');

  // dom accessors
  this.$saturation = this.$el.querySelector('.Scp-saturation');
  this.$hue = this.$el.querySelector('.Scp-hue');
  this.$sbSelector = this.$el.querySelector('.Scp-sbSelector');
  this.$hSelector = this.$el.querySelector('.Scp-hSelector');

  // event listeners
  this.$saturation.addEventListener('mousedown', this._onSaturationMouseDown);
  this.$saturation.addEventListener('touchstart', this._onSaturationMouseDown);
  this.$hue.addEventListener('mousedown', this._onHueMouseDown);
  this.$hue.addEventListener('touchstart', this._onHueMouseDown);

  // some styling and DOMing from options
  if (options.el) {
    this.appendTo(options.el);
  }
  if (options.background) {
    this.setBackgroundColor(options.background);
  }
  this.setSize(options.width || 175, options.height || 150);
  this.setColor(options.color);

  return this;
}
 constructor () {
     bindAll(this, [
         'clickText',
         'clickButton',
         'clickXpath',
         'findByText',
         'findByXpath',
         'getDriver',
         'getSauceDriver',
         'getLogs',
         'loadUri',
         'rightClickText'
     ]);
 }
Example #4
0
/**
 * An object possessing a reciprocal relationship with the state/Autocrat, 
 * meaning it has a .autocrat member while the Autocrat singleton has a 
 * .wards.[ward name] member.
 *
 * @class Law
 * @name Law
 * @alias Autocrat#Law
 */
function Law(autocrat, governor, andConditions) {

  this.autocrat = autocrat;
  this.governor = governor;

  bindAll(this, 'ask', 'to');

  this.advise = this.ask;

  this.then = bind(this.then, this, autocrat, governor);

  // Default to ANDing/zipping any streams passed in
  if(andConditions.length !== 0) this.all.apply(this, andConditions);
};
Example #5
0
 constructor(name = 'anonymous_injector', logger = Logger.create()) {
   _bindAll(this, 'resolveDependency');
   this.name = name;
   this.logger = logger;
   this.dependencies = {};
 }
Example #6
0
    initialize: function() {

        bindAll(this, 'toggleSelect');
    },
Example #7
0
var HandlerDeferred = function(handlers) {
  bindAll(this, 'resolve', 'reject');
  this.state = 'pending';
  this.handlers = handlers;
};