Sha256: 1e92501f6d106ee15f9a7f49feedd49826fdb4cfed7203d966d91eaa047b1ed5

Contents?: true

Size: 749 Bytes

Versions: 1

Compression:

Stored size: 749 Bytes

Contents

(function() {
    "use strict";
    window.Suricate = window.Suricate || {};

    Suricate.CounterWidget = function(id, container, configuration, application) {
        Suricate.Widget.call(this, id, container, configuration, application);
    };

    Suricate.CounterWidget.prototype = new Suricate.Widget();

    /*
     *
     */

    Suricate.CounterWidget.prototype.setData = function(data) {
        var precision = data.value % 1 === 0 ? 0 : 2;
        // From http://stackoverflow.com/a/14428340/610531
        var value = data.value.toFixed(precision).replace(/./g, function(c, i, a) {
            return i && c !== "." && ((a.length - i) % 3 === 0) ? ',' + c : c;
        });
        this.view.setPlaceholder('value', value);
    };
}());

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
suricate-0.0.2 lib/suricate/generator/assets/javascript/widgets/counter-widget.js