aml 0.1.3.2 → 0.1.3.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. checksums.yaml +4 -4
  2. data/bin/aml-kit +3 -0
  3. data/lib/aml-kit.rb +11 -0
  4. data/lib/aml-kit/Build.rb +55 -0
  5. data/lib/aml-kit/core/bootstrap/3.2.0/css/bootstrap-theme.min.css +6 -0
  6. data/lib/aml-kit/core/bootstrap/3.2.0/css/bootstrap.min.css +5 -0
  7. data/lib/aml-kit/core/bootstrap/3.2.0/css/font-awesome.min.css +4 -0
  8. data/lib/aml-kit/core/bootstrap/3.2.0/fonts/FontAwesome.otf +0 -0
  9. data/lib/aml-kit/core/bootstrap/3.2.0/fonts/fontawesome-webfont.eot +0 -0
  10. data/lib/aml-kit/core/bootstrap/3.2.0/fonts/fontawesome-webfont.svg +520 -0
  11. data/lib/aml-kit/core/bootstrap/3.2.0/fonts/fontawesome-webfont.ttf +0 -0
  12. data/lib/aml-kit/core/bootstrap/3.2.0/fonts/fontawesome-webfont.woff +0 -0
  13. data/lib/aml-kit/core/bootstrap/3.2.0/fonts/glyphicons-halflings-regular.eot +0 -0
  14. data/lib/aml-kit/core/bootstrap/3.2.0/fonts/glyphicons-halflings-regular.svg +229 -0
  15. data/lib/aml-kit/core/bootstrap/3.2.0/fonts/glyphicons-halflings-regular.ttf +0 -0
  16. data/lib/aml-kit/core/bootstrap/3.2.0/fonts/glyphicons-halflings-regular.woff +0 -0
  17. data/lib/aml-kit/core/bootstrap/3.2.0/index.aml +16 -0
  18. data/lib/aml-kit/core/bootstrap/3.2.0/js/bootstrap.min.js +6 -0
  19. data/lib/aml-kit/core/bootstrap/3.2.0/js/html5shiv.min.js +4 -0
  20. data/lib/aml-kit/core/bootstrap/3.2.0/js/jquery.min.js +4 -0
  21. data/lib/aml-kit/core/bootstrap/3.2.0/js/respond.min.js +5 -0
  22. data/lib/aml-kit/core/bootstrap/3.2.0/mixin.aml +11 -0
  23. data/lib/aml-kit/core/bootstrap/3.2.0/partial/footer.aml +17 -0
  24. data/lib/aml-kit/core/bootstrap/3.2.0/partial/header.aml +20 -0
  25. data/lib/aml-kit/core/bootstrap/3.2.0/partial/navigation-top.aml +17 -0
  26. data/lib/aml-kit/core/foundation/5.3.1/css/foundation.min.css +1 -0
  27. data/lib/aml-kit/core/foundation/5.3.1/css/normalize.css +425 -0
  28. data/lib/aml-kit/core/foundation/5.3.1/index.aml +14 -0
  29. data/lib/aml-kit/core/foundation/5.3.1/js/foundation.min.js +10 -0
  30. data/lib/aml-kit/core/foundation/5.3.1/js/foundation/foundation.abide.js +299 -0
  31. data/lib/aml-kit/core/foundation/5.3.1/js/foundation/foundation.accordion.js +65 -0
  32. data/lib/aml-kit/core/foundation/5.3.1/js/foundation/foundation.alert.js +43 -0
  33. data/lib/aml-kit/core/foundation/5.3.1/js/foundation/foundation.clearing.js +542 -0
  34. data/lib/aml-kit/core/foundation/5.3.1/js/foundation/foundation.dropdown.js +313 -0
  35. data/lib/aml-kit/core/foundation/5.3.1/js/foundation/foundation.equalizer.js +74 -0
  36. data/lib/aml-kit/core/foundation/5.3.1/js/foundation/foundation.interchange.js +344 -0
  37. data/lib/aml-kit/core/foundation/5.3.1/js/foundation/foundation.joyride.js +846 -0
  38. data/lib/aml-kit/core/foundation/5.3.1/js/foundation/foundation.js +613 -0
  39. data/lib/aml-kit/core/foundation/5.3.1/js/foundation/foundation.magellan.js +180 -0
  40. data/lib/aml-kit/core/foundation/5.3.1/js/foundation/foundation.offcanvas.js +108 -0
  41. data/lib/aml-kit/core/foundation/5.3.1/js/foundation/foundation.orbit.js +472 -0
  42. data/lib/aml-kit/core/foundation/5.3.1/js/foundation/foundation.reveal.js +437 -0
  43. data/lib/aml-kit/core/foundation/5.3.1/js/foundation/foundation.slider.js +226 -0
  44. data/lib/aml-kit/core/foundation/5.3.1/js/foundation/foundation.tab.js +167 -0
  45. data/lib/aml-kit/core/foundation/5.3.1/js/foundation/foundation.tooltip.js +298 -0
  46. data/lib/aml-kit/core/foundation/5.3.1/js/foundation/foundation.topbar.js +426 -0
  47. data/lib/aml-kit/core/foundation/5.3.1/js/vendor/fastclick.js +9 -0
  48. data/lib/aml-kit/core/foundation/5.3.1/js/vendor/jquery.cookie.js +8 -0
  49. data/lib/aml-kit/core/foundation/5.3.1/js/vendor/jquery.js +26 -0
  50. data/lib/aml-kit/core/foundation/5.3.1/js/vendor/modernizr.js +8 -0
  51. data/lib/aml-kit/core/foundation/5.3.1/js/vendor/placeholder.js +2 -0
  52. data/lib/aml-kit/core/foundation/5.3.1/partial/footer.aml +4 -0
  53. data/lib/aml-kit/core/foundation/5.3.1/partial/header.aml +9 -0
  54. data/lib/aml.rb +1 -1
  55. data/lib/aml/Compile.rb +15 -19
  56. data/lib/aml/Definition.rb +0 -1
  57. data/lib/aml/Line.rb +1 -1
  58. data/lib/aml/Prepare.rb +1 -2
  59. data/lib/aml/core/method.rb +42 -19
  60. metadata +59 -6
