glider-rails 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Glider - angularjs UI slider
2
2
 
3
- Glider - angularjs slider with no dependencies. Dead simple - ~~74~~ ~~98~~ 165 LOC.
3
+ Glider - AngularJS slider with no dependencies. Dead simple, < 200 LOC.
4
4
 
5
5
  ## Demo
6
6
 
@@ -1,5 +1,5 @@
1
1
  ###
2
- glider 0.1.3 - AngularJS slider
2
+ glider 0.1.4 - AngularJS slider
3
3
  https://github.com/evrone/glider
4
4
  Copyright (c) 2013 Valentin Vasilyev, Dmitry Karpunin
5
5
  Licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) license.
@@ -18,24 +18,18 @@
18
18
  slider with increments (incompatible with step option)
19
19
  <slider min="0" max="100" increments="10,50,60,90"></slider>
20
20
  ###
21
- 'use strict';
21
+ 'use strict'
22
+
22
23
  gliderModule = angular.module('glider', [])
23
24
 
24
25
  gliderModule.directive 'slider', ['$document', ($document) ->
25
26
 
26
- getSubElement = (sliderElement, className) ->
27
- sliderElement[0].getElementsByClassName(className)[0]
28
-
29
- moveHandle = (elem, posX) ->
30
- angular.element(getSubElement(elem, 'handle')).css('left', "#{posX}%")
31
- angular.element(getSubElement(elem, 'range')).css('width', "#{posX}%")
32
-
33
27
  template: """
34
28
  <span class="g-slider horizontal">
35
- <span class="slider">
36
- <span class="range"></span>
37
- <span class="handle" ng-mousedown="mouseDown($event)">
38
- <span class="value" ng-show="showValueInHandle">{{value | intersperse}}</span>
29
+ <span class="slider" ng-click="sliderClick($event)">
30
+ <span class="range" style="width: {{xPosition}}%;"></span>
31
+ <span class="handle" style="left: {{xPosition}}%;" ng-mousedown="handleMouseDown($event)">
32
+ <span class="value" ng-show="showValueInHandle">{{handleValue | intersperse}}</span>
39
33
  </span>
40
34
  </span>
41
35
  <span class="side dec">
@@ -62,58 +56,65 @@ gliderModule.directive 'slider', ['$document', ($document) ->
62
56
  max: "&"
63
57
 
64
58
  link: (scope, element, attrs) ->
59
+
65
60
  parseIncrements = ->
66
- trim = (input) -> if input then input.replace(/^\s+|\s+$/g, '') else input
67
- offset = (min, max, value) ->
68
- value = parseInt(value) - min
69
- value / Math.abs(max - min) * 100
70
- if attrs.increments
61
+ if attrs.increments?
71
62
  min = scope.min()
72
63
  max = scope.max()
73
- increments = attrs.increments.split(',')
74
- increments = for i in increments when min < parseInt(i) < max
75
- value: parseInt(trim(i), 10)
76
- offset: offset(min, max, i)
77
-
78
- createSnapValues = (increments)->
79
- if attrs.increments?
80
- ([scope.min(), scope.max()].concat(i.value for i in increments)).sort((a,b) -> a - b)
81
-
82
-
83
- sliderElement = getSubElement(element, 'slider')
64
+ offsetK = 100 / Math.abs(max - min)
65
+ scope.increments = []
66
+ scope.snapValues = [min, max]
67
+ for i in attrs.increments.split(',')
68
+ i = parseInt(i)
69
+ if min < i < max
70
+ scope.increments.push value: i, offset: (i - min) * offsetK
71
+ scope.snapValues.push i
72
+ scope.snapValues.sort((a, b) -> a - b)
73
+ undefined
74
+
75
+ sliderElement = element[0].getElementsByClassName('slider')[0]
84
76
  dragging = false
85
- xPosition = 0
86
- step = if attrs.step? then parseInt(attrs.step, 10) else 1
87
- deferUpdate = attrs.deferUpdate?
77
+ scope.xPosition = 0
78
+ step = attrs.step or 1
79
+ deferUpdate = attrs.deferUpdate?
88
80
  scope.showValueInHandle = attrs.showValueInHandle?
89
81
 
90
82
  scope.value = scope.min() unless scope.value?
91
83
 
92
- scope.increments = parseIncrements(attrs.increments)
93
- scope.snapValues = createSnapValues(scope.increments)
94
-
95
84
  refreshHandle = ->
96
85
  range = scope.max() - scope.min()
97
86
  if range is 0
98
- xPosition = 0
87
+ scope.xPosition = 0
99
88
  else
100
- xPosition = (scope.value - scope.min()) / range * 100
101
- xPosition = Math.min(Math.max(0, xPosition), 100)
102
- moveHandle element, xPosition
89
+ scope.xPosition = (scope.value - scope.min()) / range * 100
90
+ scope.xPosition = Math.min(Math.max(0, scope.xPosition), 100)
91
+ scope.handleValue = scope.value if scope.showValueInHandle
92
+
93
+ snap = ->
94
+ if scope.increments
95
+ minDiff = Infinity
96
+ for snapValue in scope.snapValues
97
+ diff = Math.abs(snapValue - scope.value)
98
+ if diff < minDiff
99
+ minDiff = diff
100
+ closestValue = snapValue
101
+ scope.value = closestValue
102
+ refreshHandle()
103
+
104
+ valueFromPosition = ->
105
+ Math.round((((scope.max() - scope.min()) * (scope.xPosition / 100)) + scope.min()) / step) * step
103
106
 
104
107
  scope.$watch 'min()', (minValue) ->
105
- if scope.value < minValue
106
- scope.value = minValue
107
- else
108
- refreshHandle()
108
+ parseIncrements()
109
+ scope.value = minValue if scope.value < minValue
110
+ snap()
109
111
 
110
112
  scope.$watch 'max()', (maxValue) ->
111
- if scope.value > maxValue
112
- scope.value = maxValue
113
- else
114
- refreshHandle()
113
+ parseIncrements()
114
+ scope.value = maxValue if scope.value > maxValue
115
+ snap()
115
116
 
116
- scope.$watch 'value', (newVal, oldVal)->
117
+ scope.$watch 'value', (newVal, oldVal) ->
117
118
  return if dragging
118
119
  if scope.min() <= newVal <= scope.max()
119
120
  refreshHandle()
@@ -130,64 +131,57 @@ gliderModule.directive 'slider', ['$document', ($document) ->
130
131
  newVal = if steps > 0
131
132
  (sv for sv in scope.snapValues when sv > scope.value)[0]
132
133
  else
133
- (sv for sv in scope.snapValues when sv < scope.value).sort((a,b) -> b - a)[0]
134
+ (sv for sv in scope.snapValues when sv < scope.value).reverse()[0]
134
135
  scope.value = newVal if newVal?
135
136
 
136
137
  if attrs.increments?
137
- doIncrement(steps)
138
+ doIncrement steps
138
139
  else
139
- doStep(steps)
140
+ doStep steps
141
+
142
+ scope.sliderClick = ($event) ->
143
+ return if angular.element($event.target).hasClass('handle')
144
+ scope.xPosition = $event.layerX / sliderElement.offsetWidth * 100
145
+ scope.value = valueFromPosition()
146
+ snap()
140
147
 
148
+ startPointX = null
141
149
 
142
- scope.mouseDown = ($event) ->
150
+ scope.handleMouseDown = ($event) ->
143
151
  return unless angular.element($event.target).hasClass('handle')
144
- dragging = true
145
152
  startPointX = $event.pageX
153
+ dragging = true
146
154
 
147
- updateValue = ->
148
- scope.value = Math.round((((scope.max() - scope.min()) * (xPosition / 100)) + scope.min()) / step) * step
149
- scope.$apply()
150
-
151
- snap = ->
152
- i = 0
153
- l = scope.snapValues.length
154
-
155
- while i < l
156
- diff = Math.abs(scope.snapValues[i] - scope.value)
157
- min = diff unless min?
158
- if diff <= min
159
- closest = scope.snapValues[i]
160
- min = diff
161
- i++
162
- scope.value = closest
163
- scope.$apply()
164
-
165
- $document.on 'mousemove', ($event) ->
166
- return unless dragging
167
- moveDelta = $event.pageX - startPointX
168
- xPosition += moveDelta / sliderElement.offsetWidth * 100
169
- if xPosition < 0
170
- xPosition = 0
171
- else if xPosition > 100
172
- xPosition = 100
173
- else
174
- startPointX = $event.pageX
175
- updateValue() unless deferUpdate
176
- moveHandle element, xPosition
177
-
178
- $document.on 'mouseup', ->
179
- dragging = false
180
- updateValue() if deferUpdate
181
- snap() if scope.increments
182
- $document.off 'mousemove'
155
+ $document.on 'mousemove', ($event) ->
156
+ return unless dragging
157
+ moveDelta = $event.pageX - startPointX
158
+ scope.xPosition += moveDelta / sliderElement.offsetWidth * 100
159
+ if scope.xPosition < 0
160
+ scope.xPosition = 0
161
+ else if scope.xPosition > 100
162
+ scope.xPosition = 100
163
+ else
164
+ startPointX = $event.pageX
165
+ scope.value = valueFromPosition() unless deferUpdate
166
+ scope.handleValue = valueFromPosition() if scope.showValueInHandle
167
+ scope.$apply()
168
+
169
+ $document.on 'mouseup', ->
170
+ return unless dragging
171
+ scope.value = valueFromPosition() if deferUpdate
172
+ snap()
173
+ scope.$apply()
174
+ dragging = false
183
175
  ]
176
+
177
+
178
+
184
179
  gliderModule.filter 'intersperse', ->
185
180
  (input) ->
186
181
  return unless input?
187
182
  input = input.toString()
188
- reverse = (input) -> input.split('').reverse().join('')
189
- reversed = reverse(input)
190
- reversed_and_sliced = reversed.replace(/(.{3})/g, '$1 ')
191
- sliced = reverse(reversed_and_sliced)
183
+ reverseString = (input) -> input.split('').reverse().join('')
184
+ reversed = reverseString(input)
185
+ reversed = reversed.replace(/(.{3})/g, '$1 ')
186
+ sliced = reverseString(reversed)
192
187
  sliced.trim()
193
-
@@ -1,6 +1,6 @@
1
1
  // Generated by CoffeeScript 1.6.3
2
2
  /*
3
- glider 0.1.3 - AngularJS slider
3
+ glider 0.1.4 - AngularJS slider
4
4
  https://github.com/evrone/glider
5
5
  Copyright (c) 2013 Valentin Vasilyev, Dmitry Karpunin
6
6
  Licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) license.
@@ -29,16 +29,8 @@
29
29
 
30
30
  gliderModule.directive('slider', [
31
31
  '$document', function($document) {
32
- var getSubElement, moveHandle;
33
- getSubElement = function(sliderElement, className) {
34
- return sliderElement[0].getElementsByClassName(className)[0];
35
- };
36
- moveHandle = function(elem, posX) {
37
- angular.element(getSubElement(elem, 'handle')).css('left', "" + posX + "%");
38
- return angular.element(getSubElement(elem, 'range')).css('width', "" + posX + "%");
39
- };
40
32
  return {
41
- template: "<span class=\"g-slider horizontal\">\n <span class=\"slider\">\n <span class=\"range\"></span>\n <span class=\"handle\" ng-mousedown=\"mouseDown($event)\">\n <span class=\"value\" ng-show=\"showValueInHandle\">{{value | intersperse}}</span>\n </span>\n </span>\n <span class=\"side dec\">\n <span class=\"button\" ng-click=\"step(-1)\">-</span>\n <span class=\"bound-value\">{{min() | intersperse}}</span>\n </span>\n <span class=\"side inc\">\n <span class=\"button\" ng-click=\"step(+1)\">+</span>\n <span class=\"bound-value\">{{max() | intersperse}}</span>\n </span>\n <span class=\"increments\">\n <span ng-repeat=\"i in increments\" class=\"i\" style=\"left: {{i.offset}}%\">\n {{ i.value | intersperse }}\n </span>\n </span>\n</span>",
33
+ template: "<span class=\"g-slider horizontal\">\n <span class=\"slider\" ng-click=\"sliderClick($event)\">\n <span class=\"range\" style=\"width: {{xPosition}}%;\"></span>\n <span class=\"handle\" style=\"left: {{xPosition}}%;\" ng-mousedown=\"handleMouseDown($event)\">\n <span class=\"value\" ng-show=\"showValueInHandle\">{{handleValue | intersperse}}</span>\n </span>\n </span>\n <span class=\"side dec\">\n <span class=\"button\" ng-click=\"step(-1)\">-</span>\n <span class=\"bound-value\">{{min() | intersperse}}</span>\n </span>\n <span class=\"side inc\">\n <span class=\"button\" ng-click=\"step(+1)\">+</span>\n <span class=\"bound-value\">{{max() | intersperse}}</span>\n </span>\n <span class=\"increments\">\n <span ng-repeat=\"i in increments\" class=\"i\" style=\"left: {{i.offset}}%\">\n {{ i.value | intersperse }}\n </span>\n </span>\n</span>",
42
34
  replace: true,
43
35
  restrict: "E",
44
36
  scope: {
@@ -47,91 +39,88 @@
47
39
  max: "&"
48
40
  },
49
41
  link: function(scope, element, attrs) {
50
- var createSnapValues, deferUpdate, dragging, parseIncrements, refreshHandle, sliderElement, step, xPosition;
42
+ var deferUpdate, dragging, parseIncrements, refreshHandle, sliderElement, snap, startPointX, step, valueFromPosition;
51
43
  parseIncrements = function() {
52
- var i, increments, max, min, offset, trim;
53
- trim = function(input) {
54
- if (input) {
55
- return input.replace(/^\s+|\s+$/g, '');
56
- } else {
57
- return input;
58
- }
59
- };
60
- offset = function(min, max, value) {
61
- value = parseInt(value) - min;
62
- return value / Math.abs(max - min) * 100;
63
- };
64
- if (attrs.increments) {
44
+ var i, max, min, offsetK, _i, _len, _ref;
45
+ if (attrs.increments != null) {
65
46
  min = scope.min();
66
47
  max = scope.max();
67
- increments = attrs.increments.split(',');
68
- return increments = (function() {
69
- var _i, _len, _ref, _results;
70
- _results = [];
71
- for (_i = 0, _len = increments.length; _i < _len; _i++) {
72
- i = increments[_i];
73
- if ((min < (_ref = parseInt(i)) && _ref < max)) {
74
- _results.push({
75
- value: parseInt(trim(i), 10),
76
- offset: offset(min, max, i)
77
- });
78
- }
79
- }
80
- return _results;
81
- })();
82
- }
83
- };
84
- createSnapValues = function(increments) {
85
- var i;
86
- if (attrs.increments != null) {
87
- return ([scope.min(), scope.max()].concat((function() {
88
- var _i, _len, _results;
89
- _results = [];
90
- for (_i = 0, _len = increments.length; _i < _len; _i++) {
91
- i = increments[_i];
92
- _results.push(i.value);
48
+ offsetK = 100 / Math.abs(max - min);
49
+ scope.increments = [];
50
+ scope.snapValues = [min, max];
51
+ _ref = attrs.increments.split(',');
52
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
53
+ i = _ref[_i];
54
+ i = parseInt(i);
55
+ if ((min < i && i < max)) {
56
+ scope.increments.push({
57
+ value: i,
58
+ offset: (i - min) * offsetK
59
+ });
60
+ scope.snapValues.push(i);
93
61
  }
94
- return _results;
95
- })())).sort(function(a, b) {
62
+ }
63
+ scope.snapValues.sort(function(a, b) {
96
64
  return a - b;
97
65
  });
98
66
  }
67
+ return void 0;
99
68
  };
100
- sliderElement = getSubElement(element, 'slider');
69
+ sliderElement = element[0].getElementsByClassName('slider')[0];
101
70
  dragging = false;
102
- xPosition = 0;
103
- step = attrs.step != null ? parseInt(attrs.step, 10) : 1;
71
+ scope.xPosition = 0;
72
+ step = attrs.step || 1;
104
73
  deferUpdate = attrs.deferUpdate != null;
105
74
  scope.showValueInHandle = attrs.showValueInHandle != null;
106
75
  if (scope.value == null) {
107
76
  scope.value = scope.min();
108
77
  }
109
- scope.increments = parseIncrements(attrs.increments);
110
- scope.snapValues = createSnapValues(scope.increments);
111
78
  refreshHandle = function() {
112
79
  var range;
113
80
  range = scope.max() - scope.min();
114
81
  if (range === 0) {
115
- xPosition = 0;
82
+ scope.xPosition = 0;
116
83
  } else {
117
- xPosition = (scope.value - scope.min()) / range * 100;
118
- xPosition = Math.min(Math.max(0, xPosition), 100);
84
+ scope.xPosition = (scope.value - scope.min()) / range * 100;
85
+ scope.xPosition = Math.min(Math.max(0, scope.xPosition), 100);
86
+ }
87
+ if (scope.showValueInHandle) {
88
+ return scope.handleValue = scope.value;
119
89
  }
120
- return moveHandle(element, xPosition);
90
+ };
91
+ snap = function() {
92
+ var closestValue, diff, minDiff, snapValue, _i, _len, _ref;
93
+ if (scope.increments) {
94
+ minDiff = Infinity;
95
+ _ref = scope.snapValues;
96
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
97
+ snapValue = _ref[_i];
98
+ diff = Math.abs(snapValue - scope.value);
99
+ if (diff < minDiff) {
100
+ minDiff = diff;
101
+ closestValue = snapValue;
102
+ }
103
+ }
104
+ scope.value = closestValue;
105
+ }
106
+ return refreshHandle();
107
+ };
108
+ valueFromPosition = function() {
109
+ return Math.round((((scope.max() - scope.min()) * (scope.xPosition / 100)) + scope.min()) / step) * step;
121
110
  };
122
111
  scope.$watch('min()', function(minValue) {
112
+ parseIncrements();
123
113
  if (scope.value < minValue) {
124
- return scope.value = minValue;
125
- } else {
126
- return refreshHandle();
114
+ scope.value = minValue;
127
115
  }
116
+ return snap();
128
117
  });
129
118
  scope.$watch('max()', function(maxValue) {
119
+ parseIncrements();
130
120
  if (scope.value > maxValue) {
131
- return scope.value = maxValue;
132
- } else {
133
- return refreshHandle();
121
+ scope.value = maxValue;
134
122
  }
123
+ return snap();
135
124
  });
136
125
  scope.$watch('value', function(newVal, oldVal) {
137
126
  if (dragging) {
@@ -176,9 +165,7 @@
176
165
  }
177
166
  }
178
167
  return _results;
179
- })()).sort(function(a, b) {
180
- return b - a;
181
- })[0];
168
+ })()).reverse()[0];
182
169
  if (newVal != null) {
183
170
  return scope.value = newVal;
184
171
  }
@@ -189,65 +176,55 @@
189
176
  return doStep(steps);
190
177
  }
191
178
  };
192
- return scope.mouseDown = function($event) {
193
- var snap, startPointX, updateValue;
179
+ scope.sliderClick = function($event) {
180
+ if (angular.element($event.target).hasClass('handle')) {
181
+ return;
182
+ }
183
+ scope.xPosition = $event.layerX / sliderElement.offsetWidth * 100;
184
+ scope.value = valueFromPosition();
185
+ return snap();
186
+ };
187
+ startPointX = null;
188
+ scope.handleMouseDown = function($event) {
194
189
  if (!angular.element($event.target).hasClass('handle')) {
195
190
  return;
196
191
  }
197
- dragging = true;
198
192
  startPointX = $event.pageX;
199
- updateValue = function() {
200
- scope.value = Math.round((((scope.max() - scope.min()) * (xPosition / 100)) + scope.min()) / step) * step;
201
- return scope.$apply();
202
- };
203
- snap = function() {
204
- var closest, diff, i, l, min;
205
- i = 0;
206
- l = scope.snapValues.length;
207
- while (i < l) {
208
- diff = Math.abs(scope.snapValues[i] - scope.value);
209
- if (typeof min === "undefined" || min === null) {
210
- min = diff;
211
- }
212
- if (diff <= min) {
213
- closest = scope.snapValues[i];
214
- min = diff;
215
- }
216
- i++;
217
- }
218
- scope.value = closest;
219
- return scope.$apply();
220
- };
221
- $document.on('mousemove', function($event) {
222
- var moveDelta;
223
- if (!dragging) {
224
- return;
225
- }
226
- moveDelta = $event.pageX - startPointX;
227
- xPosition += moveDelta / sliderElement.offsetWidth * 100;
228
- if (xPosition < 0) {
229
- xPosition = 0;
230
- } else if (xPosition > 100) {
231
- xPosition = 100;
232
- } else {
233
- startPointX = $event.pageX;
234
- }
235
- if (!deferUpdate) {
236
- updateValue();
237
- }
238
- return moveHandle(element, xPosition);
239
- });
240
- return $document.on('mouseup', function() {
241
- dragging = false;
242
- if (deferUpdate) {
243
- updateValue();
244
- }
245
- if (scope.increments) {
246
- snap();
247
- }
248
- return $document.off('mousemove');
249
- });
193
+ return dragging = true;
250
194
  };
195
+ $document.on('mousemove', function($event) {
196
+ var moveDelta;
197
+ if (!dragging) {
198
+ return;
199
+ }
200
+ moveDelta = $event.pageX - startPointX;
201
+ scope.xPosition += moveDelta / sliderElement.offsetWidth * 100;
202
+ if (scope.xPosition < 0) {
203
+ scope.xPosition = 0;
204
+ } else if (scope.xPosition > 100) {
205
+ scope.xPosition = 100;
206
+ } else {
207
+ startPointX = $event.pageX;
208
+ }
209
+ if (!deferUpdate) {
210
+ scope.value = valueFromPosition();
211
+ }
212
+ if (scope.showValueInHandle) {
213
+ scope.handleValue = valueFromPosition();
214
+ }
215
+ return scope.$apply();
216
+ });
217
+ return $document.on('mouseup', function() {
218
+ if (!dragging) {
219
+ return;
220
+ }
221
+ if (deferUpdate) {
222
+ scope.value = valueFromPosition();
223
+ }
224
+ snap();
225
+ scope.$apply();
226
+ return dragging = false;
227
+ });
251
228
  }
252
229
  };
253
230
  }
@@ -255,17 +232,17 @@
255
232
 
256
233
  gliderModule.filter('intersperse', function() {
257
234
  return function(input) {
258
- var reverse, reversed, reversed_and_sliced, sliced;
235
+ var reverseString, reversed, sliced;
259
236
  if (input == null) {
260
237
  return;
261
238
  }
262
239
  input = input.toString();
263
- reverse = function(input) {
240
+ reverseString = function(input) {
264
241
  return input.split('').reverse().join('');
265
242
  };
266
- reversed = reverse(input);
267
- reversed_and_sliced = reversed.replace(/(.{3})/g, '$1 ');
268
- sliced = reverse(reversed_and_sliced);
243
+ reversed = reverseString(input);
244
+ reversed = reversed.replace(/(.{3})/g, '$1 ');
245
+ sliced = reverseString(reversed);
269
246
  return sliced.trim();
270
247
  };
271
248
  });
@@ -6,5 +6,5 @@
6
6
  "src/glider.coffee"
7
7
  ],
8
8
  "names": [],
9
- "mappings": ";AAAA;;;;;;;;;;;;;;;;;;;;CAAA;CAAA;CAAA;CAAA,CAoBA,UApBA;CAAA,KAAA,MAAA;;CAAA,CAqBA,CAAe,GAAA,CAAO,CAAP,IAAf;;CArBA,CAuBA,MAAA,CAAA,GAAY;EAAmC,CAAA,EAAb,IAAc,EAAf;CAE/B,SAAA,eAAA;CAAA,CAAgC,CAAhB,GAAhB,GAAiB,IAAjB;CACgB,QAAd,IAAc,EAAd,OAAA;CADF,MAAgB;CAAhB,CAGoB,CAAP,CAAA,EAAb,GAAc,CAAd;CACE,CAAoC,CAApC,CAAgB,EAAhB,CAAO,CAAP,KAAgB;CACR,CAA4B,CAApC,CAAgB,GAAT,MAAS,EAAhB;CALF,MAGa;aAIb;CAAA,CAAU,MAAV,2wBAAA;CAAA,CAwBS,EAxBT,GAwBA,CAAA;CAxBA,CAyBU,CAzBV,KAyBA;CAzBA,CA2BE,GADF,GAAA;CACE,CAAO,CAA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1 +1 @@
1
- (function(){"use strict";var n;n=angular.module("glider",[]),n.directive("slider",["$document",function(n){var e,a;return e=function(n,e){return n[0].getElementsByClassName(e)[0]},a=function(n,a){return angular.element(e(n,"handle")).css("left",""+a+"%"),angular.element(e(n,"range")).css("width",""+a+"%")},{template:'<span class="g-slider horizontal">\n <span class="slider">\n <span class="range"></span>\n <span class="handle" ng-mousedown="mouseDown($event)">\n <span class="value" ng-show="showValueInHandle">{{value | intersperse}}</span>\n </span>\n </span>\n <span class="side dec">\n <span class="button" ng-click="step(-1)">-</span>\n <span class="bound-value">{{min() | intersperse}}</span>\n </span>\n <span class="side inc">\n <span class="button" ng-click="step(+1)">+</span>\n <span class="bound-value">{{max() | intersperse}}</span>\n </span>\n <span class="increments">\n <span ng-repeat="i in increments" class="i" style="left: {{i.offset}}%">\n {{ i.value | intersperse }}\n </span>\n </span>\n</span>',replace:!0,restrict:"E",scope:{value:"=",min:"&",max:"&"},link:function(s,t,r){var u,l,i,o,c,p,f,v;return o=function(){var n,e,a,t,u,l;return l=function(n){return n?n.replace(/^\s+|\s+$/g,""):n},u=function(n,e,a){return a=parseInt(a)-n,100*(a/Math.abs(e-n))},r.increments?(t=s.min(),a=s.max(),e=r.increments.split(","),e=function(){var s,r,i,o;for(o=[],s=0,r=e.length;r>s;s++)n=e[s],t<(i=parseInt(n))&&a>i&&o.push({value:parseInt(l(n),10),offset:u(t,a,n)});return o}()):void 0},u=function(n){var e;return null!=r.increments?[s.min(),s.max()].concat(function(){var a,s,t;for(t=[],a=0,s=n.length;s>a;a++)e=n[a],t.push(e.value);return t}()).sort(function(n,e){return n-e}):void 0},p=e(t,"slider"),i=!1,v=0,f=null!=r.step?parseInt(r.step,10):1,l=null!=r.deferUpdate,s.showValueInHandle=null!=r.showValueInHandle,null==s.value&&(s.value=s.min()),s.increments=o(r.increments),s.snapValues=u(s.increments),c=function(){var n;return n=s.max()-s.min(),0===n?v=0:(v=100*((s.value-s.min())/n),v=Math.min(Math.max(0,v),100)),a(t,v)},s.$watch("min()",function(n){return s.value<n?s.value=n:c()}),s.$watch("max()",function(n){return s.value>n?s.value=n:c()}),s.$watch("value",function(n,e){return i?void 0:s.min()<=n&&n<=s.max()?c():n=e}),s.step=function(n){var e,a;return a=function(n){var e;return e=s.value+n*f,s.min()<=e&&e<=s.max()?s.value=e:void 0},e=function(n){var e,a;return e=n>0?function(){var n,e,t,r;for(t=s.snapValues,r=[],n=0,e=t.length;e>n;n++)a=t[n],a>s.value&&r.push(a);return r}()[0]:function(){var n,e,t,r;for(t=s.snapValues,r=[],n=0,e=t.length;e>n;n++)a=t[n],a<s.value&&r.push(a);return r}().sort(function(n,e){return e-n})[0],null!=e?s.value=e:void 0},null!=r.increments?e(n):a(n)},s.mouseDown=function(e){var r,u,o;if(angular.element(e.target).hasClass("handle"))return i=!0,u=e.pageX,o=function(){return s.value=Math.round(((s.max()-s.min())*(v/100)+s.min())/f)*f,s.$apply()},r=function(){var n,e,a,t,r;for(a=0,t=s.snapValues.length;t>a;)e=Math.abs(s.snapValues[a]-s.value),("undefined"==typeof r||null===r)&&(r=e),r>=e&&(n=s.snapValues[a],r=e),a++;return s.value=n,s.$apply()},n.on("mousemove",function(n){var e;if(i)return e=n.pageX-u,v+=100*(e/p.offsetWidth),0>v?v=0:v>100?v=100:u=n.pageX,l||o(),a(t,v)}),n.on("mouseup",function(){return i=!1,l&&o(),s.increments&&r(),n.off("mousemove")})}}}}]),n.filter("intersperse",function(){return function(n){var e,a,s,t;if(null!=n)return n=n.toString(),e=function(n){return n.split("").reverse().join("")},a=e(n),s=a.replace(/(.{3})/g,"$1 "),t=e(s),t.trim()}})}).call(this);
1
+ (function(){"use strict";var n;n=angular.module("glider",[]),n.directive("slider",["$document",function(n){return{template:'<span class="g-slider horizontal">\n <span class="slider" ng-click="sliderClick($event)">\n <span class="range" style="width: {{xPosition}}%;"></span>\n <span class="handle" style="left: {{xPosition}}%;" ng-mousedown="handleMouseDown($event)">\n <span class="value" ng-show="showValueInHandle">{{handleValue | intersperse}}</span>\n </span>\n </span>\n <span class="side dec">\n <span class="button" ng-click="step(-1)">-</span>\n <span class="bound-value">{{min() | intersperse}}</span>\n </span>\n <span class="side inc">\n <span class="button" ng-click="step(+1)">+</span>\n <span class="bound-value">{{max() | intersperse}}</span>\n </span>\n <span class="increments">\n <span ng-repeat="i in increments" class="i" style="left: {{i.offset}}%">\n {{ i.value | intersperse }}\n </span>\n </span>\n</span>',replace:!0,restrict:"E",scope:{value:"=",min:"&",max:"&"},link:function(e,a,s){var t,l,i,u,r,o,c,p,v;return i=function(){var n,a,t,l,i,u,r;if(null!=s.increments){for(t=e.min(),a=e.max(),l=100/Math.abs(a-t),e.increments=[],e.snapValues=[t,a],r=s.increments.split(","),i=0,u=r.length;u>i;i++)n=r[i],n=parseInt(n),n>t&&a>n&&(e.increments.push({value:n,offset:(n-t)*l}),e.snapValues.push(n));e.snapValues.sort(function(n,e){return n-e})}return void 0},r=a[0].getElementsByClassName("slider")[0],l=!1,e.xPosition=0,p=s.step||1,t=null!=s.deferUpdate,e.showValueInHandle=null!=s.showValueInHandle,null==e.value&&(e.value=e.min()),u=function(){var n;return n=e.max()-e.min(),0===n?e.xPosition=0:(e.xPosition=100*((e.value-e.min())/n),e.xPosition=Math.min(Math.max(0,e.xPosition),100)),e.showValueInHandle?e.handleValue=e.value:void 0},o=function(){var n,a,s,t,l,i,r;if(e.increments){for(s=1/0,r=e.snapValues,l=0,i=r.length;i>l;l++)t=r[l],a=Math.abs(t-e.value),s>a&&(s=a,n=t);e.value=n}return u()},v=function(){return Math.round(((e.max()-e.min())*(e.xPosition/100)+e.min())/p)*p},e.$watch("min()",function(n){return i(),e.value<n&&(e.value=n),o()}),e.$watch("max()",function(n){return i(),e.value>n&&(e.value=n),o()}),e.$watch("value",function(n,a){return l?void 0:e.min()<=n&&n<=e.max()?u():n=a}),e.step=function(n){var a,t;return t=function(n){var a;return a=e.value+n*p,e.min()<=a&&a<=e.max()?e.value=a:void 0},a=function(n){var a,s;return a=n>0?function(){var n,a,t,l;for(t=e.snapValues,l=[],n=0,a=t.length;a>n;n++)s=t[n],s>e.value&&l.push(s);return l}()[0]:function(){var n,a,t,l;for(t=e.snapValues,l=[],n=0,a=t.length;a>n;n++)s=t[n],s<e.value&&l.push(s);return l}().reverse()[0],null!=a?e.value=a:void 0},null!=s.increments?a(n):t(n)},e.sliderClick=function(n){return angular.element(n.target).hasClass("handle")?void 0:(e.xPosition=100*(n.layerX/r.offsetWidth),e.value=v(),o())},c=null,e.handleMouseDown=function(n){return angular.element(n.target).hasClass("handle")?(c=n.pageX,l=!0):void 0},n.on("mousemove",function(n){var a;if(l)return a=n.pageX-c,e.xPosition+=100*(a/r.offsetWidth),e.xPosition<0?e.xPosition=0:e.xPosition>100?e.xPosition=100:c=n.pageX,t||(e.value=v()),e.showValueInHandle&&(e.handleValue=v()),e.$apply()}),n.on("mouseup",function(){return l?(t&&(e.value=v()),o(),e.$apply(),l=!1):void 0})}}}]),n.filter("intersperse",function(){return function(n){var e,a,s;if(null!=n)return n=n.toString(),e=function(n){return n.split("").reverse().join("")},a=e(n),a=a.replace(/(.{3})/g,"$1 "),s=e(a),s.trim()}})}).call(this);
data/glider-rails.gemspec CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |gem|
6
6
  gem.name = "glider-rails"
7
- gem.version = "0.1.3"
7
+ gem.version = "0.1.4"
8
8
  gem.authors = ["Valentin Valve Vasilyev", "Dmitry KODer Karpunin"]
9
9
  gem.email = ["iamvalentin@gmail.com", "koderfunk@gmail.com"]
10
10
  gem.description = "Glider, AngularJS UI slider for rails asset pipeline"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glider-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-10-22 00:00:00.000000000 Z
13
+ date: 2013-11-14 00:00:00.000000000 Z
14
14
  dependencies: []
15
15
  description: Glider, AngularJS UI slider for rails asset pipeline
16
16
  email: