Skip to content

Commit

Permalink
Parallax, Images, Shuffle and FitText installed
Browse files Browse the repository at this point in the history
  • Loading branch information
chambaz committed Oct 3, 2013
1 parent 65006d8 commit 0377a02
Show file tree
Hide file tree
Showing 23 changed files with 1,054 additions and 2 deletions.
9 changes: 8 additions & 1 deletion bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,12 @@
"main": "index.html",
"license": "MIT",
"homepage": "http://gumbyframework.com/tutorial",
"private": true
"private": true,
"dependencies": {
"gumby": "latest",
"gumby-parallax": "latest",
"gumby-images": "latest",
"gumby-shuffle": "latest",
"gumby-fittext": "latest"
}
}
17 changes: 17 additions & 0 deletions bower_components/gumby-fittext/.bower.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"name": "gumby-fittext",
"version": "1.0.0",
"main": [
"./gumby.fittext.js"
],
"homepage": "https://github.com/GumbyFramework/FitText",
"_release": "1.0.0",
"_resolution": {
"type": "version",
"tag": "1.0.0",
"commit": "b2a4a5b86655a6e9ca6180459c4fdf0f7ee232ca"
},
"_source": "git://github.com/GumbyFramework/FitText.git",
"_target": "*",
"_originalSource": "gumby-fittext"
}
Empty file.
52 changes: 52 additions & 0 deletions bower_components/gumby-fittext/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
Gumby FitText
=============

This module resizes text to fill the available space. Refactored into a Gumby UI module from the awesome [FitText.js](http://fittextjs.com/). For more detailed documentation please check out the [Gumby docs](http://gumbyframework.com).

Installation
------------

A bower package is available to install this module into your project. We recommend using this method to install Gumby and any extra UI modules, however you can alternatively move the individuals files into your project.

$ bower install gumby-fittext

Include gumby.fittext.js in the same fashion as your other UI modules, after gumby.js and before gumby.init.js. In production you should minify JavaScript files into a single optimized gumby.min.js file, ensuring the order (gumby.js, UI modules, gumby.init.js) is retained.

<!--
Include gumby.js followed by UI modules.
Or concatenate and minify into a single file-->
<script src="/bower_components/gumby/js/libs/gumby.js"></script>
<script src="/bower_components/gumby/js/libs/ui/gumby.skiplink.js"></script>
<script src="/bower_components/gumby/js/libs/ui/gumby.toggleswitch.js"></script>
<script src="/bower_components/gumby-images/gumby.images.js"></script>
<script src="/bower_components/gumby/js/libs/gumby.init.js"></script>

<!-- In production minifiy and combine the above files into gumby.min.js -->
<script src="js/gumby.min.js"></script>
<script src="js/plugins.js"></script>
<script src="js/main.js"></script>

Usage
-----
Using the FitText module is simple. Add the class `.fittext` to any element for the module to initialize with default settings. There are two optional attributes that can be used to customize the behaviour. Specify the rate at which the font size changes using `gumby-rate`, this is an exact copy of [FitText.js's](http://fittextjs.com/) Compressor value. You can also specify minimum and maximum font sizes using the `gumby-sizes` attribute, specify `min|max` sizes separated by a pipe.

<h1 class="fittext" gumby-rate="0.8" gumby-sizes="14|60">Hello this text will resize to fill the available area</h1>


**MIT Open Source License**

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.



5 changes: 5 additions & 0 deletions bower_components/gumby-fittext/bower.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "gumby-fittext",
"version": "1.0.0",
"main": ["./gumby.fittext.js"]
}
114 changes: 114 additions & 0 deletions bower_components/gumby-fittext/gumby.fittext.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
/**
* Gumby FitText
*
* Adapted from the awesome FitText jQuery plugin
* brought to you by Paravel - http://paravelinc.com/
*/
!function() {

'use strict';

function FitText($el) {

Gumby.debug('Initializing FitText', $el);

this.$el = $el;

this.rate = 0;
this.fontSizes = {};

// set up module based on attributes
this.setup();

var scope = this;

// re-initialize module
this.$el.on('gumby.initialize', function() {
Gumby.debug('Re-initializing FitText', scope.$el);
scope.setup();
scope.resize();
});

// lets go
$(window).on('load resize orientationchange', function() {
scope.resize();
});
}

// set up module based on attributes
FitText.prototype.setup = function() {
// optional compressor rate
this.rate = Number(Gumby.selectAttr.apply(this.$el, ['rate'])) || 1;
// optional font sizes (min|max)
this.fontSizes = this.parseSizes(Gumby.selectAttr.apply(this.$el, ['sizes']));
};

// apply the resizing
FitText.prototype.resize = function() {
var size = this.calculateSize();
Gumby.debug('Updating font size to '+size+'px', this.$el);
this.$el.css('font-size', size);
};

// calculate the font size
FitText.prototype.calculateSize = function() {
return Math.max(Math.min(this.$el.width() / (this.rate*10), parseFloat(this.fontSizes.max)), parseFloat(this.fontSizes.min));
};

// parse size attributes with min|max syntax
FitText.prototype.parseSizes = function(attrStr) {
var sizes = {
min: Number.NEGATIVE_INFINITY,
max: Number.POSITIVE_INFINITY
};

// attribute is optional
if(!attrStr) { return sizes; }

// min and/or max specified
if(attrStr.indexOf('|') > -1) {
attrStr = attrStr.split('|');

// both are optional
sizes.min = Number(attrStr[0]) || sizes.min;
sizes.max = Number(attrStr[1]) || sizes.max;
}

// only one value specific without | so use as min
sizes.min = Number(attrStr) || sizes.min;

return sizes;
};

// add initialisation
Gumby.addInitalisation('fittext', function(all) {
$('.fittext').each(function() {
var $this = $(this);

// this element has already been initialized
// and we're only initializing new modules
if($this.data('isFittext') && !all) {
return true;

// this element has already been initialized
// and we need to reinitialize it
} else if($this.data('isFittext') && all) {
$this.trigger('gumby.initialize');
return true;
}

// mark element as initialized
$this.data('isFittext', true);
new FitText($this);
});
});

// register UI module
Gumby.UIModule({
module: 'fittext',
events: ['initialize'],
init: function() {
Gumby.initialize('fittext');
}
});
}();
17 changes: 17 additions & 0 deletions bower_components/gumby-images/.bower.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"name": "gumby-images",
"version": "1.0.0",
"main": [
"./gumby.images.js"
],
"homepage": "https://github.com/GumbyFramework/ResponsiveImages",
"_release": "1.0.0",
"_resolution": {
"type": "version",
"tag": "1.0.0",
"commit": "440a32e4d81e4f0bd24a8780d0c8a5a86d07db9c"
},
"_source": "git://github.com/GumbyFramework/ResponsiveImages.git",
"_target": "*",
"_originalSource": "gumby-images"
}
44 changes: 44 additions & 0 deletions bower_components/gumby-images/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Numerous always-ignore extensions
*.bak
*.diff
*.err
*.orig
*.log
*.rej
*.swo
*.swp
*.vi
.sass-cache

