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
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: 5e0c02f8a561dffd728d20e93713da32b228c024
|
|
4
|
+
data.tar.gz: ec691eeee90192064a4554fed19065c83b2a796c
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: b1003f4073f059afae706603c812a31192cd18ec18d0dd3497e7527f52385ed4e66ccc0a77d0d537d243fafa77705d08120302c1d4d4ec536ee8fa8bd04682a2
|
|
7
|
+
data.tar.gz: d49fe00f1961ce737ee1388f6ea37d5a85d91260927501f8c38f58957a6447abf771f422b4bf4c16194c3280b89abf92a1db3047e317371d6906e5fab1794da6
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
Copyright (c) 2014 TODO: Write your name
|
|
2
|
+
|
|
3
|
+
MIT License
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
+
a copy of this software and associated documentation files (the
|
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
11
|
+
the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be
|
|
14
|
+
included in all copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Gumbie
|
|
2
|
+
|
|
3
|
+
TODO: Write a gem description
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
Add this line to your application's Gemfile:
|
|
8
|
+
|
|
9
|
+
gem 'gumbie'
|
|
10
|
+
|
|
11
|
+
And then execute:
|
|
12
|
+
|
|
13
|
+
$ bundle
|
|
14
|
+
|
|
15
|
+
Or install it yourself as:
|
|
16
|
+
|
|
17
|
+
$ gem install gumbie
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
TODO: Write usage instructions here
|
|
22
|
+
|
|
23
|
+
## Contributing
|
|
24
|
+
|
|
25
|
+
1. Fork it ( http://github.com/<my-github-username>/gumbie/fork )
|
|
26
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
|
27
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
|
28
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
|
29
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require "bundler/gem_tasks"
|
data/gumbie.gemspec
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
|
+
require 'gumbie/version'
|
|
5
|
+
|
|
6
|
+
Gem::Specification.new do |spec|
|
|
7
|
+
spec.name = "gumbie"
|
|
8
|
+
spec.version = Gumbie::VERSION
|
|
9
|
+
spec.authors = ["zxy"]
|
|
10
|
+
spec.email = ["lajunta@qq.com"]
|
|
11
|
+
spec.summary = %q{Gumby Framework for RoR}
|
|
12
|
+
spec.description = %q{Front End framework support ie}
|
|
13
|
+
spec.homepage = "http://github.com/lajunta/gumbie"
|
|
14
|
+
spec.license = "MIT"
|
|
15
|
+
|
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
|
19
|
+
spec.require_paths = ["lib","vendor"]
|
|
20
|
+
|
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.5"
|
|
22
|
+
spec.add_development_dependency "rake" , "~>0"
|
|
23
|
+
spec.add_dependency "jquery-rails", "~>0"
|
|
24
|
+
spec.add_dependency "modernizr-rails", "~>0"
|
|
25
|
+
end
|
data/lib/gumbie.rb
ADDED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Gumby Init
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
!function($) {
|
|
6
|
+
|
|
7
|
+
'use strict';
|
|
8
|
+
|
|
9
|
+
// not touch device or no touch events required so auto initialize here
|
|
10
|
+
if((!Gumby.touchDevice || !Gumby.touchEvents) && Gumby.autoInit) {
|
|
11
|
+
window.Gumby.init();
|
|
12
|
+
|
|
13
|
+
// load jQuery mobile touch events
|
|
14
|
+
} else if(Gumby.touchEvents && Gumby.touchDevice) {
|
|
15
|
+
Gumby.debug('Loading jQuery mobile touch events');
|
|
16
|
+
// set timeout to 2sec
|
|
17
|
+
yepnope.errorTimeout = 2000;
|
|
18
|
+
Modernizr.load({
|
|
19
|
+
test: Modernizr.touch,
|
|
20
|
+
yep: Gumby.touchEvents+'/jquery.mobile.custom.min.js',
|
|
21
|
+
complete: function() {
|
|
22
|
+
// error loading jQuery mobile
|
|
23
|
+
if(!$.mobile) {
|
|
24
|
+
Gumby.error('Error loading jQuery mobile touch events');
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// if not auto initializing
|
|
28
|
+
// this will allow helpers to fire when initialized
|
|
29
|
+
Gumby.touchEventsLoaded = true;
|
|
30
|
+
|
|
31
|
+
// auto initialize
|
|
32
|
+
if(Gumby.autoInit) {
|
|
33
|
+
window.Gumby.init();
|
|
34
|
+
|
|
35
|
+
// if already manually initialized then fire helpers
|
|
36
|
+
} else if(Gumby.uiModulesReady) {
|
|
37
|
+
Gumby.helpers();
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// if AMD return Gumby object to define
|
|
44
|
+
if(typeof define == "function" && define.amd) {
|
|
45
|
+
define(window.Gumby);
|
|
46
|
+
}
|
|
47
|
+
}(jQuery);
|
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Gumby Framework
|
|
3
|
+
* ---------------
|
|
4
|
+
*
|
|
5
|
+
* Follow @gumbycss on twitter and spread the love.
|
|
6
|
+
* We worked super hard on making this awesome and released it to the web.
|
|
7
|
+
* All we ask is you leave this intact. #gumbyisawesome
|
|
8
|
+
*
|
|
9
|
+
* Gumby Framework
|
|
10
|
+
* http://gumbyframework.com
|
|
11
|
+
*
|
|
12
|
+
* Built with love by your friends @digitalsurgeons
|
|
13
|
+
* http://www.digitalsurgeons.com
|
|
14
|
+
*
|
|
15
|
+
* Free to use under the MIT license.
|
|
16
|
+
* http://www.opensource.org/licenses/mit-license.php
|
|
17
|
+
*/
|
|
18
|
+
!function($) {
|
|
19
|
+
|
|
20
|
+
'use strict';
|
|
21
|
+
|
|
22
|
+
function Gumby() {
|
|
23
|
+
this.$dom = $(document);
|
|
24
|
+
this.$html = this.$dom.find('html');
|
|
25
|
+
this.isOldie = !!this.$html.hasClass('oldie');
|
|
26
|
+
this.click = 'click';
|
|
27
|
+
this.onReady = this.onOldie = this.onTouch = false;
|
|
28
|
+
this.autoInit = $('script[gumby-init]').attr('gumby-init') === 'false' ? false : true;
|
|
29
|
+
this.debugMode = Boolean($('script[gumby-debug]').length);
|
|
30
|
+
this.touchDevice = !!(Modernizr.touch || window.navigator.userAgent.indexOf("Windows Phone") > 0);
|
|
31
|
+
this.gumbyTouch = false;
|
|
32
|
+
this.touchEvents = 'js/libs';
|
|
33
|
+
this.breakpoint = Number($('script[gumby-breakpoint]').attr('gumby-breakpoint')) || 768;
|
|
34
|
+
this.touchEventsLoaded = false;
|
|
35
|
+
this.uiModulesReady = false;
|
|
36
|
+
this.uiModules = {};
|
|
37
|
+
this.inits = {};
|
|
38
|
+
|
|
39
|
+
// jQuery mobile touch events
|
|
40
|
+
var touch = $('script[gumby-touch]').attr('gumby-touch'),
|
|
41
|
+
path = $('script[gumby-path]').attr('gumby-path');
|
|
42
|
+
|
|
43
|
+
// do not use touch events
|
|
44
|
+
if(touch === 'false') {
|
|
45
|
+
this.touchEvents = false;
|
|
46
|
+
|
|
47
|
+
// set path to jQuery mobile
|
|
48
|
+
// support touch/path attrs for backwards compatibility
|
|
49
|
+
} else {
|
|
50
|
+
if(touch) {
|
|
51
|
+
this.touchEvents = touch;
|
|
52
|
+
} else if(path) {
|
|
53
|
+
this.touchEvents = path;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// update click property to bind to click/tap
|
|
58
|
+
if(this.touchDevice) {
|
|
59
|
+
this.click += ' tap';
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// add gumby-touch/gumby-no-touch classes
|
|
63
|
+
// gumby touch == touch enabled && smaller than defined breakpoint
|
|
64
|
+
if(this.touchDevice && $(window).width() < this.breakpoint) {
|
|
65
|
+
this.$html.addClass('gumby-touch');
|
|
66
|
+
this.gumbyTouch = true;
|
|
67
|
+
} else {
|
|
68
|
+
this.$html.addClass('gumby-no-touch');
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
if(this.debugMode) {
|
|
72
|
+
this.debug('Gumby is in debug mode');
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// initialize Gumby
|
|
77
|
+
Gumby.prototype.init = function(options) {
|
|
78
|
+
var scope = this,
|
|
79
|
+
opts = options ? options : {};
|
|
80
|
+
|
|
81
|
+
// call ready() code when dom is ready
|
|
82
|
+
this.$dom.ready(function() {
|
|
83
|
+
if(opts.debug) {
|
|
84
|
+
scope.debugMode = true;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
scope.debug("Initializing Gumby");
|
|
88
|
+
|
|
89
|
+
// init UI modules
|
|
90
|
+
var mods = opts.uiModules ? opts.uiModules : false;
|
|
91
|
+
scope.initUIModules(mods);
|
|
92
|
+
|
|
93
|
+
if(scope.onReady) {
|
|
94
|
+
scope.onReady();
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// call oldie() callback if applicable
|
|
98
|
+
if(scope.isOldie && scope.onOldie) {
|
|
99
|
+
scope.onOldie();
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// call touch() callback if applicable
|
|
103
|
+
if(Modernizr.touch && scope.onTouch) {
|
|
104
|
+
scope.onTouch();
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
return this;
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
Gumby.prototype.helpers = function() {
|
|
112
|
+
if(this.onReady) {
|
|
113
|
+
this.onReady();
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// call oldie() callback if applicable
|
|
117
|
+
if(this.isOldie && this.onOldie) {
|
|
118
|
+
this.onOldie();
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
// call touch() callback if applicable
|
|
122
|
+
if(Modernizr.touch && this.onTouch) {
|
|
123
|
+
this.onTouch();
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
// public helper - set Gumby ready callback
|
|
128
|
+
Gumby.prototype.ready = function(code) {
|
|
129
|
+
if(code && typeof code === 'function') {
|
|
130
|
+
this.onReady = code;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
return this;
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
// public helper - set oldie callback
|
|
137
|
+
Gumby.prototype.oldie = function(code) {
|
|
138
|
+
if(code && typeof code === 'function') {
|
|
139
|
+
this.onOldie = code;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
return this;
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
// public helper - set touch callback
|
|
146
|
+
Gumby.prototype.touch = function(code) {
|
|
147
|
+
if(code && typeof code === 'function') {
|
|
148
|
+
this.onTouch = code;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
return this;
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
// print to console if available and we're in debug mode
|
|
155
|
+
Gumby.prototype.console = function(type, data) {
|
|
156
|
+
if(!this.debugMode || !window.console) { return; }
|
|
157
|
+
console[console[type] ? type : 'log'](data.length > 1 ? Array.prototype.slice.call(data) : data[0]);
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
// pass args onto console method for output
|
|
161
|
+
Gumby.prototype.log = function() { this.console('log', arguments); };
|
|
162
|
+
Gumby.prototype.debug = function() { this.console('debug', arguments); };
|
|
163
|
+
Gumby.prototype.warn = function() { this.console('warn', arguments); };
|
|
164
|
+
Gumby.prototype.error = function() { this.console('error', arguments); };
|
|
165
|
+
|
|
166
|
+
// public helper - return debuggin object including uiModules object
|
|
167
|
+
Gumby.prototype.dump = function() {
|
|
168
|
+
return {
|
|
169
|
+
$dom: this.$dom,
|
|
170
|
+
isOldie: this.isOldie,
|
|
171
|
+
touchEvents: this.touchEvents,
|
|
172
|
+
debugMode: this.debugMode,
|
|
173
|
+
autoInit: this.autoInit,
|
|
174
|
+
uiModules: this.uiModules,
|
|
175
|
+
click: this.click
|
|
176
|
+
};
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
// grab attribute value, testing data- gumby- and no prefix
|
|
180
|
+
Gumby.prototype.selectAttr = function() {
|
|
181
|
+
var i = 0;
|
|
182
|
+
|
|
183
|
+
// any number of attributes can be passed
|
|
184
|
+
for(; i < arguments.length; i++) {
|
|
185
|
+
// various formats
|
|
186
|
+
var attr = arguments[i],
|
|
187
|
+
dataAttr = 'data-'+arguments[i],
|
|
188
|
+
gumbyAttr = 'gumby-'+arguments[i];
|
|
189
|
+
|
|
190
|
+
// first test for data-attr
|
|
191
|
+
if(this.is('['+dataAttr+']')) {
|
|
192
|
+
return this.attr(dataAttr) ? this.attr(dataAttr) : true;
|
|
193
|
+
|
|
194
|
+
// next test for gumby-attr
|
|
195
|
+
} else if(this.is('['+gumbyAttr+']')) {
|
|
196
|
+
return this.attr(gumbyAttr) ? this.attr(gumbyAttr) : true;
|
|
197
|
+
|
|
198
|
+
// finally no prefix
|
|
199
|
+
} else if(this.is('['+attr+']')) {
|
|
200
|
+
return this.attr(attr) ? this.attr(attr) : true;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
// none found
|
|
205
|
+
return false;
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
// add an initialisation method
|
|
209
|
+
Gumby.prototype.addInitalisation = function(ref, code) {
|
|
210
|
+
this.inits[ref] = code;
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
// initialize a uiModule, single / array of module refs
|
|
214
|
+
Gumby.prototype.initialize = function(ref, all) {
|
|
215
|
+
if(typeof ref === 'object') {
|
|
216
|
+
var i = 0;
|
|
217
|
+
for(i; i < ref.length; i++) {
|
|
218
|
+
if(!this.inits[ref[i]] || typeof this.inits[ref[i]] !== 'function') {
|
|
219
|
+
this.error('Error initializing module: '+ref[i]);
|
|
220
|
+
continue;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
this.inits[ref[i]](all);
|
|
224
|
+
}
|
|
225
|
+
} else if(this.inits[ref] && typeof this.inits[ref] === 'function') {
|
|
226
|
+
this.inits[ref](all);
|
|
227
|
+
} else {
|
|
228
|
+
this.error('Error initializing module: '+ref);
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
return this;
|
|
232
|
+
};
|
|
233
|
+
|
|
234
|
+
// store a UI module
|
|
235
|
+
Gumby.prototype.UIModule = function(data) {
|
|
236
|
+
var module = data.module;
|
|
237
|
+
this.uiModules[module] = data;
|
|
238
|
+
};
|
|
239
|
+
|
|
240
|
+
// loop round and init all UI modules
|
|
241
|
+
Gumby.prototype.initUIModules = function(mods) {
|
|
242
|
+
var x, m, arr = this.uiModules;
|
|
243
|
+
|
|
244
|
+
// only initialise specified modules
|
|
245
|
+
if(mods) {
|
|
246
|
+
arr = mods;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
// initialise everything
|
|
250
|
+
for(x in arr) {
|
|
251
|
+
m = mods ? arr[x] : x;
|
|
252
|
+
this.uiModules[m].init();
|
|
253
|
+
}
|
|
254
|
+
};
|
|
255
|
+
|
|
256
|
+
window.Gumby = new Gumby();
|
|
257
|
+
|
|
258
|
+
}(jQuery);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
!function(t){"use strict";function i(){this.$dom=t(document),this.$html=this.$dom.find("html"),this.isOldie=!!this.$html.hasClass("oldie"),this.click="click",this.onReady=this.onOldie=this.onTouch=!1,this.autoInit="false"===t("script[gumby-init]").attr("gumby-init")?!1:!0,this.debugMode=Boolean(t("script[gumby-debug]").length),this.touchDevice=!!(Modernizr.touch||window.navigator.userAgent.indexOf("Windows Phone")>0),this.gumbyTouch=!1,this.touchEvents="js/libs",this.breakpoint=Number(t("script[gumby-breakpoint]").attr("gumby-breakpoint"))||768,this.touchEventsLoaded=!1,this.uiModulesReady=!1,this.uiModules={},this.inits={};var i=t("script[gumby-touch]").attr("gumby-touch"),e=t("script[gumby-path]").attr("gumby-path");"false"===i?this.touchEvents=!1:i?this.touchEvents=i:e&&(this.touchEvents=e),this.touchDevice&&(this.click+=" tap"),this.touchDevice&&t(window).width()<this.breakpoint?(this.$html.addClass("gumby-touch"),this.gumbyTouch=!0):this.$html.addClass("gumby-no-touch"),this.debugMode&&this.debug("Gumby is in debug mode")}i.prototype.init=function(t){var i=this,e=t?t:{};return this.$dom.ready(function(){e.debug&&(i.debugMode=!0),i.debug("Initializing Gumby");var t=e.uiModules?e.uiModules:!1;i.initUIModules(t),i.onReady&&i.onReady(),i.isOldie&&i.onOldie&&i.onOldie(),Modernizr.touch&&i.onTouch&&i.onTouch()}),this},i.prototype.helpers=function(){this.onReady&&this.onReady(),this.isOldie&&this.onOldie&&this.onOldie(),Modernizr.touch&&this.onTouch&&this.onTouch()},i.prototype.ready=function(t){return t&&"function"==typeof t&&(this.onReady=t),this},i.prototype.oldie=function(t){return t&&"function"==typeof t&&(this.onOldie=t),this},i.prototype.touch=function(t){return t&&"function"==typeof t&&(this.onTouch=t),this},i.prototype.console=function(t,i){this.debugMode&&window.console&&console[console[t]?t:"log"](i.length>1?Array.prototype.slice.call(i):i[0])},i.prototype.log=function(){this.console("log",arguments)},i.prototype.debug=function(){this.console("debug",arguments)},i.prototype.warn=function(){this.console("warn",arguments)},i.prototype.error=function(){this.console("error",arguments)},i.prototype.dump=function(){return{$dom:this.$dom,isOldie:this.isOldie,touchEvents:this.touchEvents,debugMode:this.debugMode,autoInit:this.autoInit,uiModules:this.uiModules,click:this.click}},i.prototype.selectAttr=function(){for(var t=0;t<arguments.length;t++){var i=arguments[t],e="data-"+arguments[t],n="gumby-"+arguments[t];if(this.is("["+e+"]"))return this.attr(e)?this.attr(e):!0;if(this.is("["+n+"]"))return this.attr(n)?this.attr(n):!0;if(this.is("["+i+"]"))return this.attr(i)?this.attr(i):!0}return!1},i.prototype.addInitalisation=function(t,i){this.inits[t]=i},i.prototype.initialize=function(t,i){if("object"==typeof t){var e=0;for(e;e<t.length;e++)this.inits[t[e]]&&"function"==typeof this.inits[t[e]]?this.inits[t[e]](i):this.error("Error initializing module: "+t[e])}else this.inits[t]&&"function"==typeof this.inits[t]?this.inits[t](i):this.error("Error initializing module: "+t);return this},i.prototype.UIModule=function(t){var i=t.module;this.uiModules[i]=t},i.prototype.initUIModules=function(t){var i,e,n=this.uiModules;t&&(n=t);for(i in n)e=t?n[i]:i,this.uiModules[e].init()},window.Gumby=new i}(jQuery),!function(t){"use strict";function i(t){Gumby.debug("Initializing Checkbox",t),this.$el=t,this.$input=this.$el.find("input[type=checkbox]");var i=this;this.$el.on(Gumby.click,function(t){t.preventDefault(),i.$input.is("[disabled]")||(i.$el.hasClass("checked")?i.update(!1):i.update(!0))}).on("gumby.check",function(){Gumby.debug("Check event triggered",i.$el),i.update(!0)}).on("gumby.uncheck",function(){Gumby.debug("Uncheck event triggered",i.$el),i.update(!1)}),(this.$input.prop("checked")||this.$el.hasClass("checked"))&&i.update(!0)}i.prototype.update=function(t){var i=this.$el.find("span");t?(Gumby.debug("Checking Checkbox",this.$el),i.append('<i class="icon-check" />'),this.$input.prop("checked",!0),Gumby.debug("Triggering onCheck event",this.$el),Gumby.debug("Triggering onChange event",this.$el),this.$el.addClass("checked").trigger("gumby.onCheck").trigger("gumby.onChange")):(Gumby.debug("Unchecking Checkbox",this.$el),this.$input.prop("checked",!1),i.find("i").remove(),Gumby.debug("Triggering onUncheck event",this.$el),Gumby.debug("Triggering onChange event",this.$el),this.$el.removeClass("checked").trigger("gumby.onUncheck").trigger("gumby.onChange"))},Gumby.addInitalisation("checkbox",function(){t(".checkbox").each(function(){var e=t(this);return e.data("isCheckbox")?!0:(e.data("isCheckbox",!0),new i(e),void 0)})}),Gumby.UIModule({module:"checkbox",events:["onCheck","onUncheck","onChange","check","uncheck"],init:function(){Gumby.initialize("checkbox")}})}(jQuery),!function(t){"use strict";function i(i){Gumby.debug("Initializing Fixed Position",i),this.$el=i,this.$window=t(window),this.fixedPoint="",this.pinPoint=!1,this.fixedPointjQ=!1,this.pinPointjQ=!1,this.offset=0,this.pinOffset=0,this.top=0,this.constrainEl=!0,this.state=!1,this.measurements={left:0,width:0},this.setup();var e=this;this.$window.on("scroll load",function(){e.monitorScroll()}),this.$el.on("gumby.initialize",function(){Gumby.debug("Re-initializing Fixed Position",i),e.setup(),e.monitorScroll()})}i.prototype.setup=function(){var t=this;this.fixedPoint=this.parseAttrValue(Gumby.selectAttr.apply(this.$el,["fixed"])),this.pinPoint=Gumby.selectAttr.apply(this.$el,["pin"])||!1,this.offset=Number(Gumby.selectAttr.apply(this.$el,["offset"]))||0,this.pinOffset=Number(Gumby.selectAttr.apply(this.$el,["pinoffset"]))||0,this.top=Number(Gumby.selectAttr.apply(this.$el,["top"]))||0,this.constrainEl=Gumby.selectAttr.apply(this.$el,["constrain"])||!0,"false"===this.constrainEl&&(this.constrainEl=!1),this.$parent=this.$el.parents(".columns, .column, .row"),this.$parent=this.$parent.length?this.$parent.first():!1,this.parentRow=this.$parent?!!this.$parent.hasClass("row"):!1,this.pinPoint&&(this.pinPoint=this.parseAttrValue(this.pinPoint)),this.fixedPointjQ=this.fixedPoint instanceof jQuery,this.pinPointjQ=this.pinPoint instanceof jQuery,this.$parent&&this.constrainEl&&(this.measure(),this.$window.resize(function(){t.state&&(t.measure(),t.constrain())}))},i.prototype.monitorScroll=function(){var t=this.$window.scrollTop(),i=this.fixedPointjQ?this.fixedPoint.offset().top:this.fixedPoint,e=!1;this.pinPoint&&(e=this.pinPointjQ?this.pinPoint.offset().top:this.pinPoint),this.offset&&(i-=this.offset),this.pinOffset&&(e-=this.pinOffset),t>=i&&"fixed"!==this.state?(!e||e>t)&&this.fix():i>t&&"fixed"===this.state?this.unfix():e&&t>=e&&"pinned"!==this.state&&this.pin()},i.prototype.fix=function(){Gumby.debug("Element has been fixed",this.$el),Gumby.debug("Triggering onFixed event",this.$el),this.state="fixed",this.$el.css({top:this.top}).addClass("fixed").removeClass("unfixed pinned").trigger("gumby.onFixed"),this.$parent&&this.constrain()},i.prototype.unfix=function(){Gumby.debug("Element has been unfixed",this.$el),Gumby.debug("Triggering onUnfixed event",this.$el),this.state="unfixed",this.$el.addClass("unfixed").removeClass("fixed pinned").trigger("gumby.onUnfixed")},i.prototype.pin=function(){Gumby.debug("Element has been pinned",this.$el),Gumby.debug("Triggering onPinned event",this.$el),this.state="pinned",this.$el.css({top:this.$el.offset().top}).addClass("pinned fixed").removeClass("unfixed").trigger("gumby.onPinned")},i.prototype.constrain=function(){Gumby.debug("Constraining element",this.$el),this.$el.css({left:this.measurements.left,width:this.measurements.width})},i.prototype.measure=function(){var t;this.measurements.left=this.$parent.offset().left,this.measurements.width=this.$parent.width(),this.parentRow&&(t=Number(this.$parent.css("paddingLeft").replace(/px/,"")),t&&(this.measurements.left+=t))},i.prototype.parseAttrValue=function(i){if(t.isNumeric(i))return Number(i);if("top"===i)return this.$el.offset().top;var e=t(i);return e.length?e:(Gumby.error("Cannot find Fixed target: "+i),!1)},Gumby.addInitalisation("fixed",function(e){t("[data-fixed],[gumby-fixed],[fixed]").each(function(){var n=t(this);return n.data("isFixed")&&!e?!0:n.data("isFixed")&&e?(n.trigger("gumby.initialize"),!0):(n.data("isFixed",!0),new i(n),void 0)})}),Gumby.UIModule({module:"fixed",events:["initialize","onFixed","onUnfixed"],init:function(){Gumby.initialize("fixed")}})}(jQuery),!function(t){"use strict";function i(t){Gumby.debug("Initializing Navbar",t),this.$el=t,this.$dropDowns=this.$el.find("li:has(.dropdown)");var i=this,e=this.$el.attr("gumby-persist");"undefined"==typeof e&&"false"!==e&&this.$el.find("li:not(:has(.dropdown)) a").on(Gumby.click,function(){i.$el.find("ul").removeClass("active")}),this.$dropDowns.on(Gumby.click,this.toggleDropdown).on("swiperight",this.openLink),"#"!==this.$dropDowns.children("a").attr("href")&&this.$dropDowns.children("a").append('<i class="icon-popup"></i>').children("i").on(Gumby.click,this.openLink),this.$el.find("li:not(:has(.dropdown)) a[href]").on(Gumby.click,this.openLink)}Gumby.gumbyTouch&&(i.prototype.toggleDropdown=function(i){if(i.preventDefault(),t(this).parents(".dropdown")&&i.stopImmediatePropagation(),!t(i.target).is("i")){var e=t(this);e.hasClass("active")?e.removeClass("active"):e.addClass("active")}},i.prototype.openLink=function(i){i.preventDefault();var e,n=t(this),s=n;n.is("i")?s=n.parent("a"):n.is("li")&&(s=n.children("a")),e=s.attr("href"),"blank"==s.attr("target")?window.open(e):window.location=e},Gumby.addInitalisation("navbar",function(){t(".navbar").each(function(){var e=t(this);return e.data("isNavbar")?!0:(e.data("isNavbar",!0),new i(e),void 0)})}),Gumby.UIModule({module:"navbar",events:[],init:function(){Gumby.initialize("navbar")}}))}(jQuery),!function(t){"use strict";function i(t){Gumby.debug("Initializing Radio Button",t),this.$el=t,this.$input=this.$el.find("input[type=radio]");var i=this;this.$el.on(Gumby.click,function(t){t.preventDefault(),i.$input.is("[disabled]")||i.update()}).on("gumby.check",function(){Gumby.debug("Check event triggered",i.$el),i.update()}),(this.$input.prop("checked")||this.$el.hasClass("checked"))&&i.update(!0)}i.prototype.update=function(){if(!(this.$el.hasClass("checked")&&this.$input.prop("checked")&&this.$el.find("i.icon-dot").length)){Gumby.debug("Updating Radio Button group",this.$el);var i=this.$el.find("span"),e='input[name="'+this.$input.attr("name")+'"]';t(".radio").has(e).removeClass("checked").find("input").prop("checked",!1).end().find("i").remove(),this.$input.prop("checked",!0),i.append('<i class="icon-dot" />'),Gumby.debug("Triggering onCheck event",this.$el),this.$el.addClass("checked").trigger("gumby.onCheck")}},Gumby.addInitalisation("radiobtn",function(){t(".radio").each(function(){var e=t(this);return e.data("isRadioBtn")?!0:(e.data("isRadioBtn",!0),new i(e),void 0)})}),Gumby.UIModule({module:"radiobtn",events:["onCheck","check"],init:function(){Gumby.initialize("radiobtn")}})}(jQuery),!function(t){"use strict";function i(i){Gumby.debug("Initializing Retina",i),this.$el=i,this.imageSrc=this.$el.attr("src"),this.retinaSrc=this.fetchRetinaImage(),this.$retinaImg=t(new Image);var e=this;return this.retinaSrc?(this.$retinaImg.attr("src",this.retinaSrc).load(function(){e.retinaImageLoaded()}).error(function(){Gumby.error("Couln't load retina image: "+e.retinaSrc)}),void 0):!1}i.prototype.fetchRetinaImage=function(){var t=this.imageSrc,i=this.imageSrc.search(/(\.|\/)(gif|jpe?g|png)$/i);return 0>i?!1:t.substr(0,i)+"@2x"+t.substr(i,t.length)},i.prototype.retinaImageLoaded=function(){Gumby.debug("Swapping image for retina version",this.$el),Gumby.debug("Triggering onRetina event",this.$el),this.$el.attr("src",this.$retinaImg.attr("src")).trigger("gumby.onRetina")},Gumby.addInitalisation("retina",function(){!window.devicePixelRatio||window.devicePixelRatio<=1||t("img[data-retina],img[gumby-retina],img[retina]").each(function(){var e=t(this);return e.data("isRetina")?!0:(e.data("isRetina",!0),new i(e),void 0)})}),Gumby.UIModule({module:"retina",events:["onRetina"],init:function(){Gumby.initialize("retina")}})}(jQuery),!function(t){"use strict";function i(t){Gumby.debug("Initializing Skiplink",t),this.$el=t,this.targetPos=0,this.duration=0,this.offset=!1,this.easing="",this.update=!1,this.setup();var i=this;this.$el.on(Gumby.click+" gumby.skip",function(t){t.preventDefault(),"skip"===t.namespace&&Gumby.debug("Skip event triggered",i.$el),i.update?i.calculateTarget(i.skipTo):i.skipTo()}).on("gumby.initialize",function(){Gumby.debug("Re-initializing Skiplink",i.$el),i.setup()})}i.prototype.setup=function(){this.duration=Number(Gumby.selectAttr.apply(this.$el,["duration"]))||200,this.offset=Gumby.selectAttr.apply(this.$el,["offset"])||!1,this.easing=Gumby.selectAttr.apply(this.$el,["easing"])||"swing",this.update=Gumby.selectAttr.apply(this.$el,["update"])?!0:!1,this.calculateTarget()},i.prototype.calculateTarget=function(i){var e,n=Gumby.selectAttr.apply(this.$el,["goto"]);if("top"==n)this.targetPos=0;else if(t.isNumeric(n))this.targetPos=Number(n);else{if(e=t(n),!e.length)return Gumby.error("Cannot find skiplink target: "+n),!1;this.targetPos=e.offset().top}i&&i.apply(this)},i.prototype.skipTo=function(){Gumby.debug("Skipping to target",this.$el);var i=this;t("html,body").animate({scrollTop:this.calculateOffset()},this.duration,this.easing).promise().done(function(){Gumby.debug("Triggering onComplete event",i.$el),i.$el.trigger("gumby.onComplete")})},i.prototype.calculateOffset=function(){if(!this.offset)return this.targetPos;var t=this.offset.substr(0,1),i=Number(this.offset.substr(1,this.offset.length));return"-"===t?this.targetPos-i:"+"===t?this.targetPos+i:void 0},Gumby.addInitalisation("skiplink",function(e){t(".skiplink > a, .skip").each(function(){var n=t(this);return n.data("isSkipLink")&&!e?!0:n.data("isSkipLink")&&e?(n.trigger("gumby.initialize"),!0):(n.data("isSkipLink",!0),new i(n),void 0)})}),Gumby.UIModule({module:"skiplink",events:["initialize","onComplete","skip"],init:function(){Gumby.initialize("skiplink")}})}(jQuery),!function(t){"use strict";function i(i){Gumby.debug("Initializing Tabs",i),this.$el=i,this.$nav=this.$el.find("> ul.tab-nav > li"),this.$content=this.$el.children(".tab-content");var e=this;this.$nav.children("a").on(Gumby.click,function(i){i.preventDefault(),e.click(t(this))}),this.$el.on("gumby.set",function(t,i){Gumby.debug("Set event triggered",e.$el),e.set(t,i)})}i.prototype.click=function(t){var i=t.parent().index();this.$nav.eq(i).add(this.$content.eq(i)).hasClass("active")||(Gumby.debug("Setting active tab to "+i,this.$el),this.$nav.add(this.$content).removeClass("active"),this.$nav.eq(i).add(this.$content.eq(i)).addClass("active"),Gumby.debug("Triggering onChange event",this.$el),this.$el.trigger("gumby.onChange",i))},i.prototype.set=function(t,i){this.$nav.eq(i).find("a").trigger(Gumby.click)},Gumby.addInitalisation("tabs",function(){t(".tabs").each(function(){var e=t(this);return e.data("isTabs")?!0:(e.data("isTabs",!0),new i(e),void 0)})}),Gumby.UIModule({module:"tabs",events:["onChange","set"],init:function(){Gumby.initialize("tabs")}})}(jQuery),!function(t){"use strict";function i(i){this.$el=t(i),this.targets=[],this.on="",this.className="",this.self=!1,this.$el.length&&(Gumby.debug("Initializing Toggle",i),this.init())}function e(i){this.$el=t(i),this.targets=[],this.on="",this.className="",this.self=!1,this.$el.length&&(Gumby.debug("Initializing Switch",i),this.init())}i.prototype.init=function(){var t=this;this.setup(),this.$el.on(this.on,function(i){i.preventDefault(),t.trigger(t.triggered)}).on("gumby.trigger",function(){Gumby.debug("Trigger event triggered",t.$el),t.trigger(t.triggered)}).on("gumby.initialize",function(){Gumby.debug("Re-initializing "+t.constructor,$el),t.setup()})},i.prototype.setup=function(){this.targets=this.parseTargets(),this.on=Gumby.selectAttr.apply(this.$el,["on"])||Gumby.click,this.className=Gumby.selectAttr.apply(this.$el,["classname"])||"active",this.self="false"===Gumby.selectAttr.apply(this.$el,["self"])},i.prototype.parseTargets=function(){var i=Gumby.selectAttr.apply(this.$el,["trigger"]),e=0,n=[];return i?(e=i.indexOf("|"),-1===e?this.checkTargets([i])?[t(i)]:!1:(n=i.split("|"),this.checkTargets(n)?n.length>1?[t(n[0]),t(n[1])]:[t(n[0])]:!1)):!1},i.prototype.checkTargets=function(i){var e=0;for(e;e<i.length;e++)if(i[e]&&!t(i[e]).length)return Gumby.error("Cannot find "+this.constructor.name+" target: "+i[e]),!1;return!0},i.prototype.triggered=function(){Gumby.debug("Triggering onTrigger event",this.$el),this.$el.trigger("gumby.onTrigger",[this.$el.hasClass(this.className)])},e.prototype=new i,e.prototype.constructor=e,i.prototype.trigger=function(t){Gumby.debug("Triggering Toggle",this.$el);var i;this.targets?1==this.targets.length?this.$el.add(this.targets[0]).toggleClass(this.className):this.targets.length>1&&(this.targets[0].hasClass(this.className)?(i=this.targets[0],this.self||(i=i.add(this.$el)),i.removeClass(this.className),this.targets[1].addClass(this.className)):(i=this.targets[0],this.self||(i=i.add(this.$el)),i.addClass(this.className),this.targets[1].removeClass(this.className))):this.$el.toggleClass(this.className),t&&"function"==typeof t&&t.apply(this)},e.prototype.trigger=function(t){Gumby.debug("Triggering Switch",this.$el);var i;this.targets?1==this.targets.length?(i=this.targets[0],this.self||(i=i.add(this.$el)),i.addClass(this.className)):this.targets.length>1&&(i=this.targets[0],this.self||(i=i.add(this.$el)),i.addClass(this.className),this.targets[1].removeClass(this.className)):this.$el.addClass(this.className),t&&"function"==typeof t&&t.apply(this)},Gumby.addInitalisation("toggles",function(e){t(".toggle").each(function(){var n=t(this);return n.data("isToggle")&&!e?!0:(n.data("isToggle")&&e&&n.trigger("gumby.initialize"),n.data("isToggle",!0),new i(n),void 0)})}),Gumby.addInitalisation("switches",function(i){t(".switch").each(function(){var n=t(this);return n.data("isSwitch")&&!i?!0:n.data("isSwitch")&&i?(n.trigger("gumby.initialize"),!0):(n.data("isSwitch",!0),new e(n),void 0)})}),Gumby.UIModule({module:"toggleswitch",events:["initialize","trigger","onTrigger"],init:function(){Gumby.initialize("switches"),Gumby.initialize("toggles")}})}(jQuery),!function(t){"use strict";function i(t,i){Gumby&&Gumby.debug("Initializing Validation",t),this.$this=t,this.$field=this.$this.parents(".field"),this.req=i||function(){return!!this.$this.val().length};var e=this;this.$this.is("[type=checkbox], [type=radio]")?(this.$field=this.$this.parent("label"),this.$field.on("gumby.onChange",function(){e.validate()})):this.$this.is("select")?(this.$field=this.$this.parents(".picker"),this.$field.on("change",function(){e.validate()})):this.$this.on("blur",function(t){9!==t.which&&e.validate()})}i.prototype.validate=function(){var t=this.req(this.$this);return t?this.$field.removeClass("danger").addClass("success"):this.$field.removeClass("success").addClass("danger"),t},t.fn.validation=function(e){var n=t.extend({submit:!1,fail:!1,required:[]},e),s=[];return this.each(function(){if(!n.required.length)return!1;var e,o=t(this),a=n.required.length;for(e=0;a>e;e++)s.push(new i(o.find('[name="'+n.required[e].name+'"]'),n.required[e].validate||!1));o.on("submit",function(t){var i=!1;if(!o.data("passed")){t.preventDefault();var e,a=s.length;for(e=0;a>e;e++)s[e].validate()||(i=!0);if(i){if(n.fail&&"function"==typeof n.fail)return n.fail(),void 0}else{if(n.submit&&"function"==typeof n.submit)return n.submit(o.serializeArray()),void 0;o.data("passed",!0).submit()}}})})}}(jQuery),!function(t){"use strict";Gumby.touchDevice&&Gumby.touchEvents||!Gumby.autoInit?Gumby.touchEvents&&Gumby.touchDevice&&(Gumby.debug("Loading jQuery mobile touch events"),yepnope.errorTimeout=2e3,Modernizr.load({test:Modernizr.touch,yep:Gumby.touchEvents+"/jquery.mobile.custom.min.js",complete:function(){t.mobile||Gumby.error("Error loading jQuery mobile touch events"),Gumby.touchEventsLoaded=!0,Gumby.autoInit?window.Gumby.init():Gumby.uiModulesReady&&Gumby.helpers()}})):window.Gumby.init(),"function"==typeof define&&define.amd&&define(window.Gumby)}(jQuery);
|