gumbie 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +29 -0
- data/Rakefile +1 -0
- data/gumbie.gemspec +25 -0
- data/lib/gumbie/version.rb +3 -0
- data/lib/gumbie.rb +7 -0
- data/vendor/assets/fonts/icons/entypo.eot +0 -0
- data/vendor/assets/fonts/icons/entypo.ttf +0 -0
- data/vendor/assets/fonts/icons/entypo.woff +0 -0
- data/vendor/assets/javascripts/libs/gumby.init.js +47 -0
- data/vendor/assets/javascripts/libs/gumby.js +258 -0
- data/vendor/assets/javascripts/libs/gumby.min.js +1 -0
- data/vendor/assets/javascripts/libs/jquery-1.10.1.min.js +6 -0
- data/vendor/assets/javascripts/libs/jquery-1.10.1.min.map +1 -0
- data/vendor/assets/javascripts/libs/jquery-2.0.2.min.js +6 -0
- data/vendor/assets/javascripts/libs/jquery-2.0.2.min.map +1 -0
- data/vendor/assets/javascripts/libs/jquery.mobile.custom.min.js +3 -0
- data/vendor/assets/javascripts/libs/modernizr-2.6.2.min.js +4 -0
- data/vendor/assets/javascripts/libs/ui/gumby.checkbox.js +101 -0
- data/vendor/assets/javascripts/libs/ui/gumby.fixed.js +240 -0
- data/vendor/assets/javascripts/libs/ui/gumby.navbar.js +115 -0
- data/vendor/assets/javascripts/libs/ui/gumby.radiobtn.js +90 -0
- data/vendor/assets/javascripts/libs/ui/gumby.retina.js +81 -0
- data/vendor/assets/javascripts/libs/ui/gumby.skiplink.js +157 -0
- data/vendor/assets/javascripts/libs/ui/gumby.tabs.js +80 -0
- data/vendor/assets/javascripts/libs/ui/gumby.toggleswitch.js +264 -0
- data/vendor/assets/javascripts/libs/ui/jquery.validation.js +142 -0
- data/vendor/assets/javascripts/main.js +23 -0
- data/vendor/assets/javascripts/plugins.js +4 -0
- data/vendor/assets/stylesheets/gumby.css +1683 -0
- data/vendor/assets/stylesheets/style.css +4 -0
- metadata +134 -0
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Gumby Tabs
|
|
3
|
+
*/
|
|
4
|
+
!function($) {
|
|
5
|
+
|
|
6
|
+
'use strict';
|
|
7
|
+
|
|
8
|
+
function Tabs($el) {
|
|
9
|
+
|
|
10
|
+
Gumby.debug('Initializing Tabs', $el);
|
|
11
|
+
|
|
12
|
+
this.$el = $el;
|
|
13
|
+
this.$nav = this.$el.find('> ul.tab-nav > li');
|
|
14
|
+
this.$content = this.$el.children('.tab-content');
|
|
15
|
+
|
|
16
|
+
var scope = this;
|
|
17
|
+
|
|
18
|
+
// listen for click event on tab nav and custom gumby set event
|
|
19
|
+
this.$nav.children('a').on(Gumby.click, function(e) {
|
|
20
|
+
e.preventDefault();
|
|
21
|
+
scope.click($(this));
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
// listen for gumby.set value for dynamically set tabs
|
|
25
|
+
this.$el.on('gumby.set', function(e, index) {
|
|
26
|
+
Gumby.debug('Set event triggered', scope.$el);
|
|
27
|
+
scope.set(e, index);
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// handle tab nav click event
|
|
32
|
+
Tabs.prototype.click = function($this) {
|
|
33
|
+
// index of item to activate
|
|
34
|
+
var index = $this.parent().index();
|
|
35
|
+
|
|
36
|
+
if(this.$nav.eq(index).add(this.$content.eq(index)).hasClass('active')) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
Gumby.debug('Setting active tab to '+index, this.$el);
|
|
41
|
+
|
|
42
|
+
// deactivate other tab navigation and content
|
|
43
|
+
this.$nav.add(this.$content).removeClass('active');
|
|
44
|
+
|
|
45
|
+
// activate this tab nav link and content
|
|
46
|
+
this.$nav.eq(index).add(this.$content.eq(index)).addClass('active');
|
|
47
|
+
|
|
48
|
+
// trigger gumby.change event and pass current active tab index
|
|
49
|
+
Gumby.debug('Triggering onChange event', this.$el);
|
|
50
|
+
this.$el.trigger('gumby.onChange', index);
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
// set specific tab
|
|
54
|
+
Tabs.prototype.set = function(e, index) {
|
|
55
|
+
this.$nav.eq(index).find('a').trigger(Gumby.click);
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
// add initialisation
|
|
59
|
+
Gumby.addInitalisation('tabs', function() {
|
|
60
|
+
$('.tabs').each(function() {
|
|
61
|
+
var $this = $(this);
|
|
62
|
+
// this element has already been initialized
|
|
63
|
+
if($this.data('isTabs')) {
|
|
64
|
+
return true;
|
|
65
|
+
}
|
|
66
|
+
// mark element as initialized
|
|
67
|
+
$this.data('isTabs', true);
|
|
68
|
+
new Tabs($this);
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
// register UI module
|
|
73
|
+
Gumby.UIModule({
|
|
74
|
+
module: 'tabs',
|
|
75
|
+
events: ['onChange', 'set'],
|
|
76
|
+
init: function() {
|
|
77
|
+
Gumby.initialize('tabs');
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
}(jQuery);
|
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Gumby Toggles/Switches
|
|
3
|
+
*/
|
|
4
|
+
!function($) {
|
|
5
|
+
|
|
6
|
+
'use strict';
|
|
7
|
+
|
|
8
|
+
// Toggle constructor
|
|
9
|
+
function Toggle($el) {
|
|
10
|
+
this.$el = $($el);
|
|
11
|
+
this.targets = [];
|
|
12
|
+
this.on = '';
|
|
13
|
+
this.className = '';
|
|
14
|
+
this.self = false;
|
|
15
|
+
|
|
16
|
+
if(this.$el.length) {
|
|
17
|
+
Gumby.debug('Initializing Toggle', $el);
|
|
18
|
+
this.init();
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// Switch constructor
|
|
23
|
+
function Switch($el) {
|
|
24
|
+
this.$el = $($el);
|
|
25
|
+
this.targets = [];
|
|
26
|
+
this.on = '';
|
|
27
|
+
this.className = '';
|
|
28
|
+
this.self = false;
|
|
29
|
+
|
|
30
|
+
if(this.$el.length) {
|
|
31
|
+
Gumby.debug('Initializing Switch', $el);
|
|
32
|
+
this.init();
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// intialise toggles, switches will inherit method
|
|
37
|
+
Toggle.prototype.init = function() {
|
|
38
|
+
var scope = this;
|
|
39
|
+
|
|
40
|
+
// set up module based on attributes
|
|
41
|
+
this.setup();
|
|
42
|
+
|
|
43
|
+
// bind to specified event and trigger
|
|
44
|
+
this.$el.on(this.on, function(e) {
|
|
45
|
+
e.preventDefault();
|
|
46
|
+
scope.trigger(scope.triggered);
|
|
47
|
+
|
|
48
|
+
// listen for gumby.trigger to dynamically trigger toggle/switch
|
|
49
|
+
}).on('gumby.trigger', function() {
|
|
50
|
+
Gumby.debug('Trigger event triggered', scope.$el);
|
|
51
|
+
scope.trigger(scope.triggered);
|
|
52
|
+
// re-initialize module
|
|
53
|
+
}).on('gumby.initialize', function() {
|
|
54
|
+
Gumby.debug('Re-initializing '+scope.constructor, $el);
|
|
55
|
+
scope.setup();
|
|
56
|
+
});
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
// set up module based on attributes
|
|
60
|
+
Toggle.prototype.setup = function() {
|
|
61
|
+
this.targets = this.parseTargets();
|
|
62
|
+
this.on = Gumby.selectAttr.apply(this.$el, ['on']) || Gumby.click;
|
|
63
|
+
this.className = Gumby.selectAttr.apply(this.$el, ['classname']) || 'active';
|
|
64
|
+
this.self = Gumby.selectAttr.apply(this.$el, ['self']) === 'false';
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
// parse data-for attribute, switches will inherit method
|
|
68
|
+
Toggle.prototype.parseTargets = function() {
|
|
69
|
+
var targetStr = Gumby.selectAttr.apply(this.$el, ['trigger']),
|
|
70
|
+
secondaryTargets = 0,
|
|
71
|
+
targets = [];
|
|
72
|
+
|
|
73
|
+
// no targets so return false
|
|
74
|
+
if(!targetStr) {
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
secondaryTargets = targetStr.indexOf('|');
|
|
79
|
+
|
|
80
|
+
// no secondary targets specified so return single target
|
|
81
|
+
if(secondaryTargets === -1) {
|
|
82
|
+
if(!this.checkTargets([targetStr])) {
|
|
83
|
+
return false;
|
|
84
|
+
}
|
|
85
|
+
return [$(targetStr)];
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// return array of both targets, split and return 0, 1
|
|
89
|
+
targets = targetStr.split('|');
|
|
90
|
+
if(!this.checkTargets(targets)) {
|
|
91
|
+
return false;
|
|
92
|
+
}
|
|
93
|
+
return targets.length > 1 ? [$(targets[0]), $(targets[1])] : [$(targets[0])];
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
Toggle.prototype.checkTargets = function(targets) {
|
|
97
|
+
var i = 0;
|
|
98
|
+
|
|
99
|
+
for(i; i < targets.length; i++) {
|
|
100
|
+
if(targets[i] && !$(targets[i]).length) {
|
|
101
|
+
Gumby.error('Cannot find '+this.constructor.name+' target: '+targets[i]);
|
|
102
|
+
return false;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
return true;
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
// call triggered event and pass target data
|
|
110
|
+
Toggle.prototype.triggered = function() {
|
|
111
|
+
// trigger gumby.onTrigger event and pass array of target status data
|
|
112
|
+
Gumby.debug('Triggering onTrigger event', this.$el);
|
|
113
|
+
this.$el.trigger('gumby.onTrigger', [this.$el.hasClass(this.className)]);
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
// Switch object inherits from Toggle
|
|
117
|
+
Switch.prototype = new Toggle();
|
|
118
|
+
Switch.prototype.constructor = Switch;
|
|
119
|
+
|
|
120
|
+
// Toggle specific trigger method
|
|
121
|
+
Toggle.prototype.trigger = function(cb) {
|
|
122
|
+
|
|
123
|
+
Gumby.debug('Triggering Toggle', this.$el);
|
|
124
|
+
|
|
125
|
+
var $target;
|
|
126
|
+
|
|
127
|
+
// no targets just toggle active class on toggle
|
|
128
|
+
if(!this.targets) {
|
|
129
|
+
this.$el.toggleClass(this.className);
|
|
130
|
+
|
|
131
|
+
// combine single target with toggle and toggle active class
|
|
132
|
+
} else if(this.targets.length == 1) {
|
|
133
|
+
this.$el.add(this.targets[0]).toggleClass(this.className);
|
|
134
|
+
|
|
135
|
+
// if two targets check active state of first
|
|
136
|
+
// always combine toggle and first target
|
|
137
|
+
} else if(this.targets.length > 1) {
|
|
138
|
+
if(this.targets[0].hasClass(this.className)) {
|
|
139
|
+
$target = this.targets[0];
|
|
140
|
+
|
|
141
|
+
// add this element to it unless gumby-self set
|
|
142
|
+
if(!this.self) {
|
|
143
|
+
$target = $target.add(this.$el);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
$target.removeClass(this.className);
|
|
147
|
+
this.targets[1].addClass(this.className);
|
|
148
|
+
} else {
|
|
149
|
+
$target = this.targets[0];
|
|
150
|
+
|
|
151
|
+
// add this element to it unless gumby-self set
|
|
152
|
+
if(!this.self) {
|
|
153
|
+
$target = $target.add(this.$el);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
$target.addClass(this.className);
|
|
157
|
+
this.targets[1].removeClass(this.className);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
// call event handler here, applying scope of object Switch/Toggle
|
|
162
|
+
if(cb && typeof cb === 'function') {
|
|
163
|
+
cb.apply(this);
|
|
164
|
+
}
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
// Switch specific trigger method
|
|
168
|
+
Switch.prototype.trigger = function(cb) {
|
|
169
|
+
|
|
170
|
+
Gumby.debug('Triggering Switch', this.$el);
|
|
171
|
+
|
|
172
|
+
var $target;
|
|
173
|
+
|
|
174
|
+
// no targets just add active class to switch
|
|
175
|
+
if(!this.targets) {
|
|
176
|
+
this.$el.addClass(this.className);
|
|
177
|
+
|
|
178
|
+
// combine single target with switch and add active class
|
|
179
|
+
} else if(this.targets.length == 1) {
|
|
180
|
+
$target = this.targets[0];
|
|
181
|
+
|
|
182
|
+
// add this element to it unless gumby-self set
|
|
183
|
+
if(!this.self) {
|
|
184
|
+
$target = $target.add(this.$el);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
$target.addClass(this.className);
|
|
188
|
+
|
|
189
|
+
// if two targets check active state of first
|
|
190
|
+
// always combine switch and first target
|
|
191
|
+
} else if(this.targets.length > 1) {
|
|
192
|
+
$target = this.targets[0];
|
|
193
|
+
|
|
194
|
+
// add this element to it unless gumby-self set
|
|
195
|
+
if(!this.self) {
|
|
196
|
+
$target = $target.add(this.$el);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
$target.addClass(this.className);
|
|
200
|
+
this.targets[1].removeClass(this.className);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
// call event handler here, applying scope of object Switch/Toggle
|
|
204
|
+
if(cb && typeof cb === 'function') {
|
|
205
|
+
cb.apply(this);
|
|
206
|
+
}
|
|
207
|
+
};
|
|
208
|
+
|
|
209
|
+
// add toggle initialisation
|
|
210
|
+
Gumby.addInitalisation('toggles', function(all) {
|
|
211
|
+
$('.toggle').each(function() {
|
|
212
|
+
var $this = $(this);
|
|
213
|
+
|
|
214
|
+
// this element has already been initialized
|
|
215
|
+
// and we're only initializing new modules
|
|
216
|
+
if($this.data('isToggle') && !all) {
|
|
217
|
+
return true;
|
|
218
|
+
|
|
219
|
+
// this element has already been initialized
|
|
220
|
+
// and we need to reinitialize it
|
|
221
|
+
} else if($this.data('isToggle') && all) {
|
|
222
|
+
$this.trigger('gumby.initialize');
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
// mark element as initialized
|
|
226
|
+
$this.data('isToggle', true);
|
|
227
|
+
new Toggle($this);
|
|
228
|
+
});
|
|
229
|
+
});
|
|
230
|
+
|
|
231
|
+
// add switches initialisation
|
|
232
|
+
Gumby.addInitalisation('switches', function(all) {
|
|
233
|
+
$('.switch').each(function() {
|
|
234
|
+
var $this = $(this);
|
|
235
|
+
|
|
236
|
+
// this element has already been initialized
|
|
237
|
+
// and we're only initializing new modules
|
|
238
|
+
if($this.data('isSwitch') && !all) {
|
|
239
|
+
return true;
|
|
240
|
+
|
|
241
|
+
// this element has already been initialized
|
|
242
|
+
// and we need to reinitialize it
|
|
243
|
+
} else if($this.data('isSwitch') && all) {
|
|
244
|
+
$this.trigger('gumby.initialize');
|
|
245
|
+
return true;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
// mark element as initialized
|
|
249
|
+
$this.data('isSwitch', true);
|
|
250
|
+
new Switch($this);
|
|
251
|
+
});
|
|
252
|
+
});
|
|
253
|
+
|
|
254
|
+
// register UI module
|
|
255
|
+
Gumby.UIModule({
|
|
256
|
+
module: 'toggleswitch',
|
|
257
|
+
events: ['initialize', 'trigger', 'onTrigger'],
|
|
258
|
+
init: function() {
|
|
259
|
+
// Run initialize methods
|
|
260
|
+
Gumby.initialize('switches');
|
|
261
|
+
Gumby.initialize('toggles');
|
|
262
|
+
}
|
|
263
|
+
});
|
|
264
|
+
}(jQuery);
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Gumby jQuery Validation Plugin
|
|
3
|
+
*/
|
|
4
|
+
!function($) {
|
|
5
|
+
|
|
6
|
+
'use strict';
|
|
7
|
+
|
|
8
|
+
function Validation($this, req) {
|
|
9
|
+
|
|
10
|
+
if(Gumby) {
|
|
11
|
+
Gumby.debug('Initializing Validation', $this);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
// input and holder .field
|
|
15
|
+
this.$this = $this;
|
|
16
|
+
this.$field = this.$this.parents('.field');
|
|
17
|
+
|
|
18
|
+
// supplied validation function with default length check
|
|
19
|
+
this.req = req || function() {
|
|
20
|
+
return !!this.$this.val().length;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
// reference to this class
|
|
24
|
+
var scope = this;
|
|
25
|
+
|
|
26
|
+
// checkboxes and radio buttons use gumby.onChange event to validate
|
|
27
|
+
if(this.$this.is('[type=checkbox], [type=radio]')) {
|
|
28
|
+
this.$field = this.$this.parent('label');
|
|
29
|
+
this.$field.on('gumby.onChange', function() {
|
|
30
|
+
scope.validate();
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
// selects validate on change
|
|
34
|
+
} else if(this.$this.is('select')) {
|
|
35
|
+
this.$field = this.$this.parents('.picker');
|
|
36
|
+
this.$field.on('change', function() {
|
|
37
|
+
scope.validate();
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
// others (text input, textarea) use blur
|
|
41
|
+
} else {
|
|
42
|
+
this.$this.on('blur', function(e) {
|
|
43
|
+
// ignore tab
|
|
44
|
+
if(e.which !== 9) {
|
|
45
|
+
scope.validate();
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// validate field
|
|
52
|
+
Validation.prototype.validate = function() {
|
|
53
|
+
|
|
54
|
+
var result = this.req(this.$this);
|
|
55
|
+
|
|
56
|
+
// failed
|
|
57
|
+
if(!result) {
|
|
58
|
+
this.$field.removeClass('success').addClass('danger');
|
|
59
|
+
|
|
60
|
+
// passed
|
|
61
|
+
} else {
|
|
62
|
+
//} else if(this.$field.hasClass('danger')) {
|
|
63
|
+
this.$field.removeClass('danger').addClass('success');
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
return result;
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
// jQuery plugin definition
|
|
70
|
+
$.fn.validation = function(options) {
|
|
71
|
+
|
|
72
|
+
var // extend params with defaults
|
|
73
|
+
settings = $.extend({
|
|
74
|
+
submit : false,
|
|
75
|
+
fail: false,
|
|
76
|
+
required : []
|
|
77
|
+
}, options),
|
|
78
|
+
// store validation objects
|
|
79
|
+
validations = [];
|
|
80
|
+
|
|
81
|
+
// init each form plugin is called on
|
|
82
|
+
return this.each(function() {
|
|
83
|
+
|
|
84
|
+
// no required fields so plugin is pointless
|
|
85
|
+
if(!settings.required.length) {
|
|
86
|
+
return false;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
var $this = $(this),
|
|
90
|
+
reqLength = settings.required.length,
|
|
91
|
+
i;
|
|
92
|
+
|
|
93
|
+
// loop round each required field and instantiate new validation object
|
|
94
|
+
for(i = 0; i < reqLength; i++) {
|
|
95
|
+
validations.push(new Validation(
|
|
96
|
+
$this.find('[name="'+settings.required[i].name+'"]'),
|
|
97
|
+
settings.required[i].validate || false
|
|
98
|
+
));
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// hijack submit event
|
|
102
|
+
$this.on('submit', function(e) {
|
|
103
|
+
|
|
104
|
+
// reference to whole form pass/fail
|
|
105
|
+
var failed = false;
|
|
106
|
+
|
|
107
|
+
// if no passed attribute found we should halt form submit
|
|
108
|
+
if(!$this.data('passed')) {
|
|
109
|
+
e.preventDefault();
|
|
110
|
+
|
|
111
|
+
// loop round validation objects and validate each
|
|
112
|
+
var reqLength = validations.length, i;
|
|
113
|
+
for(i = 0; i < reqLength; i++) {
|
|
114
|
+
if(!validations[i].validate()) {
|
|
115
|
+
failed = true;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
// passed
|
|
120
|
+
if(!failed) {
|
|
121
|
+
// if submit method present call that otherwise submit form
|
|
122
|
+
if(settings.submit && typeof settings.submit === 'function') {
|
|
123
|
+
settings.submit($this.serializeArray());
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
// store passed bool and re-submit
|
|
128
|
+
$this.data('passed', true).submit();
|
|
129
|
+
|
|
130
|
+
// failed
|
|
131
|
+
} else {
|
|
132
|
+
// call fail method if present
|
|
133
|
+
if(settings.fail && typeof settings.fail === 'function') {
|
|
134
|
+
settings.fail();
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
});
|
|
141
|
+
};
|
|
142
|
+
}(jQuery);
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// Gumby is ready to go
|
|
2
|
+
Gumby.ready(function() {
|
|
3
|
+
Gumby.log('Gumby is ready to go...', Gumby.dump());
|
|
4
|
+
|
|
5
|
+
// placeholder polyfil
|
|
6
|
+
if(Gumby.isOldie || Gumby.$dom.find('html').hasClass('ie9')) {
|
|
7
|
+
$('input, textarea').placeholder();
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
// skip link and toggle on one element
|
|
11
|
+
// when the skip link completes, trigger the switch
|
|
12
|
+
$('#skip-switch').on('gumby.onComplete', function() {
|
|
13
|
+
$(this).trigger('gumby.trigger');
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
// Oldie document loaded
|
|
17
|
+
}).oldie(function() {
|
|
18
|
+
Gumby.warn("This is an oldie browser...");
|
|
19
|
+
|
|
20
|
+
// Touch devices loaded
|
|
21
|
+
}).touch(function() {
|
|
22
|
+
Gumby.log("This is a touch enabled device...");
|
|
23
|
+
});
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/*! http://mths.be/placeholder v2.0.7 by @mathias */
|
|
2
|
+
;(function(f,h,$){var a='placeholder' in h.createElement('input'),d='placeholder' in h.createElement('textarea'),i=$.fn,c=$.valHooks,k,j;if(a&&d){j=i.placeholder=function(){return this};j.input=j.textarea=true}else{j=i.placeholder=function(){var l=this;l.filter((a?'textarea':':input')+'[placeholder]').not('.placeholder').bind({'focus.placeholder':b,'blur.placeholder':e}).data('placeholder-enabled',true).trigger('blur.placeholder');return l};j.input=a;j.textarea=d;k={get:function(m){var l=$(m);return l.data('placeholder-enabled')&&l.hasClass('placeholder')?'':m.value},set:function(m,n){var l=$(m);if(!l.data('placeholder-enabled')){return m.value=n}if(n==''){m.value=n;if(m!=h.activeElement){e.call(m)}}else{if(l.hasClass('placeholder')){b.call(m,true,n)||(m.value=n)}else{m.value=n}}return l}};a||(c.input=k);d||(c.textarea=k);$(function(){$(h).delegate('form','submit.placeholder',function(){var l=$('.placeholder',this).each(b);setTimeout(function(){l.each(e)},10)})});$(f).bind('beforeunload.placeholder',function(){$('.placeholder').each(function(){this.value=''})})}function g(m){var l={},n=/^jQuery\d+$/;$.each(m.attributes,function(p,o){if(o.specified&&!n.test(o.name)){l[o.name]=o.value}});return l}function b(m,n){var l=this,o=$(l);if(l.value==o.attr('placeholder')&&o.hasClass('placeholder')){if(o.data('placeholder-password')){o=o.hide().next().show().attr('id',o.removeAttr('id').data('placeholder-id'));if(m===true){return o[0].value=n}o.focus()}else{l.value='';o.removeClass('placeholder');l==h.activeElement&&l.select()}}}function e(){var q,l=this,p=$(l),m=p,o=this.id;if(l.value==''){if(l.type=='password'){if(!p.data('placeholder-textinput')){try{q=p.clone().attr({type:'text'})}catch(n){q=$('<input>').attr($.extend(g(this),{type:'text'}))}q.removeAttr('name').data({'placeholder-password':true,'placeholder-id':o}).bind('focus.placeholder',b);p.data({'placeholder-textinput':q,'placeholder-id':o}).before(q)}p=p.removeAttr('id').hide().prev().attr('id',o).show()}p.addClass('placeholder');p[0].value=p.attr('placeholder')}else{p.removeClass('placeholder')}}}(this,document,jQuery));
|
|
3
|
+
|
|
4
|
+
// place any jQuery/helper plugins in here, instead of separate, slower script files.
|