locomotivecms_wagon 2.0.0.rc3 → 2.0.0.rc4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/generators/blank/Gemfile.tt +8 -5
- data/generators/blank/Guardfile +22 -0
- data/generators/bootstrap/Gemfile.tt +7 -4
- data/generators/bootstrap/Guardfile +22 -0
- data/generators/bootstrap/public/stylesheets/bootstrap.css +1 -1
- data/generators/bootstrap/public/stylesheets/bootstrap.scss +1 -1
- data/generators/cloned/Gemfile.tt +7 -4
- data/generators/cloned/Guardfile +22 -0
- data/generators/foundation5/Gemfile.tt +7 -4
- data/generators/foundation5/Guardfile +22 -0
- data/lib/locomotive/wagon/cli.rb +1 -1
- data/lib/locomotive/wagon/commands/pull_sub_commands/concerns/assets_concern.rb +1 -1
- data/lib/locomotive/wagon/commands/push_sub_commands/push_theme_assets_command.rb +23 -3
- data/lib/locomotive/wagon/commands/serve_command.rb +2 -2
- data/lib/locomotive/wagon/version.rb +1 -1
- data/locomotivecms_wagon.gemspec +4 -3
- data/spec/fixtures/cassettes/authenticate.yml +27 -27
- data/spec/fixtures/cassettes/push.yml +1036 -1110
- data/spec/unit/commands/pull_sub_commands/concerns/assets_concern_spec.rb +24 -4
- data/spec/unit/commands/push_sub_commands/push_theme_assets_command_spec.rb +42 -0
- metadata +28 -99
- data/generators/foundation5/favicon.ico +0 -0
- data/generators/line_case/Gemfile.tt +0 -21
- data/generators/line_case/app/content_types/categories.yml +0 -56
- data/generators/line_case/app/content_types/emails.yml +0 -35
- data/generators/line_case/app/content_types/projects.yml +0 -58
- data/generators/line_case/app/views/pages/404.liquid.haml +0 -11
- data/generators/line_case/app/views/pages/email-registered.liquid.haml +0 -13
- data/generators/line_case/app/views/pages/index.liquid.haml +0 -110
- data/generators/line_case/app/views/pages/projects/content_type_template.liquid.haml +0 -32
- data/generators/line_case/app/views/snippets/newsletter_form.liquid.haml +0 -14
- data/generators/line_case/app/views/snippets/projects.liquid.haml +0 -17
- data/generators/line_case/app/views/snippets/social_links.liquid.haml +0 -19
- data/generators/line_case/config/deploy.yml +0 -15
- data/generators/line_case/config/site.yml.tt +0 -33
- data/generators/line_case/config/translations.yml +0 -8
- data/generators/line_case/data/categories.yml +0 -8
- data/generators/line_case/data/emails.yml +0 -2
- data/generators/line_case/data/projects.yml +0 -39
- data/generators/line_case/icon.png +0 -0
- data/generators/line_case/public/images/banner-header.png +0 -0
- data/generators/line_case/public/javascripts/foundation.min.js +0 -15
- data/generators/line_case/public/javascripts/foundation/foundation.abide.js +0 -194
- data/generators/line_case/public/javascripts/foundation/foundation.alerts.js +0 -57
- data/generators/line_case/public/javascripts/foundation/foundation.clearing.js +0 -516
- data/generators/line_case/public/javascripts/foundation/foundation.cookie.js +0 -74
- data/generators/line_case/public/javascripts/foundation/foundation.dropdown.js +0 -183
- data/generators/line_case/public/javascripts/foundation/foundation.forms.js +0 -556
- data/generators/line_case/public/javascripts/foundation/foundation.interchange.js +0 -280
- data/generators/line_case/public/javascripts/foundation/foundation.joyride.js +0 -852
- data/generators/line_case/public/javascripts/foundation/foundation.js +0 -464
- data/generators/line_case/public/javascripts/foundation/foundation.magellan.js +0 -136
- data/generators/line_case/public/javascripts/foundation/foundation.orbit.js +0 -432
- data/generators/line_case/public/javascripts/foundation/foundation.placeholder.js +0 -426
- data/generators/line_case/public/javascripts/foundation/foundation.reveal.js +0 -353
- data/generators/line_case/public/javascripts/foundation/foundation.section.js +0 -430
- data/generators/line_case/public/javascripts/foundation/foundation.tooltips.js +0 -209
- data/generators/line_case/public/javascripts/foundation/foundation.topbar.js +0 -370
- data/generators/line_case/public/javascripts/vendor/custom.modernizr.js +0 -4
- data/generators/line_case/public/javascripts/vendor/jquery.js +0 -9789
- data/generators/line_case/public/javascripts/vendor/zepto.js +0 -2000
- data/generators/line_case/public/samples/projects/sample.jpeg +0 -0
- data/generators/line_case/public/samples/projects/sample2.jpeg +0 -0
- data/generators/line_case/public/samples/projects/sample3.jpeg +0 -0
- data/generators/line_case/public/samples/projects/sample4.jpeg +0 -0
- data/generators/line_case/public/samples/projects/sample5.jpeg +0 -0
- data/generators/line_case/public/samples/projects/sample6.jpeg +0 -0
- data/generators/line_case/public/samples/projects/sample7.jpeg +0 -0
- data/generators/line_case/public/samples/projects/sample8.jpeg +0 -0
- data/generators/line_case/public/stylesheets/_variables.css.sass +0 -20
- data/generators/line_case/public/stylesheets/foundation.css.scss +0 -43
- data/generators/line_case/public/stylesheets/foundation.min.css +0 -1
- data/generators/line_case/public/stylesheets/foundation/_variables.scss +0 -1290
- data/generators/line_case/public/stylesheets/foundation/components/_alert-boxes.scss +0 -107
- data/generators/line_case/public/stylesheets/foundation/components/_block-grid.scss +0 -71
- data/generators/line_case/public/stylesheets/foundation/components/_breadcrumbs.scss +0 -124
- data/generators/line_case/public/stylesheets/foundation/components/_button-groups.scss +0 -89
- data/generators/line_case/public/stylesheets/foundation/components/_buttons.scss +0 -230
- data/generators/line_case/public/stylesheets/foundation/components/_clearing.scss +0 -227
- data/generators/line_case/public/stylesheets/foundation/components/_custom-forms.scss +0 -278
- data/generators/line_case/public/stylesheets/foundation/components/_dropdown-buttons.scss +0 -115
- data/generators/line_case/public/stylesheets/foundation/components/_dropdown.scss +0 -151
- data/generators/line_case/public/stylesheets/foundation/components/_flex-video.scss +0 -46
- data/generators/line_case/public/stylesheets/foundation/components/_forms.scss +0 -411
- data/generators/line_case/public/stylesheets/foundation/components/_global.scss +0 -366
- data/generators/line_case/public/stylesheets/foundation/components/_grid-5.scss +0 -214
- data/generators/line_case/public/stylesheets/foundation/components/_grid.scss +0 -188
- data/generators/line_case/public/stylesheets/foundation/components/_inline-lists.scss +0 -53
- data/generators/line_case/public/stylesheets/foundation/components/_joyride.scss +0 -217
- data/generators/line_case/public/stylesheets/foundation/components/_keystrokes.scss +0 -57
- data/generators/line_case/public/stylesheets/foundation/components/_labels.scss +0 -85
- data/generators/line_case/public/stylesheets/foundation/components/_magellan.scss +0 -23
- data/generators/line_case/public/stylesheets/foundation/components/_orbit.scss +0 -340
- data/generators/line_case/public/stylesheets/foundation/components/_pagination.scss +0 -140
- data/generators/line_case/public/stylesheets/foundation/components/_panels.scss +0 -83
- data/generators/line_case/public/stylesheets/foundation/components/_pricing-tables.scss +0 -131
- data/generators/line_case/public/stylesheets/foundation/components/_progress-bars.scss +0 -71
- data/generators/line_case/public/stylesheets/foundation/components/_reveal.scss +0 -136
- data/generators/line_case/public/stylesheets/foundation/components/_section.scss +0 -391
- data/generators/line_case/public/stylesheets/foundation/components/_side-nav.scss +0 -69
- data/generators/line_case/public/stylesheets/foundation/components/_split-buttons.scss +0 -167
- data/generators/line_case/public/stylesheets/foundation/components/_sub-nav.scss +0 -84
- data/generators/line_case/public/stylesheets/foundation/components/_switch.scss +0 -266
- data/generators/line_case/public/stylesheets/foundation/components/_tables.scss +0 -84
- data/generators/line_case/public/stylesheets/foundation/components/_thumbs.scss +0 -53
- data/generators/line_case/public/stylesheets/foundation/components/_tooltips.scss +0 -117
- data/generators/line_case/public/stylesheets/foundation/components/_top-bar.scss +0 -576
- data/generators/line_case/public/stylesheets/foundation/components/_type.scss +0 -435
- data/generators/line_case/public/stylesheets/foundation/components/_visibility.scss +0 -322
- data/generators/line_case/public/stylesheets/normalize.css.scss +0 -410
- data/generators/line_case/public/stylesheets/pages.css.sass +0 -163
- data/lib/locomotive/wagon/tools/livereload.rb +0 -45
@@ -1,426 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* The MIT License
|
3
|
-
*
|
4
|
-
* Copyright (c) 2012 James Allardice
|
5
|
-
*
|
6
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"),
|
7
|
-
* to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
8
|
-
* and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
9
|
-
*
|
10
|
-
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
11
|
-
*
|
12
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
13
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
14
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
15
|
-
* THE SOFTWARE.
|
16
|
-
*/
|
17
|
-
|
18
|
-
// Defines the global Placeholders object along with various utility methods
|
19
|
-
(function (global) {
|
20
|
-
|
21
|
-
"use strict";
|
22
|
-
|
23
|
-
// Cross-browser DOM event binding
|
24
|
-
function addEventListener(elem, event, fn) {
|
25
|
-
if (elem.addEventListener) {
|
26
|
-
return elem.addEventListener(event, fn, false);
|
27
|
-
}
|
28
|
-
if (elem.attachEvent) {
|
29
|
-
return elem.attachEvent("on" + event, fn);
|
30
|
-
}
|
31
|
-
}
|
32
|
-
|
33
|
-
// Check whether an item is in an array (we don't use Array.prototype.indexOf so we don't clobber any existing polyfills - this is a really simple alternative)
|
34
|
-
function inArray(arr, item) {
|
35
|
-
var i, len;
|
36
|
-
for (i = 0, len = arr.length; i < len; i++) {
|
37
|
-
if (arr[i] === item) {
|
38
|
-
return true;
|
39
|
-
}
|
40
|
-
}
|
41
|
-
return false;
|
42
|
-
}
|
43
|
-
|
44
|
-
// Move the caret to the index position specified. Assumes that the element has focus
|
45
|
-
function moveCaret(elem, index) {
|
46
|
-
var range;
|
47
|
-
if (elem.createTextRange) {
|
48
|
-
range = elem.createTextRange();
|
49
|
-
range.move("character", index);
|
50
|
-
range.select();
|
51
|
-
} else if (elem.selectionStart) {
|
52
|
-
elem.focus();
|
53
|
-
elem.setSelectionRange(index, index);
|
54
|
-
}
|
55
|
-
}
|
56
|
-
|
57
|
-
// Attempt to change the type property of an input element
|
58
|
-
function changeType(elem, type) {
|
59
|
-
try {
|
60
|
-
elem.type = type;
|
61
|
-
return true;
|
62
|
-
} catch (e) {
|
63
|
-
// You can't change input type in IE8 and below
|
64
|
-
return false;
|
65
|
-
}
|
66
|
-
}
|
67
|
-
|
68
|
-
// Expose public methods
|
69
|
-
global.Placeholders = {
|
70
|
-
Utils: {
|
71
|
-
addEventListener: addEventListener,
|
72
|
-
inArray: inArray,
|
73
|
-
moveCaret: moveCaret,
|
74
|
-
changeType: changeType
|
75
|
-
}
|
76
|
-
};
|
77
|
-
|
78
|
-
}(this));
|
79
|
-
|
80
|
-
(function (global) {
|
81
|
-
|
82
|
-
"use strict";
|
83
|
-
|
84
|
-
var validTypes = [
|
85
|
-
"text",
|
86
|
-
"search",
|
87
|
-
"url",
|
88
|
-
"tel",
|
89
|
-
"email",
|
90
|
-
"password",
|
91
|
-
"number",
|
92
|
-
"textarea"
|
93
|
-
],
|
94
|
-
|
95
|
-
// The list of keycodes that are not allowed when the polyfill is configured to hide-on-input
|
96
|
-
badKeys = [
|
97
|
-
|
98
|
-
// The following keys all cause the caret to jump to the end of the input value
|
99
|
-
27, // Escape
|
100
|
-
33, // Page up
|
101
|
-
34, // Page down
|
102
|
-
35, // End
|
103
|
-
36, // Home
|
104
|
-
|
105
|
-
// Arrow keys allow you to move the caret manually, which should be prevented when the placeholder is visible
|
106
|
-
37, // Left
|
107
|
-
38, // Up
|
108
|
-
39, // Right
|
109
|
-
40, // Down
|
110
|
-
|
111
|
-
// The following keys allow you to modify the placeholder text by removing characters, which should be prevented when the placeholder is visible
|
112
|
-
8, // Backspace
|
113
|
-
46 // Delete
|
114
|
-
],
|
115
|
-
|
116
|
-
// Styling variables
|
117
|
-
placeholderStyleColor = "#ccc",
|
118
|
-
placeholderClassName = "placeholdersjs",
|
119
|
-
classNameRegExp = new RegExp("(?:^|\\s)" + placeholderClassName + "(?!\\S)"),
|
120
|
-
|
121
|
-
// These will hold references to all elements that can be affected. NodeList objects are live, so we only need to get those references once
|
122
|
-
inputs, textareas,
|
123
|
-
|
124
|
-
// The various data-* attributes used by the polyfill
|
125
|
-
ATTR_CURRENT_VAL = "data-placeholder-value",
|
126
|
-
ATTR_ACTIVE = "data-placeholder-active",
|
127
|
-
ATTR_INPUT_TYPE = "data-placeholder-type",
|
128
|
-
ATTR_FORM_HANDLED = "data-placeholder-submit",
|
129
|
-
ATTR_EVENTS_BOUND = "data-placeholder-bound",
|
130
|
-
ATTR_OPTION_FOCUS = "data-placeholder-focus",
|
131
|
-
ATTR_OPTION_LIVE = "data-placeholder-live",
|
132
|
-
|
133
|
-
// Various other variables used throughout the rest of the script
|
134
|
-
test = document.createElement("input"),
|
135
|
-
head = document.getElementsByTagName("head")[0],
|
136
|
-
root = document.documentElement,
|
137
|
-
Placeholders = global.Placeholders,
|
138
|
-
Utils = Placeholders.Utils,
|
139
|
-
hideOnInput, liveUpdates, keydownVal, styleElem, styleRules, placeholder, timer, form, elem, len, i;
|
140
|
-
|
141
|
-
// No-op (used in place of public methods when native support is detected)
|
142
|
-
function noop() {}
|
143
|
-
|
144
|
-
// Hide the placeholder value on a single element. Returns true if the placeholder was hidden and false if it was not (because it wasn't visible in the first place)
|
145
|
-
function hidePlaceholder(elem) {
|
146
|
-
var type;
|
147
|
-
if (elem.value === elem.getAttribute(ATTR_CURRENT_VAL) && elem.getAttribute(ATTR_ACTIVE) === "true") {
|
148
|
-
elem.setAttribute(ATTR_ACTIVE, "false");
|
149
|
-
elem.value = "";
|
150
|
-
elem.className = elem.className.replace(classNameRegExp, "");
|
151
|
-
|
152
|
-
// If the polyfill has changed the type of the element we need to change it back
|
153
|
-
type = elem.getAttribute(ATTR_INPUT_TYPE);
|
154
|
-
if (type) {
|
155
|
-
elem.type = type;
|
156
|
-
}
|
157
|
-
return true;
|
158
|
-
}
|
159
|
-
return false;
|
160
|
-
}
|
161
|
-
|
162
|
-
// Show the placeholder value on a single element. Returns true if the placeholder was shown and false if it was not (because it was already visible)
|
163
|
-
function showPlaceholder(elem) {
|
164
|
-
var type,
|
165
|
-
val = elem.getAttribute(ATTR_CURRENT_VAL);
|
166
|
-
if (elem.value === "" && val) {
|
167
|
-
elem.setAttribute(ATTR_ACTIVE, "true");
|
168
|
-
elem.value = val;
|
169
|
-
elem.className += " " + placeholderClassName;
|
170
|
-
|
171
|
-
// If the type of element needs to change, change it (e.g. password inputs)
|
172
|
-
type = elem.getAttribute(ATTR_INPUT_TYPE);
|
173
|
-
if (type) {
|
174
|
-
elem.type = "text";
|
175
|
-
} else if (elem.type === "password") {
|
176
|
-
if (Utils.changeType(elem, "text")) {
|
177
|
-
elem.setAttribute(ATTR_INPUT_TYPE, "password");
|
178
|
-
}
|
179
|
-
}
|
180
|
-
return true;
|
181
|
-
}
|
182
|
-
return false;
|
183
|
-
}
|
184
|
-
|
185
|
-
function handleElem(node, callback) {
|
186
|
-
|
187
|
-
var handleInputs, handleTextareas, elem, len, i;
|
188
|
-
|
189
|
-
// Check if the passed in node is an input/textarea (in which case it can't have any affected descendants)
|
190
|
-
if (node && node.getAttribute(ATTR_CURRENT_VAL)) {
|
191
|
-
callback(node);
|
192
|
-
} else {
|
193
|
-
|
194
|
-
// If an element was passed in, get all affected descendants. Otherwise, get all affected elements in document
|
195
|
-
handleInputs = node ? node.getElementsByTagName("input") : inputs;
|
196
|
-
handleTextareas = node ? node.getElementsByTagName("textarea") : textareas;
|
197
|
-
|
198
|
-
// Run the callback for each element
|
199
|
-
for (i = 0, len = handleInputs.length + handleTextareas.length; i < len; i++) {
|
200
|
-
elem = i < handleInputs.length ? handleInputs[i] : handleTextareas[i - handleInputs.length];
|
201
|
-
callback(elem);
|
202
|
-
}
|
203
|
-
}
|
204
|
-
}
|
205
|
-
|
206
|
-
// Return all affected elements to their normal state (remove placeholder value if present)
|
207
|
-
function disablePlaceholders(node) {
|
208
|
-
handleElem(node, hidePlaceholder);
|
209
|
-
}
|
210
|
-
|
211
|
-
// Show the placeholder value on all appropriate elements
|
212
|
-
function enablePlaceholders(node) {
|
213
|
-
handleElem(node, showPlaceholder);
|
214
|
-
}
|
215
|
-
|
216
|
-
// Returns a function that is used as a focus event handler
|
217
|
-
function makeFocusHandler(elem) {
|
218
|
-
return function () {
|
219
|
-
|
220
|
-
// Only hide the placeholder value if the (default) hide-on-focus behaviour is enabled
|
221
|
-
if (hideOnInput && elem.value === elem.getAttribute(ATTR_CURRENT_VAL) && elem.getAttribute(ATTR_ACTIVE) === "true") {
|
222
|
-
|
223
|
-
// Move the caret to the start of the input (this mimics the behaviour of all browsers that do not hide the placeholder on focus)
|
224
|
-
Utils.moveCaret(elem, 0);
|
225
|
-
|
226
|
-
} else {
|
227
|
-
|
228
|
-
// Remove the placeholder
|
229
|
-
hidePlaceholder(elem);
|
230
|
-
}
|
231
|
-
};
|
232
|
-
}
|
233
|
-
|
234
|
-
// Returns a function that is used as a blur event handler
|
235
|
-
function makeBlurHandler(elem) {
|
236
|
-
return function () {
|
237
|
-
showPlaceholder(elem);
|
238
|
-
};
|
239
|
-
}
|
240
|
-
|
241
|
-
// Functions that are used as a event handlers when the hide-on-input behaviour has been activated - very basic implementation of the "input" event
|
242
|
-
function makeKeydownHandler(elem) {
|
243
|
-
return function (e) {
|
244
|
-
keydownVal = elem.value;
|
245
|
-
|
246
|
-
//Prevent the use of the arrow keys (try to keep the cursor before the placeholder)
|
247
|
-
if (elem.getAttribute(ATTR_ACTIVE) === "true") {
|
248
|
-
if (keydownVal === elem.getAttribute(ATTR_CURRENT_VAL) && Utils.inArray(badKeys, e.keyCode)) {
|
249
|
-
if (e.preventDefault) {
|
250
|
-
e.preventDefault();
|
251
|
-
}
|
252
|
-
return false;
|
253
|
-
}
|
254
|
-
}
|
255
|
-
};
|
256
|
-
}
|
257
|
-
function makeKeyupHandler(elem) {
|
258
|
-
return function () {
|
259
|
-
var type;
|
260
|
-
|
261
|
-
if (elem.getAttribute(ATTR_ACTIVE) === "true" && elem.value !== keydownVal) {
|
262
|
-
|
263
|
-
// Remove the placeholder
|
264
|
-
elem.className = elem.className.replace(classNameRegExp, "");
|
265
|
-
elem.value = elem.value.replace(elem.getAttribute(ATTR_CURRENT_VAL), "");
|
266
|
-
elem.setAttribute(ATTR_ACTIVE, false);
|
267
|
-
|
268
|
-
// If the type of element needs to change, change it (e.g. password inputs)
|
269
|
-
type = elem.getAttribute(ATTR_INPUT_TYPE);
|
270
|
-
if (type) {
|
271
|
-
elem.type = type;
|
272
|
-
}
|
273
|
-
}
|
274
|
-
|
275
|
-
// If the element is now empty we need to show the placeholder
|
276
|
-
if (elem.value === "") {
|
277
|
-
elem.blur();
|
278
|
-
Utils.moveCaret(elem, 0);
|
279
|
-
}
|
280
|
-
};
|
281
|
-
}
|
282
|
-
function makeClickHandler(elem) {
|
283
|
-
return function () {
|
284
|
-
if (elem === document.activeElement && elem.value === elem.getAttribute(ATTR_CURRENT_VAL) && elem.getAttribute(ATTR_ACTIVE) === "true") {
|
285
|
-
Utils.moveCaret(elem, 0);
|
286
|
-
}
|
287
|
-
};
|
288
|
-
}
|
289
|
-
|
290
|
-
// Returns a function that is used as a submit event handler on form elements that have children affected by this polyfill
|
291
|
-
function makeSubmitHandler(form) {
|
292
|
-
return function () {
|
293
|
-
|
294
|
-
// Turn off placeholders on all appropriate descendant elements
|
295
|
-
disablePlaceholders(form);
|
296
|
-
};
|
297
|
-
}
|
298
|
-
|
299
|
-
// Bind event handlers to an element that we need to affect with the polyfill
|
300
|
-
function newElement(elem) {
|
301
|
-
|
302
|
-
// If the element is part of a form, make sure the placeholder string is not submitted as a value
|
303
|
-
if (elem.form) {
|
304
|
-
form = elem.form;
|
305
|
-
|
306
|
-
// Set a flag on the form so we know it's been handled (forms can contain multiple inputs)
|
307
|
-
if (!form.getAttribute(ATTR_FORM_HANDLED)) {
|
308
|
-
Utils.addEventListener(form, "submit", makeSubmitHandler(form));
|
309
|
-
form.setAttribute(ATTR_FORM_HANDLED, "true");
|
310
|
-
}
|
311
|
-
}
|
312
|
-
|
313
|
-
// Bind event handlers to the element so we can hide/show the placeholder as appropriate
|
314
|
-
Utils.addEventListener(elem, "focus", makeFocusHandler(elem));
|
315
|
-
Utils.addEventListener(elem, "blur", makeBlurHandler(elem));
|
316
|
-
|
317
|
-
// If the placeholder should hide on input rather than on focus we need additional event handlers
|
318
|
-
if (hideOnInput) {
|
319
|
-
Utils.addEventListener(elem, "keydown", makeKeydownHandler(elem));
|
320
|
-
Utils.addEventListener(elem, "keyup", makeKeyupHandler(elem));
|
321
|
-
Utils.addEventListener(elem, "click", makeClickHandler(elem));
|
322
|
-
}
|
323
|
-
|
324
|
-
// Remember that we've bound event handlers to this element
|
325
|
-
elem.setAttribute(ATTR_EVENTS_BOUND, "true");
|
326
|
-
elem.setAttribute(ATTR_CURRENT_VAL, placeholder);
|
327
|
-
|
328
|
-
// If the element doesn't have a value, set it to the placeholder string
|
329
|
-
showPlaceholder(elem);
|
330
|
-
}
|
331
|
-
|
332
|
-
Placeholders.nativeSupport = test.placeholder !== void 0;
|
333
|
-
|
334
|
-
if (!Placeholders.nativeSupport) {
|
335
|
-
|
336
|
-
// Get references to all the input and textarea elements currently in the DOM (live NodeList objects to we only need to do this once)
|
337
|
-
inputs = document.getElementsByTagName("input");
|
338
|
-
textareas = document.getElementsByTagName("textarea");
|
339
|
-
|
340
|
-
// Get any settings declared as data-* attributes on the root element (currently the only options are whether to hide the placeholder on focus or input and whether to auto-update)
|
341
|
-
hideOnInput = root.getAttribute(ATTR_OPTION_FOCUS) === "false";
|
342
|
-
liveUpdates = root.getAttribute(ATTR_OPTION_LIVE) !== "false";
|
343
|
-
|
344
|
-
// Create style element for placeholder styles (instead of directly setting style properties on elements - allows for better flexibility alongside user-defined styles)
|
345
|
-
styleElem = document.createElement("style");
|
346
|
-
styleElem.type = "text/css";
|
347
|
-
|
348
|
-
// Create style rules as text node
|
349
|
-
styleRules = document.createTextNode("." + placeholderClassName + " { color:" + placeholderStyleColor + "; }");
|
350
|
-
|
351
|
-
// Append style rules to newly created stylesheet
|
352
|
-
if (styleElem.styleSheet) {
|
353
|
-
styleElem.styleSheet.cssText = styleRules.nodeValue;
|
354
|
-
} else {
|
355
|
-
styleElem.appendChild(styleRules);
|
356
|
-
}
|
357
|
-
|
358
|
-
// Prepend new style element to the head (before any existing stylesheets, so user-defined rules take precedence)
|
359
|
-
head.insertBefore(styleElem, head.firstChild);
|
360
|
-
|
361
|
-
// Set up the placeholders
|
362
|
-
for (i = 0, len = inputs.length + textareas.length; i < len; i++) {
|
363
|
-
elem = i < inputs.length ? inputs[i] : textareas[i - inputs.length];
|
364
|
-
|
365
|
-
// Get the value of the placeholder attribute, if any. IE10 emulating IE7 fails with getAttribute, hence the use of the attributes node
|
366
|
-
placeholder = elem.attributes.placeholder;
|
367
|
-
if (placeholder) {
|
368
|
-
|
369
|
-
// IE returns an empty object instead of undefined if the attribute is not present
|
370
|
-
placeholder = placeholder.nodeValue;
|
371
|
-
|
372
|
-
// Only apply the polyfill if this element is of a type that supports placeholders, and has a placeholder attribute with a non-empty value
|
373
|
-
if (placeholder && Utils.inArray(validTypes, elem.type)) {
|
374
|
-
newElement(elem);
|
375
|
-
}
|
376
|
-
}
|
377
|
-
}
|
378
|
-
|
379
|
-
// If enabled, the polyfill will repeatedly check for changed/added elements and apply to those as well
|
380
|
-
timer = setInterval(function () {
|
381
|
-
for (i = 0, len = inputs.length + textareas.length; i < len; i++) {
|
382
|
-
elem = i < inputs.length ? inputs[i] : textareas[i - inputs.length];
|
383
|
-
|
384
|
-
// Only apply the polyfill if this element is of a type that supports placeholders, and has a placeholder attribute with a non-empty value
|
385
|
-
placeholder = elem.attributes.placeholder;
|
386
|
-
if (placeholder) {
|
387
|
-
placeholder = placeholder.nodeValue;
|
388
|
-
if (placeholder && Utils.inArray(validTypes, elem.type)) {
|
389
|
-
|
390
|
-
// If the element hasn't had event handlers bound to it then add them
|
391
|
-
if (!elem.getAttribute(ATTR_EVENTS_BOUND)) {
|
392
|
-
newElement(elem);
|
393
|
-
}
|
394
|
-
|
395
|
-
// If the placeholder value has changed or not been initialised yet we need to update the display
|
396
|
-
if (placeholder !== elem.getAttribute(ATTR_CURRENT_VAL) || (elem.type === "password" && !elem.getAttribute(ATTR_INPUT_TYPE))) {
|
397
|
-
|
398
|
-
// Attempt to change the type of password inputs (fails in IE < 9)
|
399
|
-
if (elem.type === "password" && !elem.getAttribute(ATTR_INPUT_TYPE) && Utils.changeType(elem, "text")) {
|
400
|
-
elem.setAttribute(ATTR_INPUT_TYPE, "password");
|
401
|
-
}
|
402
|
-
|
403
|
-
// If the placeholder value has changed and the placeholder is currently on display we need to change it
|
404
|
-
if (elem.value === elem.getAttribute(ATTR_CURRENT_VAL)) {
|
405
|
-
elem.value = placeholder;
|
406
|
-
}
|
407
|
-
|
408
|
-
// Keep a reference to the current placeholder value in case it changes via another script
|
409
|
-
elem.setAttribute(ATTR_CURRENT_VAL, placeholder);
|
410
|
-
}
|
411
|
-
}
|
412
|
-
}
|
413
|
-
}
|
414
|
-
|
415
|
-
// If live updates are not enabled cancel the timer
|
416
|
-
if (!liveUpdates) {
|
417
|
-
clearInterval(timer);
|
418
|
-
}
|
419
|
-
}, 100);
|
420
|
-
}
|
421
|
-
|
422
|
-
// Expose public methods
|
423
|
-
Placeholders.disable = Placeholders.nativeSupport ? noop : disablePlaceholders;
|
424
|
-
Placeholders.enable = Placeholders.nativeSupport ? noop : enablePlaceholders;
|
425
|
-
|
426
|
-
}(this));
|
@@ -1,353 +0,0 @@
|
|
1
|
-
/*jslint unparam: true, browser: true, indent: 2 */
|
2
|
-
|
3
|
-
;(function ($, window, document, undefined) {
|
4
|
-
'use strict';
|
5
|
-
|
6
|
-
Foundation.libs.reveal = {
|
7
|
-
name : 'reveal',
|
8
|
-
|
9
|
-
version : '4.3.2',
|
10
|
-
|
11
|
-
locked : false,
|
12
|
-
|
13
|
-
settings : {
|
14
|
-
animation: 'fadeAndPop',
|
15
|
-
animationSpeed: 250,
|
16
|
-
closeOnBackgroundClick: true,
|
17
|
-
closeOnEsc: true,
|
18
|
-
dismissModalClass: 'close-reveal-modal',
|
19
|
-
bgClass: 'reveal-modal-bg',
|
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
|
-
Foundation.inherit(this, 'data_options delay');
|
41
|
-
|
42
|
-
if (typeof method === 'object') {
|
43
|
-
$.extend(true, this.settings, method);
|
44
|
-
} else if (typeof options !== 'undefined') {
|
45
|
-
$.extend(true, this.settings, options);
|
46
|
-
}
|
47
|
-
|
48
|
-
if (typeof method !== 'string') {
|
49
|
-
this.events();
|
50
|
-
|
51
|
-
return this.settings.init;
|
52
|
-
} else {
|
53
|
-
return this[method].call(this, options);
|
54
|
-
}
|
55
|
-
},
|
56
|
-
|
57
|
-
events : function () {
|
58
|
-
var self = this;
|
59
|
-
|
60
|
-
$(this.scope)
|
61
|
-
.off('.fndtn.reveal')
|
62
|
-
.on('click.fndtn.reveal', '[data-reveal-id]', function (e) {
|
63
|
-
e.preventDefault();
|
64
|
-
|
65
|
-
if (!self.locked) {
|
66
|
-
var element = $(this),
|
67
|
-
ajax = element.data('reveal-ajax');
|
68
|
-
|
69
|
-
self.locked = true;
|
70
|
-
|
71
|
-
if (typeof ajax === 'undefined') {
|
72
|
-
self.open.call(self, element);
|
73
|
-
} else {
|
74
|
-
var url = ajax === true ? element.attr('href') : ajax;
|
75
|
-
|
76
|
-
self.open.call(self, element, {url: url});
|
77
|
-
}
|
78
|
-
}
|
79
|
-
})
|
80
|
-
.on('click.fndtn.reveal touchend', this.close_targets(), function (e) {
|
81
|
-
e.preventDefault();
|
82
|
-
if (!self.locked) {
|
83
|
-
var settings = $.extend({}, self.settings, self.data_options($('.reveal-modal.open'))),
|
84
|
-
bgClicked = $(e.target)[0] === $('.' + settings.bgClass)[0];
|
85
|
-
if (bgClicked && !settings.closeOnBackgroundClick) {
|
86
|
-
return;
|
87
|
-
}
|
88
|
-
|
89
|
-
self.locked = true;
|
90
|
-
self.close.call(self, bgClicked ? $('.reveal-modal.open') : $(this).closest('.reveal-modal'));
|
91
|
-
}
|
92
|
-
});
|
93
|
-
|
94
|
-
if($(this.scope).hasClass('reveal-modal')) {
|
95
|
-
$(this.scope)
|
96
|
-
.on('open.fndtn.reveal', this.settings.open)
|
97
|
-
.on('opened.fndtn.reveal', this.settings.opened)
|
98
|
-
.on('opened.fndtn.reveal', this.open_video)
|
99
|
-
.on('close.fndtn.reveal', this.settings.close)
|
100
|
-
.on('closed.fndtn.reveal', this.settings.closed)
|
101
|
-
.on('closed.fndtn.reveal', this.close_video);
|
102
|
-
} else {
|
103
|
-
$(this.scope)
|
104
|
-
.on('open.fndtn.reveal', '.reveal-modal', this.settings.open)
|
105
|
-
.on('opened.fndtn.reveal', '.reveal-modal', this.settings.opened)
|
106
|
-
.on('opened.fndtn.reveal', '.reveal-modal', this.open_video)
|
107
|
-
.on('close.fndtn.reveal', '.reveal-modal', this.settings.close)
|
108
|
-
.on('closed.fndtn.reveal', '.reveal-modal', this.settings.closed)
|
109
|
-
.on('closed.fndtn.reveal', '.reveal-modal', this.close_video);
|
110
|
-
}
|
111
|
-
|
112
|
-
$( 'body' ).bind( 'keyup.reveal', function ( event ) {
|
113
|
-
var open_modal = $('.reveal-modal.open'),
|
114
|
-
settings = $.extend({}, self.settings, self.data_options(open_modal));
|
115
|
-
if ( event.which === 27 && settings.closeOnEsc) { // 27 is the keycode for the Escape key
|
116
|
-
open_modal.foundation('reveal', 'close');
|
117
|
-
}
|
118
|
-
});
|
119
|
-
|
120
|
-
return true;
|
121
|
-
},
|
122
|
-
|
123
|
-
open : function (target, ajax_settings) {
|
124
|
-
if (target) {
|
125
|
-
if (typeof target.selector !== 'undefined') {
|
126
|
-
var modal = $('#' + target.data('reveal-id'));
|
127
|
-
} else {
|
128
|
-
var modal = $(this.scope);
|
129
|
-
|
130
|
-
ajax_settings = target;
|
131
|
-
}
|
132
|
-
} else {
|
133
|
-
var modal = $(this.scope);
|
134
|
-
}
|
135
|
-
|
136
|
-
if (!modal.hasClass('open')) {
|
137
|
-
var open_modal = $('.reveal-modal.open');
|
138
|
-
|
139
|
-
if (typeof modal.data('css-top') === 'undefined') {
|
140
|
-
modal.data('css-top', parseInt(modal.css('top'), 10))
|
141
|
-
.data('offset', this.cache_offset(modal));
|
142
|
-
}
|
143
|
-
|
144
|
-
modal.trigger('open');
|
145
|
-
|
146
|
-
if (open_modal.length < 1) {
|
147
|
-
this.toggle_bg();
|
148
|
-
}
|
149
|
-
|
150
|
-
if (typeof ajax_settings === 'undefined' || !ajax_settings.url) {
|
151
|
-
this.hide(open_modal, this.settings.css.close);
|
152
|
-
this.show(modal, this.settings.css.open);
|
153
|
-
} else {
|
154
|
-
var self = this,
|
155
|
-
old_success = typeof ajax_settings.success !== 'undefined' ? ajax_settings.success : null;
|
156
|
-
|
157
|
-
$.extend(ajax_settings, {
|
158
|
-
success: function (data, textStatus, jqXHR) {
|
159
|
-
if ( $.isFunction(old_success) ) {
|
160
|
-
old_success(data, textStatus, jqXHR);
|
161
|
-
}
|
162
|
-
|
163
|
-
modal.html(data);
|
164
|
-
$(modal).foundation('section', 'reflow');
|
165
|
-
|
166
|
-
self.hide(open_modal, self.settings.css.close);
|
167
|
-
self.show(modal, self.settings.css.open);
|
168
|
-
}
|
169
|
-
});
|
170
|
-
|
171
|
-
$.ajax(ajax_settings);
|
172
|
-
}
|
173
|
-
}
|
174
|
-
},
|
175
|
-
|
176
|
-
close : function (modal) {
|
177
|
-
|
178
|
-
var modal = modal && modal.length ? modal : $(this.scope),
|
179
|
-
open_modals = $('.reveal-modal.open');
|
180
|
-
|
181
|
-
if (open_modals.length > 0) {
|
182
|
-
this.locked = true;
|
183
|
-
modal.trigger('close');
|
184
|
-
this.toggle_bg();
|
185
|
-
this.hide(open_modals, this.settings.css.close);
|
186
|
-
}
|
187
|
-
},
|
188
|
-
|
189
|
-
close_targets : function () {
|
190
|
-
var base = '.' + this.settings.dismissModalClass;
|
191
|
-
|
192
|
-
if (this.settings.closeOnBackgroundClick) {
|
193
|
-
return base + ', .' + this.settings.bgClass;
|
194
|
-
}
|
195
|
-
|
196
|
-
return base;
|
197
|
-
},
|
198
|
-
|
199
|
-
toggle_bg : function () {
|
200
|
-
if ($('.' + this.settings.bgClass).length === 0) {
|
201
|
-
this.settings.bg = $('<div />', {'class': this.settings.bgClass})
|
202
|
-
.appendTo('body');
|
203
|
-
}
|
204
|
-
|
205
|
-
if (this.settings.bg.filter(':visible').length > 0) {
|
206
|
-
this.hide(this.settings.bg);
|
207
|
-
} else {
|
208
|
-
this.show(this.settings.bg);
|
209
|
-
}
|
210
|
-
},
|
211
|
-
|
212
|
-
show : function (el, css) {
|
213
|
-
// is modal
|
214
|
-
if (css) {
|
215
|
-
if (el.parent('body').length === 0) {
|
216
|
-
var placeholder = el.wrap('<div style="display: none;" />').parent();
|
217
|
-
el.on('closed.fndtn.reveal.wrapped', function() {
|
218
|
-
el.detach().appendTo(placeholder);
|
219
|
-
el.unwrap().unbind('closed.fndtn.reveal.wrapped');
|
220
|
-
});
|
221
|
-
|
222
|
-
el.detach().appendTo('body');
|
223
|
-
}
|
224
|
-
|
225
|
-
if (/pop/i.test(this.settings.animation)) {
|
226
|
-
css.top = $(window).scrollTop() - el.data('offset') + 'px';
|
227
|
-
var end_css = {
|
228
|
-
top: $(window).scrollTop() + el.data('css-top') + 'px',
|
229
|
-
opacity: 1
|
230
|
-
};
|
231
|
-
|
232
|
-
return this.delay(function () {
|
233
|
-
return el
|
234
|
-
.css(css)
|
235
|
-
.animate(end_css, this.settings.animationSpeed, 'linear', function () {
|
236
|
-
this.locked = false;
|
237
|
-
el.trigger('opened');
|
238
|
-
}.bind(this))
|
239
|
-
.addClass('open');
|
240
|
-
}.bind(this), this.settings.animationSpeed / 2);
|
241
|
-
}
|
242
|
-
|
243
|
-
if (/fade/i.test(this.settings.animation)) {
|
244
|
-
var end_css = {opacity: 1};
|
245
|
-
|
246
|
-
return this.delay(function () {
|
247
|
-
return el
|
248
|
-
.css(css)
|
249
|
-
.animate(end_css, this.settings.animationSpeed, 'linear', function () {
|
250
|
-
this.locked = false;
|
251
|
-
el.trigger('opened');
|
252
|
-
}.bind(this))
|
253
|
-
.addClass('open');
|
254
|
-
}.bind(this), this.settings.animationSpeed / 2);
|
255
|
-
}
|
256
|
-
|
257
|
-
return el.css(css).show().css({opacity: 1}).addClass('open').trigger('opened');
|
258
|
-
}
|
259
|
-
|
260
|
-
// should we animate the background?
|
261
|
-
if (/fade/i.test(this.settings.animation)) {
|
262
|
-
return el.fadeIn(this.settings.animationSpeed / 2);
|
263
|
-
}
|
264
|
-
|
265
|
-
return el.show();
|
266
|
-
},
|
267
|
-
|
268
|
-
hide : function (el, css) {
|
269
|
-
// is modal
|
270
|
-
if (css) {
|
271
|
-
if (/pop/i.test(this.settings.animation)) {
|
272
|
-
var end_css = {
|
273
|
-
top: - $(window).scrollTop() - el.data('offset') + 'px',
|
274
|
-
opacity: 0
|
275
|
-
};
|
276
|
-
|
277
|
-
return this.delay(function () {
|
278
|
-
return el
|
279
|
-
.animate(end_css, this.settings.animationSpeed, 'linear', function () {
|
280
|
-
this.locked = false;
|
281
|
-
el.css(css).trigger('closed');
|
282
|
-
}.bind(this))
|
283
|
-
.removeClass('open');
|
284
|
-
}.bind(this), this.settings.animationSpeed / 2);
|
285
|
-
}
|
286
|
-
|
287
|
-
if (/fade/i.test(this.settings.animation)) {
|
288
|
-
var end_css = {opacity: 0};
|
289
|
-
|
290
|
-
return this.delay(function () {
|
291
|
-
return el
|
292
|
-
.animate(end_css, this.settings.animationSpeed, 'linear', function () {
|
293
|
-
this.locked = false;
|
294
|
-
el.css(css).trigger('closed');
|
295
|
-
}.bind(this))
|
296
|
-
.removeClass('open');
|
297
|
-
}.bind(this), this.settings.animationSpeed / 2);
|
298
|
-
}
|
299
|
-
|
300
|
-
return el.hide().css(css).removeClass('open').trigger('closed');
|
301
|
-
}
|
302
|
-
|
303
|
-
// should we animate the background?
|
304
|
-
if (/fade/i.test(this.settings.animation)) {
|
305
|
-
return el.fadeOut(this.settings.animationSpeed / 2);
|
306
|
-
}
|
307
|
-
|
308
|
-
return el.hide();
|
309
|
-
},
|
310
|
-
|
311
|
-
close_video : function (e) {
|
312
|
-
var video = $(this).find('.flex-video'),
|
313
|
-
iframe = video.find('iframe');
|
314
|
-
|
315
|
-
if (iframe.length > 0) {
|
316
|
-
iframe.attr('data-src', iframe[0].src);
|
317
|
-
iframe.attr('src', 'about:blank');
|
318
|
-
video.hide();
|
319
|
-
}
|
320
|
-
},
|
321
|
-
|
322
|
-
open_video : function (e) {
|
323
|
-
var video = $(this).find('.flex-video'),
|
324
|
-
iframe = video.find('iframe');
|
325
|
-
|
326
|
-
if (iframe.length > 0) {
|
327
|
-
var data_src = iframe.attr('data-src');
|
328
|
-
if (typeof data_src === 'string') {
|
329
|
-
iframe[0].src = iframe.attr('data-src');
|
330
|
-
} else {
|
331
|
-
var src = iframe[0].src;
|
332
|
-
iframe[0].src = undefined;
|
333
|
-
iframe[0].src = src;
|
334
|
-
}
|
335
|
-
video.show();
|
336
|
-
}
|
337
|
-
},
|
338
|
-
|
339
|
-
cache_offset : function (modal) {
|
340
|
-
var offset = modal.show().height() + parseInt(modal.css('top'), 10);
|
341
|
-
|
342
|
-
modal.hide();
|
343
|
-
|
344
|
-
return offset;
|
345
|
-
},
|
346
|
-
|
347
|
-
off : function () {
|
348
|
-
$(this.scope).off('.fndtn.reveal');
|
349
|
-
},
|
350
|
-
|
351
|
-
reflow : function () {}
|
352
|
-
};
|
353
|
-
}(Foundation.zj, this, this.document));
|