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,307 @@
1
+ ;(function ($, window, document, undefined) {
2
+ 'use strict';
3
+
4
+ Tennpipes.libs.tooltip = {
5
+ name : 'tooltip',
6
+
7
+ version : '5.5.1',
8
+
9
+ settings : {
10
+ additional_inheritable_classes : [],
11
+ tooltip_class : '.tooltip',
12
+ append_to : 'body',
13
+ touch_close_text : 'Tap To Close',
14
+ disable_for_touch : false,
15
+ hover_delay : 200,
16
+ show_on : 'all',
17
+ tip_template : function (selector, content) {
18
+ return '<span data-selector="' + selector + '" id="' + selector + '" class="'
19
+ + Tennpipes.libs.tooltip.settings.tooltip_class.substring(1)
20
+ + '" role="tooltip">' + content + '<span class="nub"></span></span>';
21
+ }
22
+ },
23
+
24
+ cache : {},
25
+
26
+ init : function (scope, method, options) {
27
+ Tennpipes.inherit(this, 'random_str');
28
+ this.bindings(method, options);
29
+ },
30
+
31
+ should_show : function (target, tip) {
32
+ var settings = $.extend({}, this.settings, this.data_options(target));
33
+
34
+ if (settings.show_on === 'all') {
35
+ return true;
36
+ } else if (this.small() && settings.show_on === 'small') {
37
+ return true;
38
+ } else if (this.medium() && settings.show_on === 'medium') {
39
+ return true;
40
+ } else if (this.large() && settings.show_on === 'large') {
41
+ return true;
42
+ }
43
+ return false;
44
+ },
45
+
46
+ medium : function () {
47
+ return matchMedia(Tennpipes.media_queries['medium']).matches;
48
+ },
49
+
50
+ large : function () {
51
+ return matchMedia(Tennpipes.media_queries['large']).matches;
52
+ },
53
+
54
+ events : function (instance) {
55
+ var self = this,
56
+ S = self.S;
57
+
58
+ self.create(this.S(instance));
59
+
60
+ $(this.scope)
61
+ .off('.tooltip')
62
+ .on('mouseenter.fndtn.tooltip mouseleave.fndtn.tooltip touchstart.fndtn.tooltip MSPointerDown.fndtn.tooltip',
63
+ '[' + this.attr_name() + ']', function (e) {
64
+ var $this = S(this),
65
+ settings = $.extend({}, self.settings, self.data_options($this)),
66
+ is_touch = false;
67
+
68
+ if (Modernizr.touch && /touchstart|MSPointerDown/i.test(e.type) && S(e.target).is('a')) {
69
+ return false;
70
+ }
71
+
72
+ if (/mouse/i.test(e.type) && self.ie_touch(e)) {
73
+ return false;
74
+ }
75
+
76
+ if ($this.hasClass('open')) {
77
+ if (Modernizr.touch && /touchstart|MSPointerDown/i.test(e.type)) {
78
+ e.preventDefault();
79
+ }
80
+ self.hide($this);
81
+ } else {
82
+ if (settings.disable_for_touch && Modernizr.touch && /touchstart|MSPointerDown/i.test(e.type)) {
83
+ return;
84
+ } else if (!settings.disable_for_touch && Modernizr.touch && /touchstart|MSPointerDown/i.test(e.type)) {
85
+ e.preventDefault();
86
+ S(settings.tooltip_class + '.open').hide();
87
+ is_touch = true;
88
+ }
89
+
90
+ if (/enter|over/i.test(e.type)) {
91
+ this.timer = setTimeout(function () {
92
+ var tip = self.showTip($this);
93
+ }.bind(this), self.settings.hover_delay);
94
+ } else if (e.type === 'mouseout' || e.type === 'mouseleave') {
95
+ clearTimeout(this.timer);
96
+ self.hide($this);
97
+ } else {
98
+ self.showTip($this);
99
+ }
100
+ }
101
+ })
102
+ .on('mouseleave.fndtn.tooltip touchstart.fndtn.tooltip MSPointerDown.fndtn.tooltip', '[' + this.attr_name() + '].open', function (e) {
103
+ if (/mouse/i.test(e.type) && self.ie_touch(e)) {
104
+ return false;
105
+ }
106
+
107
+ if ($(this).data('tooltip-open-event-type') == 'touch' && e.type == 'mouseleave') {
108
+ return;
109
+ } else if ($(this).data('tooltip-open-event-type') == 'mouse' && /MSPointerDown|touchstart/i.test(e.type)) {
110
+ self.convert_to_touch($(this));
111
+ } else {
112
+ self.hide($(this));
113
+ }
114
+ })
115
+ .on('DOMNodeRemoved DOMAttrModified', '[' + this.attr_name() + ']:not(a)', function (e) {
116
+ self.hide(S(this));
117
+ });
118
+ },
119
+
120
+ ie_touch : function (e) {
121
+ // How do I distinguish between IE11 and Windows Phone 8?????
122
+ return false;
123
+ },
124
+
125
+ showTip : function ($target) {
126
+ var $tip = this.getTip($target);
127
+ if (this.should_show($target, $tip)) {
128
+ return this.show($target);
129
+ }
130
+ return;
131
+ },
132
+
133
+ getTip : function ($target) {
134
+ var selector = this.selector($target),
135
+ settings = $.extend({}, this.settings, this.data_options($target)),
136
+ tip = null;
137
+
138
+ if (selector) {
139
+ tip = this.S('span[data-selector="' + selector + '"]' + settings.tooltip_class);
140
+ }
141
+
142
+ return (typeof tip === 'object') ? tip : false;
143
+ },
144
+
145
+ selector : function ($target) {
146
+ var id = $target.attr('id'),
147
+ dataSelector = $target.attr(this.attr_name()) || $target.attr('data-selector');
148
+
149
+ if ((id && id.length < 1 || !id) && typeof dataSelector != 'string') {
150
+ dataSelector = this.random_str(6);
151
+ $target
152
+ .attr('data-selector', dataSelector)
153
+ .attr('aria-describedby', dataSelector);
154
+ }
155
+
156
+ return (id && id.length > 0) ? id : dataSelector;
157
+ },
158
+
159
+ create : function ($target) {
160
+ var self = this,
161
+ settings = $.extend({}, this.settings, this.data_options($target)),
162
+ tip_template = this.settings.tip_template;
163
+
164
+ if (typeof settings.tip_template === 'string' && window.hasOwnProperty(settings.tip_template)) {
165
+ tip_template = window[settings.tip_template];
166
+ }
167
+
168
+ var $tip = $(tip_template(this.selector($target), $('<div></div>').html($target.attr('title')).html())),
169
+ classes = this.inheritable_classes($target);
170
+
171
+ $tip.addClass(classes).appendTo(settings.append_to);
172
+
173
+ if (Modernizr.touch) {
174
+ $tip.append('<span class="tap-to-close">' + settings.touch_close_text + '</span>');
175
+ $tip.on('touchstart.fndtn.tooltip MSPointerDown.fndtn.tooltip', function (e) {
176
+ self.hide($target);
177
+ });
178
+ }
179
+
180
+ $target.removeAttr('title').attr('title', '');
181
+ },
182
+
183
+ reposition : function (target, tip, classes) {
184
+ var width, nub, nubHeight, nubWidth, column, objPos;
185
+
186
+ tip.css('visibility', 'hidden').show();
187
+
188
+ width = target.data('width');
189
+ nub = tip.children('.nub');
190
+ nubHeight = nub.outerHeight();
191
+ nubWidth = nub.outerHeight();
192
+
193
+ if (this.small()) {
194
+ tip.css({'width' : '100%'});
195
+ } else {
196
+ tip.css({'width' : (width) ? width : 'auto'});
197
+ }
198
+
199
+ objPos = function (obj, top, right, bottom, left, width) {
200
+ return obj.css({
201
+ 'top' : (top) ? top : 'auto',
202
+ 'bottom' : (bottom) ? bottom : 'auto',
203
+ 'left' : (left) ? left : 'auto',
204
+ 'right' : (right) ? right : 'auto'
205
+ }).end();
206
+ };
207
+
208
+ objPos(tip, (target.offset().top + target.outerHeight() + 10), 'auto', 'auto', target.offset().left);
209
+
210
+ if (this.small()) {
211
+ objPos(tip, (target.offset().top + target.outerHeight() + 10), 'auto', 'auto', 12.5, $(this.scope).width());
212
+ tip.addClass('tip-override');
213
+ objPos(nub, -nubHeight, 'auto', 'auto', target.offset().left);
214
+ } else {
215
+ var left = target.offset().left;
216
+ if (Tennpipes.rtl) {
217
+ nub.addClass('rtl');
218
+ left = target.offset().left + target.outerWidth() - tip.outerWidth();
219
+ }
220
+ objPos(tip, (target.offset().top + target.outerHeight() + 10), 'auto', 'auto', left);
221
+ tip.removeClass('tip-override');
222
+ if (classes && classes.indexOf('tip-top') > -1) {
223
+ if (Tennpipes.rtl) {
224
+ nub.addClass('rtl');
225
+ }
226
+ objPos(tip, (target.offset().top - tip.outerHeight()), 'auto', 'auto', left)
227
+ .removeClass('tip-override');
228
+ } else if (classes && classes.indexOf('tip-left') > -1) {
229
+ objPos(tip, (target.offset().top + (target.outerHeight() / 2) - (tip.outerHeight() / 2)), 'auto', 'auto', (target.offset().left - tip.outerWidth() - nubHeight))
230
+ .removeClass('tip-override');
231
+ nub.removeClass('rtl');
232
+ } else if (classes && classes.indexOf('tip-right') > -1) {
233
+ objPos(tip, (target.offset().top + (target.outerHeight() / 2) - (tip.outerHeight() / 2)), 'auto', 'auto', (target.offset().left + target.outerWidth() + nubHeight))
234
+ .removeClass('tip-override');
235
+ nub.removeClass('rtl');
236
+ }
237
+ }
238
+
239
+ tip.css('visibility', 'visible').hide();
240
+ },
241
+
242
+ small : function () {
243
+ return matchMedia(Tennpipes.media_queries.small).matches &&
244
+ !matchMedia(Tennpipes.media_queries.medium).matches;
245
+ },
246
+
247
+ inheritable_classes : function ($target) {
248
+ var settings = $.extend({}, this.settings, this.data_options($target)),
249
+ inheritables = ['tip-top', 'tip-left', 'tip-bottom', 'tip-right', 'radius', 'round'].concat(settings.additional_inheritable_classes),
250
+ classes = $target.attr('class'),
251
+ filtered = classes ? $.map(classes.split(' '), function (el, i) {
252
+ if ($.inArray(el, inheritables) !== -1) {
253
+ return el;
254
+ }
255
+ }).join(' ') : '';
256
+
257
+ return $.trim(filtered);
258
+ },
259
+
260
+ convert_to_touch : function ($target) {
261
+ var self = this,
262
+ $tip = self.getTip($target),
263
+ settings = $.extend({}, self.settings, self.data_options($target));
264
+
265
+ if ($tip.find('.tap-to-close').length === 0) {
266
+ $tip.append('<span class="tap-to-close">' + settings.touch_close_text + '</span>');
267
+ $tip.on('click.fndtn.tooltip.tapclose touchstart.fndtn.tooltip.tapclose MSPointerDown.fndtn.tooltip.tapclose', function (e) {
268
+ self.hide($target);
269
+ });
270
+ }
271
+
272
+ $target.data('tooltip-open-event-type', 'touch');
273
+ },
274
+
275
+ show : function ($target) {
276
+ var $tip = this.getTip($target);
277
+
278
+ if ($target.data('tooltip-open-event-type') == 'touch') {
279
+ this.convert_to_touch($target);
280
+ }
281
+
282
+ this.reposition($target, $tip, $target.attr('class'));
283
+ $target.addClass('open');
284
+ $tip.fadeIn(150);
285
+ },
286
+
287
+ hide : function ($target) {
288
+ var $tip = this.getTip($target);
289
+
290
+ $tip.fadeOut(150, function () {
291
+ $tip.find('.tap-to-close').remove();
292
+ $tip.off('click.fndtn.tooltip.tapclose MSPointerDown.fndtn.tapclose');
293
+ $target.removeClass('open');
294
+ });
295
+ },
296
+
297
+ off : function () {
298
+ var self = this;
299
+ this.S(this.scope).off('.fndtn.tooltip');
300
+ this.S(this.settings.tooltip_class).each(function (i) {
301
+ $('[' + self.attr_name() + ']').eq(i).attr('title', $(this).text());
302
+ }).remove();
303
+ },
304
+
305
+ reflow : function () {}
306
+ };
307
+ }(jQuery, window, window.document));
@@ -0,0 +1,452 @@
1
+ ;(function ($, window, document, undefined) {
2
+ 'use strict';
3
+
4
+ Tennpipes.libs.topbar = {
5
+ name : 'topbar',
6
+
7
+ version : '5.5.1',
8
+
9
+ settings : {
10
+ index : 0,
11
+ sticky_class : 'sticky',
12
+ custom_back_text : true,
13
+ back_text : 'Back',
14
+ mobile_show_parent_link : true,
15
+ is_hover : true,
16
+ scrolltop : true, // jump to top when sticky nav menu toggle is clicked
17
+ sticky_on : 'all'
18
+ },
19
+
20
+ init : function (section, method, options) {
21
+ Tennpipes.inherit(this, 'add_custom_rule register_media throttle');
22
+ var self = this;
23
+
24
+ self.register_media('topbar', 'tennpipes-mq-topbar');
25
+
26
+ this.bindings(method, options);
27
+
28
+ self.S('[' + this.attr_name() + ']', this.scope).each(function () {
29
+ var topbar = $(this),
30
+ settings = topbar.data(self.attr_name(true) + '-init'),
31
+ section = self.S('section, .top-bar-section', this);
32
+ topbar.data('index', 0);
33
+ var topbarContainer = topbar.parent();
34
+ if (topbarContainer.hasClass('fixed') || self.is_sticky(topbar, topbarContainer, settings) ) {
35
+ self.settings.sticky_class = settings.sticky_class;
36
+ self.settings.sticky_topbar = topbar;
37
+ topbar.data('height', topbarContainer.outerHeight());
38
+ topbar.data('stickyoffset', topbarContainer.offset().top);
39
+ } else {
40
+ topbar.data('height', topbar.outerHeight());
41
+ }
42
+
43
+ if (!settings.assembled) {
44
+ self.assemble(topbar);
45
+ }
46
+
47
+ if (settings.is_hover) {
48
+ self.S('.has-dropdown', topbar).addClass('not-click');
49
+ } else {
50
+ self.S('.has-dropdown', topbar).removeClass('not-click');
51
+ }
52
+
53
+ // Pad body when sticky (scrolled) or fixed.
54
+ self.add_custom_rule('.f-topbar-fixed { padding-top: ' + topbar.data('height') + 'px }');
55
+
56
+ if (topbarContainer.hasClass('fixed')) {
57
+ self.S('body').addClass('f-topbar-fixed');
58
+ }
59
+ });
60
+
61
+ },
62
+
63
+ is_sticky : function (topbar, topbarContainer, settings) {
64
+ var sticky = topbarContainer.hasClass(settings.sticky_class);
65
+ var smallMatch = matchMedia(Tennpipes.media_queries.small).matches;
66
+ var medMatch = matchMedia(Tennpipes.media_queries.medium).matches;
67
+ var lrgMatch = matchMedia(Tennpipes.media_queries.large).matches;
68
+
69
+ if (sticky && settings.sticky_on === 'all') {
70
+ return true;
71
+ }
72
+ if (sticky && this.small() && settings.sticky_on.indexOf('small') !== -1) {
73
+ if (smallMatch && !medMatch && !lrgMatch) { return true; }
74
+ }
75
+ if (sticky && this.medium() && settings.sticky_on.indexOf('medium') !== -1) {
76
+ if (smallMatch && medMatch && !lrgMatch) { return true; }
77
+ }
78
+ if (sticky && this.large() && settings.sticky_on.indexOf('large') !== -1) {
79
+ if (smallMatch && medMatch && lrgMatch) { return true; }
80
+ }
81
+
82
+ // fix for iOS browsers
83
+ if (sticky && navigator.userAgent.match(/(iPad|iPhone|iPod)/g)) {
84
+ return true;
85
+ }
86
+ return false;
87
+ },
88
+
89
+ toggle : function (toggleEl) {
90
+ var self = this,
91
+ topbar;
92
+
93
+ if (toggleEl) {
94
+ topbar = self.S(toggleEl).closest('[' + this.attr_name() + ']');
95
+ } else {
96
+ topbar = self.S('[' + this.attr_name() + ']');
97
+ }
98
+
99
+ var settings = topbar.data(this.attr_name(true) + '-init');
100
+
101
+ var section = self.S('section, .top-bar-section', topbar);
102
+
103
+ if (self.breakpoint()) {
104
+ if (!self.rtl) {
105
+ section.css({left : '0%'});
106
+ $('>.name', section).css({left : '100%'});
107
+ } else {
108
+ section.css({right : '0%'});
109
+ $('>.name', section).css({right : '100%'});
110
+ }
111
+
112
+ self.S('li.moved', section).removeClass('moved');
113
+ topbar.data('index', 0);
114
+
115
+ topbar
116
+ .toggleClass('expanded')
117
+ .css('height', '');
118
+ }
119
+
120
+ if (settings.scrolltop) {
121
+ if (!topbar.hasClass('expanded')) {
122
+ if (topbar.hasClass('fixed')) {
123
+ topbar.parent().addClass('fixed');
124
+ topbar.removeClass('fixed');
125
+ self.S('body').addClass('f-topbar-fixed');
126
+ }
127
+ } else if (topbar.parent().hasClass('fixed')) {
128
+ if (settings.scrolltop) {
129
+ topbar.parent().removeClass('fixed');
130
+ topbar.addClass('fixed');
131
+ self.S('body').removeClass('f-topbar-fixed');
132
+
133
+ window.scrollTo(0, 0);
134
+ } else {
135
+ topbar.parent().removeClass('expanded');
136
+ }
137
+ }
138
+ } else {
139
+ if (self.is_sticky(topbar, topbar.parent(), settings)) {
140
+ topbar.parent().addClass('fixed');
141
+ }
142
+
143
+ if (topbar.parent().hasClass('fixed')) {
144
+ if (!topbar.hasClass('expanded')) {
145
+ topbar.removeClass('fixed');
146
+ topbar.parent().removeClass('expanded');
147
+ self.update_sticky_positioning();
148
+ } else {
149
+ topbar.addClass('fixed');
150
+ topbar.parent().addClass('expanded');
151
+ self.S('body').addClass('f-topbar-fixed');
152
+ }
153
+ }
154
+ }
155
+ },
156
+
157
+ timer : null,
158
+
159
+ events : function (bar) {
160
+ var self = this,
161
+ S = this.S;
162
+
163
+ S(this.scope)
164
+ .off('.topbar')
165
+ .on('click.fndtn.topbar', '[' + this.attr_name() + '] .toggle-topbar', function (e) {
166
+ e.preventDefault();
167
+ self.toggle(this);
168
+ })
169
+ .on('click.fndtn.topbar', '.top-bar .top-bar-section li a[href^="#"],[' + this.attr_name() + '] .top-bar-section li a[href^="#"]', function (e) {
170
+ var li = $(this).closest('li');
171
+ if (self.breakpoint() && !li.hasClass('back') && !li.hasClass('has-dropdown')) {
172
+ self.toggle();
173
+ }
174
+ })
175
+ .on('click.fndtn.topbar', '[' + this.attr_name() + '] li.has-dropdown', function (e) {
176
+ var li = S(this),
177
+ target = S(e.target),
178
+ topbar = li.closest('[' + self.attr_name() + ']'),
179
+ settings = topbar.data(self.attr_name(true) + '-init');
180
+
181
+ if (target.data('revealId')) {
182
+ self.toggle();
183
+ return;
184
+ }
185
+
186
+ if (self.breakpoint()) {
187
+ return;
188
+ }
189
+
190
+ if (settings.is_hover && !Modernizr.touch) {
191
+ return;
192
+ }
193
+
194
+ e.stopImmediatePropagation();
195
+
196
+ if (li.hasClass('hover')) {
197
+ li
198
+ .removeClass('hover')
199
+ .find('li')
200
+ .removeClass('hover');
201
+
202
+ li.parents('li.hover')
203
+ .removeClass('hover');
204
+ } else {
205
+ li.addClass('hover');
206
+
207
+ $(li).siblings().removeClass('hover');
208
+
209
+ if (target[0].nodeName === 'A' && target.parent().hasClass('has-dropdown')) {
210
+ e.preventDefault();
211
+ }
212
+ }
213
+ })
214
+ .on('click.fndtn.topbar', '[' + this.attr_name() + '] .has-dropdown>a', function (e) {
215
+ if (self.breakpoint()) {
216
+
217
+ e.preventDefault();
218
+
219
+ var $this = S(this),
220
+ topbar = $this.closest('[' + self.attr_name() + ']'),
221
+ section = topbar.find('section, .top-bar-section'),
222
+ dropdownHeight = $this.next('.dropdown').outerHeight(),
223
+ $selectedLi = $this.closest('li');
224
+
225
+ topbar.data('index', topbar.data('index') + 1);
226
+ $selectedLi.addClass('moved');
227
+
228
+ if (!self.rtl) {
229
+ section.css({left : -(100 * topbar.data('index')) + '%'});
230
+ section.find('>.name').css({left : 100 * topbar.data('index') + '%'});
231
+ } else {
232
+ section.css({right : -(100 * topbar.data('index')) + '%'});
233
+ section.find('>.name').css({right : 100 * topbar.data('index') + '%'});
234
+ }
235
+
236
+ topbar.css('height', $this.siblings('ul').outerHeight(true) + topbar.data('height'));
237
+ }
238
+ });
239
+
240
+ S(window).off('.topbar').on('resize.fndtn.topbar', self.throttle(function () {
241
+ self.resize.call(self);
242
+ }, 50)).trigger('resize').trigger('resize.fndtn.topbar').load(function () {
243
+ // Ensure that the offset is calculated after all of the pages resources have loaded
244
+ S(this).trigger('resize.fndtn.topbar');
245
+ });
246
+
247
+ S('body').off('.topbar').on('click.fndtn.topbar', function (e) {
248
+ var parent = S(e.target).closest('li').closest('li.hover');
249
+
250
+ if (parent.length > 0) {
251
+ return;
252
+ }
253
+
254
+ S('[' + self.attr_name() + '] li.hover').removeClass('hover');
255
+ });
256
+
257
+ // Go up a level on Click
258
+ S(this.scope).on('click.fndtn.topbar', '[' + this.attr_name() + '] .has-dropdown .back', function (e) {
259
+ e.preventDefault();
260
+
261
+ var $this = S(this),
262
+ topbar = $this.closest('[' + self.attr_name() + ']'),
263
+ section = topbar.find('section, .top-bar-section'),
264
+ settings = topbar.data(self.attr_name(true) + '-init'),
265
+ $movedLi = $this.closest('li.moved'),
266
+ $previousLevelUl = $movedLi.parent();
267
+
268
+ topbar.data('index', topbar.data('index') - 1);
269
+
270
+ if (!self.rtl) {
271
+ section.css({left : -(100 * topbar.data('index')) + '%'});
272
+ section.find('>.name').css({left : 100 * topbar.data('index') + '%'});
273
+ } else {
274
+ section.css({right : -(100 * topbar.data('index')) + '%'});
275
+ section.find('>.name').css({right : 100 * topbar.data('index') + '%'});
276
+ }
277
+
278
+ if (topbar.data('index') === 0) {
279
+ topbar.css('height', '');
280
+ } else {
281
+ topbar.css('height', $previousLevelUl.outerHeight(true) + topbar.data('height'));
282
+ }
283
+
284
+ setTimeout(function () {
285
+ $movedLi.removeClass('moved');
286
+ }, 300);
287
+ });
288
+
289
+ // Show dropdown menus when their items are focused
290
+ S(this.scope).find('.dropdown a')
291
+ .focus(function () {
292
+ $(this).parents('.has-dropdown').addClass('hover');
293
+ })
294
+ .blur(function () {
295
+ $(this).parents('.has-dropdown').removeClass('hover');
296
+ });
297
+ },
298
+
299
+ resize : function () {
300
+ var self = this;
301
+ self.S('[' + this.attr_name() + ']').each(function () {
302
+ var topbar = self.S(this),
303
+ settings = topbar.data(self.attr_name(true) + '-init');
304
+
305
+ var stickyContainer = topbar.parent('.' + self.settings.sticky_class);
306
+ var stickyOffset;
307
+
308
+ if (!self.breakpoint()) {
309
+ var doToggle = topbar.hasClass('expanded');
310
+ topbar
311
+ .css('height', '')
312
+ .removeClass('expanded')
313
+ .find('li')
314
+ .removeClass('hover');
315
+
316
+ if (doToggle) {
317
+ self.toggle(topbar);
318
+ }
319
+ }
320
+
321
+ if (self.is_sticky(topbar, stickyContainer, settings)) {
322
+ if (stickyContainer.hasClass('fixed')) {
323
+ // Remove the fixed to allow for correct calculation of the offset.
324
+ stickyContainer.removeClass('fixed');
325
+
326
+ stickyOffset = stickyContainer.offset().top;
327
+ if (self.S(document.body).hasClass('f-topbar-fixed')) {
328
+ stickyOffset -= topbar.data('height');
329
+ }
330
+
331
+ topbar.data('stickyoffset', stickyOffset);
332
+ stickyContainer.addClass('fixed');
333
+ } else {
334
+ stickyOffset = stickyContainer.offset().top;
335
+ topbar.data('stickyoffset', stickyOffset);
336
+ }
337
+ }
338
+
339
+ });
340
+ },
341
+
342
+ breakpoint : function () {
343
+ return !matchMedia(Tennpipes.media_queries['topbar']).matches;
344
+ },
345
+
346
+ small : function () {
347
+ return matchMedia(Tennpipes.media_queries['small']).matches;
348
+ },
349
+
350
+ medium : function () {
351
+ return matchMedia(Tennpipes.media_queries['medium']).matches;
352
+ },
353
+
354
+ large : function () {
355
+ return matchMedia(Tennpipes.media_queries['large']).matches;
356
+ },
357
+
358
+ assemble : function (topbar) {
359
+ var self = this,
360
+ settings = topbar.data(this.attr_name(true) + '-init'),
361
+ section = self.S('section, .top-bar-section', topbar);
362
+
363
+ // Pull element out of the DOM for manipulation
364
+ section.detach();
365
+
366
+ self.S('.has-dropdown>a', section).each(function () {
367
+ var $link = self.S(this),
368
+ $dropdown = $link.siblings('.dropdown'),
369
+ url = $link.attr('href'),
370
+ $titleLi;
371
+
372
+ if (!$dropdown.find('.title.back').length) {
373
+
374
+ if (settings.mobile_show_parent_link == true && url) {
375
+ $titleLi = $('<li class="title back js-generated"><h5><a href="javascript:void(0)"></a></h5></li><li class="parent-link hide-for-large-up"><a class="parent-link js-generated" href="' + url + '">' + $link.html() +'</a></li>');
376
+ } else {
377
+ $titleLi = $('<li class="title back js-generated"><h5><a href="javascript:void(0)"></a></h5>');
378
+ }
379
+
380
+ // Copy link to subnav
381
+ if (settings.custom_back_text == true) {
382
+ $('h5>a', $titleLi).html(settings.back_text);
383
+ } else {
384
+ $('h5>a', $titleLi).html('&laquo; ' + $link.html());
385
+ }
386
+ $dropdown.prepend($titleLi);
387
+ }
388
+ });
389
+
390
+ // Put element back in the DOM
391
+ section.appendTo(topbar);
392
+
393
+ // check for sticky
394
+ this.sticky();
395
+
396
+ this.assembled(topbar);
397
+ },
398
+
399
+ assembled : function (topbar) {
400
+ topbar.data(this.attr_name(true), $.extend({}, topbar.data(this.attr_name(true)), {assembled : true}));
401
+ },
402
+
403
+ height : function (ul) {
404
+ var total = 0,
405
+ self = this;
406
+
407
+ $('> li', ul).each(function () {
408
+ total += self.S(this).outerHeight(true);
409
+ });
410
+
411
+ return total;
412
+ },
413
+
414
+ sticky : function () {
415
+ var self = this;
416
+
417
+ this.S(window).on('scroll', function () {
418
+ self.update_sticky_positioning();
419
+ });
420
+ },
421
+
422
+ update_sticky_positioning : function () {
423
+ var klass = '.' + this.settings.sticky_class,
424
+ $window = this.S(window),
425
+ self = this;
426
+
427
+ if (self.settings.sticky_topbar && self.is_sticky(this.settings.sticky_topbar, this.settings.sticky_topbar.parent(), this.settings)) {
428
+ var distance = this.settings.sticky_topbar.data('stickyoffset');
429
+ if (!self.S(klass).hasClass('expanded')) {
430
+ if ($window.scrollTop() > (distance)) {
431
+ if (!self.S(klass).hasClass('fixed')) {
432
+ self.S(klass).addClass('fixed');
433
+ self.S('body').addClass('f-topbar-fixed');
434
+ }
435
+ } else if ($window.scrollTop() <= distance) {
436
+ if (self.S(klass).hasClass('fixed')) {
437
+ self.S(klass).removeClass('fixed');
438
+ self.S('body').removeClass('f-topbar-fixed');
439
+ }
440
+ }
441
+ }
442
+ }
443
+ },
444
+
445
+ off : function () {
446
+ this.S(this.scope).off('.fndtn.topbar');
447
+ this.S(window).off('.fndtn.topbar');
448
+ },
449
+
450
+ reflow : function () {}
451
+ };
452
+ }(jQuery, window, window.document));