|
90 | 90 | min : this.$.data('min') || 0,
|
91 | 91 | max : this.$.data('max') || 100,
|
92 | 92 | stopper : true,
|
93 |
| - readOnly : this.$.data('readonly') || (this.$.attr('readonly') == 'readonly'), |
| 93 | + readOnly : this.$.data('readonly') || (this.$.attr('readonly') === 'readonly'), |
94 | 94 |
|
95 | 95 | // UI
|
96 |
| - cursor : (this.$.data('cursor') === true && 30) |
97 |
| - || this.$.data('cursor') |
98 |
| - || 0, |
| 96 | + cursor : (this.$.data('cursor') === true && 30) || |
| 97 | + this.$.data('cursor') || 0, |
99 | 98 | thickness : (
|
100 |
| - this.$.data('thickness') |
101 |
| - && Math.max(Math.min(this.$.data('thickness'), 1), 0.01) |
102 |
| - ) |
103 |
| - || 0.35, |
| 99 | + this.$.data('thickness') && |
| 100 | + Math.max(Math.min(this.$.data('thickness'), 1), 0.01) |
| 101 | + ) || 0.35, |
104 | 102 | lineCap : this.$.data('linecap') || 'butt',
|
105 | 103 | width : this.$.data('width') || 200,
|
106 | 104 | height : this.$.data('height') || 200,
|
|
132 | 130 |
|
133 | 131 | // fieldset = array of integer
|
134 | 132 | this.v = {};
|
135 |
| - this.i = this.$.find('input') |
| 133 | + this.i = this.$.find('input'); |
136 | 134 | this.i.each(function(k) {
|
137 | 135 | var $this = $(this);
|
138 | 136 | s.i[k] = $this;
|
|
154 | 152 | // input = integer
|
155 | 153 | this.i = this.$;
|
156 | 154 | this.v = this.$.val();
|
157 |
| - (this.v == '') && (this.v = this.o.min); |
| 155 | + (this.v === '') && (this.v = this.o.min); |
158 | 156 |
|
159 | 157 | this.$.bind(
|
160 | 158 | 'change blur'
|
|
205 | 203 | );
|
206 | 204 |
|
207 | 205 | // detects relative width / height
|
208 |
| - this.relativeWidth = ((this.o.width % 1 !== 0) |
209 |
| - && this.o.width.indexOf('%')); |
210 |
| - this.relativeHeight = ((this.o.height % 1 !== 0) |
211 |
| - && this.o.height.indexOf('%')); |
| 206 | + this.relativeWidth = ((this.o.width % 1 !== 0) && |
| 207 | + this.o.width.indexOf('%')); |
| 208 | + this.relativeHeight = ((this.o.height % 1 !== 0) && |
| 209 | + this.o.height.indexOf('%')); |
212 | 210 | this.relative = (this.relativeWidth || this.relativeHeight);
|
213 | 211 |
|
214 | 212 | // computes size and carves the component
|
|
244 | 242 |
|
245 | 243 | this._carve = function() {
|
246 | 244 | if(this.relative) {
|
247 |
| - var w = this.relativeWidth |
248 |
| - ? this.$div.parent().width() |
249 |
| - * parseInt(this.o.width) / 100 |
250 |
| - : this.$div.parent().width(), |
251 |
| - h = this.relativeHeight |
252 |
| - ? this.$div.parent().height() |
253 |
| - * parseInt(this.o.height) / 100 |
254 |
| - : this.$div.parent().height(); |
| 245 | + var w = this.relativeWidth ? |
| 246 | + this.$div.parent().width() * |
| 247 | + parseInt(this.o.width) / 100 : |
| 248 | + this.$div.parent().width(), |
| 249 | + h = this.relativeHeight ? |
| 250 | + this.$div.parent().height() * |
| 251 | + parseInt(this.o.height) / 100 : |
| 252 | + this.$div.parent().height(); |
255 | 253 |
|
256 | 254 | // apply relative
|
257 | 255 | this.w = this.h = Math.min(w, h);
|
|
310 | 308 |
|
311 | 309 | if (v == s.cv) return;
|
312 | 310 |
|
313 |
| - if ( |
314 |
| - s.cH |
315 |
| - && (s.cH(v) === false) |
316 |
| - ) return; |
| 311 | + if (s.cH && (s.cH(v) === false)) return; |
317 | 312 |
|
318 | 313 | s.change(s._validate(v));
|
319 | 314 | s._draw();
|
|
343 | 338 |
|
344 | 339 | var mouseMove = function (e) {
|
345 | 340 | var v = s.xy2val(e.pageX, e.pageY);
|
346 |
| - |
| 341 | + |
347 | 342 | if (v == s.cv) return;
|
348 | 343 |
|
349 |
| - if ( |
350 |
| - s.cH |
351 |
| - && (s.cH(v) === false) |
352 |
| - ) return; |
| 344 | + if (s.cH && (s.cH(v) === false)) return; |
353 | 345 |
|
354 | 346 | s.change(s._validate(v));
|
355 | 347 | s._draw();
|
|
511 | 503 | if (null != v) {
|
512 | 504 |
|
513 | 505 | if (
|
514 |
| - triggerRelease !== false |
515 |
| - && (v != this.v) |
516 |
| - && this.rH |
517 |
| - && (this.rH(v) === false) |
| 506 | + triggerRelease !== false && (v != this.v) && this.rH && |
| 507 | + (this.rH(v) === false) |
518 | 508 | ) return;
|
519 | 509 |
|
520 | 510 | this.cv = this.o.stopper ? max(min(v, this.o.max), this.o.min) : v;
|
|
544 | 534 | ret = ~~ (0.5 + (a * (this.o.max - this.o.min) / this.angleArc))
|
545 | 535 | + this.o.min;
|
546 | 536 |
|
547 |
| - this.o.stopper |
548 |
| - && (ret = max(min(ret, this.o.max), this.o.min)); |
| 537 | + this.o.stopper && (ret = max(min(ret, this.o.max), this.o.min)); |
549 | 538 |
|
550 | 539 | return ret;
|
551 | 540 | };
|
|
612 | 601 |
|
613 | 602 | var v = parseInt(s.$.val()) + kv[kc] * m;
|
614 | 603 |
|
615 |
| - s.o.stopper |
616 |
| - && (v = max(min(v, s.o.max), s.o.min)); |
| 604 | + s.o.stopper && (v = max(min(v, s.o.max), s.o.min)); |
617 | 605 |
|
618 | 606 | s.change(v);
|
619 | 607 | s._draw();
|
|
0 commit comments