middleman-gumby 0.0.1
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 +18 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +43 -0
- data/Rakefile +1 -0
- data/lib/middleman/gumby.rb +17 -0
- data/lib/middleman/gumby/version.rb +5 -0
- data/middleman-gumby.gemspec +25 -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/gumby/libs/gumby.init.js +47 -0
- data/vendor/assets/javascripts/gumby/libs/gumby.js +258 -0
- data/vendor/assets/javascripts/gumby/libs/gumby.min.js +1 -0
- data/vendor/assets/javascripts/gumby/libs/jquery-1.10.1.min.js +6 -0
- data/vendor/assets/javascripts/gumby/libs/jquery-1.10.1.min.map +1 -0
- data/vendor/assets/javascripts/gumby/libs/jquery-2.0.2.min.js +6 -0
- data/vendor/assets/javascripts/gumby/libs/jquery-2.0.2.min.map +1 -0
- data/vendor/assets/javascripts/gumby/libs/jquery.mobile.custom.min.js +3 -0
- data/vendor/assets/javascripts/gumby/libs/modernizr-2.6.2.min.js +4 -0
- data/vendor/assets/javascripts/gumby/libs/ui/gumby.checkbox.js +101 -0
- data/vendor/assets/javascripts/gumby/libs/ui/gumby.fixed.js +240 -0
- data/vendor/assets/javascripts/gumby/libs/ui/gumby.navbar.js +111 -0
- data/vendor/assets/javascripts/gumby/libs/ui/gumby.radiobtn.js +90 -0
- data/vendor/assets/javascripts/gumby/libs/ui/gumby.retina.js +81 -0
- data/vendor/assets/javascripts/gumby/libs/ui/gumby.skiplink.js +157 -0
- data/vendor/assets/javascripts/gumby/libs/ui/gumby.tabs.js +80 -0
- data/vendor/assets/javascripts/gumby/libs/ui/gumby.toggleswitch.js +264 -0
- data/vendor/assets/javascripts/gumby/libs/ui/jquery.validation.js +142 -0
- data/vendor/assets/javascripts/gumby/main.js +23 -0
- data/vendor/assets/javascripts/gumby/plugins.js +4 -0
- data/vendor/assets/javascripts/gumby/production.js +3 -0
- data/vendor/assets/sass/_base.scss +49 -0
- data/vendor/assets/sass/_custom.scss +1 -0
- data/vendor/assets/sass/_fonts.scss +28 -0
- data/vendor/assets/sass/_grid.scss +339 -0
- data/vendor/assets/sass/_shame.scss +36 -0
- data/vendor/assets/sass/_typography.scss +272 -0
- data/vendor/assets/sass/extensions/modular-scale/lib/modular-scale.rb +128 -0
- data/vendor/assets/sass/extensions/modular-scale/stylesheets/_modular-scale.scss +310 -0
- data/vendor/assets/sass/extensions/sassy-math/lib/sassy-math.rb +159 -0
- data/vendor/assets/sass/extensions/sassy-math/stylesheets/_math.scss +310 -0
- data/vendor/assets/sass/functions/_all.scss +25 -0
- data/vendor/assets/sass/functions/_breakpoints.scss +11 -0
- data/vendor/assets/sass/functions/_button-size.scss +44 -0
- data/vendor/assets/sass/functions/_clearfix.scss +25 -0
- data/vendor/assets/sass/functions/_em.scss +11 -0
- data/vendor/assets/sass/functions/_even.scss +10 -0
- data/vendor/assets/sass/functions/_fade.scss +20 -0
- data/vendor/assets/sass/functions/_fancytiles.scss +29 -0
- data/vendor/assets/sass/functions/_fixed.scss +21 -0
- data/vendor/assets/sass/functions/_forms.scss +18 -0
- data/vendor/assets/sass/functions/_grid-calc.scss +82 -0
- data/vendor/assets/sass/functions/_height-calc.scss +6 -0
- data/vendor/assets/sass/functions/_icons.scss +35 -0
- data/vendor/assets/sass/functions/_line-and-height.scss +7 -0
- data/vendor/assets/sass/functions/_palette.scss +76 -0
- data/vendor/assets/sass/functions/_responsivity.scss +34 -0
- data/vendor/assets/sass/functions/_semantic-grid.scss +170 -0
- data/vendor/assets/sass/functions/_shapes.scss +22 -0
- data/vendor/assets/sass/functions/_strip-units.scss +5 -0
- data/vendor/assets/sass/functions/_tooltips.scss +98 -0
- data/vendor/assets/sass/functions/_typography.scss +15 -0
- data/vendor/assets/sass/functions/_visibility.scss +17 -0
- data/vendor/assets/sass/gumby.scss +39 -0
- data/vendor/assets/sass/ui/_all.scss +11 -0
- data/vendor/assets/sass/ui/_buttons.scss +154 -0
- data/vendor/assets/sass/ui/_forms.scss +392 -0
- data/vendor/assets/sass/ui/_icons.scss +23 -0
- data/vendor/assets/sass/ui/_images.scss +23 -0
- data/vendor/assets/sass/ui/_labels.scss +87 -0
- data/vendor/assets/sass/ui/_navbar.scss +440 -0
- data/vendor/assets/sass/ui/_tables.scss +89 -0
- data/vendor/assets/sass/ui/_tabs.scss +156 -0
- data/vendor/assets/sass/ui/_toggles.scss +73 -0
- data/vendor/assets/sass/ui/_tooltips.scss +12 -0
- data/vendor/assets/sass/ui/_video.scss +24 -0
- data/vendor/assets/sass/var/_lists.scss +20 -0
- data/vendor/assets/sass/var/_settings.scss +169 -0
- data/vendor/assets/sass/var/icons/_entypo-icon-list.scss +286 -0
- data/vendor/assets/sass/var/icons/_entypo.scss +294 -0
- metadata +167 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: 2f3dcb34eda915b628a8cd48d09a4e5b2be381e4
|
|
4
|
+
data.tar.gz: da38cd6f4d98b8f0d8261aa7412b6c424f9349e6
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 7f648d7f9ffa1f4168b5016a3ad6d415eed9c6aaaa9447b38038e1bf43246c55b63f64af1f6b1226de9eaff82ef619c693eb7616ba2747f33f482973a281ae56
|
|
7
|
+
data.tar.gz: ec5733bea6c89931305a3ebb5dbfac78588ff1cd5e50e31040c5cb2e549e3264bfa4ce4e420a745ab56d66fd32a3c10b7776cf172a927648ad62d3483ca4bb38
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
Copyright (c) 2013 Bradley
|
|
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,43 @@
|
|
|
1
|
+
# MiddlemanGumby
|
|
2
|
+
|
|
3
|
+
A simple gem to use the Gumby framework in Middleman apps.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
Add this line to your application's Gemfile:
|
|
8
|
+
|
|
9
|
+
gem 'middleman-gumby'
|
|
10
|
+
|
|
11
|
+
And then execute:
|
|
12
|
+
|
|
13
|
+
$ bundle install
|
|
14
|
+
|
|
15
|
+
Or install it yourself as:
|
|
16
|
+
|
|
17
|
+
$ gem install middleman-gumby
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
Add the following line to config.rb in your Middleman project:
|
|
22
|
+
|
|
23
|
+
activate :gumby
|
|
24
|
+
|
|
25
|
+
### To use the sass mixins
|
|
26
|
+
|
|
27
|
+
Create or rename a .sass file, and add the following line to the top:
|
|
28
|
+
|
|
29
|
+
@import "gumby"
|
|
30
|
+
|
|
31
|
+
### To include Gumby's javascript framework
|
|
32
|
+
|
|
33
|
+
Add the following line to your javascript file:
|
|
34
|
+
|
|
35
|
+
//= require gumby/production
|
|
36
|
+
|
|
37
|
+
## Contributing
|
|
38
|
+
|
|
39
|
+
1. Fork it
|
|
40
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
|
41
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
|
42
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
|
43
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require "bundler/gem_tasks"
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
require "middleman/gumby/version"
|
|
2
|
+
require "modular-scale"
|
|
3
|
+
|
|
4
|
+
module MiddlemanGumby
|
|
5
|
+
class << self
|
|
6
|
+
def registered(app)
|
|
7
|
+
gem_dir = Gem::Specification.find_by_name("middleman-gumby").gem_dir
|
|
8
|
+
Sass.load_paths << File.expand_path("./vendor/assets/sass", gem_dir)
|
|
9
|
+
|
|
10
|
+
app.after_configuration do
|
|
11
|
+
sprockets.append_path "vendor/assets"
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
::Middleman::Extensions.register(:gumby, MiddlemanGumby)
|
|
@@ -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 'middleman/gumby/version'
|
|
5
|
+
|
|
6
|
+
Gem::Specification.new do |spec|
|
|
7
|
+
spec.name = "middleman-gumby"
|
|
8
|
+
spec.version = Middleman::Gumby::VERSION
|
|
9
|
+
spec.authors = ["Bradley"]
|
|
10
|
+
spec.email = ["bradley.wittenbrook@gmail.com"]
|
|
11
|
+
spec.description = "Adds Gumby to a Middleman project."
|
|
12
|
+
spec.summary = "Adds Gumby to a Middleman project."
|
|
13
|
+
spec.homepage = ""
|
|
14
|
+
spec.license = "MIT"
|
|
15
|
+
|
|
16
|
+
spec.files = `git ls-files`.split($/)
|
|
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"]
|
|
20
|
+
|
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
|
22
|
+
spec.add_development_dependency "rake"
|
|
23
|
+
|
|
24
|
+
spec.add_runtime_dependency "modular-scale"
|
|
25
|
+
end
|
|
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);
|