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,471 @@
|
|
1
|
+
;(function ($, window, document, undefined) {
|
2
|
+
'use strict';
|
3
|
+
|
4
|
+
Tennpipes.libs.reveal = {
|
5
|
+
name : 'reveal',
|
6
|
+
|
7
|
+
version : '5.5.1',
|
8
|
+
|
9
|
+
locked : false,
|
10
|
+
|
11
|
+
settings : {
|
12
|
+
animation : 'fadeAndPop',
|
13
|
+
animation_speed : 250,
|
14
|
+
close_on_background_click : true,
|
15
|
+
close_on_esc : true,
|
16
|
+
dismiss_modal_class : 'close-reveal-modal',
|
17
|
+
multiple_opened : false,
|
18
|
+
bg_class : 'reveal-modal-bg',
|
19
|
+
root_element : 'body',
|
20
|
+
open : function(){},
|
21
|
+
opened : function(){},
|
22
|
+
close : function(){},
|
23
|
+
closed : function(){},
|
24
|
+
bg : $('.reveal-modal-bg'),
|
25
|
+
css : {
|
26
|
+
open : {
|
27
|
+
'opacity' : 0,
|
28
|
+
'visibility' : 'visible',
|
29
|
+
'display' : 'block'
|
30
|
+
},
|
31
|
+
close : {
|
32
|
+
'opacity' : 1,
|
33
|
+
'visibility' : 'hidden',
|
34
|
+
'display' : 'none'
|
35
|
+
}
|
36
|
+
}
|
37
|
+
},
|
38
|
+
|
39
|
+
init : function (scope, method, options) {
|
40
|
+
$.extend(true, this.settings, method, options);
|
41
|
+
this.bindings(method, options);
|
42
|
+
},
|
43
|
+
|
44
|
+
events : function (scope) {
|
45
|
+
var self = this,
|
46
|
+
S = self.S;
|
47
|
+
|
48
|
+
S(this.scope)
|
49
|
+
.off('.reveal')
|
50
|
+
.on('click.fndtn.reveal', '[' + this.add_namespace('data-reveal-id') + ']:not([disabled])', function (e) {
|
51
|
+
e.preventDefault();
|
52
|
+
|
53
|
+
if (!self.locked) {
|
54
|
+
var element = S(this),
|
55
|
+
ajax = element.data(self.data_attr('reveal-ajax'));
|
56
|
+
|
57
|
+
self.locked = true;
|
58
|
+
|
59
|
+
if (typeof ajax === 'undefined') {
|
60
|
+
self.open.call(self, element);
|
61
|
+
} else {
|
62
|
+
var url = ajax === true ? element.attr('href') : ajax;
|
63
|
+
|
64
|
+
self.open.call(self, element, {url : url});
|
65
|
+
}
|
66
|
+
}
|
67
|
+
});
|
68
|
+
|
69
|
+
S(document)
|
70
|
+
.on('click.fndtn.reveal', this.close_targets(), function (e) {
|
71
|
+
e.preventDefault();
|
72
|
+
if (!self.locked) {
|
73
|
+
var settings = S('[' + self.attr_name() + '].open').data(self.attr_name(true) + '-init') || self.settings,
|
74
|
+
bg_clicked = S(e.target)[0] === S('.' + settings.bg_class)[0];
|
75
|
+
|
76
|
+
if (bg_clicked) {
|
77
|
+
if (settings.close_on_background_click) {
|
78
|
+
e.stopPropagation();
|
79
|
+
} else {
|
80
|
+
return;
|
81
|
+
}
|
82
|
+
}
|
83
|
+
|
84
|
+
self.locked = true;
|
85
|
+
self.close.call(self, bg_clicked ? S('[' + self.attr_name() + '].open') : S(this).closest('[' + self.attr_name() + ']'));
|
86
|
+
}
|
87
|
+
});
|
88
|
+
|
89
|
+
if (S('[' + self.attr_name() + ']', this.scope).length > 0) {
|
90
|
+
S(this.scope)
|
91
|
+
// .off('.reveal')
|
92
|
+
.on('open.fndtn.reveal', this.settings.open)
|
93
|
+
.on('opened.fndtn.reveal', this.settings.opened)
|
94
|
+
.on('opened.fndtn.reveal', this.open_video)
|
95
|
+
.on('close.fndtn.reveal', this.settings.close)
|
96
|
+
.on('closed.fndtn.reveal', this.settings.closed)
|
97
|
+
.on('closed.fndtn.reveal', this.close_video);
|
98
|
+
} else {
|
99
|
+
S(this.scope)
|
100
|
+
// .off('.reveal')
|
101
|
+
.on('open.fndtn.reveal', '[' + self.attr_name() + ']', this.settings.open)
|
102
|
+
.on('opened.fndtn.reveal', '[' + self.attr_name() + ']', this.settings.opened)
|
103
|
+
.on('opened.fndtn.reveal', '[' + self.attr_name() + ']', this.open_video)
|
104
|
+
.on('close.fndtn.reveal', '[' + self.attr_name() + ']', this.settings.close)
|
105
|
+
.on('closed.fndtn.reveal', '[' + self.attr_name() + ']', this.settings.closed)
|
106
|
+
.on('closed.fndtn.reveal', '[' + self.attr_name() + ']', this.close_video);
|
107
|
+
}
|
108
|
+
|
109
|
+
return true;
|
110
|
+
},
|
111
|
+
|
112
|
+
// PATCH #3: turning on key up capture only when a reveal window is open
|
113
|
+
key_up_on : function (scope) {
|
114
|
+
var self = this;
|
115
|
+
|
116
|
+
// PATCH #1: fixing multiple keyup event trigger from single key press
|
117
|
+
self.S('body').off('keyup.fndtn.reveal').on('keyup.fndtn.reveal', function ( event ) {
|
118
|
+
var open_modal = self.S('[' + self.attr_name() + '].open'),
|
119
|
+
settings = open_modal.data(self.attr_name(true) + '-init') || self.settings ;
|
120
|
+
// PATCH #2: making sure that the close event can be called only while unlocked,
|
121
|
+
// so that multiple keyup.fndtn.reveal events don't prevent clean closing of the reveal window.
|
122
|
+
if ( settings && event.which === 27 && settings.close_on_esc && !self.locked) { // 27 is the keycode for the Escape key
|
123
|
+
self.close.call(self, open_modal);
|
124
|
+
}
|
125
|
+
});
|
126
|
+
|
127
|
+
return true;
|
128
|
+
},
|
129
|
+
|
130
|
+
// PATCH #3: turning on key up capture only when a reveal window is open
|
131
|
+
key_up_off : function (scope) {
|
132
|
+
this.S('body').off('keyup.fndtn.reveal');
|
133
|
+
return true;
|
134
|
+
},
|
135
|
+
|
136
|
+
open : function (target, ajax_settings) {
|
137
|
+
var self = this,
|
138
|
+
modal;
|
139
|
+
|
140
|
+
if (target) {
|
141
|
+
if (typeof target.selector !== 'undefined') {
|
142
|
+
// Find the named node; only use the first one found, since the rest of the code assumes there's only one node
|
143
|
+
modal = self.S('#' + target.data(self.data_attr('reveal-id'))).first();
|
144
|
+
} else {
|
145
|
+
modal = self.S(this.scope);
|
146
|
+
|
147
|
+
ajax_settings = target;
|
148
|
+
}
|
149
|
+
} else {
|
150
|
+
modal = self.S(this.scope);
|
151
|
+
}
|
152
|
+
|
153
|
+
var settings = modal.data(self.attr_name(true) + '-init');
|
154
|
+
settings = settings || this.settings;
|
155
|
+
|
156
|
+
if (modal.hasClass('open') && target.attr('data-reveal-id') == modal.attr('id')) {
|
157
|
+
return self.close(modal);
|
158
|
+
}
|
159
|
+
|
160
|
+
if (!modal.hasClass('open')) {
|
161
|
+
var open_modal = self.S('[' + self.attr_name() + '].open');
|
162
|
+
|
163
|
+
if (typeof modal.data('css-top') === 'undefined') {
|
164
|
+
modal.data('css-top', parseInt(modal.css('top'), 10))
|
165
|
+
.data('offset', this.cache_offset(modal));
|
166
|
+
}
|
167
|
+
|
168
|
+
this.key_up_on(modal); // PATCH #3: turning on key up capture only when a reveal window is open
|
169
|
+
|
170
|
+
modal.on('open.fndtn.reveal').trigger('open.fndtn.reveal');
|
171
|
+
|
172
|
+
if (open_modal.length < 1) {
|
173
|
+
this.toggle_bg(modal, true);
|
174
|
+
}
|
175
|
+
|
176
|
+
if (typeof ajax_settings === 'string') {
|
177
|
+
ajax_settings = {
|
178
|
+
url : ajax_settings
|
179
|
+
};
|
180
|
+
}
|
181
|
+
|
182
|
+
if (typeof ajax_settings === 'undefined' || !ajax_settings.url) {
|
183
|
+
if (open_modal.length > 0) {
|
184
|
+
if (settings.multiple_opened) {
|
185
|
+
this.to_back(open_modal);
|
186
|
+
} else {
|
187
|
+
this.hide(open_modal, settings.css.close);
|
188
|
+
}
|
189
|
+
}
|
190
|
+
|
191
|
+
this.show(modal, settings.css.open);
|
192
|
+
} else {
|
193
|
+
var old_success = typeof ajax_settings.success !== 'undefined' ? ajax_settings.success : null;
|
194
|
+
|
195
|
+
$.extend(ajax_settings, {
|
196
|
+
success : function (data, textStatus, jqXHR) {
|
197
|
+
if ( $.isFunction(old_success) ) {
|
198
|
+
var result = old_success(data, textStatus, jqXHR);
|
199
|
+
if (typeof result == 'string') {
|
200
|
+
data = result;
|
201
|
+
}
|
202
|
+
}
|
203
|
+
|
204
|
+
modal.html(data);
|
205
|
+
self.S(modal).tennpipes('section', 'reflow');
|
206
|
+
self.S(modal).children().tennpipes();
|
207
|
+
|
208
|
+
if (open_modal.length > 0) {
|
209
|
+
if (settings.multiple_opened) {
|
210
|
+
this.to_back(open_modal);
|
211
|
+
} else {
|
212
|
+
this.hide(open_modal, settings.css.close);
|
213
|
+
}
|
214
|
+
}
|
215
|
+
self.show(modal, settings.css.open);
|
216
|
+
}
|
217
|
+
});
|
218
|
+
|
219
|
+
$.ajax(ajax_settings);
|
220
|
+
}
|
221
|
+
}
|
222
|
+
self.S(window).trigger('resize');
|
223
|
+
},
|
224
|
+
|
225
|
+
close : function (modal) {
|
226
|
+
var modal = modal && modal.length ? modal : this.S(this.scope),
|
227
|
+
open_modals = this.S('[' + this.attr_name() + '].open'),
|
228
|
+
settings = modal.data(this.attr_name(true) + '-init') || this.settings;
|
229
|
+
|
230
|
+
if (open_modals.length > 0) {
|
231
|
+
this.locked = true;
|
232
|
+
this.key_up_off(modal); // PATCH #3: turning on key up capture only when a reveal window is open
|
233
|
+
modal.trigger('close').trigger('close.fndtn.reveal');
|
234
|
+
|
235
|
+
if ((settings.multiple_opened && open_modals.length === 1) || !settings.multiple_opened || modal.length > 1) {
|
236
|
+
this.toggle_bg(modal, false);
|
237
|
+
this.to_front(modal);
|
238
|
+
}
|
239
|
+
|
240
|
+
if (settings.multiple_opened) {
|
241
|
+
this.hide(modal, settings.css.close, settings);
|
242
|
+
this.to_front($($.makeArray(open_modals).reverse()[1]));
|
243
|
+
} else {
|
244
|
+
this.hide(open_modals, settings.css.close, settings);
|
245
|
+
}
|
246
|
+
}
|
247
|
+
},
|
248
|
+
|
249
|
+
close_targets : function () {
|
250
|
+
var base = '.' + this.settings.dismiss_modal_class;
|
251
|
+
|
252
|
+
if (this.settings.close_on_background_click) {
|
253
|
+
return base + ', .' + this.settings.bg_class;
|
254
|
+
}
|
255
|
+
|
256
|
+
return base;
|
257
|
+
},
|
258
|
+
|
259
|
+
toggle_bg : function (modal, state) {
|
260
|
+
if (this.S('.' + this.settings.bg_class).length === 0) {
|
261
|
+
this.settings.bg = $('<div />', {'class': this.settings.bg_class})
|
262
|
+
.appendTo('body').hide();
|
263
|
+
}
|
264
|
+
|
265
|
+
var visible = this.settings.bg.filter(':visible').length > 0;
|
266
|
+
if ( state != visible ) {
|
267
|
+
if ( state == undefined ? visible : !state ) {
|
268
|
+
this.hide(this.settings.bg);
|
269
|
+
} else {
|
270
|
+
this.show(this.settings.bg);
|
271
|
+
}
|
272
|
+
}
|
273
|
+
},
|
274
|
+
|
275
|
+
show : function (el, css) {
|
276
|
+
// is modal
|
277
|
+
if (css) {
|
278
|
+
var settings = el.data(this.attr_name(true) + '-init') || this.settings,
|
279
|
+
root_element = settings.root_element;
|
280
|
+
|
281
|
+
if (el.parent(root_element).length === 0) {
|
282
|
+
var placeholder = el.wrap('<div style="display: none;" />').parent();
|
283
|
+
|
284
|
+
el.on('closed.fndtn.reveal.wrapped', function () {
|
285
|
+
el.detach().appendTo(placeholder);
|
286
|
+
el.unwrap().unbind('closed.fndtn.reveal.wrapped');
|
287
|
+
});
|
288
|
+
|
289
|
+
el.detach().appendTo(root_element);
|
290
|
+
}
|
291
|
+
|
292
|
+
var animData = getAnimationData(settings.animation);
|
293
|
+
if (!animData.animate) {
|
294
|
+
this.locked = false;
|
295
|
+
}
|
296
|
+
if (animData.pop) {
|
297
|
+
css.top = $(window).scrollTop() - el.data('offset') + 'px';
|
298
|
+
var end_css = {
|
299
|
+
top: $(window).scrollTop() + el.data('css-top') + 'px',
|
300
|
+
opacity: 1
|
301
|
+
};
|
302
|
+
|
303
|
+
return setTimeout(function () {
|
304
|
+
return el
|
305
|
+
.css(css)
|
306
|
+
.animate(end_css, settings.animation_speed, 'linear', function () {
|
307
|
+
this.locked = false;
|
308
|
+
el.trigger('opened').trigger('opened.fndtn.reveal');
|
309
|
+
}.bind(this))
|
310
|
+
.addClass('open');
|
311
|
+
}.bind(this), settings.animation_speed / 2);
|
312
|
+
}
|
313
|
+
|
314
|
+
if (animData.fade) {
|
315
|
+
css.top = $(window).scrollTop() + el.data('css-top') + 'px';
|
316
|
+
var end_css = {opacity: 1};
|
317
|
+
|
318
|
+
return setTimeout(function () {
|
319
|
+
return el
|
320
|
+
.css(css)
|
321
|
+
.animate(end_css, settings.animation_speed, 'linear', function () {
|
322
|
+
this.locked = false;
|
323
|
+
el.trigger('opened').trigger('opened.fndtn.reveal');
|
324
|
+
}.bind(this))
|
325
|
+
.addClass('open');
|
326
|
+
}.bind(this), settings.animation_speed / 2);
|
327
|
+
}
|
328
|
+
|
329
|
+
return el.css(css).show().css({opacity : 1}).addClass('open').trigger('opened').trigger('opened.fndtn.reveal');
|
330
|
+
}
|
331
|
+
|
332
|
+
var settings = this.settings;
|
333
|
+
|
334
|
+
// should we animate the background?
|
335
|
+
if (getAnimationData(settings.animation).fade) {
|
336
|
+
return el.fadeIn(settings.animation_speed / 2);
|
337
|
+
}
|
338
|
+
|
339
|
+
this.locked = false;
|
340
|
+
|
341
|
+
return el.show();
|
342
|
+
},
|
343
|
+
|
344
|
+
to_back : function(el) {
|
345
|
+
el.addClass('toback');
|
346
|
+
},
|
347
|
+
|
348
|
+
to_front : function(el) {
|
349
|
+
el.removeClass('toback');
|
350
|
+
},
|
351
|
+
|
352
|
+
hide : function (el, css) {
|
353
|
+
// is modal
|
354
|
+
if (css) {
|
355
|
+
var settings = el.data(this.attr_name(true) + '-init');
|
356
|
+
settings = settings || this.settings;
|
357
|
+
|
358
|
+
var animData = getAnimationData(settings.animation);
|
359
|
+
if (!animData.animate) {
|
360
|
+
this.locked = false;
|
361
|
+
}
|
362
|
+
if (animData.pop) {
|
363
|
+
var end_css = {
|
364
|
+
top: - $(window).scrollTop() - el.data('offset') + 'px',
|
365
|
+
opacity: 0
|
366
|
+
};
|
367
|
+
|
368
|
+
return setTimeout(function () {
|
369
|
+
return el
|
370
|
+
.animate(end_css, settings.animation_speed, 'linear', function () {
|
371
|
+
this.locked = false;
|
372
|
+
el.css(css).trigger('closed').trigger('closed.fndtn.reveal');
|
373
|
+
}.bind(this))
|
374
|
+
.removeClass('open');
|
375
|
+
}.bind(this), settings.animation_speed / 2);
|
376
|
+
}
|
377
|
+
|
378
|
+
if (animData.fade) {
|
379
|
+
var end_css = {opacity : 0};
|
380
|
+
|
381
|
+
return setTimeout(function () {
|
382
|
+
return el
|
383
|
+
.animate(end_css, settings.animation_speed, 'linear', function () {
|
384
|
+
this.locked = false;
|
385
|
+
el.css(css).trigger('closed').trigger('closed.fndtn.reveal');
|
386
|
+
}.bind(this))
|
387
|
+
.removeClass('open');
|
388
|
+
}.bind(this), settings.animation_speed / 2);
|
389
|
+
}
|
390
|
+
|
391
|
+
return el.hide().css(css).removeClass('open').trigger('closed').trigger('closed.fndtn.reveal');
|
392
|
+
}
|
393
|
+
|
394
|
+
var settings = this.settings;
|
395
|
+
|
396
|
+
// should we animate the background?
|
397
|
+
if (getAnimationData(settings.animation).fade) {
|
398
|
+
return el.fadeOut(settings.animation_speed / 2);
|
399
|
+
}
|
400
|
+
|
401
|
+
return el.hide();
|
402
|
+
},
|
403
|
+
|
404
|
+
close_video : function (e) {
|
405
|
+
var video = $('.flex-video', e.target),
|
406
|
+
iframe = $('iframe', video);
|
407
|
+
|
408
|
+
if (iframe.length > 0) {
|
409
|
+
iframe.attr('data-src', iframe[0].src);
|
410
|
+
iframe.attr('src', iframe.attr('src'));
|
411
|
+
video.hide();
|
412
|
+
}
|
413
|
+
},
|
414
|
+
|
415
|
+
open_video : function (e) {
|
416
|
+
var video = $('.flex-video', e.target),
|
417
|
+
iframe = video.find('iframe');
|
418
|
+
|
419
|
+
if (iframe.length > 0) {
|
420
|
+
var data_src = iframe.attr('data-src');
|
421
|
+
if (typeof data_src === 'string') {
|
422
|
+
iframe[0].src = iframe.attr('data-src');
|
423
|
+
} else {
|
424
|
+
var src = iframe[0].src;
|
425
|
+
iframe[0].src = undefined;
|
426
|
+
iframe[0].src = src;
|
427
|
+
}
|
428
|
+
video.show();
|
429
|
+
}
|
430
|
+
},
|
431
|
+
|
432
|
+
data_attr : function (str) {
|
433
|
+
if (this.namespace.length > 0) {
|
434
|
+
return this.namespace + '-' + str;
|
435
|
+
}
|
436
|
+
|
437
|
+
return str;
|
438
|
+
},
|
439
|
+
|
440
|
+
cache_offset : function (modal) {
|
441
|
+
var offset = modal.show().height() + parseInt(modal.css('top'), 10);
|
442
|
+
|
443
|
+
modal.hide();
|
444
|
+
|
445
|
+
return offset;
|
446
|
+
},
|
447
|
+
|
448
|
+
off : function () {
|
449
|
+
$(this.scope).off('.fndtn.reveal');
|
450
|
+
},
|
451
|
+
|
452
|
+
reflow : function () {}
|
453
|
+
};
|
454
|
+
|
455
|
+
/*
|
456
|
+
* getAnimationData('popAndFade') // {animate: true, pop: true, fade: true}
|
457
|
+
* getAnimationData('fade') // {animate: true, pop: false, fade: true}
|
458
|
+
* getAnimationData('pop') // {animate: true, pop: true, fade: false}
|
459
|
+
* getAnimationData('foo') // {animate: false, pop: false, fade: false}
|
460
|
+
* getAnimationData(null) // {animate: false, pop: false, fade: false}
|
461
|
+
*/
|
462
|
+
function getAnimationData(str) {
|
463
|
+
var fade = /fade/i.test(str);
|
464
|
+
var pop = /pop/i.test(str);
|
465
|
+
return {
|
466
|
+
animate : fade || pop,
|
467
|
+
pop : pop,
|
468
|
+
fade : fade
|
469
|
+
};
|
470
|
+
}
|
471
|
+
}(jQuery, window, window.document));
|