Akron | 9905e2a | 2016-05-10 16:06:44 +0200 | [diff] [blame^] | 1 | define({ |
| 2 | |
| 3 | /** |
| 4 | * Create new prefix object. |
| 5 | */ |
| 6 | create : function () { |
| 7 | return Object.create(this)._init(); |
| 8 | }, |
| 9 | |
| 10 | // Initialize prefix object |
| 11 | _init : function () { |
| 12 | |
| 13 | this._element = document.createElement('div'); |
| 14 | this._element.setAttribute('class', 'ruler'); |
| 15 | |
| 16 | this._slider = this._element.appendChild( |
| 17 | document.createElement('span') |
| 18 | ); |
| 19 | |
| 20 | this._element.appendChild(document.createElement('div')); |
| 21 | |
| 22 | /* |
| 23 | this._string = ''; |
| 24 | |
| 25 | // Add prefix span |
| 26 | this._element = document.createElement('span'); |
| 27 | this._element.classList.add('pref'); |
| 28 | // Connect action |
| 29 | |
| 30 | if (this["onclick"] !== undefined) |
| 31 | this._element["onclick"] = this.onclick.bind(this); |
| 32 | |
| 33 | */ |
| 34 | return this; |
| 35 | }, |
| 36 | |
| 37 | show : function (i) { |
| 38 | this._slider.style.height = ((this._limit / this._length) * 100) + '%'; |
| 39 | }, |
| 40 | |
| 41 | length : function (i) { |
| 42 | this._length = i; |
| 43 | }, |
| 44 | |
| 45 | limit : function (i) { |
| 46 | this._limit = i; |
| 47 | }, |
| 48 | |
| 49 | element : function () { |
| 50 | return this._element; |
| 51 | } |
| 52 | }); |