Sha256: f215aa70c4a136bbc9e411f02a5ea042fdc37fe0ef5d832ab1be02208870400e
Contents?: true
Size: 1.85 KB
Versions: 7
Compression:
Stored size: 1.85 KB
Contents
/* --- script: Slider.js description: Because sometimes slider is the answer license: Public domain (http://unlicense.org). requires: - LSD.Trait - More/Slider - Ext/Slider.prototype.update - Ext/Class.hasParent provides: - LSD.Trait.Slider ... */ LSD.Trait.Slider = new Class({ options: { actions: { slider: { enable: function() { if (!this.slider) this.getSlider(); else this.slider.attach(); }, disable: function() { if (this.slider) this.slider.detach() } } }, events: { parent: { resize: 'onParentResize' }, slider: {} }, slider: {}, value: 0, mode: 'horizontal', }, onParentResize: function(current, old) { if (this.slider) this.slider.update(); }, getSlider: Macro.getter('slider', function (update) { var slider = new Slider(document.id(this.getTrack()), document.id(this.getTrackThumb()), Object.merge(this.options.slider, { mode: this.options.mode })).set(parseFloat(this.options.value)); slider.addEvent('change', this.onSet.bind(this)); this.fireEvent('register', ['slider', slider]); return slider; }), onSet: Macro.defaults(function() { return true; }), getTrack: Macro.defaults(function() { return this }), getTrackThumb: Macro.defaults(function() { return this.thumb; }), increment: function() { this.slider.set((this.slider.step || 0) + 10) }, decrement: function() { this.slider.set((this.slider.step || 0) - 10) } }); Slider = new Class({ Extends: Slider, initialize: function() { (this.Binds.push ? this.Binds : [this.Binds]).each(function(name){ var original = this[name]; if (original) this[name] = original.bind(this); }, this); return this.parent.apply(this, arguments); } })
Version data entries
7 entries across 7 versions & 1 rubygems