@@ -0,0 +1,437 @@
1
+ ;(function ($, window, document, undefined) {
2
+ 'use strict';
3
+
4
+ Foundation.libs.reveal = {
5
+ name : 'reveal',
6
+
7
+ version : '5.3.0',
8
+
9
+ locked : false,
10
+
11
+ settings : {
12
+ animation: 'fadeAndPop',
13
+ animation_speed: 250,
14
+ close_on_background_click: true,
15
+ close_on_esc: true,
16
+ dismiss_modal_class: 'close-reveal-modal',
17
+ bg_class: 'reveal-modal-bg',
18
+ root_element: 'body',
19
+ open: function(){},
20
+ opened: function(){},
21
+ close: function(){},
22
+ closed: function(){},
23
+ bg : $('.reveal-modal-bg'),
24
+ css : {
25
+ open : {
26
+ 'opacity': 0,
27
+ 'visibility': 'visible',
28
+ 'display' : 'block'
29
+ },
30
+ close : {
31
+ 'opacity': 1,
32
+ 'visibility': 'hidden',
33
+ 'display': 'none'
34
+ }
35
+ }
36
+ },
37
+
38
+ init : function (scope, method, options) {
39
+ $.extend(true, this.settings, method, options);
40
+ this.bindings(method, options);
41
+ },
42
+
43
+ events : function (scope) {
44
+ var self = this,
45
+ S = self.S;
46
+
47
+ S(this.scope)
48
+ .off('.reveal')
49
+ .on('click.fndtn.reveal', '[' + this.add_namespace('data-reveal-id') + ']:not([disabled])', function (e) {
50
+ e.preventDefault();
51
+
52
+ if (!self.locked) {
53
+ var element = S(this),
54
+ ajax = element.data(self.data_attr('reveal-ajax'));
55
+
56
+ self.locked = true;
57
+
58
+ if (typeof ajax === 'undefined') {
59
+ self.open.call(self, element);
60
+ } else {
61
+ var url = ajax === true ? element.attr('href') : ajax;
62
+
63
+ self.open.call(self, element, {url: url});
64
+ }
65
+ }
66
+ });
67
+
68
+ S(document)
69
+ .on('touchend.fndtn.reveal click.fndtn.reveal', this.close_targets(), function (e) {
70
+
71
+ e.preventDefault();
72
+
73
+ if (!self.locked) {
74
+ var settings = S('[' + self.attr_name() + '].open').data(self.attr_name(true) + '-init'),
75
+ bg_clicked = S(e.target)[0] === S('.' + settings.bg_class)[0];
76
+
77
+ if (bg_clicked) {
78
+ if (settings.close_on_background_click) {
79
+ e.stopPropagation();
80
+ } else {
81
+ return;
82
+ }
83
+ }
84
+
85
+ self.locked = true;
86
+ self.close.call(self, bg_clicked ? S('[' + self.attr_name() + '].open') : S(this).closest('[' + self.attr_name() + ']'));
87
+ }
88
+ });
89
+
90
+ if(S('[' + self.attr_name() + ']', this.scope).length > 0) {
91
+ S(this.scope)
92
+ // .off('.reveal')
93
+ .on('open.fndtn.reveal', this.settings.open)
94
+ .on('opened.fndtn.reveal', this.settings.opened)
95
+ .on('opened.fndtn.reveal', this.open_video)
96
+ .on('close.fndtn.reveal', this.settings.close)
97
+ .on('closed.fndtn.reveal', this.settings.closed)
98
+ .on('closed.fndtn.reveal', this.close_video);
99
+ } else {
100
+ S(this.scope)
101
+ // .off('.reveal')
102
+ .on('open.fndtn.reveal', '[' + self.attr_name() + ']', this.settings.open)
103
+ .on('opened.fndtn.reveal', '[' + self.attr_name() + ']', this.settings.opened)
104
+ .on('opened.fndtn.reveal', '[' + self.attr_name() + ']', this.open_video)
105
+ .on('close.fndtn.reveal', '[' + self.attr_name() + ']', this.settings.close)
106
+ .on('closed.fndtn.reveal', '[' + self.attr_name() + ']', this.settings.closed)
107
+ .on('closed.fndtn.reveal', '[' + self.attr_name() + ']', this.close_video);
108
+ }
109
+
110
+ return true;
111
+ },
112
+
113
+ // PATCH #3: turning on key up capture only when a reveal window is open
114
+ key_up_on : function (scope) {
115
+ var self = this;
116
+
117
+ // PATCH #1: fixing multiple keyup event trigger from single key press
118
+ self.S('body').off('keyup.fndtn.reveal').on('keyup.fndtn.reveal', function ( event ) {
119
+ var open_modal = self.S('[' + self.attr_name() + '].open'),
120
+ settings = open_modal.data(self.attr_name(true) + '-init');
121
+ // PATCH #2: making sure that the close event can be called only while unlocked,
122
+ // so that multiple keyup.fndtn.reveal events don't prevent clean closing of the reveal window.
123
+ if ( settings && event.which === 27 && settings.close_on_esc && !self.locked) { // 27 is the keycode for the Escape key
124
+ self.close.call(self, open_modal);
125
+ }
126
+ });
127
+
128
+ return true;
129
+ },
130
+
131
+ // PATCH #3: turning on key up capture only when a reveal window is open
132
+ key_up_off : function (scope) {
133
+ this.S('body').off('keyup.fndtn.reveal');
134
+ return true;
135
+ },
136
+
137
+ open : function (target, ajax_settings) {
138
+ var self = this,
139
+ modal;
140
+
141
+ if (target) {
142
+ if (typeof target.selector !== 'undefined') {
143
+ // Find the named node; only use the first one found, since the rest of the code assumes there's only one node
144
+ modal = self.S('#' + target.data(self.data_attr('reveal-id'))).first();
145
+ } else {
146
+ modal = self.S(this.scope);
147
+
148
+ ajax_settings = target;
149
+ }
150
+ } else {
151
+ modal = self.S(this.scope);
152
+ }
153
+
154
+ var settings = modal.data(self.attr_name(true) + '-init');
155
+ settings = settings || this.settings;
156
+
157
+ if (!modal.hasClass('open')) {
158
+ var open_modal = self.S('[' + self.attr_name() + '].open');
159
+
160
+ if (typeof modal.data('css-top') === 'undefined') {
161
+ modal.data('css-top', parseInt(modal.css('top'), 10))
162
+ .data('offset', this.cache_offset(modal));
163
+ }
164
+
165
+ this.key_up_on(modal); // PATCH #3: turning on key up capture only when a reveal window is open
166
+ modal.trigger('open').trigger('open.fndtn.reveal');
167
+
168
+ if (open_modal.length < 1) {
169
+ this.toggle_bg(modal, true);
170
+ }
171
+
172
+ if (typeof ajax_settings === 'string') {
173
+ ajax_settings = {
174
+ url: ajax_settings
175
+ };
176
+ }
177
+
178
+ if (typeof ajax_settings === 'undefined' || !ajax_settings.url) {
179
+ if (open_modal.length > 0) {
180
+ this.hide(open_modal, settings.css.close);
181
+ }
182
+
183
+ this.show(modal, settings.css.open);
184
+ } else {
185
+ var old_success = typeof ajax_settings.success !== 'undefined' ? ajax_settings.success : null;
186
+
187
+ $.extend(ajax_settings, {
188
+ success: function (data, textStatus, jqXHR) {
189
+ if ( $.isFunction(old_success) ) {
190
+ old_success(data, textStatus, jqXHR);
191
+ }
192
+
193
+ modal.html(data);
194
+ self.S(modal).foundation('section', 'reflow');
195
+ self.S(modal).children().foundation();
196
+
197
+ if (open_modal.length > 0) {
198
+ self.hide(open_modal, settings.css.close);
199
+ }
200
+ self.show(modal, settings.css.open);
201
+ }
202
+ });
203
+
204
+ $.ajax(ajax_settings);
205
+ }
206
+ }
207
+ },
208
+
209
+ close : function (modal) {
210
+ var modal = modal && modal.length ? modal : this.S(this.scope),
211
+ open_modals = this.S('[' + this.attr_name() + '].open'),
212
+ settings = modal.data(this.attr_name(true) + '-init') || this.settings;
213
+
214
+ if (open_modals.length > 0) {
215
+ this.locked = true;
216
+ this.key_up_off(modal); // PATCH #3: turning on key up capture only when a reveal window is open
217
+ modal.trigger('close').trigger('close.fndtn.reveal');
218
+ this.toggle_bg(modal, false);
219
+ this.hide(open_modals, settings.css.close, settings);
220
+ }
221
+ },
222
+
223
+ close_targets : function () {
224
+ var base = '.' + this.settings.dismiss_modal_class;
225
+
226
+ if (this.settings.close_on_background_click) {
227
+ return base + ', .' + this.settings.bg_class;
228
+ }
229
+
230
+ return base;
231
+ },
232
+
233
+ toggle_bg : function (modal, state) {
234
+ if (this.S('.' + this.settings.bg_class).length === 0) {
235
+ this.settings.bg = $('<div />', {'class': this.settings.bg_class})
236
+ .appendTo('body').hide();
237
+ }
238
+
239
+ var visible = this.settings.bg.filter(':visible').length > 0;
240
+ if ( state != visible ) {
241
+ if ( state == undefined ? visible : !state ) {
242
+ this.hide(this.settings.bg);
243
+ } else {
244
+ this.show(this.settings.bg);
245
+ }
246
+ }
247
+ },
248
+
249
+ show : function (el, css) {
250
+ // is modal
251
+ if (css) {
252
+ var settings = el.data(this.attr_name(true) + '-init') || this.settings,
253
+ root_element = settings.root_element;
254
+
255
+ if (el.parent(root_element).length === 0) {
256
+ var placeholder = el.wrap('<div style="display: none;" />').parent();
257
+
258
+ el.on('closed.fndtn.reveal.wrapped', function() {
259
+ el.detach().appendTo(placeholder);
260
+ el.unwrap().unbind('closed.fndtn.reveal.wrapped');
261
+ });
262
+
263
+ el.detach().appendTo(root_element);
264
+ }
265
+
266
+ var animData = getAnimationData(settings.animation);
267
+ if (!animData.animate) {
268
+ this.locked = false;
269
+ }
270
+ if (animData.pop) {
271
+ css.top = $(window).scrollTop() - el.data('offset') + 'px';
272
+ var end_css = {
273
+ top: $(window).scrollTop() + el.data('css-top') + 'px',
274
+ opacity: 1
275
+ };
276
+
277
+ return setTimeout(function () {
278
+ return el
279
+ .css(css)
280
+ .animate(end_css, settings.animation_speed, 'linear', function () {
281
+ this.locked = false;
282
+ el.trigger('opened').trigger('opened.fndtn.reveal');
283
+ }.bind(this))
284
+ .addClass('open');
285
+ }.bind(this), settings.animation_speed / 2);
286
+ }
287
+
288
+ if (animData.fade) {
289
+ css.top = $(window).scrollTop() + el.data('css-top') + 'px';
290
+ var end_css = {opacity: 1};
291
+
292
+ return setTimeout(function () {
293
+ return el
294
+ .css(css)
295
+ .animate(end_css, settings.animation_speed, 'linear', function () {
296
+ this.locked = false;
297
+ el.trigger('opened').trigger('opened.fndtn.reveal');
298
+ }.bind(this))
299
+ .addClass('open');
300
+ }.bind(this), settings.animation_speed / 2);
301
+ }
302
+
303
+ return el.css(css).show().css({opacity: 1}).addClass('open').trigger('opened').trigger('opened.fndtn.reveal');
304
+ }
305
+
306
+ var settings = this.settings;
307
+
308
+ // should we animate the background?
309
+ if (getAnimationData(settings.animation).fade) {
310
+ return el.fadeIn(settings.animation_speed / 2);
311
+ }
312
+
313
+ this.locked = false;
314
+
315
+ return el.show();
316
+ },
317
+
318
+ hide : function (el, css) {
319
+ // is modal
320
+ if (css) {
321
+ var settings = el.data(this.attr_name(true) + '-init');
322
+ settings = settings || this.settings;
323
+
324
+ var animData = getAnimationData(settings.animation);
325
+ if (!animData.animate) {
326
+ this.locked = false;
327
+ }
328
+ if (animData.pop) {
329
+ var end_css = {
330
+ top: - $(window).scrollTop() - el.data('offset') + 'px',
331
+ opacity: 0
332
+ };
333
+
334
+ return setTimeout(function () {
335
+ return el
336
+ .animate(end_css, settings.animation_speed, 'linear', function () {
337
+ this.locked = false;
338
+ el.css(css).trigger('closed').trigger('closed.fndtn.reveal');
339
+ }.bind(this))
340
+ .removeClass('open');
341
+ }.bind(this), settings.animation_speed / 2);
342
+ }
343
+
344
+ if (animData.fade) {
345
+ var end_css = {opacity: 0};
346
+
347
+ return setTimeout(function () {
348
+ return el
349
+ .animate(end_css, settings.animation_speed, 'linear', function () {
350
+ this.locked = false;
351
+ el.css(css).trigger('closed').trigger('closed.fndtn.reveal');
352
+ }.bind(this))
353
+ .removeClass('open');
354
+ }.bind(this), settings.animation_speed / 2);
355
+ }
356
+
357
+ return el.hide().css(css).removeClass('open').trigger('closed').trigger('closed.fndtn.reveal');
358
+ }
359
+
360
+ var settings = this.settings;
361
+
362
+ // should we animate the background?
363
+ if (getAnimationData(settings.animation).fade) {
364
+ return el.fadeOut(settings.animation_speed / 2);
365
+ }
366
+
367
+ return el.hide();
368
+ },
369
+
370
+ close_video : function (e) {
371
+ var video = $('.flex-video', e.target),
372
+ iframe = $('iframe', video);
373
+
374
+ if (iframe.length > 0) {
375
+ iframe.attr('data-src', iframe[0].src);
376
+ iframe.attr('src', 'about:blank');
377
+ video.hide();
378
+ }
379
+ },
380
+
381
+ open_video : function (e) {
382
+ var video = $('.flex-video', e.target),
383
+ iframe = video.find('iframe');
384
+
385
+ if (iframe.length > 0) {
386
+ var data_src = iframe.attr('data-src');
387
+ if (typeof data_src === 'string') {
388
+ iframe[0].src = iframe.attr('data-src');
389
+ } else {
390
+ var src = iframe[0].src;
391
+ iframe[0].src = undefined;
392
+ iframe[0].src = src;
393
+ }
394
+ video.show();
395
+ }
396
+ },
397
+
398
+ data_attr: function (str) {
399
+ if (this.namespace.length > 0) {
400
+ return this.namespace + '-' + str;
401
+ }
402
+
403
+ return str;
404
+ },
405
+
406
+ cache_offset : function (modal) {
407
+ var offset = modal.show().height() + parseInt(modal.css('top'), 10);
408
+
409
+ modal.hide();
410
+
411
+ return offset;
412
+ },
413
+
414
+ off : function () {
415
+ $(this.scope).off('.fndtn.reveal');
416
+ },
417
+
418
+ reflow : function () {}
419
+ };
420
+
421
+ /*
422
+ * getAnimationData('popAndFade') // {animate: true, pop: true, fade: true}
423
+ * getAnimationData('fade') // {animate: true, pop: false, fade: true}
424
+ * getAnimationData('pop') // {animate: true, pop: true, fade: false}
425
+ * getAnimationData('foo') // {animate: false, pop: false, fade: false}
426
+ * getAnimationData(null) // {animate: false, pop: false, fade: false}
427
+ */
428
+ function getAnimationData(str) {
429
+ var fade = /fade/i.test(str);
430
+ var pop = /pop/i.test(str);
431
+ return {
432
+ animate: fade || pop,
433
+ pop: pop,
434
+ fade: fade
435
+ };
436
+ }
437
+ }(jQuery, window, window.document));
@@ -0,0 +1,226 @@
1
+ ;(function ($, window, document, undefined) {
2
+ 'use strict';
3
+
4
+ Foundation.libs.slider = {
5
+ name : 'slider',
6
+
7
+ version : '5.3.0',
8
+
9
+ settings: {
10
+ start: 0,
11
+ end: 100,
12
+ step: 1,
13
+ initial: null,
14
+ display_selector: '',
15
+ vertical: false,
16
+ on_change: function(){}
17
+ },
18
+
19
+ cache : {},
20
+
21
+ init : function (scope, method, options) {
22
+ Foundation.inherit(this,'throttle');
23
+ this.bindings(method, options);
24
+ this.reflow();
25
+ },
26
+
27
+ events : function() {
28
+ var self = this;
29
+
30
+ $(this.scope)
31
+ .off('.slider')
32
+ .on('mousedown.fndtn.slider touchstart.fndtn.slider pointerdown.fndtn.slider',
33
+ '[' + self.attr_name() + ']:not(.disabled, [disabled]) .range-slider-handle', function(e) {
34
+ if (!self.cache.active) {
35
+ e.preventDefault();
36
+ self.set_active_slider($(e.target));
37
+ }
38
+ })
39
+ .on('mousemove.fndtn.slider touchmove.fndtn.slider pointermove.fndtn.slider', function(e) {
40
+ if (!!self.cache.active) {
41
+ e.preventDefault();
42
+ if ($.data(self.cache.active[0], 'settings').vertical) {
43
+ self.calculate_position(self.cache.active, e.pageY ||
44
+ e.originalEvent.clientY ||
45
+ e.originalEvent.touches[0].clientY ||
46
+ e.currentPoint.y);
47
+ } else {
48
+ self.calculate_position(self.cache.active, e.pageX ||
49
+ e.originalEvent.clientX ||
50
+ e.originalEvent.touches[0].clientX ||
51
+ e.currentPoint.x);
52
+ }
53
+ }
54
+ })
55
+ .on('mouseup.fndtn.slider touchend.fndtn.slider pointerup.fndtn.slider', function(e) {
56
+ self.remove_active_slider();
57
+ })
58
+ .on('change.fndtn.slider', function(e) {
59
+ self.settings.on_change();
60
+ });
61
+
62
+ self.S(window)
63
+ .on('resize.fndtn.slider', self.throttle(function(e) {
64
+ self.reflow();
65
+ }, 300));
66
+ },
67
+
68
+ set_active_slider : function($handle) {
69
+ this.cache.active = $handle;
70
+ },
71
+
72
+ remove_active_slider : function() {
73
+ this.cache.active = null;
74
+ },
75
+
76
+ calculate_position : function($handle, cursor_x) {
77
+ var self = this,
78
+ settings = $.data($handle[0], 'settings'),
79
+ handle_l = $.data($handle[0], 'handle_l'),
80
+ handle_o = $.data($handle[0], 'handle_o'),
81
+ bar_l = $.data($handle[0], 'bar_l'),
82
+ bar_o = $.data($handle[0], 'bar_o');
83
+
84
+ requestAnimationFrame(function(){
85
+ var pct;
86
+
87
+ if (Foundation.rtl && !settings.vertical) {
88
+ pct = self.limit_to(((bar_o+bar_l-cursor_x)/bar_l),0,1);
89
+ } else {
90
+ pct = self.limit_to(((cursor_x-bar_o)/bar_l),0,1);
91
+ }
92
+
93
+ pct = settings.vertical ? 1-pct : pct;
94
+
95
+ var norm = self.normalized_value(pct, settings.start, settings.end, settings.step);
96
+
97
+ self.set_ui($handle, norm);
98
+ });
99
+ },
100
+
101
+ set_ui : function($handle, value) {
102
+ var settings = $.data($handle[0], 'settings'),
103
+ handle_l = $.data($handle[0], 'handle_l'),
104
+ bar_l = $.data($handle[0], 'bar_l'),
105
+ norm_pct = this.normalized_percentage(value, settings.start, settings.end),
106
+ handle_offset = norm_pct*(bar_l-handle_l)-1,
107
+ progress_bar_length = norm_pct*100;
108
+
109
+ if (Foundation.rtl && !settings.vertical) {
110
+ handle_offset = -handle_offset;
111
+ }
112
+
113
+ handle_offset = settings.vertical ? -handle_offset + bar_l - handle_l + 1 : handle_offset;
114
+ this.set_translate($handle, handle_offset, settings.vertical);
115
+
116
+ if (settings.vertical) {
117
+ $handle.siblings('.range-slider-active-segment').css('height', progress_bar_length + '%');
118
+ } else {
119
+ $handle.siblings('.range-slider-active-segment').css('width', progress_bar_length + '%');
120
+ }
121
+
122
+ $handle.parent().attr(this.attr_name(), value).trigger('change').trigger('change.fndtn.slider');
123
+
124
+ $handle.parent().children('input[type=hidden]').val(value);
125
+
126
+ if (settings.input_id != '') {
127
+ $(settings.display_selector).each(function(){
128
+ if (this.hasOwnProperty('value')) {
129
+ $(this).val(value);
130
+ } else {
131
+ $(this).text(value);
132
+ }
133
+ });
134
+ }
135
+
136
+ },
137
+
138
+ normalized_percentage : function(val, start, end) {
139
+ return (val - start)/(end - start);
140
+ },
141
+
142
+ normalized_value : function(val, start, end, step) {
143
+ var range = end - start,
144
+ point = val*range,
145
+ mod = (point-(point%step)) / step,
146
+ rem = point % step,
147
+ round = ( rem >= step*0.5 ? step : 0);
148
+ return (mod*step + round) + start;
149
+ },
150
+
151
+ set_translate : function(ele, offset, vertical) {
152
+ if (vertical) {
153
+ $(ele)
154
+ .css('-webkit-transform', 'translateY('+offset+'px)')
155
+ .css('-moz-transform', 'translateY('+offset+'px)')
156
+ .css('-ms-transform', 'translateY('+offset+'px)')
157
+ .css('-o-transform', 'translateY('+offset+'px)')
158
+ .css('transform', 'translateY('+offset+'px)');
159
+ } else {
160
+ $(ele)
161
+ .css('-webkit-transform', 'translateX('+offset+'px)')
162
+ .css('-moz-transform', 'translateX('+offset+'px)')
163
+ .css('-ms-transform', 'translateX('+offset+'px)')
164
+ .css('-o-transform', 'translateX('+offset+'px)')
165
+ .css('transform', 'translateX('+offset+'px)');
166
+ }
167
+ },
168
+
169
+ limit_to : function(val, min, max) {
170
+ return Math.min(Math.max(val, min), max);
171
+ },
172
+
173
+ initialize_settings : function(handle) {
174
+ var settings = $.extend({}, this.settings, this.data_options($(handle).parent()));
175
+
176
+ if (settings.vertical) {
177
+ $.data(handle, 'bar_o', $(handle).parent().offset().top);
178
+ $.data(handle, 'bar_l', $(handle).parent().outerHeight());
179
+ $.data(handle, 'handle_o', $(handle).offset().top);
180
+ $.data(handle, 'handle_l', $(handle).outerHeight());
181
+ } else {
182
+ $.data(handle, 'bar_o', $(handle).parent().offset().left);
183
+ $.data(handle, 'bar_l', $(handle).parent().outerWidth());
184
+ $.data(handle, 'handle_o', $(handle).offset().left);
185
+ $.data(handle, 'handle_l', $(handle).outerWidth());
186
+ }
187
+
188
+ $.data(handle, 'bar', $(handle).parent());
189
+ $.data(handle, 'settings', settings);
190
+ },
191
+
192
+ set_initial_position : function($ele) {
193
+ var settings = $.data($ele.children('.range-slider-handle')[0], 'settings'),
194
+ initial = (!!settings.initial ? settings.initial : Math.floor((settings.end-settings.start)*0.5/settings.step)*settings.step+settings.start),
195
+ $handle = $ele.children('.range-slider-handle');
196
+ this.set_ui($handle, initial);
197
+ },
198
+
199
+ set_value : function(value) {
200
+ var self = this;
201
+ $('[' + self.attr_name() + ']', this.scope).each(function(){
202
+ $(this).attr(self.attr_name(), value);
203
+ });
204
+ if (!!$(this.scope).attr(self.attr_name())) {
205
+ $(this.scope).attr(self.attr_name(), value);
206
+ }
207
+ self.reflow();
208
+ },
209
+
210
+ reflow : function() {
211
+ var self = this;
212
+ self.S('[' + this.attr_name() + ']').each(function() {
213
+ var handle = $(this).children('.range-slider-handle')[0],
214
+ val = $(this).attr(self.attr_name());
215
+ self.initialize_settings(handle);
216
+
217
+ if (val) {
218
+ self.set_ui($(handle), parseFloat(val));
219
+ } else {
220
+ self.set_initial_position($(this));
221
+ }
222
+ });
223
+ }
224
+ };
225
+
226
+ }(jQuery, window, window.document));