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,703 @@
1
+ /*
2
+ * Tennpipes Responsive Library
3
+ * http://tennpipes.zurb.com
4
+ * Copyright 2014, ZURB
5
+ * Free to use under the MIT license.
6
+ * http://www.opensource.org/licenses/mit-license.php
7
+ */
8
+
9
+ (function ($, window, document, undefined) {
10
+ 'use strict';
11
+
12
+ var header_helpers = function (class_array) {
13
+ var i = class_array.length;
14
+ var head = $('head');
15
+
16
+ while (i--) {
17
+ if (head.has('.' + class_array[i]).length === 0) {
18
+ head.append('<meta class="' + class_array[i] + '" />');
19
+ }
20
+ }
21
+ };
22
+
23
+ header_helpers([
24
+ 'tennpipes-mq-small',
25
+ 'tennpipes-mq-small-only',
26
+ 'tennpipes-mq-medium',
27
+ 'tennpipes-mq-medium-only',
28
+ 'tennpipes-mq-large',
29
+ 'tennpipes-mq-large-only',
30
+ 'tennpipes-mq-xlarge',
31
+ 'tennpipes-mq-xlarge-only',
32
+ 'tennpipes-mq-xxlarge',
33
+ 'tennpipes-data-attribute-namespace']);
34
+
35
+ // Enable FastClick if present
36
+
37
+ $(function () {
38
+ if (typeof FastClick !== 'undefined') {
39
+ // Don't attach to body if undefined
40
+ if (typeof document.body !== 'undefined') {
41
+ FastClick.attach(document.body);
42
+ }
43
+ }
44
+ });
45
+
46
+ // private Fast Selector wrapper,
47
+ // returns jQuery object. Only use where
48
+ // getElementById is not available.
49
+ var S = function (selector, context) {
50
+ if (typeof selector === 'string') {
51
+ if (context) {
52
+ var cont;
53
+ if (context.jquery) {
54
+ cont = context[0];
55
+ if (!cont) {
56
+ return context;
57
+ }
58
+ } else {
59
+ cont = context;
60
+ }
61
+ return $(cont.querySelectorAll(selector));
62
+ }
63
+
64
+ return $(document.querySelectorAll(selector));
65
+ }
66
+
67
+ return $(selector, context);
68
+ };
69
+
70
+ // Namespace functions.
71
+
72
+ var attr_name = function (init) {
73
+ var arr = [];
74
+ if (!init) {
75
+ arr.push('data');
76
+ }
77
+ if (this.namespace.length > 0) {
78
+ arr.push(this.namespace);
79
+ }
80
+ arr.push(this.name);
81
+
82
+ return arr.join('-');
83
+ };
84
+
85
+ var add_namespace = function (str) {
86
+ var parts = str.split('-'),
87
+ i = parts.length,
88
+ arr = [];
89
+
90
+ while (i--) {
91
+ if (i !== 0) {
92
+ arr.push(parts[i]);
93
+ } else {
94
+ if (this.namespace.length > 0) {
95
+ arr.push(this.namespace, parts[i]);
96
+ } else {
97
+ arr.push(parts[i]);
98
+ }
99
+ }
100
+ }
101
+
102
+ return arr.reverse().join('-');
103
+ };
104
+
105
+ // Event binding and data-options updating.
106
+
107
+ var bindings = function (method, options) {
108
+ var self = this,
109
+ bind = function(){
110
+ var $this = S(this),
111
+ should_bind_events = !$this.data(self.attr_name(true) + '-init');
112
+ $this.data(self.attr_name(true) + '-init', $.extend({}, self.settings, (options || method), self.data_options($this)));
113
+
114
+ if (should_bind_events) {
115
+ self.events(this);
116
+ }
117
+ };
118
+
119
+ if (S(this.scope).is('[' + this.attr_name() +']')) {
120
+ bind.call(this.scope);
121
+ } else {
122
+ S('[' + this.attr_name() +']', this.scope).each(bind);
123
+ }
124
+ // # Patch to fix #5043 to move this *after* the if/else clause in order for Backbone and similar frameworks to have improved control over event binding and data-options updating.
125
+ if (typeof method === 'string') {
126
+ return this[method].call(this, options);
127
+ }
128
+
129
+ };
130
+
131
+ var single_image_loaded = function (image, callback) {
132
+ function loaded () {
133
+ callback(image[0]);
134
+ }
135
+
136
+ function bindLoad () {
137
+ this.one('load', loaded);
138
+
139
+ if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)) {
140
+ var src = this.attr( 'src' ),
141
+ param = src.match( /\?/ ) ? '&' : '?';
142
+
143
+ param += 'random=' + (new Date()).getTime();
144
+ this.attr('src', src + param);
145
+ }
146
+ }
147
+
148
+ if (!image.attr('src')) {
149
+ loaded();
150
+ return;
151
+ }
152
+
153
+ if (image[0].complete || image[0].readyState === 4) {
154
+ loaded();
155
+ } else {
156
+ bindLoad.call(image);
157
+ }
158
+ };
159
+
160
+ /*
161
+ https://github.com/paulirish/matchMedia.js
162
+ */
163
+
164
+ window.matchMedia = window.matchMedia || (function ( doc ) {
165
+
166
+ 'use strict';
167
+
168
+ var bool,
169
+ docElem = doc.documentElement,
170
+ refNode = docElem.firstElementChild || docElem.firstChild,
171
+ // fakeBody required for <FF4 when executed in <head>
172
+ fakeBody = doc.createElement( 'body' ),
173
+ div = doc.createElement( 'div' );
174
+
175
+ div.id = 'mq-test-1';
176
+ div.style.cssText = 'position:absolute;top:-100em';
177
+ fakeBody.style.background = 'none';
178
+ fakeBody.appendChild(div);
179
+
180
+ return function (q) {
181
+
182
+ div.innerHTML = '&shy;<style media="' + q + '"> #mq-test-1 { width: 42px; }</style>';
183
+
184
+ docElem.insertBefore( fakeBody, refNode );
185
+ bool = div.offsetWidth === 42;
186
+ docElem.removeChild( fakeBody );
187
+
188
+ return {
189
+ matches : bool,
190
+ media : q
191
+ };
192
+
193
+ };
194
+
195
+ }( document ));
196
+
197
+ /*
198
+ * jquery.requestAnimationFrame
199
+ * https://github.com/gnarf37/jquery-requestAnimationFrame
200
+ * Requires jQuery 1.8+
201
+ *
202
+ * Copyright (c) 2012 Corey Frang
203
+ * Licensed under the MIT license.
204
+ */
205
+
206
+ (function(jQuery) {
207
+
208
+
209
+ // requestAnimationFrame polyfill adapted from Erik Möller
210
+ // fixes from Paul Irish and Tino Zijdel
211
+ // http://paulirish.com/2011/requestanimationframe-for-smart-animating/
212
+ // http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
213
+
214
+ var animating,
215
+ lastTime = 0,
216
+ vendors = ['webkit', 'moz'],
217
+ requestAnimationFrame = window.requestAnimationFrame,
218
+ cancelAnimationFrame = window.cancelAnimationFrame,
219
+ jqueryFxAvailable = 'undefined' !== typeof jQuery.fx;
220
+
221
+ for (; lastTime < vendors.length && !requestAnimationFrame; lastTime++) {
222
+ requestAnimationFrame = window[ vendors[lastTime] + 'RequestAnimationFrame' ];
223
+ cancelAnimationFrame = cancelAnimationFrame ||
224
+ window[ vendors[lastTime] + 'CancelAnimationFrame' ] ||
225
+ window[ vendors[lastTime] + 'CancelRequestAnimationFrame' ];
226
+ }
227
+
228
+ function raf() {
229
+ if (animating) {
230
+ requestAnimationFrame(raf);
231
+
232
+ if (jqueryFxAvailable) {
233
+ jQuery.fx.tick();
234
+ }
235
+ }
236
+ }
237
+
238
+ if (requestAnimationFrame) {
239
+ // use rAF
240
+ window.requestAnimationFrame = requestAnimationFrame;
241
+ window.cancelAnimationFrame = cancelAnimationFrame;
242
+
243
+ if (jqueryFxAvailable) {
244
+ jQuery.fx.timer = function (timer) {
245
+ if (timer() && jQuery.timers.push(timer) && !animating) {
246
+ animating = true;
247
+ raf();
248
+ }
249
+ };
250
+
251
+ jQuery.fx.stop = function () {
252
+ animating = false;
253
+ };
254
+ }
255
+ } else {
256
+ // polyfill
257
+ window.requestAnimationFrame = function (callback) {
258
+ var currTime = new Date().getTime(),
259
+ timeToCall = Math.max(0, 16 - (currTime - lastTime)),
260
+ id = window.setTimeout(function () {
261
+ callback(currTime + timeToCall);
262
+ }, timeToCall);
263
+ lastTime = currTime + timeToCall;
264
+ return id;
265
+ };
266
+
267
+ window.cancelAnimationFrame = function (id) {
268
+ clearTimeout(id);
269
+ };
270
+
271
+ }
272
+
273
+ }( $ ));
274
+
275
+ function removeQuotes (string) {
276
+ if (typeof string === 'string' || string instanceof String) {
277
+ string = string.replace(/^['\\/"]+|(;\s?})+|['\\/"]+$/g, '');
278
+ }
279
+
280
+ return string;
281
+ }
282
+
283
+ window.Tennpipes = {
284
+ name : 'Tennpipes',
285
+
286
+ version : '5.5.1',
287
+
288
+ media_queries : {
289
+ 'small' : S('.tennpipes-mq-small').css('font-family').replace(/^[\/\\'"]+|(;\s?})+|[\/\\'"]+$/g, ''),
290
+ 'small-only' : S('.tennpipes-mq-small-only').css('font-family').replace(/^[\/\\'"]+|(;\s?})+|[\/\\'"]+$/g, ''),
291
+ 'medium' : S('.tennpipes-mq-medium').css('font-family').replace(/^[\/\\'"]+|(;\s?})+|[\/\\'"]+$/g, ''),
292
+ 'medium-only' : S('.tennpipes-mq-medium-only').css('font-family').replace(/^[\/\\'"]+|(;\s?})+|[\/\\'"]+$/g, ''),
293
+ 'large' : S('.tennpipes-mq-large').css('font-family').replace(/^[\/\\'"]+|(;\s?})+|[\/\\'"]+$/g, ''),
294
+ 'large-only' : S('.tennpipes-mq-large-only').css('font-family').replace(/^[\/\\'"]+|(;\s?})+|[\/\\'"]+$/g, ''),
295
+ 'xlarge' : S('.tennpipes-mq-xlarge').css('font-family').replace(/^[\/\\'"]+|(;\s?})+|[\/\\'"]+$/g, ''),
296
+ 'xlarge-only' : S('.tennpipes-mq-xlarge-only').css('font-family').replace(/^[\/\\'"]+|(;\s?})+|[\/\\'"]+$/g, ''),
297
+ 'xxlarge' : S('.tennpipes-mq-xxlarge').css('font-family').replace(/^[\/\\'"]+|(;\s?})+|[\/\\'"]+$/g, '')
298
+ },
299
+
300
+ stylesheet : $('<style></style>').appendTo('head')[0].sheet,
301
+
302
+ global : {
303
+ namespace : undefined
304
+ },
305
+
306
+ init : function (scope, libraries, method, options, response) {
307
+ var args = [scope, method, options, response],
308
+ responses = [];
309
+
310
+ // check RTL
311
+ this.rtl = /rtl/i.test(S('html').attr('dir'));
312
+
313
+ // set tennpipes global scope
314
+ this.scope = scope || this.scope;
315
+
316
+ this.set_namespace();
317
+
318
+ if (libraries && typeof libraries === 'string' && !/reflow/i.test(libraries)) {
319
+ if (this.libs.hasOwnProperty(libraries)) {
320
+ responses.push(this.init_lib(libraries, args));
321
+ }
322
+ } else {
323
+ for (var lib in this.libs) {
324
+ responses.push(this.init_lib(lib, libraries));
325
+ }
326
+ }
327
+
328
+ S(window).load(function () {
329
+ S(window)
330
+ .trigger('resize.fndtn.clearing')
331
+ .trigger('resize.fndtn.dropdown')
332
+ .trigger('resize.fndtn.equalizer')
333
+ .trigger('resize.fndtn.interchange')
334
+ .trigger('resize.fndtn.joyride')
335
+ .trigger('resize.fndtn.magellan')
336
+ .trigger('resize.fndtn.topbar')
337
+ .trigger('resize.fndtn.slider');
338
+ });
339
+
340
+ return scope;
341
+ },
342
+
343
+ init_lib : function (lib, args) {
344
+ if (this.libs.hasOwnProperty(lib)) {
345
+ this.patch(this.libs[lib]);
346
+
347
+ if (args && args.hasOwnProperty(lib)) {
348
+ if (typeof this.libs[lib].settings !== 'undefined') {
349
+ $.extend(true, this.libs[lib].settings, args[lib]);
350
+ } else if (typeof this.libs[lib].defaults !== 'undefined') {
351
+ $.extend(true, this.libs[lib].defaults, args[lib]);
352
+ }
353
+ return this.libs[lib].init.apply(this.libs[lib], [this.scope, args[lib]]);
354
+ }
355
+
356
+ args = args instanceof Array ? args : new Array(args);
357
+ return this.libs[lib].init.apply(this.libs[lib], args);
358
+ }
359
+
360
+ return function () {};
361
+ },
362
+
363
+ patch : function (lib) {
364
+ lib.scope = this.scope;
365
+ lib.namespace = this.global.namespace;
366
+ lib.rtl = this.rtl;
367
+ lib['data_options'] = this.utils.data_options;
368
+ lib['attr_name'] = attr_name;
369
+ lib['add_namespace'] = add_namespace;
370
+ lib['bindings'] = bindings;
371
+ lib['S'] = this.utils.S;
372
+ },
373
+
374
+ inherit : function (scope, methods) {
375
+ var methods_arr = methods.split(' '),
376
+ i = methods_arr.length;
377
+
378
+ while (i--) {
379
+ if (this.utils.hasOwnProperty(methods_arr[i])) {
380
+ scope[methods_arr[i]] = this.utils[methods_arr[i]];
381
+ }
382
+ }
383
+ },
384
+
385
+ set_namespace : function () {
386
+
387
+ // Description:
388
+ // Don't bother reading the namespace out of the meta tag
389
+ // if the namespace has been set globally in javascript
390
+ //
391
+ // Example:
392
+ // Tennpipes.global.namespace = 'my-namespace';
393
+ // or make it an empty string:
394
+ // Tennpipes.global.namespace = '';
395
+ //
396
+ //
397
+
398
+ // If the namespace has not been set (is undefined), try to read it out of the meta element.
399
+ // Otherwise use the globally defined namespace, even if it's empty ('')
400
+ var namespace = ( this.global.namespace === undefined ) ? $('.tennpipes-data-attribute-namespace').css('font-family') : this.global.namespace;
401
+
402
+ // Finally, if the namsepace is either undefined or false, set it to an empty string.
403
+ // Otherwise use the namespace value.
404
+ this.global.namespace = ( namespace === undefined || /false/i.test(namespace) ) ? '' : namespace;
405
+ },
406
+
407
+ libs : {},
408
+
409
+ // methods that can be inherited in libraries
410
+ utils : {
411
+
412
+ // Description:
413
+ // Fast Selector wrapper returns jQuery object. Only use where getElementById
414
+ // is not available.
415
+ //
416
+ // Arguments:
417
+ // Selector (String): CSS selector describing the element(s) to be
418
+ // returned as a jQuery object.
419
+ //
420
+ // Scope (String): CSS selector describing the area to be searched. Default
421
+ // is document.
422
+ //
423
+ // Returns:
424
+ // Element (jQuery Object): jQuery object containing elements matching the
425
+ // selector within the scope.
426
+ S : S,
427
+
428
+ // Description:
429
+ // Executes a function a max of once every n milliseconds
430
+ //
431
+ // Arguments:
432
+ // Func (Function): Function to be throttled.
433
+ //
434
+ // Delay (Integer): Function execution threshold in milliseconds.
435
+ //
436
+ // Returns:
437
+ // Lazy_function (Function): Function with throttling applied.
438
+ throttle : function (func, delay) {
439
+ var timer = null;
440
+
441
+ return function () {
442
+ var context = this, args = arguments;
443
+
444
+ if (timer == null) {
445
+ timer = setTimeout(function () {
446
+ func.apply(context, args);
447
+ timer = null;
448
+ }, delay);
449
+ }
450
+ };
451
+ },
452
+
453
+ // Description:
454
+ // Executes a function when it stops being invoked for n seconds
455
+ // Modified version of _.debounce() http://underscorejs.org
456
+ //
457
+ // Arguments:
458
+ // Func (Function): Function to be debounced.
459
+ //
460
+ // Delay (Integer): Function execution threshold in milliseconds.
461
+ //
462
+ // Immediate (Bool): Whether the function should be called at the beginning
463
+ // of the delay instead of the end. Default is false.
464
+ //
465
+ // Returns:
466
+ // Lazy_function (Function): Function with debouncing applied.
467
+ debounce : function (func, delay, immediate) {
468
+ var timeout, result;
469
+ return function () {
470
+ var context = this, args = arguments;
471
+ var later = function () {
472
+ timeout = null;
473
+ if (!immediate) {
474
+ result = func.apply(context, args);
475
+ }
476
+ };
477
+ var callNow = immediate && !timeout;
478
+ clearTimeout(timeout);
479
+ timeout = setTimeout(later, delay);
480
+ if (callNow) {
481
+ result = func.apply(context, args);
482
+ }
483
+ return result;
484
+ };
485
+ },
486
+
487
+ // Description:
488
+ // Parses data-options attribute
489
+ //
490
+ // Arguments:
491
+ // El (jQuery Object): Element to be parsed.
492
+ //
493
+ // Returns:
494
+ // Options (Javascript Object): Contents of the element's data-options
495
+ // attribute.
496
+ data_options : function (el, data_attr_name) {
497
+ data_attr_name = data_attr_name || 'options';
498
+ var opts = {}, ii, p, opts_arr,
499
+ data_options = function (el) {
500
+ var namespace = Tennpipes.global.namespace;
501
+
502
+ if (namespace.length > 0) {
503
+ return el.data(namespace + '-' + data_attr_name);
504
+ }
505
+
506
+ return el.data(data_attr_name);
507
+ };
508
+
509
+ var cached_options = data_options(el);
510
+
511
+ if (typeof cached_options === 'object') {
512
+ return cached_options;
513
+ }
514
+
515
+ opts_arr = (cached_options || ':').split(';');
516
+ ii = opts_arr.length;
517
+
518
+ function isNumber (o) {
519
+ return !isNaN (o - 0) && o !== null && o !== '' && o !== false && o !== true;
520
+ }
521
+
522
+ function trim (str) {
523
+ if (typeof str === 'string') {
524
+ return $.trim(str);
525
+ }
526
+ return str;
527
+ }
528
+
529
+ while (ii--) {
530
+ p = opts_arr[ii].split(':');
531
+ p = [p[0], p.slice(1).join(':')];
532
+
533
+ if (/true/i.test(p[1])) {
534
+ p[1] = true;
535
+ }
536
+ if (/false/i.test(p[1])) {
537
+ p[1] = false;
538
+ }
539
+ if (isNumber(p[1])) {
540
+ if (p[1].indexOf('.') === -1) {
541
+ p[1] = parseInt(p[1], 10);
542
+ } else {
543
+ p[1] = parseFloat(p[1]);
544
+ }
545
+ }
546
+
547
+ if (p.length === 2 && p[0].length > 0) {
548
+ opts[trim(p[0])] = trim(p[1]);
549
+ }
550
+ }
551
+
552
+ return opts;
553
+ },
554
+
555
+ // Description:
556
+ // Adds JS-recognizable media queries
557
+ //
558
+ // Arguments:
559
+ // Media (String): Key string for the media query to be stored as in
560
+ // Tennpipes.media_queries
561
+ //
562
+ // Class (String): Class name for the generated <meta> tag
563
+ register_media : function (media, media_class) {
564
+ if (Tennpipes.media_queries[media] === undefined) {
565
+ $('head').append('<meta class="' + media_class + '"/>');
566
+ Tennpipes.media_queries[media] = removeQuotes($('.' + media_class).css('font-family'));
567
+ }
568
+ },
569
+
570
+ // Description:
571
+ // Add custom CSS within a JS-defined media query
572
+ //
573
+ // Arguments:
574
+ // Rule (String): CSS rule to be appended to the document.
575
+ //
576
+ // Media (String): Optional media query string for the CSS rule to be
577
+ // nested under.
578
+ add_custom_rule : function (rule, media) {
579
+ if (media === undefined && Tennpipes.stylesheet) {
580
+ Tennpipes.stylesheet.insertRule(rule, Tennpipes.stylesheet.cssRules.length);
581
+ } else {
582
+ var query = Tennpipes.media_queries[media];
583
+
584
+ if (query !== undefined) {
585
+ Tennpipes.stylesheet.insertRule('@media ' +
586
+ Tennpipes.media_queries[media] + '{ ' + rule + ' }');
587
+ }
588
+ }
589
+ },
590
+
591
+ // Description:
592
+ // Performs a callback function when an image is fully loaded
593
+ //
594
+ // Arguments:
595
+ // Image (jQuery Object): Image(s) to check if loaded.
596
+ //
597
+ // Callback (Function): Function to execute when image is fully loaded.
598
+ image_loaded : function (images, callback) {
599
+ var self = this,
600
+ unloaded = images.length;
601
+
602
+ if (unloaded === 0) {
603
+ callback(images);
604
+ }
605
+
606
+ images.each(function () {
607
+ single_image_loaded(self.S(this), function () {
608
+ unloaded -= 1;
609
+ if (unloaded === 0) {
610
+ callback(images);
611
+ }
612
+ });
613
+ });
614
+ },
615
+
616
+ // Description:
617
+ // Returns a random, alphanumeric string
618
+ //
619
+ // Arguments:
620
+ // Length (Integer): Length of string to be generated. Defaults to random
621
+ // integer.
622
+ //
623
+ // Returns:
624
+ // Rand (String): Pseudo-random, alphanumeric string.
625
+ random_str : function () {
626
+ if (!this.fidx) {
627
+ this.fidx = 0;
628
+ }
629
+ this.prefix = this.prefix || [(this.name || 'F'), (+new Date).toString(36)].join('-');
630
+
631
+ return this.prefix + (this.fidx++).toString(36);
632
+ },
633
+
634
+ // Description:
635
+ // Helper for window.matchMedia
636
+ //
637
+ // Arguments:
638
+ // mq (String): Media query
639
+ //
640
+ // Returns:
641
+ // (Boolean): Whether the media query passes or not
642
+ match : function (mq) {
643
+ return window.matchMedia(mq).matches;
644
+ },
645
+
646
+ // Description:
647
+ // Helpers for checking Tennpipes default media queries with JS
648
+ //
649
+ // Returns:
650
+ // (Boolean): Whether the media query passes or not
651
+
652
+ is_small_up : function () {
653
+ return this.match(Tennpipes.media_queries.small);
654
+ },
655
+
656
+ is_medium_up : function () {
657
+ return this.match(Tennpipes.media_queries.medium);
658
+ },
659
+
660
+ is_large_up : function () {
661
+ return this.match(Tennpipes.media_queries.large);
662
+ },
663
+
664
+ is_xlarge_up : function () {
665
+ return this.match(Tennpipes.media_queries.xlarge);
666
+ },
667
+
668
+ is_xxlarge_up : function () {
669
+ return this.match(Tennpipes.media_queries.xxlarge);
670
+ },
671
+
672
+ is_small_only : function () {
673
+ return !this.is_medium_up() && !this.is_large_up() && !this.is_xlarge_up() && !this.is_xxlarge_up();
674
+ },
675
+
676
+ is_medium_only : function () {
677
+ return this.is_medium_up() && !this.is_large_up() && !this.is_xlarge_up() && !this.is_xxlarge_up();
678
+ },
679
+
680
+ is_large_only : function () {
681
+ return this.is_medium_up() && this.is_large_up() && !this.is_xlarge_up() && !this.is_xxlarge_up();
682
+ },
683
+
684
+ is_xlarge_only : function () {
685
+ return this.is_medium_up() && this.is_large_up() && this.is_xlarge_up() && !this.is_xxlarge_up();
686
+ },
687
+
688
+ is_xxlarge_only : function () {
689
+ return this.is_medium_up() && this.is_large_up() && this.is_xlarge_up() && this.is_xxlarge_up();
690
+ }
691
+ }
692
+ };
693
+
694
+ $.fn.tennpipes = function () {
695
+ var args = Array.prototype.slice.call(arguments, 0);
696
+
697
+ return this.each(function () {
698
+ Tennpipes.init.apply(Tennpipes, [this].concat(args));
699
+ return this;
700
+ });
701
+ };
702
+
703
+ }(jQuery, window, window.document));