tennpipes-init 3.6.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE.txt +20 -0
- data/README.rdoc +163 -0
- data/Rakefile +1 -0
- data/bin/tennpipes-init +16 -0
- data/lib/tennpipes-init.rb +73 -0
- data/lib/tennpipes-init/command.rb +18 -0
- data/lib/tennpipes-init/generators/actions.rb +630 -0
- data/lib/tennpipes-init/generators/app.rb +75 -0
- data/lib/tennpipes-init/generators/app/app.rb.tt +72 -0
- data/lib/tennpipes-init/generators/app/app.rb.tt~ +72 -0
- data/lib/tennpipes-init/generators/cli.rb +57 -0
- data/lib/tennpipes-init/generators/component.rb +73 -0
- data/lib/tennpipes-init/generators/components/actions.rb +208 -0
- data/lib/tennpipes-init/generators/components/mocks/mocha.rb +10 -0
- data/lib/tennpipes-init/generators/components/mocks/rr.rb +13 -0
- data/lib/tennpipes-init/generators/components/orms/activerecord.rb +201 -0
- data/lib/tennpipes-init/generators/components/orms/couchrest.rb +55 -0
- data/lib/tennpipes-init/generators/components/orms/datamapper.rb +140 -0
- data/lib/tennpipes-init/generators/components/orms/dynamoid.rb +67 -0
- data/lib/tennpipes-init/generators/components/orms/minirecord.rb +165 -0
- data/lib/tennpipes-init/generators/components/orms/mongoid.rb +113 -0
- data/lib/tennpipes-init/generators/components/orms/mongomapper.rb +43 -0
- data/lib/tennpipes-init/generators/components/orms/mongomatic.rb +84 -0
- data/lib/tennpipes-init/generators/components/orms/ohm.rb +65 -0
- data/lib/tennpipes-init/generators/components/orms/ripple.rb +75 -0
- data/lib/tennpipes-init/generators/components/orms/sequel.rb +99 -0
- data/lib/tennpipes-init/generators/components/renderers/erb.rb +3 -0
- data/lib/tennpipes-init/generators/components/renderers/haml.rb +3 -0
- data/lib/tennpipes-init/generators/components/renderers/liquid.rb +4 -0
- data/lib/tennpipes-init/generators/components/renderers/slim.rb +3 -0
- data/lib/tennpipes-init/generators/components/scripts/dojo.rb +10 -0
- data/lib/tennpipes-init/generators/components/scripts/extcore.rb +10 -0
- data/lib/tennpipes-init/generators/components/scripts/jquery.rb +10 -0
- data/lib/tennpipes-init/generators/components/scripts/mootools.rb +10 -0
- data/lib/tennpipes-init/generators/components/scripts/prototype.rb +12 -0
- data/lib/tennpipes-init/generators/components/scripts/rightjs.rb +10 -0
- data/lib/tennpipes-init/generators/components/stylesheets/compass.rb +39 -0
- data/lib/tennpipes-init/generators/components/stylesheets/compass/application.scss +43 -0
- data/lib/tennpipes-init/generators/components/stylesheets/compass/partials/_base.scss +12 -0
- data/lib/tennpipes-init/generators/components/stylesheets/less.rb +25 -0
- data/lib/tennpipes-init/generators/components/stylesheets/sass.rb +15 -0
- data/lib/tennpipes-init/generators/components/stylesheets/scss.rb +16 -0
- data/lib/tennpipes-init/generators/components/tests/bacon.rb +103 -0
- data/lib/tennpipes-init/generators/components/tests/cucumber.rb +86 -0
- data/lib/tennpipes-init/generators/components/tests/minitest.rb +110 -0
- data/lib/tennpipes-init/generators/components/tests/riot.rb +117 -0
- data/lib/tennpipes-init/generators/components/tests/rspec.rb +111 -0
- data/lib/tennpipes-init/generators/components/tests/shoulda.rb +114 -0
- data/lib/tennpipes-init/generators/components/tests/steak.rb +114 -0
- data/lib/tennpipes-init/generators/controller.rb +77 -0
- data/lib/tennpipes-init/generators/helper.rb +50 -0
- data/lib/tennpipes-init/generators/mailer.rb +52 -0
- data/lib/tennpipes-init/generators/migration.rb +43 -0
- data/lib/tennpipes-init/generators/model.rb +113 -0
- data/lib/tennpipes-init/generators/plugin.rb +67 -0
- data/lib/tennpipes-init/generators/project.rb +160 -0
- data/lib/tennpipes-init/generators/project/config.ru +9 -0
- data/lib/tennpipes-init/generators/project/config/apps.rb.tt +35 -0
- data/lib/tennpipes-init/generators/project/config/boot.rb +49 -0
- data/lib/tennpipes-init/generators/project/public/favicon.ico +0 -0
- data/lib/tennpipes-init/generators/project/public/images/booking.com.png +0 -0
- data/lib/tennpipes-init/generators/project/public/images/causes.png +0 -0
- data/lib/tennpipes-init/generators/project/public/images/ennkeypee_bg.jpg +0 -0
- data/lib/tennpipes-init/generators/project/public/images/ennkeypee_bluelogo.png +0 -0
- data/lib/tennpipes-init/generators/project/public/images/ennkeypee_bluelogo.svg +68 -0
- data/lib/tennpipes-init/generators/project/public/images/ennkeypee_whitelogo.png +0 -0
- data/lib/tennpipes-init/generators/project/public/images/ennkeypee_whitelogo.svg +65 -0
- data/lib/tennpipes-init/generators/project/public/images/forever21.png +0 -0
- data/lib/tennpipes-init/generators/project/public/images/icons/foundation-icons.eot +0 -0
- data/lib/tennpipes-init/generators/project/public/images/icons/foundation-icons.svg +970 -0
- data/lib/tennpipes-init/generators/project/public/images/icons/foundation-icons.ttf +0 -0
- data/lib/tennpipes-init/generators/project/public/images/icons/foundation-icons.woff +0 -0
- data/lib/tennpipes-init/generators/project/public/images/icons/tennpipes-icons.css +598 -0
- data/lib/tennpipes-init/generators/project/public/images/image1.jpg +0 -0
- data/lib/tennpipes-init/generators/project/public/images/image11.jpg +0 -0
- data/lib/tennpipes-init/generators/project/public/images/image2.jpg +0 -0
- data/lib/tennpipes-init/generators/project/public/images/image3.jpg +0 -0
- data/lib/tennpipes-init/generators/project/public/images/intuit.png +0 -0
- data/lib/tennpipes-init/generators/project/public/images/krispykreme.png +0 -0
- data/lib/tennpipes-init/generators/project/public/images/placeholders/README.md +302 -0
- data/lib/tennpipes-init/generators/project/public/images/placeholders/bower.json +4 -0
- data/lib/tennpipes-init/generators/project/public/images/placeholders/composer.json +34 -0
- data/lib/tennpipes-init/generators/project/public/images/placeholders/gulpfile.js +92 -0
- data/lib/tennpipes-init/generators/project/public/images/placeholders/holder.js +1920 -0
- data/lib/tennpipes-init/generators/project/public/images/placeholders/holder.min.js +12 -0
- data/lib/tennpipes-init/generators/project/public/images/placeholders/package.json +46 -0
- data/lib/tennpipes-init/generators/project/public/images/placeholders/src/holder.js +1411 -0
- data/lib/tennpipes-init/generators/project/public/images/placeholders/src/lib/augment.js +27 -0
- data/lib/tennpipes-init/generators/project/public/images/placeholders/src/lib/ondomready.js +155 -0
- data/lib/tennpipes-init/generators/project/public/images/placeholders/src/lib/polyfills.js +177 -0
- data/lib/tennpipes-init/generators/project/public/images/placeholders/src/scenegraph.js +101 -0
- data/lib/tennpipes-init/generators/project/public/images/placeholders/src/utils.js +129 -0
- data/lib/tennpipes-init/generators/project/public/images/priceline.com.png +0 -0
- data/lib/tennpipes-init/generators/project/public/images/stripe.png +0 -0
- data/lib/tennpipes-init/generators/project/public/javascripts/tennpipes.min.js +6081 -0
- data/lib/tennpipes-init/generators/project/public/javascripts/tennpipes/tennpipes.abide.js +340 -0
- data/lib/tennpipes-init/generators/project/public/javascripts/tennpipes/tennpipes.accordion.js +67 -0
- data/lib/tennpipes-init/generators/project/public/javascripts/tennpipes/tennpipes.alert.js +43 -0
- data/lib/tennpipes-init/generators/project/public/javascripts/tennpipes/tennpipes.clearing.js +556 -0
- data/lib/tennpipes-init/generators/project/public/javascripts/tennpipes/tennpipes.dropdown.js +448 -0
- data/lib/tennpipes-init/generators/project/public/javascripts/tennpipes/tennpipes.equalizer.js +77 -0
- data/lib/tennpipes-init/generators/project/public/javascripts/tennpipes/tennpipes.interchange.js +354 -0
- data/lib/tennpipes-init/generators/project/public/javascripts/tennpipes/tennpipes.joyride.js +932 -0
- data/lib/tennpipes-init/generators/project/public/javascripts/tennpipes/tennpipes.js +703 -0
- data/lib/tennpipes-init/generators/project/public/javascripts/tennpipes/tennpipes.magellan.js +203 -0
- data/lib/tennpipes-init/generators/project/public/javascripts/tennpipes/tennpipes.offcanvas.js +152 -0
- data/lib/tennpipes-init/generators/project/public/javascripts/tennpipes/tennpipes.orbit.js +476 -0
- data/lib/tennpipes-init/generators/project/public/javascripts/tennpipes/tennpipes.reveal.js +471 -0
- data/lib/tennpipes-init/generators/project/public/javascripts/tennpipes/tennpipes.slider.js +263 -0
- data/lib/tennpipes-init/generators/project/public/javascripts/tennpipes/tennpipes.tab.js +237 -0
- data/lib/tennpipes-init/generators/project/public/javascripts/tennpipes/tennpipes.tooltip.js +307 -0
- data/lib/tennpipes-init/generators/project/public/javascripts/tennpipes/tennpipes.topbar.js +452 -0
- data/lib/tennpipes-init/generators/project/public/javascripts/vendor/fastclick.js +8 -0
- data/lib/tennpipes-init/generators/project/public/javascripts/vendor/jquery.cookie.js +8 -0
- data/lib/tennpipes-init/generators/project/public/javascripts/vendor/jquery.js +26 -0
- data/lib/tennpipes-init/generators/project/public/javascripts/vendor/modernizr.js +8 -0
- data/lib/tennpipes-init/generators/project/public/javascripts/vendor/placeholder.js +2 -0
- data/lib/tennpipes-init/generators/project/public/stylesheets/app.css~ +178 -0
- data/lib/tennpipes-init/generators/project/public/stylesheets/app1.css~ +177 -0
- data/lib/tennpipes-init/generators/project/public/stylesheets/ennkeypee.css +214 -0
- data/lib/tennpipes-init/generators/project/public/stylesheets/ennkeypee.css~ +214 -0
- data/lib/tennpipes-init/generators/project/public/stylesheets/normalize.css +427 -0
- data/lib/tennpipes-init/generators/project/public/stylesheets/tennpipes.css +6201 -0
- data/lib/tennpipes-init/generators/project/public/stylesheets/tennpipes.css~ +6201 -0
- data/lib/tennpipes-init/generators/project/public/stylesheets/tennpipes.min.css +1 -0
- data/lib/tennpipes-init/generators/runner.rb +139 -0
- data/lib/tennpipes-init/generators/task.rb +45 -0
- data/lib/tennpipes-init/generators/templates/Gemfile.tt +32 -0
- data/lib/tennpipes-init/generators/templates/Rakefile.tt +8 -0
- data/lib/tennpipes-init/generators/templates/controller.rb.tt +22 -0
- data/lib/tennpipes-init/generators/templates/gem/README.md.tt +29 -0
- data/lib/tennpipes-init/generators/templates/gem/gemspec.tt +19 -0
- data/lib/tennpipes-init/generators/templates/gem/lib/libname.tt +6 -0
- data/lib/tennpipes-init/generators/templates/gem/lib/libname/version.tt +3 -0
- data/lib/tennpipes-init/generators/templates/helper.rb.tt +13 -0
- data/lib/tennpipes-init/generators/templates/initializer.rb.tt +5 -0
- data/lib/tennpipes-init/generators/templates/mailer.rb.tt +54 -0
- data/lib/tennpipes-init/generators/templates/project_bin.tt +14 -0
- data/lib/tennpipes-init/generators/templates/task.rb.tt +7 -0
- data/lib/tennpipes-init/tennpipes-tasks/activerecord.rb +377 -0
- data/lib/tennpipes-init/tennpipes-tasks/database.rb +12 -0
- data/lib/tennpipes-init/tennpipes-tasks/datamapper.rb +94 -0
- data/lib/tennpipes-init/tennpipes-tasks/minirecord.rb +19 -0
- data/lib/tennpipes-init/tennpipes-tasks/mongoid.rb +215 -0
- data/lib/tennpipes-init/tennpipes-tasks/mongomapper.rb +55 -0
- data/lib/tennpipes-init/tennpipes-tasks/sequel.rb +85 -0
- data/lib/tennpipes-init/tennpipes-tasks/sql-helpers.rb +72 -0
- data/test/fixtures/admin_template.rb +7 -0
- data/test/fixtures/example_template.rb +15 -0
- data/test/fixtures/git_template.rb +4 -0
- data/test/fixtures/plugin_template.rb +13 -0
- data/test/fixtures/rake_template.rb +9 -0
- data/test/helper.rb +103 -0
- data/test/test_app_generator.rb +142 -0
- data/test/test_cli.rb +27 -0
- data/test/test_component_generator.rb +98 -0
- data/test/test_controller_generator.rb +272 -0
- data/test/test_generator.rb +13 -0
- data/test/test_helper_generator.rb +133 -0
- data/test/test_mailer_generator.rb +69 -0
- data/test/test_migration_generator.rb +222 -0
- data/test/test_model_generator.rb +553 -0
- data/test/test_plugin_generator.rb +152 -0
- data/test/test_project_generator.rb +757 -0
- data/test/test_task_generator.rb +53 -0
- metadata +285 -0
@@ -0,0 +1,448 @@
|
|
1
|
+
;(function ($, window, document, undefined) {
|
2
|
+
'use strict';
|
3
|
+
|
4
|
+
Tennpipes.libs.dropdown = {
|
5
|
+
name : 'dropdown',
|
6
|
+
|
7
|
+
version : '5.5.1',
|
8
|
+
|
9
|
+
settings : {
|
10
|
+
active_class : 'open',
|
11
|
+
disabled_class : 'disabled',
|
12
|
+
mega_class : 'mega',
|
13
|
+
align : 'bottom',
|
14
|
+
is_hover : false,
|
15
|
+
hover_timeout : 150,
|
16
|
+
opened : function () {},
|
17
|
+
closed : function () {}
|
18
|
+
},
|
19
|
+
|
20
|
+
init : function (scope, method, options) {
|
21
|
+
Tennpipes.inherit(this, 'throttle');
|
22
|
+
|
23
|
+
$.extend(true, this.settings, method, options);
|
24
|
+
this.bindings(method, options);
|
25
|
+
},
|
26
|
+
|
27
|
+
events : function (scope) {
|
28
|
+
var self = this,
|
29
|
+
S = self.S;
|
30
|
+
|
31
|
+
S(this.scope)
|
32
|
+
.off('.dropdown')
|
33
|
+
.on('click.fndtn.dropdown', '[' + this.attr_name() + ']', function (e) {
|
34
|
+
var settings = S(this).data(self.attr_name(true) + '-init') || self.settings;
|
35
|
+
if (!settings.is_hover || Modernizr.touch) {
|
36
|
+
e.preventDefault();
|
37
|
+
if (S(this).parent('[data-reveal-id]')) {
|
38
|
+
e.stopPropagation();
|
39
|
+
}
|
40
|
+
self.toggle($(this));
|
41
|
+
}
|
42
|
+
})
|
43
|
+
.on('mouseenter.fndtn.dropdown', '[' + this.attr_name() + '], [' + this.attr_name() + '-content]', function (e) {
|
44
|
+
var $this = S(this),
|
45
|
+
dropdown,
|
46
|
+
target;
|
47
|
+
|
48
|
+
clearTimeout(self.timeout);
|
49
|
+
|
50
|
+
if ($this.data(self.data_attr())) {
|
51
|
+
dropdown = S('#' + $this.data(self.data_attr()));
|
52
|
+
target = $this;
|
53
|
+
} else {
|
54
|
+
dropdown = $this;
|
55
|
+
target = S('[' + self.attr_name() + '="' + dropdown.attr('id') + '"]');
|
56
|
+
}
|
57
|
+
|
58
|
+
var settings = target.data(self.attr_name(true) + '-init') || self.settings;
|
59
|
+
|
60
|
+
if (S(e.currentTarget).data(self.data_attr()) && settings.is_hover) {
|
61
|
+
self.closeall.call(self);
|
62
|
+
}
|
63
|
+
|
64
|
+
if (settings.is_hover) {
|
65
|
+
self.open.apply(self, [dropdown, target]);
|
66
|
+
}
|
67
|
+
})
|
68
|
+
.on('mouseleave.fndtn.dropdown', '[' + this.attr_name() + '], [' + this.attr_name() + '-content]', function (e) {
|
69
|
+
var $this = S(this);
|
70
|
+
var settings;
|
71
|
+
|
72
|
+
if ($this.data(self.data_attr())) {
|
73
|
+
settings = $this.data(self.data_attr(true) + '-init') || self.settings;
|
74
|
+
} else {
|
75
|
+
var target = S('[' + self.attr_name() + '="' + S(this).attr('id') + '"]'),
|
76
|
+
settings = target.data(self.attr_name(true) + '-init') || self.settings;
|
77
|
+
}
|
78
|
+
|
79
|
+
self.timeout = setTimeout(function () {
|
80
|
+
if ($this.data(self.data_attr())) {
|
81
|
+
if (settings.is_hover) {
|
82
|
+
self.close.call(self, S('#' + $this.data(self.data_attr())));
|
83
|
+
}
|
84
|
+
} else {
|
85
|
+
if (settings.is_hover) {
|
86
|
+
self.close.call(self, $this);
|
87
|
+
}
|
88
|
+
}
|
89
|
+
}.bind(this), settings.hover_timeout);
|
90
|
+
})
|
91
|
+
.on('click.fndtn.dropdown', function (e) {
|
92
|
+
var parent = S(e.target).closest('[' + self.attr_name() + '-content]');
|
93
|
+
var links = parent.find('a');
|
94
|
+
|
95
|
+
if (links.length > 0 && parent.attr('aria-autoclose') !== 'false') {
|
96
|
+
self.close.call(self, S('[' + self.attr_name() + '-content]'));
|
97
|
+
}
|
98
|
+
|
99
|
+
if (e.target !== document && !$.contains(document.documentElement, e.target)) {
|
100
|
+
return;
|
101
|
+
}
|
102
|
+
|
103
|
+
if (S(e.target).closest('[' + self.attr_name() + ']').length > 0) {
|
104
|
+
return;
|
105
|
+
}
|
106
|
+
|
107
|
+
if (!(S(e.target).data('revealId')) &&
|
108
|
+
(parent.length > 0 && (S(e.target).is('[' + self.attr_name() + '-content]') ||
|
109
|
+
$.contains(parent.first()[0], e.target)))) {
|
110
|
+
e.stopPropagation();
|
111
|
+
return;
|
112
|
+
}
|
113
|
+
|
114
|
+
self.close.call(self, S('[' + self.attr_name() + '-content]'));
|
115
|
+
})
|
116
|
+
.on('opened.fndtn.dropdown', '[' + self.attr_name() + '-content]', function () {
|
117
|
+
self.settings.opened.call(this);
|
118
|
+
})
|
119
|
+
.on('closed.fndtn.dropdown', '[' + self.attr_name() + '-content]', function () {
|
120
|
+
self.settings.closed.call(this);
|
121
|
+
});
|
122
|
+
|
123
|
+
S(window)
|
124
|
+
.off('.dropdown')
|
125
|
+
.on('resize.fndtn.dropdown', self.throttle(function () {
|
126
|
+
self.resize.call(self);
|
127
|
+
}, 50));
|
128
|
+
|
129
|
+
this.resize();
|
130
|
+
},
|
131
|
+
|
132
|
+
close : function (dropdown) {
|
133
|
+
var self = this;
|
134
|
+
dropdown.each(function () {
|
135
|
+
var original_target = $('[' + self.attr_name() + '=' + dropdown[0].id + ']') || $('aria-controls=' + dropdown[0].id + ']');
|
136
|
+
original_target.attr('aria-expanded', 'false');
|
137
|
+
if (self.S(this).hasClass(self.settings.active_class)) {
|
138
|
+
self.S(this)
|
139
|
+
.css(Tennpipes.rtl ? 'right' : 'left', '-99999px')
|
140
|
+
.attr('aria-hidden', 'true')
|
141
|
+
.removeClass(self.settings.active_class)
|
142
|
+
.prev('[' + self.attr_name() + ']')
|
143
|
+
.removeClass(self.settings.active_class)
|
144
|
+
.removeData('target');
|
145
|
+
|
146
|
+
self.S(this).trigger('closed').trigger('closed.fndtn.dropdown', [dropdown]);
|
147
|
+
}
|
148
|
+
});
|
149
|
+
dropdown.removeClass('f-open-' + this.attr_name(true));
|
150
|
+
},
|
151
|
+
|
152
|
+
closeall : function () {
|
153
|
+
var self = this;
|
154
|
+
$.each(self.S('.f-open-' + this.attr_name(true)), function () {
|
155
|
+
self.close.call(self, self.S(this));
|
156
|
+
});
|
157
|
+
},
|
158
|
+
|
159
|
+
open : function (dropdown, target) {
|
160
|
+
this
|
161
|
+
.css(dropdown
|
162
|
+
.addClass(this.settings.active_class), target);
|
163
|
+
dropdown.prev('[' + this.attr_name() + ']').addClass(this.settings.active_class);
|
164
|
+
dropdown.data('target', target.get(0)).trigger('opened').trigger('opened.fndtn.dropdown', [dropdown, target]);
|
165
|
+
dropdown.attr('aria-hidden', 'false');
|
166
|
+
target.attr('aria-expanded', 'true');
|
167
|
+
dropdown.focus();
|
168
|
+
dropdown.addClass('f-open-' + this.attr_name(true));
|
169
|
+
},
|
170
|
+
|
171
|
+
data_attr : function () {
|
172
|
+
if (this.namespace.length > 0) {
|
173
|
+
return this.namespace + '-' + this.name;
|
174
|
+
}
|
175
|
+
|
176
|
+
return this.name;
|
177
|
+
},
|
178
|
+
|
179
|
+
toggle : function (target) {
|
180
|
+
if (target.hasClass(this.settings.disabled_class)) {
|
181
|
+
return;
|
182
|
+
}
|
183
|
+
var dropdown = this.S('#' + target.data(this.data_attr()));
|
184
|
+
if (dropdown.length === 0) {
|
185
|
+
// No dropdown found, not continuing
|
186
|
+
return;
|
187
|
+
}
|
188
|
+
|
189
|
+
this.close.call(this, this.S('[' + this.attr_name() + '-content]').not(dropdown));
|
190
|
+
|
191
|
+
if (dropdown.hasClass(this.settings.active_class)) {
|
192
|
+
this.close.call(this, dropdown);
|
193
|
+
if (dropdown.data('target') !== target.get(0)) {
|
194
|
+
this.open.call(this, dropdown, target);
|
195
|
+
}
|
196
|
+
} else {
|
197
|
+
this.open.call(this, dropdown, target);
|
198
|
+
}
|
199
|
+
},
|
200
|
+
|
201
|
+
resize : function () {
|
202
|
+
var dropdown = this.S('[' + this.attr_name() + '-content].open');
|
203
|
+
var target = $(dropdown.data("target"));
|
204
|
+
|
205
|
+
if (dropdown.length && target.length) {
|
206
|
+
this.css(dropdown, target);
|
207
|
+
}
|
208
|
+
},
|
209
|
+
|
210
|
+
css : function (dropdown, target) {
|
211
|
+
var left_offset = Math.max((target.width() - dropdown.width()) / 2, 8),
|
212
|
+
settings = target.data(this.attr_name(true) + '-init') || this.settings;
|
213
|
+
|
214
|
+
this.clear_idx();
|
215
|
+
|
216
|
+
if (this.small()) {
|
217
|
+
var p = this.dirs.bottom.call(dropdown, target, settings);
|
218
|
+
|
219
|
+
dropdown.attr('style', '').removeClass('drop-left drop-right drop-top').css({
|
220
|
+
position : 'absolute',
|
221
|
+
width : '95%',
|
222
|
+
'max-width' : 'none',
|
223
|
+
top : p.top
|
224
|
+
});
|
225
|
+
|
226
|
+
dropdown.css(Tennpipes.rtl ? 'right' : 'left', left_offset);
|
227
|
+
} else {
|
228
|
+
|
229
|
+
this.style(dropdown, target, settings);
|
230
|
+
}
|
231
|
+
|
232
|
+
return dropdown;
|
233
|
+
},
|
234
|
+
|
235
|
+
style : function (dropdown, target, settings) {
|
236
|
+
var css = $.extend({position : 'absolute'},
|
237
|
+
this.dirs[settings.align].call(dropdown, target, settings));
|
238
|
+
|
239
|
+
dropdown.attr('style', '').css(css);
|
240
|
+
},
|
241
|
+
|
242
|
+
// return CSS property object
|
243
|
+
// `this` is the dropdown
|
244
|
+
dirs : {
|
245
|
+
// Calculate target offset
|
246
|
+
_base : function (t) {
|
247
|
+
var o_p = this.offsetParent(),
|
248
|
+
o = o_p.offset(),
|
249
|
+
p = t.offset();
|
250
|
+
|
251
|
+
p.top -= o.top;
|
252
|
+
p.left -= o.left;
|
253
|
+
|
254
|
+
//set some flags on the p object to pass along
|
255
|
+
p.missRight = false;
|
256
|
+
p.missTop = false;
|
257
|
+
p.missLeft = false;
|
258
|
+
p.leftRightFlag = false;
|
259
|
+
|
260
|
+
//lets see if the panel will be off the screen
|
261
|
+
//get the actual width of the page and store it
|
262
|
+
var actualBodyWidth;
|
263
|
+
if (document.getElementsByClassName('row')[0]) {
|
264
|
+
actualBodyWidth = document.getElementsByClassName('row')[0].clientWidth;
|
265
|
+
} else {
|
266
|
+
actualBodyWidth = window.outerWidth;
|
267
|
+
}
|
268
|
+
|
269
|
+
var actualMarginWidth = (window.outerWidth - actualBodyWidth) / 2;
|
270
|
+
var actualBoundary = actualBodyWidth;
|
271
|
+
|
272
|
+
if (!this.hasClass('mega')) {
|
273
|
+
//miss top
|
274
|
+
if (t.offset().top <= this.outerHeight()) {
|
275
|
+
p.missTop = true;
|
276
|
+
actualBoundary = window.outerWidth - actualMarginWidth;
|
277
|
+
p.leftRightFlag = true;
|
278
|
+
}
|
279
|
+
|
280
|
+
//miss right
|
281
|
+
if (t.offset().left + this.outerWidth() > t.offset().left + actualMarginWidth && t.offset().left - actualMarginWidth > this.outerWidth()) {
|
282
|
+
p.missRight = true;
|
283
|
+
p.missLeft = false;
|
284
|
+
}
|
285
|
+
|
286
|
+
//miss left
|
287
|
+
if (t.offset().left - this.outerWidth() <= 0) {
|
288
|
+
p.missLeft = true;
|
289
|
+
p.missRight = false;
|
290
|
+
}
|
291
|
+
}
|
292
|
+
|
293
|
+
return p;
|
294
|
+
},
|
295
|
+
|
296
|
+
top : function (t, s) {
|
297
|
+
var self = Tennpipes.libs.dropdown,
|
298
|
+
p = self.dirs._base.call(this, t);
|
299
|
+
|
300
|
+
this.addClass('drop-top');
|
301
|
+
|
302
|
+
if (p.missTop == true) {
|
303
|
+
p.top = p.top + t.outerHeight() + this.outerHeight();
|
304
|
+
this.removeClass('drop-top');
|
305
|
+
}
|
306
|
+
|
307
|
+
if (p.missRight == true) {
|
308
|
+
p.left = p.left - this.outerWidth() + t.outerWidth();
|
309
|
+
}
|
310
|
+
|
311
|
+
if (t.outerWidth() < this.outerWidth() || self.small() || this.hasClass(s.mega_menu)) {
|
312
|
+
self.adjust_pip(this, t, s, p);
|
313
|
+
}
|
314
|
+
|
315
|
+
if (Tennpipes.rtl) {
|
316
|
+
return {left : p.left - this.outerWidth() + t.outerWidth(),
|
317
|
+
top : p.top - this.outerHeight()};
|
318
|
+
}
|
319
|
+
|
320
|
+
return {left : p.left, top : p.top - this.outerHeight()};
|
321
|
+
},
|
322
|
+
|
323
|
+
bottom : function (t, s) {
|
324
|
+
var self = Tennpipes.libs.dropdown,
|
325
|
+
p = self.dirs._base.call(this, t);
|
326
|
+
|
327
|
+
if (p.missRight == true) {
|
328
|
+
p.left = p.left - this.outerWidth() + t.outerWidth();
|
329
|
+
}
|
330
|
+
|
331
|
+
if (t.outerWidth() < this.outerWidth() || self.small() || this.hasClass(s.mega_menu)) {
|
332
|
+
self.adjust_pip(this, t, s, p);
|
333
|
+
}
|
334
|
+
|
335
|
+
if (self.rtl) {
|
336
|
+
return {left : p.left - this.outerWidth() + t.outerWidth(), top : p.top + t.outerHeight()};
|
337
|
+
}
|
338
|
+
|
339
|
+
return {left : p.left, top : p.top + t.outerHeight()};
|
340
|
+
},
|
341
|
+
|
342
|
+
left : function (t, s) {
|
343
|
+
var p = Tennpipes.libs.dropdown.dirs._base.call(this, t);
|
344
|
+
|
345
|
+
this.addClass('drop-left');
|
346
|
+
|
347
|
+
if (p.missLeft == true) {
|
348
|
+
p.left = p.left + this.outerWidth();
|
349
|
+
p.top = p.top + t.outerHeight();
|
350
|
+
this.removeClass('drop-left');
|
351
|
+
}
|
352
|
+
|
353
|
+
return {left : p.left - this.outerWidth(), top : p.top};
|
354
|
+
},
|
355
|
+
|
356
|
+
right : function (t, s) {
|
357
|
+
var p = Tennpipes.libs.dropdown.dirs._base.call(this, t);
|
358
|
+
|
359
|
+
this.addClass('drop-right');
|
360
|
+
|
361
|
+
if (p.missRight == true) {
|
362
|
+
p.left = p.left - this.outerWidth();
|
363
|
+
p.top = p.top + t.outerHeight();
|
364
|
+
this.removeClass('drop-right');
|
365
|
+
} else {
|
366
|
+
p.triggeredRight = true;
|
367
|
+
}
|
368
|
+
|
369
|
+
var self = Tennpipes.libs.dropdown;
|
370
|
+
|
371
|
+
if (t.outerWidth() < this.outerWidth() || self.small() || this.hasClass(s.mega_menu)) {
|
372
|
+
self.adjust_pip(this, t, s, p);
|
373
|
+
}
|
374
|
+
|
375
|
+
return {left : p.left + t.outerWidth(), top : p.top};
|
376
|
+
}
|
377
|
+
},
|
378
|
+
|
379
|
+
// Insert rule to style psuedo elements
|
380
|
+
adjust_pip : function (dropdown, target, settings, position) {
|
381
|
+
var sheet = Tennpipes.stylesheet,
|
382
|
+
pip_offset_base = 8;
|
383
|
+
|
384
|
+
if (dropdown.hasClass(settings.mega_class)) {
|
385
|
+
pip_offset_base = position.left + (target.outerWidth() / 2) - 8;
|
386
|
+
} else if (this.small()) {
|
387
|
+
pip_offset_base += position.left - 8;
|
388
|
+
}
|
389
|
+
|
390
|
+
this.rule_idx = sheet.cssRules.length;
|
391
|
+
|
392
|
+
//default
|
393
|
+
var sel_before = '.f-dropdown.open:before',
|
394
|
+
sel_after = '.f-dropdown.open:after',
|
395
|
+
css_before = 'left: ' + pip_offset_base + 'px;',
|
396
|
+
css_after = 'left: ' + (pip_offset_base - 1) + 'px;';
|
397
|
+
|
398
|
+
if (position.missRight == true) {
|
399
|
+
pip_offset_base = dropdown.outerWidth() - 23;
|
400
|
+
sel_before = '.f-dropdown.open:before',
|
401
|
+
sel_after = '.f-dropdown.open:after',
|
402
|
+
css_before = 'left: ' + pip_offset_base + 'px;',
|
403
|
+
css_after = 'left: ' + (pip_offset_base - 1) + 'px;';
|
404
|
+
}
|
405
|
+
|
406
|
+
//just a case where right is fired, but its not missing right
|
407
|
+
if (position.triggeredRight == true) {
|
408
|
+
sel_before = '.f-dropdown.open:before',
|
409
|
+
sel_after = '.f-dropdown.open:after',
|
410
|
+
css_before = 'left:-12px;',
|
411
|
+
css_after = 'left:-14px;';
|
412
|
+
}
|
413
|
+
|
414
|
+
if (sheet.insertRule) {
|
415
|
+
sheet.insertRule([sel_before, '{', css_before, '}'].join(' '), this.rule_idx);
|
416
|
+
sheet.insertRule([sel_after, '{', css_after, '}'].join(' '), this.rule_idx + 1);
|
417
|
+
} else {
|
418
|
+
sheet.addRule(sel_before, css_before, this.rule_idx);
|
419
|
+
sheet.addRule(sel_after, css_after, this.rule_idx + 1);
|
420
|
+
}
|
421
|
+
},
|
422
|
+
|
423
|
+
// Remove old dropdown rule index
|
424
|
+
clear_idx : function () {
|
425
|
+
var sheet = Tennpipes.stylesheet;
|
426
|
+
|
427
|
+
if (typeof this.rule_idx !== 'undefined') {
|
428
|
+
sheet.deleteRule(this.rule_idx);
|
429
|
+
sheet.deleteRule(this.rule_idx);
|
430
|
+
delete this.rule_idx;
|
431
|
+
}
|
432
|
+
},
|
433
|
+
|
434
|
+
small : function () {
|
435
|
+
return matchMedia(Tennpipes.media_queries.small).matches &&
|
436
|
+
!matchMedia(Tennpipes.media_queries.medium).matches;
|
437
|
+
},
|
438
|
+
|
439
|
+
off : function () {
|
440
|
+
this.S(this.scope).off('.fndtn.dropdown');
|
441
|
+
this.S('html, body').off('.fndtn.dropdown');
|
442
|
+
this.S(window).off('.fndtn.dropdown');
|
443
|
+
this.S('[data-dropdown-content]').off('.fndtn.dropdown');
|
444
|
+
},
|
445
|
+
|
446
|
+
reflow : function () {}
|
447
|
+
};
|
448
|
+
}(jQuery, window, window.document));
|
data/lib/tennpipes-init/generators/project/public/javascripts/tennpipes/tennpipes.equalizer.js
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
;(function ($, window, document, undefined) {
|
2
|
+
'use strict';
|
3
|
+
|
4
|
+
Tennpipes.libs.equalizer = {
|
5
|
+
name : 'equalizer',
|
6
|
+
|
7
|
+
version : '5.5.1',
|
8
|
+
|
9
|
+
settings : {
|
10
|
+
use_tallest : true,
|
11
|
+
before_height_change : $.noop,
|
12
|
+
after_height_change : $.noop,
|
13
|
+
equalize_on_stack : false
|
14
|
+
},
|
15
|
+
|
16
|
+
init : function (scope, method, options) {
|
17
|
+
Tennpipes.inherit(this, 'image_loaded');
|
18
|
+
this.bindings(method, options);
|
19
|
+
this.reflow();
|
20
|
+
},
|
21
|
+
|
22
|
+
events : function () {
|
23
|
+
this.S(window).off('.equalizer').on('resize.fndtn.equalizer', function (e) {
|
24
|
+
this.reflow();
|
25
|
+
}.bind(this));
|
26
|
+
},
|
27
|
+
|
28
|
+
equalize : function (equalizer) {
|
29
|
+
var isStacked = false,
|
30
|
+
vals = equalizer.find('[' + this.attr_name() + '-watch]:visible'),
|
31
|
+
settings = equalizer.data(this.attr_name(true) + '-init');
|
32
|
+
|
33
|
+
if (vals.length === 0) {
|
34
|
+
return;
|
35
|
+
}
|
36
|
+
var firstTopOffset = vals.first().offset().top;
|
37
|
+
settings.before_height_change();
|
38
|
+
equalizer.trigger('before-height-change').trigger('before-height-change.fndth.equalizer');
|
39
|
+
vals.height('inherit');
|
40
|
+
vals.each(function () {
|
41
|
+
var el = $(this);
|
42
|
+
if (el.offset().top !== firstTopOffset) {
|
43
|
+
isStacked = true;
|
44
|
+
}
|
45
|
+
});
|
46
|
+
|
47
|
+
if (settings.equalize_on_stack === false) {
|
48
|
+
if (isStacked) {
|
49
|
+
return;
|
50
|
+
}
|
51
|
+
};
|
52
|
+
|
53
|
+
var heights = vals.map(function () { return $(this).outerHeight(false) }).get();
|
54
|
+
|
55
|
+
if (settings.use_tallest) {
|
56
|
+
var max = Math.max.apply(null, heights);
|
57
|
+
vals.css('height', max);
|
58
|
+
} else {
|
59
|
+
var min = Math.min.apply(null, heights);
|
60
|
+
vals.css('height', min);
|
61
|
+
}
|
62
|
+
settings.after_height_change();
|
63
|
+
equalizer.trigger('after-height-change').trigger('after-height-change.fndtn.equalizer');
|
64
|
+
},
|
65
|
+
|
66
|
+
reflow : function () {
|
67
|
+
var self = this;
|
68
|
+
|
69
|
+
this.S('[' + this.attr_name() + ']', this.scope).each(function () {
|
70
|
+
var $eq_target = $(this);
|
71
|
+
self.image_loaded(self.S('img', this), function () {
|
72
|
+
self.equalize($eq_target)
|
73
|
+
});
|
74
|
+
});
|
75
|
+
}
|
76
|
+
};
|
77
|
+
})(jQuery, window, window.document);
|