Sha256: 41b38155220a1658b8a5012d16e6e8b7ec7102e588b41a5dc8b9c54e93126865

Contents?: true

Size: 858 Bytes

Versions: 6

Compression:

Stored size: 858 Bytes

Contents

"use strict";

// Overrides native jQuery spinner to avoid validation of the "step".
// We wants to use the step but also wants to leave the user the ability to select specific values.

var $ = require('jquery');
var spinner = require("jquery-ui/spinner");
var console = require('console');

if (typeof spinner == 'undefined') throw "Cannot find jquery-ui spinner widget dependency!";

$.widget("ui.spinner", spinner, {
  _adjustValue: function(value) {
    var adj = this._super(value);

    var options = this.options;

    // fix precision from bad JS floating point math
    value = parseFloat(value.toFixed(this._precision()));

    // clamp the value
    if (options.max !== null && value > options.max) {
      return options.max;
    }
    if (options.min !== null && value < options.min) {
      return options.min;
    }

    return value;
  }
});

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
mosaico-2.0.0 vendor/assets/mosaico-0.16.0/mosaico/src/js/bindings/jqueryui-spinner.js
mosaico-1.1.1 vendor/assets/mosaico-0.16.0/mosaico/src/js/bindings/jqueryui-spinner.js
mosaico-1.1.0 vendor/assets/mosaico-0.16.0/mosaico/src/js/bindings/jqueryui-spinner.js
mosaico-1.0.2 vendor/assets/mosaico-0.16.0/mosaico/src/js/bindings/jqueryui-spinner.js
mosaico-1.0.1 vendor/assets/mosaico-0.16.0/mosaico/src/js/bindings/jqueryui-spinner.js
mosaico-1.0.0 vendor/assets/mosaico-0.16.0/mosaico/src/js/bindings/jqueryui-spinner.js