tennpipes-init 3.6.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (167) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +20 -0
  3. data/README.rdoc +163 -0
  4. data/Rakefile +1 -0
  5. data/bin/tennpipes-init +16 -0
  6. data/lib/tennpipes-init.rb +73 -0
  7. data/lib/tennpipes-init/command.rb +18 -0
  8. data/lib/tennpipes-init/generators/actions.rb +630 -0
  9. data/lib/tennpipes-init/generators/app.rb +75 -0
  10. data/lib/tennpipes-init/generators/app/app.rb.tt +72 -0
  11. data/lib/tennpipes-init/generators/app/app.rb.tt~ +72 -0
  12. data/lib/tennpipes-init/generators/cli.rb +57 -0
  13. data/lib/tennpipes-init/generators/component.rb +73 -0
  14. data/lib/tennpipes-init/generators/components/actions.rb +208 -0
  15. data/lib/tennpipes-init/generators/components/mocks/mocha.rb +10 -0
  16. data/lib/tennpipes-init/generators/components/mocks/rr.rb +13 -0
  17. data/lib/tennpipes-init/generators/components/orms/activerecord.rb +201 -0
  18. data/lib/tennpipes-init/generators/components/orms/couchrest.rb +55 -0
  19. data/lib/tennpipes-init/generators/components/orms/datamapper.rb +140 -0
  20. data/lib/tennpipes-init/generators/components/orms/dynamoid.rb +67 -0
  21. data/lib/tennpipes-init/generators/components/orms/minirecord.rb +165 -0
  22. data/lib/tennpipes-init/generators/components/orms/mongoid.rb +113 -0
  23. data/lib/tennpipes-init/generators/components/orms/mongomapper.rb +43 -0
  24. data/lib/tennpipes-init/generators/components/orms/mongomatic.rb +84 -0
  25. data/lib/tennpipes-init/generators/components/orms/ohm.rb +65 -0
  26. data/lib/tennpipes-init/generators/components/orms/ripple.rb +75 -0
  27. data/lib/tennpipes-init/generators/components/orms/sequel.rb +99 -0
  28. data/lib/tennpipes-init/generators/components/renderers/erb.rb +3 -0
  29. data/lib/tennpipes-init/generators/components/renderers/haml.rb +3 -0
  30. data/lib/tennpipes-init/generators/components/renderers/liquid.rb +4 -0
  31. data/lib/tennpipes-init/generators/components/renderers/slim.rb +3 -0
  32. data/lib/tennpipes-init/generators/components/scripts/dojo.rb +10 -0
  33. data/lib/tennpipes-init/generators/components/scripts/extcore.rb +10 -0
  34. data/lib/tennpipes-init/generators/components/scripts/jquery.rb +10 -0
  35. data/lib/tennpipes-init/generators/components/scripts/mootools.rb +10 -0
  36. data/lib/tennpipes-init/generators/components/scripts/prototype.rb +12 -0
  37. data/lib/tennpipes-init/generators/components/scripts/rightjs.rb +10 -0
  38. data/lib/tennpipes-init/generators/components/stylesheets/compass.rb +39 -0
  39. data/lib/tennpipes-init/generators/components/stylesheets/compass/application.scss +43 -0
  40. data/lib/tennpipes-init/generators/components/stylesheets/compass/partials/_base.scss +12 -0
  41. data/lib/tennpipes-init/generators/components/stylesheets/less.rb +25 -0
  42. data/lib/tennpipes-init/generators/components/stylesheets/sass.rb +15 -0
  43. data/lib/tennpipes-init/generators/components/stylesheets/scss.rb +16 -0
  44. data/lib/tennpipes-init/generators/components/tests/bacon.rb +103 -0
  45. data/lib/tennpipes-init/generators/components/tests/cucumber.rb +86 -0
  46. data/lib/tennpipes-init/generators/components/tests/minitest.rb +110 -0
  47. data/lib/tennpipes-init/generators/components/tests/riot.rb +117 -0
  48. data/lib/tennpipes-init/generators/components/tests/rspec.rb +111 -0
  49. data/lib/tennpipes-init/generators/components/tests/shoulda.rb +114 -0
  50. data/lib/tennpipes-init/generators/components/tests/steak.rb +114 -0
  51. data/lib/tennpipes-init/generators/controller.rb +77 -0
  52. data/lib/tennpipes-init/generators/helper.rb +50 -0
  53. data/lib/tennpipes-init/generators/mailer.rb +52 -0
  54. data/lib/tennpipes-init/generators/migration.rb +43 -0
  55. data/lib/tennpipes-init/generators/model.rb +113 -0
  56. data/lib/tennpipes-init/generators/plugin.rb +67 -0
  57. data/lib/tennpipes-init/generators/project.rb +160 -0
  58. data/lib/tennpipes-init/generators/project/config.ru +9 -0
  59. data/lib/tennpipes-init/generators/project/config/apps.rb.tt +35 -0
  60. data/lib/tennpipes-init/generators/project/config/boot.rb +49 -0
  61. data/lib/tennpipes-init/generators/project/public/favicon.ico +0 -0
  62. data/lib/tennpipes-init/generators/project/public/images/booking.com.png +0 -0
  63. data/lib/tennpipes-init/generators/project/public/images/causes.png +0 -0
  64. data/lib/tennpipes-init/generators/project/public/images/ennkeypee_bg.jpg +0 -0
  65. data/lib/tennpipes-init/generators/project/public/images/ennkeypee_bluelogo.png +0 -0
  66. data/lib/tennpipes-init/generators/project/public/images/ennkeypee_bluelogo.svg +68 -0
  67. data/lib/tennpipes-init/generators/project/public/images/ennkeypee_whitelogo.png +0 -0
  68. data/lib/tennpipes-init/generators/project/public/images/ennkeypee_whitelogo.svg +65 -0
  69. data/lib/tennpipes-init/generators/project/public/images/forever21.png +0 -0
  70. data/lib/tennpipes-init/generators/project/public/images/icons/foundation-icons.eot +0 -0
  71. data/lib/tennpipes-init/generators/project/public/images/icons/foundation-icons.svg +970 -0
  72. data/lib/tennpipes-init/generators/project/public/images/icons/foundation-icons.ttf +0 -0
  73. data/lib/tennpipes-init/generators/project/public/images/icons/foundation-icons.woff +0 -0
  74. data/lib/tennpipes-init/generators/project/public/images/icons/tennpipes-icons.css +598 -0
  75. data/lib/tennpipes-init/generators/project/public/images/image1.jpg +0 -0
  76. data/lib/tennpipes-init/generators/project/public/images/image11.jpg +0 -0
  77. data/lib/tennpipes-init/generators/project/public/images/image2.jpg +0 -0
  78. data/lib/tennpipes-init/generators/project/public/images/image3.jpg +0 -0
  79. data/lib/tennpipes-init/generators/project/public/images/intuit.png +0 -0
  80. data/lib/tennpipes-init/generators/project/public/images/krispykreme.png +0 -0
  81. data/lib/tennpipes-init/generators/project/public/images/placeholders/README.md +302 -0
  82. data/lib/tennpipes-init/generators/project/public/images/placeholders/bower.json +4 -0
  83. data/lib/tennpipes-init/generators/project/public/images/placeholders/composer.json +34 -0
  84. data/lib/tennpipes-init/generators/project/public/images/placeholders/gulpfile.js +92 -0
  85. data/lib/tennpipes-init/generators/project/public/images/placeholders/holder.js +1920 -0
  86. data/lib/tennpipes-init/generators/project/public/images/placeholders/holder.min.js +12 -0
  87. data/lib/tennpipes-init/generators/project/public/images/placeholders/package.json +46 -0
  88. data/lib/tennpipes-init/generators/project/public/images/placeholders/src/holder.js +1411 -0
  89. data/lib/tennpipes-init/generators/project/public/images/placeholders/src/lib/augment.js +27 -0
  90. data/lib/tennpipes-init/generators/project/public/images/placeholders/src/lib/ondomready.js +155 -0
  91. data/lib/tennpipes-init/generators/project/public/images/placeholders/src/lib/polyfills.js +177 -0
  92. data/lib/tennpipes-init/generators/project/public/images/placeholders/src/scenegraph.js +101 -0
  93. data/lib/tennpipes-init/generators/project/public/images/placeholders/src/utils.js +129 -0
  94. data/lib/tennpipes-init/generators/project/public/images/priceline.com.png +0 -0
  95. data/lib/tennpipes-init/generators/project/public/images/stripe.png +0 -0
  96. data/lib/tennpipes-init/generators/project/public/javascripts/tennpipes.min.js +6081 -0
  97. data/lib/tennpipes-init/generators/project/public/javascripts/tennpipes/tennpipes.abide.js +340 -0
  98. data/lib/tennpipes-init/generators/project/public/javascripts/tennpipes/tennpipes.accordion.js +67 -0
  99. data/lib/tennpipes-init/generators/project/public/javascripts/tennpipes/tennpipes.alert.js +43 -0
  100. data/lib/tennpipes-init/generators/project/public/javascripts/tennpipes/tennpipes.clearing.js +556 -0
  101. data/lib/tennpipes-init/generators/project/public/javascripts/tennpipes/tennpipes.dropdown.js +448 -0
  102. data/lib/tennpipes-init/generators/project/public/javascripts/tennpipes/tennpipes.equalizer.js +77 -0
  103. data/lib/tennpipes-init/generators/project/public/javascripts/tennpipes/tennpipes.interchange.js +354 -0
  104. data/lib/tennpipes-init/generators/project/public/javascripts/tennpipes/tennpipes.joyride.js +932 -0
  105. data/lib/tennpipes-init/generators/project/public/javascripts/tennpipes/tennpipes.js +703 -0
  106. data/lib/tennpipes-init/generators/project/public/javascripts/tennpipes/tennpipes.magellan.js +203 -0
  107. data/lib/tennpipes-init/generators/project/public/javascripts/tennpipes/tennpipes.offcanvas.js +152 -0
  108. data/lib/tennpipes-init/generators/project/public/javascripts/tennpipes/tennpipes.orbit.js +476 -0
  109. data/lib/tennpipes-init/generators/project/public/javascripts/tennpipes/tennpipes.reveal.js +471 -0
  110. data/lib/tennpipes-init/generators/project/public/javascripts/tennpipes/tennpipes.slider.js +263 -0
  111. data/lib/tennpipes-init/generators/project/public/javascripts/tennpipes/tennpipes.tab.js +237 -0
  112. data/lib/tennpipes-init/generators/project/public/javascripts/tennpipes/tennpipes.tooltip.js +307 -0
  113. data/lib/tennpipes-init/generators/project/public/javascripts/tennpipes/tennpipes.topbar.js +452 -0
  114. data/lib/tennpipes-init/generators/project/public/javascripts/vendor/fastclick.js +8 -0
  115. data/lib/tennpipes-init/generators/project/public/javascripts/vendor/jquery.cookie.js +8 -0
  116. data/lib/tennpipes-init/generators/project/public/javascripts/vendor/jquery.js +26 -0
  117. data/lib/tennpipes-init/generators/project/public/javascripts/vendor/modernizr.js +8 -0
  118. data/lib/tennpipes-init/generators/project/public/javascripts/vendor/placeholder.js +2 -0
  119. data/lib/tennpipes-init/generators/project/public/stylesheets/app.css~ +178 -0
  120. data/lib/tennpipes-init/generators/project/public/stylesheets/app1.css~ +177 -0
  121. data/lib/tennpipes-init/generators/project/public/stylesheets/ennkeypee.css +214 -0
  122. data/lib/tennpipes-init/generators/project/public/stylesheets/ennkeypee.css~ +214 -0
  123. data/lib/tennpipes-init/generators/project/public/stylesheets/normalize.css +427 -0
  124. data/lib/tennpipes-init/generators/project/public/stylesheets/tennpipes.css +6201 -0
  125. data/lib/tennpipes-init/generators/project/public/stylesheets/tennpipes.css~ +6201 -0
  126. data/lib/tennpipes-init/generators/project/public/stylesheets/tennpipes.min.css +1 -0
  127. data/lib/tennpipes-init/generators/runner.rb +139 -0
  128. data/lib/tennpipes-init/generators/task.rb +45 -0
  129. data/lib/tennpipes-init/generators/templates/Gemfile.tt +32 -0
  130. data/lib/tennpipes-init/generators/templates/Rakefile.tt +8 -0
  131. data/lib/tennpipes-init/generators/templates/controller.rb.tt +22 -0
  132. data/lib/tennpipes-init/generators/templates/gem/README.md.tt +29 -0
  133. data/lib/tennpipes-init/generators/templates/gem/gemspec.tt +19 -0
  134. data/lib/tennpipes-init/generators/templates/gem/lib/libname.tt +6 -0
  135. data/lib/tennpipes-init/generators/templates/gem/lib/libname/version.tt +3 -0
  136. data/lib/tennpipes-init/generators/templates/helper.rb.tt +13 -0
  137. data/lib/tennpipes-init/generators/templates/initializer.rb.tt +5 -0
  138. data/lib/tennpipes-init/generators/templates/mailer.rb.tt +54 -0
  139. data/lib/tennpipes-init/generators/templates/project_bin.tt +14 -0
  140. data/lib/tennpipes-init/generators/templates/task.rb.tt +7 -0
  141. data/lib/tennpipes-init/tennpipes-tasks/activerecord.rb +377 -0
  142. data/lib/tennpipes-init/tennpipes-tasks/database.rb +12 -0
  143. data/lib/tennpipes-init/tennpipes-tasks/datamapper.rb +94 -0
  144. data/lib/tennpipes-init/tennpipes-tasks/minirecord.rb +19 -0
  145. data/lib/tennpipes-init/tennpipes-tasks/mongoid.rb +215 -0
  146. data/lib/tennpipes-init/tennpipes-tasks/mongomapper.rb +55 -0
  147. data/lib/tennpipes-init/tennpipes-tasks/sequel.rb +85 -0
  148. data/lib/tennpipes-init/tennpipes-tasks/sql-helpers.rb +72 -0
  149. data/test/fixtures/admin_template.rb +7 -0
  150. data/test/fixtures/example_template.rb +15 -0
  151. data/test/fixtures/git_template.rb +4 -0
  152. data/test/fixtures/plugin_template.rb +13 -0
  153. data/test/fixtures/rake_template.rb +9 -0
  154. data/test/helper.rb +103 -0
  155. data/test/test_app_generator.rb +142 -0
  156. data/test/test_cli.rb +27 -0
  157. data/test/test_component_generator.rb +98 -0
  158. data/test/test_controller_generator.rb +272 -0
  159. data/test/test_generator.rb +13 -0
  160. data/test/test_helper_generator.rb +133 -0
  161. data/test/test_mailer_generator.rb +69 -0
  162. data/test/test_migration_generator.rb +222 -0
  163. data/test/test_model_generator.rb +553 -0
  164. data/test/test_plugin_generator.rb +152 -0
  165. data/test/test_project_generator.rb +757 -0
  166. data/test/test_task_generator.rb +53 -0
  167. metadata +285 -0