# OS or Editor folders
.DS_Store
._*
Thumbs.db
.cache
.project
.settings
.tmproj
nbproject
*.sublime-project
*.sublime-workspace

# Dreamweaver added files
_notes
dwsync.xml

# Komodo
*.komodoproject
.komodotools

# Espresso
*.esproj
*.espressostorage

# Rubinius
*.rbc

# Folders to ignore
.hg
.svn
.CVS
.idea
58 changes: 58 additions & 0 deletions bower_components/gumby-images/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
Gumby Responsive Images
=======================

This module will preload and insert images based on media queries and/or feature detection. For more detailed documentation please check out the [Gumby docs](http://gumbyframework.com).

Installation
------------

A bower package is available to install this module into your project. We recommend using this method to install Gumby and any extra UI modules, however you can alternatively move the individuals files into your project.

$ bower install gumby-images

Include gumby.images.js in the same fashion as your other UI modules, after gumby.js and before gumby.init.js. In production you should minify JavaScript files into a single optimized gumby.min.js file, ensuring the order (gumby.js, UI modules, gumby.init.js) is retained.

<!--
Include gumby.js followed by UI modules.
Or concatenate and minify into a single file-->
<script src="/bower_components/gumby/js/libs/gumby.js"></script>
<script src="/bower_components/gumby/js/libs/ui/gumby.skiplink.js"></script>
<script src="/bower_components/gumby/js/libs/ui/gumby.toggleswitch.js"></script>
<script src="/bower_components/gumby-images/gumby.images.js"></script>
<script src="/bower_components/gumby/js/libs/gumby.init.js"></script>

<!-- In production minifiy and combine the above files into gumby.min.js -->
<script src="js/gumby.min.js"></script>
<script src="js/plugins.js"></script>
<script src="js/main.js"></script>

Usage
-----

Using the responsive images module is simple. Add a `gumby-media` attribute to any element containing any number of comma separated media query / image path pairs. Media queries and their associated images should be separated with a pipe. You can also add a `gumby-supports` attribute to any element, containing any number of comma seaparted features / image path pairs, in the same format as `gumby-media`. Features will be tested with Modernizr so ensure your Modernizr build contains all the tests you require. Both `gumby-media` and `gumby-supports` will fallback to the image supplied in `gumby-default`. If applied to an `<img>` the `src` will be updated otherwise the `background-image` will be used.

<img gumby-media="only screen and (max-width: 768px) and (min-width: 501px)|img/img_silence_demo-768.jpg,
only screen and (max-width: 500px)|img/img_silence_demo-500.jpg"
gumby-default="img/img_silence_demo.jpg" />
<img gumby-supports="webp|img/img_silence_demo.webp"
gumby-default="img/img_silence_demo.jpg" />


**MIT Open Source License**

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.



5 changes: 5 additions & 0 deletions bower_components/gumby-images/bower.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "gumby-images",
"version": "1.0.0",
"main": ["./gumby.images.js"]
}
Loading

0 comments on commit 0377a02

Please sign in to comment.