Sha256: ba6202e21e514af4ec3d7e42a98b0de261a88d847da09bf4b72b015ade32b598

Contents?: true

Size: 780 Bytes

Versions: 3

Compression:

Stored size: 780 Bytes

Contents

/*
---
 
script: Progress.js
 
description: Progress bar of html5
 
license: Public domain (http://unlicense.org).

authors: Yaroslaff Fedin
 
requires:
  - LSD/LSD.Widget

provides:   
  - LSD.Widget.Progress
 
...
*/

LSD.Widget.Progress = new Class({
  options: {
    tag: 'progress',
    inline: null,
    pseudos: Array.fast('value'),
    events: {
      _initial: {
        self: {
          build: function() {
            if (!('value' in this.attributes)) this.setAttribute('value', 0)
          }
        }
      }
    }
  },
  
  getBar: Macro.getter('bar', function() {
    return new Element('span').inject(this.toElement());
  }),
  
  set: function(value) {
    this.setAttribute('value', value);
    this.getBar().setStyle('width', Math.round(value) + '%')
  }
});

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
lsd_rails-0.1.2 Packages/lsd-widgets/Source/Progress.js
lsd_rails-0.1.1 Packages/lsd-widgets/Source/Progress.js
lsd_rails-0.1 Packages/lsd-widgets/Source/Progress.js