Sha256: 8ba71faa6472468d0f4f3ef53c7dd55ab287a4c4eeffa20ada537976987a7686
Contents?: true
Size: 1.22 KB
Versions: 1
Compression:
Stored size: 1.22 KB
Contents
$(function () { 'use strict'; window.Digit = window.Digit || {}; Digit.setData = function (widget, data) { var currentValue = widget.find('.value')[0].getAttribute('data-value'); widget.find('.value').html(Kiteboard.nFormatter(data)); widget.find('.value')[0].setAttribute('data-value', data); var changeRateIcon = widget.find('.change-rate').find('.fa'); changeRateIcon.removeClass('fa-arrow-down'); changeRateIcon.removeClass('fa-arrow-up'); if (data < currentValue) { changeRateIcon.addClass('fa-arrow-down'); if (data == currentValue || currentValue == 0) { var changeRate = 0; } else { var changeRate = Math.round(((currentValue - data) / currentValue) * 100); } widget.find('.change-rate').find('span').html(changeRate + '%'); } else { if (data == currentValue || currentValue == 0) { var changeRate = 0; } else { var changeRate = Math.round(((data - currentValue) / currentValue) * 100); } changeRateIcon.addClass('fa-arrow-up'); widget.find('.change-rate').find('span').html(changeRate + '%'); } widget.find('.updated-at').html('Last updated at ' + new Date().toLocaleTimeString()) } });
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
kiteboard-0.1.0 | app/assets/javascripts/digit.js |