@@ -0,0 +1,263 @@
1
+ ;(function ($, window, document, undefined) {
2
+ 'use strict';
3
+
4
+ Tennpipes.libs.slider = {
5
+ name : 'slider',
6
+
7
+ version : '5.5.1',
8
+
9
+ settings : {
10
+ start : 0,
11
+ end : 100,
12
+ step : 1,
13
+ precision : null,
14
+ initial : null,
15
+ display_selector : '',
16
+ vertical : false,
17
+ trigger_input_change : false,
18
+ on_change : function () {}
19
+ },
20
+
21
+ cache : {},
22
+
23
+ init : function (scope, method, options) {
24
+ Tennpipes.inherit(this, 'throttle');
25
+ this.bindings(method, options);
26
+ this.reflow();
27
+ },
28
+
29
+ events : function () {
30
+ var self = this;
31
+
32
+ $(this.scope)
33
+ .off('.slider')
34
+ .on('mousedown.fndtn.slider touchstart.fndtn.slider pointerdown.fndtn.slider',
35
+ '[' + self.attr_name() + ']:not(.disabled, [disabled]) .range-slider-handle', function (e) {
36
+ if (!self.cache.active) {
37
+ e.preventDefault();
38
+ self.set_active_slider($(e.target));
39
+ }
40
+ })
41
+ .on('mousemove.fndtn.slider touchmove.fndtn.slider pointermove.fndtn.slider', function (e) {
42
+ if (!!self.cache.active) {
43
+ e.preventDefault();
44
+ if ($.data(self.cache.active[0], 'settings').vertical) {
45
+ var scroll_offset = 0;
46
+ if (!e.pageY) {
47
+ scroll_offset = window.scrollY;
48
+ }
49
+ self.calculate_position(self.cache.active, self.get_cursor_position(e, 'y') + scroll_offset);
50
+ } else {
51
+ self.calculate_position(self.cache.active, self.get_cursor_position(e, '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
+ get_cursor_position : function (e, xy) {
69
+ var pageXY = 'page' + xy.toUpperCase(),
70
+ clientXY = 'client' + xy.toUpperCase(),
71
+ position;
72
+
73
+ if (typeof e[pageXY] !== 'undefined') {
74
+ position = e[pageXY];
75
+ } else if (typeof e.originalEvent[clientXY] !== 'undefined') {
76
+ position = e.originalEvent[clientXY];
77
+ } else if (e.originalEvent.touches && e.originalEvent.touches[0] && typeof e.originalEvent.touches[0][clientXY] !== 'undefined') {
78
+ position = e.originalEvent.touches[0][clientXY];
79
+ } else if (e.currentPoint && typeof e.currentPoint[xy] !== 'undefined') {
80
+ position = e.currentPoint[xy];
81
+ }
82
+
83
+ return position;
84
+ },
85
+
86
+ set_active_slider : function ($handle) {
87
+ this.cache.active = $handle;
88
+ },
89
+
90
+ remove_active_slider : function () {
91
+ this.cache.active = null;
92
+ },
93
+
94
+ calculate_position : function ($handle, cursor_x) {
95
+ var self = this,
96
+ settings = $.data($handle[0], 'settings'),
97
+ handle_l = $.data($handle[0], 'handle_l'),
98
+ handle_o = $.data($handle[0], 'handle_o'),
99
+ bar_l = $.data($handle[0], 'bar_l'),
100
+ bar_o = $.data($handle[0], 'bar_o');
101
+
102
+ requestAnimationFrame(function () {
103
+ var pct;
104
+
105
+ if (Tennpipes.rtl && !settings.vertical) {
106
+ pct = self.limit_to(((bar_o + bar_l - cursor_x) / bar_l), 0, 1);
107
+ } else {
108
+ pct = self.limit_to(((cursor_x - bar_o) / bar_l), 0, 1);
109
+ }
110
+
111
+ pct = settings.vertical ? 1 - pct : pct;
112
+
113
+ var norm = self.normalized_value(pct, settings.start, settings.end, settings.step, settings.precision);
114
+
115
+ self.set_ui($handle, norm);
116
+ });
117
+ },
118
+
119
+ set_ui : function ($handle, value) {
120
+ var settings = $.data($handle[0], 'settings'),
121
+ handle_l = $.data($handle[0], 'handle_l'),
122
+ bar_l = $.data($handle[0], 'bar_l'),
123
+ norm_pct = this.normalized_percentage(value, settings.start, settings.end),
124
+ handle_offset = norm_pct * (bar_l - handle_l) - 1,
125
+ progress_bar_length = norm_pct * 100,
126
+ $handle_parent = $handle.parent(),
127
+ $hidden_inputs = $handle.parent().children('input[type=hidden]');
128
+
129
+ if (Tennpipes.rtl && !settings.vertical) {
130
+ handle_offset = -handle_offset;
131
+ }
132
+
133
+ handle_offset = settings.vertical ? -handle_offset + bar_l - handle_l + 1 : handle_offset;
134
+ this.set_translate($handle, handle_offset, settings.vertical);
135
+
136
+ if (settings.vertical) {
137
+ $handle.siblings('.range-slider-active-segment').css('height', progress_bar_length + '%');
138
+ } else {
139
+ $handle.siblings('.range-slider-active-segment').css('width', progress_bar_length + '%');
140
+ }
141
+
142
+ $handle_parent.attr(this.attr_name(), value).trigger('change').trigger('change.fndtn.slider');
143
+
144
+ $hidden_inputs.val(value);
145
+ if (settings.trigger_input_change) {
146
+ $hidden_inputs.trigger('change');
147
+ }
148
+
149
+ if (!$handle[0].hasAttribute('aria-valuemin')) {
150
+ $handle.attr({
151
+ 'aria-valuemin' : settings.start,
152
+ 'aria-valuemax' : settings.end
153
+ });
154
+ }
155
+ $handle.attr('aria-valuenow', value);
156
+
157
+ if (settings.display_selector != '') {
158
+ $(settings.display_selector).each(function () {
159
+ if (this.hasOwnProperty('value')) {
160
+ $(this).val(value);
161
+ } else {
162
+ $(this).text(value);
163
+ }
164
+ });
165
+ }
166
+
167
+ },
168
+
169
+ normalized_percentage : function (val, start, end) {
170
+ return Math.min(1, (val - start) / (end - start));
171
+ },
172
+
173
+ normalized_value : function (val, start, end, step, precision) {
174
+ var range = end - start,
175
+ point = val * range,
176
+ mod = (point - (point % step)) / step,
177
+ rem = point % step,
178
+ round = ( rem >= step * 0.5 ? step : 0);
179
+ return ((mod * step + round) + start).toFixed(precision);
180
+ },
181
+
182
+ set_translate : function (ele, offset, vertical) {
183
+ if (vertical) {
184
+ $(ele)
185
+ .css('-webkit-transform', 'translateY(' + offset + 'px)')
186
+ .css('-moz-transform', 'translateY(' + offset + 'px)')
187
+ .css('-ms-transform', 'translateY(' + offset + 'px)')
188
+ .css('-o-transform', 'translateY(' + offset + 'px)')
189
+ .css('transform', 'translateY(' + offset + 'px)');
190
+ } else {
191
+ $(ele)
192
+ .css('-webkit-transform', 'translateX(' + offset + 'px)')
193
+ .css('-moz-transform', 'translateX(' + offset + 'px)')
194
+ .css('-ms-transform', 'translateX(' + offset + 'px)')
195
+ .css('-o-transform', 'translateX(' + offset + 'px)')
196
+ .css('transform', 'translateX(' + offset + 'px)');
197
+ }
198
+ },
199
+
200
+ limit_to : function (val, min, max) {
201
+ return Math.min(Math.max(val, min), max);
202
+ },
203
+
204
+ initialize_settings : function (handle) {
205
+ var settings = $.extend({}, this.settings, this.data_options($(handle).parent())),
206
+ decimal_places_match_result;
207
+
208
+ if (settings.precision === null) {
209
+ decimal_places_match_result = ('' + settings.step).match(/\.([\d]*)/);
210
+ settings.precision = decimal_places_match_result && decimal_places_match_result[1] ? decimal_places_match_result[1].length : 0;
211
+ }
212
+
213
+ if (settings.vertical) {
214
+ $.data(handle, 'bar_o', $(handle).parent().offset().top);
215
+ $.data(handle, 'bar_l', $(handle).parent().outerHeight());
216
+ $.data(handle, 'handle_o', $(handle).offset().top);
217
+ $.data(handle, 'handle_l', $(handle).outerHeight());
218
+ } else {
219
+ $.data(handle, 'bar_o', $(handle).parent().offset().left);
220
+ $.data(handle, 'bar_l', $(handle).parent().outerWidth());
221
+ $.data(handle, 'handle_o', $(handle).offset().left);
222
+ $.data(handle, 'handle_l', $(handle).outerWidth());
223
+ }
224
+
225
+ $.data(handle, 'bar', $(handle).parent());
226
+ $.data(handle, 'settings', settings);
227
+ },
228
+
229
+ set_initial_position : function ($ele) {
230
+ var settings = $.data($ele.children('.range-slider-handle')[0], 'settings'),
231
+ initial = ((typeof settings.initial == 'number' && !isNaN(settings.initial)) ? settings.initial : Math.floor((settings.end - settings.start) * 0.5 / settings.step) * settings.step + settings.start),
232
+ $handle = $ele.children('.range-slider-handle');
233
+ this.set_ui($handle, initial);
234
+ },
235
+
236
+ set_value : function (value) {
237
+ var self = this;
238
+ $('[' + self.attr_name() + ']', this.scope).each(function () {
239
+ $(this).attr(self.attr_name(), value);
240
+ });
241
+ if (!!$(this.scope).attr(self.attr_name())) {
242
+ $(this.scope).attr(self.attr_name(), value);
243
+ }
244
+ self.reflow();
245
+ },
246
+
247
+ reflow : function () {
248
+ var self = this;
249
+ self.S('[' + this.attr_name() + ']').each(function () {
250
+ var handle = $(this).children('.range-slider-handle')[0],
251
+ val = $(this).attr(self.attr_name());
252
+ self.initialize_settings(handle);
253
+
254
+ if (val) {
255
+ self.set_ui($(handle), parseFloat(val));
256
+ } else {
257
+ self.set_initial_position($(this));
258
+ }
259
+ });
260
+ }
261
+ };
262
+
263
+ }(jQuery, window, window.document));
@@ -0,0 +1,237 @@
1
+ ;(function ($, window, document, undefined) {
2
+ 'use strict';
3
+
4
+ Tennpipes.libs.tab = {
5
+ name : 'tab',
6
+
7
+ version : '5.5.1',
8
+
9
+ settings : {
10
+ active_class : 'active',
11
+ callback : function () {},
12
+ deep_linking : false,
13
+ scroll_to_content : true,
14
+ is_hover : false
15
+ },
16
+
17
+ default_tab_hashes : [],
18
+
19
+ init : function (scope, method, options) {
20
+ var self = this,
21
+ S = this.S;
22
+
23
+ this.bindings(method, options);
24
+
25
+ // store the initial href, which is used to allow correct behaviour of the
26
+ // browser back button when deep linking is turned on.
27
+ self.entry_location = window.location.href;
28
+
29
+ this.handle_location_hash_change();
30
+
31
+ // Store the default active tabs which will be referenced when the
32
+ // location hash is absent, as in the case of navigating the tabs and
33
+ // returning to the first viewing via the browser Back button.
34
+ S('[' + this.attr_name() + '] > .active > a', this.scope).each(function () {
35
+ self.default_tab_hashes.push(this.hash);
36
+ });
37
+ },
38
+
39
+ events : function () {
40
+ var self = this,
41
+ S = this.S;
42
+
43
+ var usual_tab_behavior = function (e) {
44
+ var settings = S(this).closest('[' + self.attr_name() + ']').data(self.attr_name(true) + '-init');
45
+ if (!settings.is_hover || Modernizr.touch) {
46
+ e.preventDefault();
47
+ e.stopPropagation();
48
+ self.toggle_active_tab(S(this).parent());
49
+ }
50
+ };
51
+
52
+ S(this.scope)
53
+ .off('.tab')
54
+ // Click event: tab title
55
+ .on('focus.fndtn.tab', '[' + this.attr_name() + '] > * > a', usual_tab_behavior )
56
+ .on('click.fndtn.tab', '[' + this.attr_name() + '] > * > a', usual_tab_behavior )
57
+ // Hover event: tab title
58
+ .on('mouseenter.fndtn.tab', '[' + this.attr_name() + '] > * > a', function (e) {
59
+ var settings = S(this).closest('[' + self.attr_name() + ']').data(self.attr_name(true) + '-init');
60
+ if (settings.is_hover) {
61
+ self.toggle_active_tab(S(this).parent());
62
+ }
63
+ });
64
+
65
+ // Location hash change event
66
+ S(window).on('hashchange.fndtn.tab', function (e) {
67
+ e.preventDefault();
68
+ self.handle_location_hash_change();
69
+ });
70
+ },
71
+
72
+ handle_location_hash_change : function () {
73
+
74
+ var self = this,
75
+ S = this.S;
76
+
77
+ S('[' + this.attr_name() + ']', this.scope).each(function () {
78
+ var settings = S(this).data(self.attr_name(true) + '-init');
79
+ if (settings.deep_linking) {
80
+ // Match the location hash to a label
81
+ var hash;
82
+ if (settings.scroll_to_content) {
83
+ hash = self.scope.location.hash;
84
+ } else {
85
+ // prefix the hash to prevent anchor scrolling
86
+ hash = self.scope.location.hash.replace('fndtn-', '');
87
+ }
88
+ if (hash != '') {
89
+ // Check whether the location hash references a tab content div or
90
+ // another element on the page (inside or outside the tab content div)
91
+ var hash_element = S(hash);
92
+ if (hash_element.hasClass('content') && hash_element.parent().hasClass('tabs-content')) {
93
+ // Tab content div
94
+ self.toggle_active_tab($('[' + self.attr_name() + '] > * > a[href=' + hash + ']').parent());
95
+ } else {
96
+ // Not the tab content div. If inside the tab content, find the
97
+ // containing tab and toggle it as active.
98
+ var hash_tab_container_id = hash_element.closest('.content').attr('id');
99
+ if (hash_tab_container_id != undefined) {
100
+ self.toggle_active_tab($('[' + self.attr_name() + '] > * > a[href=#' + hash_tab_container_id + ']').parent(), hash);
101
+ }
102
+ }
103
+ } else {
104
+ // Reference the default tab hashes which were initialized in the init function
105
+ for (var ind = 0; ind < self.default_tab_hashes.length; ind++) {
106
+ self.toggle_active_tab($('[' + self.attr_name() + '] > * > a[href=' + self.default_tab_hashes[ind] + ']').parent());
107
+ }
108
+ }
109
+ }
110
+ });
111
+ },
112
+
113
+ toggle_active_tab : function (tab, location_hash) {
114
+ var self = this,
115
+ S = self.S,
116
+ tabs = tab.closest('[' + this.attr_name() + ']'),
117
+ tab_link = tab.find('a'),
118
+ anchor = tab.children('a').first(),
119
+ target_hash = '#' + anchor.attr('href').split('#')[1],
120
+ target = S(target_hash),
121
+ siblings = tab.siblings(),
122
+ settings = tabs.data(this.attr_name(true) + '-init'),
123
+ interpret_keyup_action = function (e) {
124
+ // Light modification of Heydon Pickering's Practical ARIA Examples: http://heydonworks.com/practical_aria_examples/js/a11y.js
125
+
126
+ // define current, previous and next (possible) tabs
127
+
128
+ var $original = $(this);
129
+ var $prev = $(this).parents('li').prev().children('[role="tab"]');
130
+ var $next = $(this).parents('li').next().children('[role="tab"]');
131
+ var $target;
132
+
133
+ // find the direction (prev or next)
134
+
135
+ switch (e.keyCode) {
136
+ case 37:
137
+ $target = $prev;
138
+ break;
139
+ case 39:
140
+ $target = $next;
141
+ break;
142
+ default:
143
+ $target = false
144
+ break;
145
+ }
146
+
147
+ if ($target.length) {
148
+ $original.attr({
149
+ 'tabindex' : '-1',
150
+ 'aria-selected' : null
151
+ });
152
+ $target.attr({
153
+ 'tabindex' : '0',
154
+ 'aria-selected' : true
155
+ }).focus();
156
+ }
157
+
158
+ // Hide panels
159
+
160
+ $('[role="tabpanel"]')
161
+ .attr('aria-hidden', 'true');
162
+
163
+ // Show panel which corresponds to target
164
+
165
+ $('#' + $(document.activeElement).attr('href').substring(1))
166
+ .attr('aria-hidden', null);
167
+
168
+ },
169
+ go_to_hash = function(hash) {
170
+ // This function allows correct behaviour of the browser's back button when deep linking is enabled. Without it
171
+ // the user would get continually redirected to the default hash.
172
+ var is_entry_location = window.location.href === self.entry_location,
173
+ default_hash = settings.scroll_to_content ? self.default_tab_hashes[0] : is_entry_location ? window.location.hash :'fndtn-' + self.default_tab_hashes[0].replace('#', '')
174
+
175
+ if (!(is_entry_location && hash === default_hash)) {
176
+ window.location.hash = hash;
177
+ }
178
+ };
179
+
180
+ // allow usage of data-tab-content attribute instead of href
181
+ if (S(this).data(this.data_attr('tab-content'))) {
182
+ target_hash = '#' + S(this).data(this.data_attr('tab-content')).split('#')[1];
183
+ target = S(target_hash);
184
+ }
185
+
186
+ if (settings.deep_linking) {
187
+
188
+ if (settings.scroll_to_content) {
189
+
190
+ // retain current hash to scroll to content
191
+ go_to_hash(location_hash || target_hash);
192
+
193
+ if (location_hash == undefined || location_hash == target_hash) {
194
+ tab.parent()[0].scrollIntoView();
195
+ } else {
196
+ S(target_hash)[0].scrollIntoView();
197
+ }
198
+ } else {
199
+ // prefix the hashes so that the browser doesn't scroll down
200
+ if (location_hash != undefined) {
201
+ go_to_hash('fndtn-' + location_hash.replace('#', ''));
202
+ } else {
203
+ go_to_hash('fndtn-' + target_hash.replace('#', ''));
204
+ }
205
+ }
206
+ }
207
+
208
+ // WARNING: The activation and deactivation of the tab content must
209
+ // occur after the deep linking in order to properly refresh the browser
210
+ // window (notably in Chrome).
211
+ // Clean up multiple attr instances to done once
212
+ tab.addClass(settings.active_class).triggerHandler('opened');
213
+ tab_link.attr({'aria-selected' : 'true', tabindex : 0});
214
+ siblings.removeClass(settings.active_class)
215
+ siblings.find('a').attr({'aria-selected' : 'false', tabindex : -1});
216
+ target.siblings().removeClass(settings.active_class).attr({'aria-hidden' : 'true', tabindex : -1});
217
+ target.addClass(settings.active_class).attr('aria-hidden', 'false').removeAttr('tabindex');
218
+ settings.callback(tab);
219
+ target.triggerHandler('toggled', [tab]);
220
+ tabs.triggerHandler('toggled', [target]);
221
+
222
+ tab_link.off('keydown').on('keydown', interpret_keyup_action );
223
+ },
224
+
225
+ data_attr : function (str) {
226
+ if (this.namespace.length > 0) {
227
+ return this.namespace + '-' + str;
228
+ }
229
+
230
+ return str;
231
+ },
232
+
233
+ off : function () {},
234
+
235
+ reflow : function () {}
236
+ };
237
+ }(jQuery, window, window.document));