ratchet_design 0.1.10 → 0.1.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/ratchet/base/form.js +8 -117
- data/app/assets/javascripts/ratchet/base/mobilemenu.js +12 -50
- data/app/assets/javascripts/ratchet/base/sync-input-value.js +30 -0
- data/app/assets/javascripts/ratchet/core.js +55 -78
- data/app/assets/javascripts/ratchet/enhancement/lightbox.js +9 -8
- data/app/assets/javascripts/ratchet/enhancement/notice.js +8 -3
- data/app/assets/javascripts/ratchet/enhancement/sticky.js +18 -35
- data/app/assets/javascripts/ratchet/enhancement/waypoints.js +125 -162
- data/app/assets/javascripts/ratchet/utility/loader.js +4 -2
- data/app/assets/stylesheets/ratchet/_core.scss +2 -1
- data/app/assets/stylesheets/ratchet/base/_form.scss +4 -13
- data/app/assets/stylesheets/ratchet/base/_multistep-form.scss +62 -0
- data/app/assets/stylesheets/ratchet/utility/_global.scss +1 -10
- data/app/helpers/ratchet/application_helper.rb +23 -2
- data/app/views/layouts/ratchet/default.html.slim +2 -2
- data/app/views/shared/ratchet/_footer.html.slim +3 -2
- data/app/views/shared/ratchet/_header.html.slim +1 -1
- data/lib/ratchet_design/version.rb +1 -1
- data/public/assets/ratchet/core-0.1.11.js +133 -0
- data/public/assets/ratchet/core-0.1.11.js.gz +0 -0
- data/public/assets/ratchet/core-0.1.11.map.json +1 -0
- data/public/assets/ratchet/{fonts-woff-0.1.10.css → fonts-woff-0.1.11.css} +0 -0
- data/public/assets/ratchet/{fonts-woff-0.1.10.css.gz → fonts-woff-0.1.11.css.gz} +0 -0
- data/public/assets/ratchet/{fonts-woff2-0.1.10.css → fonts-woff2-0.1.11.css} +0 -0
- data/public/assets/ratchet/{fonts-woff2-0.1.10.css.gz → fonts-woff2-0.1.11.css.gz} +0 -0
- metadata +11 -23
- data/app/assets/javascripts/ratchet/base/validation.js +0 -263
- data/app/assets/javascripts/ratchet/shim/classlist.js +0 -234
- data/app/assets/javascripts/ratchet/shim/object.assign.js +0 -30
- data/app/assets/javascripts/ratchet/utility/compile_data.js +0 -40
- data/app/assets/javascripts/ratchet/utility/from_top.js +0 -14
- data/app/assets/javascripts/ratchet/utility/full_stop.js +0 -55
- data/app/assets/javascripts/ratchet/utility/get_closest.js +0 -20
- data/app/assets/javascripts/ratchet/utility/get_next.js +0 -17
- data/app/assets/javascripts/ratchet/utility/matches.js +0 -15
- data/app/assets/javascripts/ratchet/utility/scroll_to.js +0 -74
- data/app/assets/javascripts/ratchet/utility/throttle.js +0 -25
- data/app/assets/javascripts/ratchet/utility/timeout.js +0 -45
- data/app/assets/javascripts/ratchet/utility/unhover.js +0 -56
- data/app/assets/javascripts/ratchet/utility/word_count.js +0 -15
- data/public/assets/ratchet/core-0.1.10.js +0 -115
- data/public/assets/ratchet/core-0.1.10.js.gz +0 -0
- data/public/assets/ratchet/core-0.1.10.map.json +0 -1
File without changes
|
Binary file
|
File without changes
|
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ratchet_design
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brandon Mathis
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2017-01-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: cyborg
|
@@ -111,7 +111,7 @@ files:
|
|
111
111
|
- app/assets/javascripts/ratchet/_svg.js
|
112
112
|
- app/assets/javascripts/ratchet/base/form.js
|
113
113
|
- app/assets/javascripts/ratchet/base/mobilemenu.js
|
114
|
-
- app/assets/javascripts/ratchet/base/
|
114
|
+
- app/assets/javascripts/ratchet/base/sync-input-value.js
|
115
115
|
- app/assets/javascripts/ratchet/core.js
|
116
116
|
- app/assets/javascripts/ratchet/enhancement/_collapse.js
|
117
117
|
- app/assets/javascripts/ratchet/enhancement/_swap.js
|
@@ -121,29 +121,17 @@ files:
|
|
121
121
|
- app/assets/javascripts/ratchet/enhancement/notice.js
|
122
122
|
- app/assets/javascripts/ratchet/enhancement/sticky.js
|
123
123
|
- app/assets/javascripts/ratchet/enhancement/waypoints.js
|
124
|
-
- app/assets/javascripts/ratchet/shim/classlist.js
|
125
|
-
- app/assets/javascripts/ratchet/shim/object.assign.js
|
126
124
|
- app/assets/javascripts/ratchet/shim/scope.js
|
127
|
-
- app/assets/javascripts/ratchet/utility/compile_data.js
|
128
|
-
- app/assets/javascripts/ratchet/utility/from_top.js
|
129
|
-
- app/assets/javascripts/ratchet/utility/full_stop.js
|
130
|
-
- app/assets/javascripts/ratchet/utility/get_closest.js
|
131
|
-
- app/assets/javascripts/ratchet/utility/get_next.js
|
132
125
|
- app/assets/javascripts/ratchet/utility/load_font.js
|
133
126
|
- app/assets/javascripts/ratchet/utility/load_script.js
|
134
127
|
- app/assets/javascripts/ratchet/utility/loader.js
|
135
|
-
- app/assets/javascripts/ratchet/utility/matches.js
|
136
|
-
- app/assets/javascripts/ratchet/utility/scroll_to.js
|
137
|
-
- app/assets/javascripts/ratchet/utility/throttle.js
|
138
|
-
- app/assets/javascripts/ratchet/utility/timeout.js
|
139
|
-
- app/assets/javascripts/ratchet/utility/unhover.js
|
140
|
-
- app/assets/javascripts/ratchet/utility/word_count.js
|
141
128
|
- app/assets/stylesheets/ratchet/_core.scss
|
142
129
|
- app/assets/stylesheets/ratchet/base/_button.scss
|
143
130
|
- app/assets/stylesheets/ratchet/base/_document.scss
|
144
131
|
- app/assets/stylesheets/ratchet/base/_form.scss
|
145
132
|
- app/assets/stylesheets/ratchet/base/_list.scss
|
146
133
|
- app/assets/stylesheets/ratchet/base/_media.scss
|
134
|
+
- app/assets/stylesheets/ratchet/base/_multistep-form.scss
|
147
135
|
- app/assets/stylesheets/ratchet/base/_table.scss
|
148
136
|
- app/assets/stylesheets/ratchet/base/_text.scss
|
149
137
|
- app/assets/stylesheets/ratchet/enhancement/_contrast-section.scss
|
@@ -177,13 +165,13 @@ files:
|
|
177
165
|
- app/views/shared/ratchet/_icons.html.slim
|
178
166
|
- lib/ratchet_design.rb
|
179
167
|
- lib/ratchet_design/version.rb
|
180
|
-
- public/assets/ratchet/core-0.1.
|
181
|
-
- public/assets/ratchet/core-0.1.
|
182
|
-
- public/assets/ratchet/core-0.1.
|
183
|
-
- public/assets/ratchet/fonts-woff-0.1.
|
184
|
-
- public/assets/ratchet/fonts-woff-0.1.
|
185
|
-
- public/assets/ratchet/fonts-woff2-0.1.
|
186
|
-
- public/assets/ratchet/fonts-woff2-0.1.
|
168
|
+
- public/assets/ratchet/core-0.1.11.js
|
169
|
+
- public/assets/ratchet/core-0.1.11.js.gz
|
170
|
+
- public/assets/ratchet/core-0.1.11.map.json
|
171
|
+
- public/assets/ratchet/fonts-woff-0.1.11.css
|
172
|
+
- public/assets/ratchet/fonts-woff-0.1.11.css.gz
|
173
|
+
- public/assets/ratchet/fonts-woff2-0.1.11.css
|
174
|
+
- public/assets/ratchet/fonts-woff2-0.1.11.css.gz
|
187
175
|
homepage:
|
188
176
|
licenses:
|
189
177
|
- MIT
|
@@ -1,263 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* Validation 0.0.6
|
3
|
-
* Compose form validation module
|
4
|
-
* @author Kyle Foster (@hkfoster)
|
5
|
-
* @license MIT
|
6
|
-
**/
|
7
|
-
|
8
|
-
// Dependencies
|
9
|
-
var matches = require( '../utility/matches' ),
|
10
|
-
getClosest = require( '../utility/get_closest' ),
|
11
|
-
wordCount = require( '../utility/word_count' );
|
12
|
-
|
13
|
-
// Public API function
|
14
|
-
var validation = function( element, settings ) {
|
15
|
-
|
16
|
-
// Overridable defaults
|
17
|
-
var defaults = {};
|
18
|
-
|
19
|
-
// Parameter variables
|
20
|
-
var selector = document.querySelector( element ) || document.querySelector( '[required]' );
|
21
|
-
|
22
|
-
// Only run if selector exists & validation is supported
|
23
|
-
if ( !selector || typeof document.createElement( 'input' ).checkValidity !== 'function' ) return false;
|
24
|
-
|
25
|
-
// Scoped variables
|
26
|
-
var options = Object.assign( {}, defaults, settings ),
|
27
|
-
docBody = document.body;
|
28
|
-
|
29
|
-
// Suppress default message bubbles
|
30
|
-
docBody.addEventListener( 'invalid', function( event ) {
|
31
|
-
event.preventDefault();
|
32
|
-
}, true );
|
33
|
-
|
34
|
-
// Run delegated `on blur` validation checks
|
35
|
-
docBody.addEventListener( 'blur', blurHandler, true );
|
36
|
-
|
37
|
-
// Run delegated `on submit` validation checks
|
38
|
-
docBody.addEventListener( 'click', submissionHandler, false );
|
39
|
-
|
40
|
-
// Blur validation handler
|
41
|
-
function blurHandler( event ) {
|
42
|
-
|
43
|
-
// Only run on non-submit inputs
|
44
|
-
if ( !matches( event.target, 'input:not([type=submit]), textarea' ) ) return false;
|
45
|
-
|
46
|
-
// Scoped variables
|
47
|
-
var element = event.target,
|
48
|
-
minWords = element.dataset.minWords,
|
49
|
-
maxWords = element.dataset.maxWords,
|
50
|
-
indicator = getClosest( element, 'label' ) || element,
|
51
|
-
validity;
|
52
|
-
|
53
|
-
// If element only contains whitespace, strip value
|
54
|
-
if ( element.value && !element.value.replace( /\s/g, '' ).length ) {
|
55
|
-
element.value = '';
|
56
|
-
}
|
57
|
-
|
58
|
-
// Remove pre-existing validation message
|
59
|
-
messageHandler( 'hide', element );
|
60
|
-
|
61
|
-
// If element has `data-min-words` attribute
|
62
|
-
if ( minWords ) {
|
63
|
-
|
64
|
-
// Run respective validation function
|
65
|
-
validateWords( 'min', element, minWords );
|
66
|
-
|
67
|
-
}
|
68
|
-
|
69
|
-
// If element has `data-min-words` attribute
|
70
|
-
if ( maxWords ) {
|
71
|
-
|
72
|
-
// Run respective validation function
|
73
|
-
validateWords( 'max', element, maxWords );
|
74
|
-
|
75
|
-
}
|
76
|
-
|
77
|
-
// Check validity
|
78
|
-
validity = element.checkValidity();
|
79
|
-
|
80
|
-
// If the element has a value but is invalid
|
81
|
-
if ( element.value && !validity ) {
|
82
|
-
|
83
|
-
// Set invalid state
|
84
|
-
indicator.classList.remove( 'valid' );
|
85
|
-
indicator.classList.add( 'invalid' );
|
86
|
-
|
87
|
-
// If the element has a value and is valid
|
88
|
-
} else if ( element.value && validity ) {
|
89
|
-
|
90
|
-
// Set valid state
|
91
|
-
indicator.classList.remove( 'invalid' );
|
92
|
-
indicator.classList.add( 'valid' );
|
93
|
-
|
94
|
-
// If the element has no value
|
95
|
-
} else if ( !element.value ) {
|
96
|
-
|
97
|
-
// Set neutral state
|
98
|
-
indicator.classList.remove( 'valid' );
|
99
|
-
indicator.classList.remove( 'invalid' );
|
100
|
-
|
101
|
-
}
|
102
|
-
|
103
|
-
}
|
104
|
-
|
105
|
-
// Submission validation handler function
|
106
|
-
function submissionHandler( event ) {
|
107
|
-
|
108
|
-
// Only run on submission
|
109
|
-
if ( !matches( event.target, 'input[type=submit], button[type=submit]' ) ) return;
|
110
|
-
|
111
|
-
// Scoped variables
|
112
|
-
var invalidForm = getClosest( event.target, 'form' ),
|
113
|
-
invalidElem = invalidForm.querySelector( 'input:invalid, textarea:invalid' ),
|
114
|
-
indicator;
|
115
|
-
|
116
|
-
// If invalid element found
|
117
|
-
if ( invalidElem ) {
|
118
|
-
|
119
|
-
// Set indicator to parent label if it exists
|
120
|
-
indicator = getClosest( invalidElem, 'label' ) || invalidElem;
|
121
|
-
|
122
|
-
// If credit card field is invalid
|
123
|
-
if ( matches( invalidElem, '[data-stripe=number]' ) ) {
|
124
|
-
|
125
|
-
// Strip it of non-number characters
|
126
|
-
invalidElem.value = invalidElem.value.replace( /[^0-9 -]/g, '' );
|
127
|
-
|
128
|
-
// Evaluate form validity again
|
129
|
-
invalidElem = invalidForm.querySelector( 'input:invalid, textarea:invalid' );
|
130
|
-
|
131
|
-
// And return if valid
|
132
|
-
if ( !invalidElem ) return;
|
133
|
-
|
134
|
-
}
|
135
|
-
|
136
|
-
// Prevent default behavior
|
137
|
-
event.preventDefault();
|
138
|
-
|
139
|
-
// If invalid is not hidden
|
140
|
-
if ( invalidElem.style.display !== 'none' ) {
|
141
|
-
|
142
|
-
// Focus it
|
143
|
-
invalidElem.focus();
|
144
|
-
|
145
|
-
// Otherwise
|
146
|
-
} else {
|
147
|
-
|
148
|
-
// Focus its immediate sibling (mostly used for upload buttons)
|
149
|
-
invalidElem.nextSibling.focus();
|
150
|
-
|
151
|
-
}
|
152
|
-
|
153
|
-
// Toggle classes
|
154
|
-
indicator.classList.remove( 'valid' );
|
155
|
-
indicator.classList.add( 'invalid' );
|
156
|
-
|
157
|
-
// Show validation message
|
158
|
-
messageHandler( 'show', invalidElem );
|
159
|
-
|
160
|
-
// Prevent Safari submission
|
161
|
-
return false;
|
162
|
-
|
163
|
-
}
|
164
|
-
|
165
|
-
}
|
166
|
-
|
167
|
-
// Validation message handler function
|
168
|
-
function messageHandler( action, element ) {
|
169
|
-
|
170
|
-
// Scoped variables
|
171
|
-
var parentForm = getClosest( element, 'form' ),
|
172
|
-
oldMessage = parentForm.querySelector( '.validation-message' ),
|
173
|
-
newMessage = element.validationMessage,
|
174
|
-
|
175
|
-
// Hide old message
|
176
|
-
hideMessage = function() {
|
177
|
-
oldMessage.parentNode.removeChild( oldMessage );
|
178
|
-
},
|
179
|
-
|
180
|
-
// Show new message
|
181
|
-
showMessage = function() {
|
182
|
-
|
183
|
-
// Find the element's parent label
|
184
|
-
var labelParent = getClosest( element, 'label' );
|
185
|
-
|
186
|
-
// If it doesn't exist, abort
|
187
|
-
if ( !labelParent ) return false;
|
188
|
-
|
189
|
-
// Otherwise, create and append the validation message
|
190
|
-
labelParent.insertAdjacentHTML( 'beforeend', '<aside class="validation-message"><p>' + newMessage + '</p></aside>' );
|
191
|
-
|
192
|
-
};
|
193
|
-
|
194
|
-
// If a `data-message` attribute exists, use it in message
|
195
|
-
if ( element.dataset.message ) newMessage = element.dataset.message;
|
196
|
-
|
197
|
-
// If hide action is passed hide old message
|
198
|
-
if ( oldMessage && action === 'hide' ) hideMessage();
|
199
|
-
|
200
|
-
// If show action is passed and no old message exists
|
201
|
-
if ( action === 'show' && !oldMessage ) {
|
202
|
-
|
203
|
-
// Show new message
|
204
|
-
showMessage();
|
205
|
-
|
206
|
-
// If show action is passed and old message exists
|
207
|
-
} else if ( action === 'show' && oldMessage ) {
|
208
|
-
|
209
|
-
// Make sure old message is not on currently invalid element
|
210
|
-
if ( oldMessage.parentNode !== element.parentNode ) {
|
211
|
-
|
212
|
-
// Hide old message
|
213
|
-
hideMessage();
|
214
|
-
|
215
|
-
// And show new message
|
216
|
-
showMessage();
|
217
|
-
|
218
|
-
// Otherwise
|
219
|
-
} else {
|
220
|
-
|
221
|
-
// Update message text on currently invalid element
|
222
|
-
oldMessage.childNodes[ 0 ].textContent = newMessage;
|
223
|
-
|
224
|
-
}
|
225
|
-
|
226
|
-
}
|
227
|
-
|
228
|
-
}
|
229
|
-
|
230
|
-
// Min- or max-words validation function
|
231
|
-
function validateWords( type, element, goal ) {
|
232
|
-
|
233
|
-
// Defaults settings to min-words
|
234
|
-
var value = element.value,
|
235
|
-
condition = wordCount( value ) < goal,
|
236
|
-
verbiage = 'at least ';
|
237
|
-
|
238
|
-
// Overwrite defaults in case of max-words
|
239
|
-
if ( type === 'max' ) {
|
240
|
-
condition = wordCount( value ) > goal;
|
241
|
-
verbiage = 'no more than ';
|
242
|
-
}
|
243
|
-
|
244
|
-
// If value exists and it meets invalid condition
|
245
|
-
if ( value && condition ) {
|
246
|
-
|
247
|
-
// Set a custom error message
|
248
|
-
element.setCustomValidity( 'Please write ' + verbiage + goal + ' words.' );
|
249
|
-
|
250
|
-
// Otherwise
|
251
|
-
} else {
|
252
|
-
|
253
|
-
// Default to normal error messaging
|
254
|
-
element.setCustomValidity( '' );
|
255
|
-
|
256
|
-
}
|
257
|
-
|
258
|
-
}
|
259
|
-
|
260
|
-
};
|
261
|
-
|
262
|
-
// Public API
|
263
|
-
module.exports = validation;
|
@@ -1,234 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* ClassList polyfill
|
3
|
-
* Cross-browser full element.classList implementation
|
4
|
-
* @source http://purl.eligrey.com/github/classList.js/blob/master/classList.js
|
5
|
-
* @author Eli Grey - http://eligrey.com
|
6
|
-
* @license MIT
|
7
|
-
**/
|
8
|
-
|
9
|
-
if ( 'document' in self ) {
|
10
|
-
|
11
|
-
// Full polyfill for browsers with no classList support
|
12
|
-
if ( !( 'classList' in document.createElement( '_' ) ) ) {
|
13
|
-
|
14
|
-
( function( view ) {
|
15
|
-
|
16
|
-
'use strict';
|
17
|
-
|
18
|
-
if ( !( 'Element' in view ) ) return;
|
19
|
-
|
20
|
-
var
|
21
|
-
classListProp = 'classList',
|
22
|
-
protoProp = 'prototype',
|
23
|
-
elemCtrProto = view.Element[ protoProp ],
|
24
|
-
objCtr = Object,
|
25
|
-
|
26
|
-
strTrim = String[ protoProp ].trim || function() {
|
27
|
-
return this.replace( /^\s+|\s+$/g, '' );
|
28
|
-
},
|
29
|
-
|
30
|
-
arrIndexOf = Array[ protoProp ].indexOf || function( item ) {
|
31
|
-
for ( var i = 0; i < this.length; i++ ) {
|
32
|
-
if ( i in this && this[ i ] === item ) {
|
33
|
-
return i;
|
34
|
-
}
|
35
|
-
}
|
36
|
-
return -1;
|
37
|
-
},
|
38
|
-
|
39
|
-
DOMEx = function( type, message ) {
|
40
|
-
this.name = type;
|
41
|
-
this.code = DOMException[ type ];
|
42
|
-
this.message = message;
|
43
|
-
},
|
44
|
-
|
45
|
-
checkTokenAndGetIndex = function( classList, token ) {
|
46
|
-
if ( token === '' ) {
|
47
|
-
throw new DOMEx(
|
48
|
-
'SYNTAX_ERR',
|
49
|
-
'An invalid or illegal string was specified'
|
50
|
-
);
|
51
|
-
}
|
52
|
-
if ( /\s/.test( token ) ) {
|
53
|
-
throw new DOMEx(
|
54
|
-
'INVALID_CHARACTER_ERR',
|
55
|
-
'String contains an invalid character'
|
56
|
-
);
|
57
|
-
}
|
58
|
-
return arrIndexOf.call( classList, token );
|
59
|
-
},
|
60
|
-
|
61
|
-
ClassList = function( elem ) {
|
62
|
-
var trimmedClasses = strTrim.call( elem.getAttribute( 'class' ) || '' ),
|
63
|
-
classes = trimmedClasses ? trimmedClasses.split( /\s+/ ) : [];
|
64
|
-
|
65
|
-
for ( var i = 0; i < classes.length; i++ ) {
|
66
|
-
this.push( classes[ i ] );
|
67
|
-
}
|
68
|
-
|
69
|
-
this._updateClassName = function() {
|
70
|
-
elem.setAttribute( 'class', this.toString() );
|
71
|
-
};
|
72
|
-
},
|
73
|
-
|
74
|
-
classListProto = ClassList[ protoProp ] = [],
|
75
|
-
|
76
|
-
classListGetter = function() {
|
77
|
-
return new ClassList( this );
|
78
|
-
};
|
79
|
-
|
80
|
-
DOMEx[ protoProp ] = Error[ protoProp ];
|
81
|
-
|
82
|
-
classListProto.item = function( i ) {
|
83
|
-
return this[ i ] || null;
|
84
|
-
};
|
85
|
-
|
86
|
-
classListProto.contains = function( token ) {
|
87
|
-
token += '';
|
88
|
-
return checkTokenAndGetIndex( this, token ) !== -1;
|
89
|
-
};
|
90
|
-
|
91
|
-
classListProto.add = function() {
|
92
|
-
var
|
93
|
-
tokens = arguments,
|
94
|
-
iter = 0,
|
95
|
-
len = tokens.length,
|
96
|
-
updated = false,
|
97
|
-
token;
|
98
|
-
|
99
|
-
do {
|
100
|
-
token = tokens[ iter ] + '';
|
101
|
-
if ( checkTokenAndGetIndex( this, token ) === -1 ) {
|
102
|
-
this.push( token );
|
103
|
-
updated = true;
|
104
|
-
}
|
105
|
-
}
|
106
|
-
|
107
|
-
while ( ++iter < len );
|
108
|
-
|
109
|
-
if ( updated ) {
|
110
|
-
this._updateClassName();
|
111
|
-
}
|
112
|
-
};
|
113
|
-
|
114
|
-
classListProto.remove = function() {
|
115
|
-
var
|
116
|
-
tokens = arguments,
|
117
|
-
iter = 0,
|
118
|
-
len = tokens.length,
|
119
|
-
updated = false,
|
120
|
-
token,
|
121
|
-
index;
|
122
|
-
|
123
|
-
do {
|
124
|
-
token = tokens[ iter ] + '';
|
125
|
-
index = checkTokenAndGetIndex( this, token );
|
126
|
-
|
127
|
-
while ( index !== -1 ) {
|
128
|
-
this.splice( index, 1 );
|
129
|
-
updated = true;
|
130
|
-
index = checkTokenAndGetIndex( this, token );
|
131
|
-
}
|
132
|
-
}
|
133
|
-
|
134
|
-
while ( ++iter < len );
|
135
|
-
|
136
|
-
if ( updated ) {
|
137
|
-
this._updateClassName();
|
138
|
-
}
|
139
|
-
};
|
140
|
-
|
141
|
-
classListProto.toggle = function( token, force ) {
|
142
|
-
token += '';
|
143
|
-
|
144
|
-
var
|
145
|
-
result = this.contains( token ),
|
146
|
-
method = result ? force !== true && 'remove' : force !== false && 'add';
|
147
|
-
|
148
|
-
if ( method ) {
|
149
|
-
this[ method ]( token );
|
150
|
-
}
|
151
|
-
|
152
|
-
if ( force === true || force === false ) {
|
153
|
-
return force;
|
154
|
-
} else {
|
155
|
-
return !result;
|
156
|
-
}
|
157
|
-
};
|
158
|
-
|
159
|
-
classListProto.toString = function() {
|
160
|
-
return this.join( ' ' );
|
161
|
-
};
|
162
|
-
|
163
|
-
if ( objCtr.defineProperty ) {
|
164
|
-
var classListPropDesc = {
|
165
|
-
get : classListGetter,
|
166
|
-
enumerable : true,
|
167
|
-
configurable : true
|
168
|
-
};
|
169
|
-
|
170
|
-
try {
|
171
|
-
objCtr.defineProperty( elemCtrProto, classListProp, classListPropDesc );
|
172
|
-
}
|
173
|
-
|
174
|
-
catch ( ex ) {
|
175
|
-
if ( ex.number === -0x7FF5EC54 ) {
|
176
|
-
classListPropDesc.enumerable = false;
|
177
|
-
objCtr.defineProperty( elemCtrProto, classListProp, classListPropDesc );
|
178
|
-
}
|
179
|
-
}
|
180
|
-
|
181
|
-
} else if ( objCtr[ protoProp ].__defineGetter__ ) {
|
182
|
-
elemCtrProto.__defineGetter__( classListProp, classListGetter );
|
183
|
-
}
|
184
|
-
|
185
|
-
}( self ));
|
186
|
-
|
187
|
-
} else {
|
188
|
-
|
189
|
-
( function() {
|
190
|
-
|
191
|
-
'use strict';
|
192
|
-
|
193
|
-
var testElement = document.createElement( '_' );
|
194
|
-
|
195
|
-
testElement.classList.add( 'c1', 'c2' );
|
196
|
-
|
197
|
-
if ( !testElement.classList.contains( 'c2' ) ) {
|
198
|
-
var createMethod = function( method ) {
|
199
|
-
var original = DOMTokenList.prototype[ method ];
|
200
|
-
|
201
|
-
DOMTokenList.prototype[ method ] = function( token ) {
|
202
|
-
var i, len = arguments.length;
|
203
|
-
|
204
|
-
for ( i = 0; i < len; i++ ) {
|
205
|
-
token = arguments[ i ];
|
206
|
-
original.call( this, token );
|
207
|
-
}
|
208
|
-
};
|
209
|
-
};
|
210
|
-
createMethod( 'add' );
|
211
|
-
createMethod( 'remove' );
|
212
|
-
}
|
213
|
-
|
214
|
-
testElement.classList.toggle( 'c3', false );
|
215
|
-
|
216
|
-
if ( testElement.classList.contains( 'c3' ) ) {
|
217
|
-
var _toggle = DOMTokenList.prototype.toggle;
|
218
|
-
|
219
|
-
DOMTokenList.prototype.toggle = function( token, force ) {
|
220
|
-
if ( 1 in arguments && !this.contains( token ) === !force ) {
|
221
|
-
return force;
|
222
|
-
} else {
|
223
|
-
return _toggle.call( this, token );
|
224
|
-
}
|
225
|
-
};
|
226
|
-
|
227
|
-
}
|
228
|
-
|
229
|
-
testElement = null;
|
230
|
-
|
231
|
-
}());
|
232
|
-
|
233
|
-
}
|
234
|
-
}
|
@@ -1,30 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* Object.assign polyfill
|
3
|
-
* Cross-browser full Object.assign implementation
|
4
|
-
* @source https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign#Polyfill
|
5
|
-
* @license MIT
|
6
|
-
**/
|
7
|
-
|
8
|
-
if ( typeof Object.assign != 'function' ) {
|
9
|
-
( function() {
|
10
|
-
Object.assign = function( target ) {
|
11
|
-
'use strict';
|
12
|
-
if ( target === undefined || target === null ) {
|
13
|
-
throw new TypeError( 'Cannot convert undefined or null to object' );
|
14
|
-
}
|
15
|
-
|
16
|
-
var output = Object( target );
|
17
|
-
for ( var index = 1; index < arguments.length; index++ ) {
|
18
|
-
var source = arguments[ index ];
|
19
|
-
if ( source !== undefined && source !== null ) {
|
20
|
-
for ( var nextKey in source ) {
|
21
|
-
if ( Object.prototype.hasOwnProperty.call( source, nextKey ) ) {
|
22
|
-
output[ nextKey ] = source[ nextKey ];
|
23
|
-
}
|
24
|
-
}
|
25
|
-
}
|
26
|
-
}
|
27
|
-
return output;
|
28
|
-
};
|
29
|
-
})();
|
30
|
-
}
|
@@ -1,40 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* CompileData 0.0.1
|
3
|
-
* Compile input data from a given parent element
|
4
|
-
* @author Kyle Foster (@hkfoster)
|
5
|
-
* @license MIT
|
6
|
-
**/
|
7
|
-
|
8
|
-
// Public API function
|
9
|
-
var compileData = function( parent, debug ) {
|
10
|
-
|
11
|
-
// Scoped variables
|
12
|
-
var formData = new FormData(),
|
13
|
-
allFields = parent.querySelectorAll( 'input:not([type=submit])' );
|
14
|
-
|
15
|
-
// Loop over fields
|
16
|
-
for ( var i = 0; i < allFields.length; i++ ) {
|
17
|
-
|
18
|
-
// Cache current field
|
19
|
-
var field = allFields[ i ];
|
20
|
-
|
21
|
-
// If a name attribute is present
|
22
|
-
if ( field.name ) {
|
23
|
-
|
24
|
-
// Debug mode logging
|
25
|
-
if ( debug ) console.log( 'Name: ' + field.name + '\n' + 'Value: ' + field.value );
|
26
|
-
|
27
|
-
// Append current field’s name/value to new formData object
|
28
|
-
formData.append( field.name, field.value );
|
29
|
-
|
30
|
-
}
|
31
|
-
|
32
|
-
}
|
33
|
-
|
34
|
-
// Then return said formData object
|
35
|
-
return formData;
|
36
|
-
|
37
|
-
};
|
38
|
-
|
39
|
-
// Public API
|
40
|
-
module.exports = compileData;
|
@@ -1,14 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* FromTop 0.0.1
|
3
|
-
* Find element’s distance from top of document
|
4
|
-
* @author Kyle Foster (@hkfoster)
|
5
|
-
* @license MIT
|
6
|
-
**/
|
7
|
-
|
8
|
-
// Public API function
|
9
|
-
var fromTop = function( elem ) {
|
10
|
-
return Math.round( elem.getBoundingClientRect().top + window.pageYOffset );
|
11
|
-
};
|
12
|
-
|
13
|
-
// Public API
|
14
|
-
module.exports = fromTop;
|