Skip to content

Commit

Permalink
davatron5000 just make an update, so do I
Browse files Browse the repository at this point in the history
  • Loading branch information
Calvein committed Jun 14, 2012
1 parent 8dadc05 commit b91a655
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 33 deletions.
61 changes: 29 additions & 32 deletions ender-fitText.js
Original file line number Diff line number Diff line change
@@ -1,43 +1,40 @@
/*!
* ender-fitText 1.0
/*!
* ender-fitText 1.0.2
*
* Copyright 2011, Dave Rupert http://daverupert.com
* Ported to ender by François Robichet http://francois.robichet.com
* Released under the WTFPL license
* Released under the WTFPL license
* http://sam.zoy.org/wtfpl/
*
* Date: Thu May 05 14:23:00 2011 -0600
* Date: Jun 14 19:30:00 2012
*/

!(function($) {
$.ender({
fitText: function(kompressor, options) {

var settings = {
'minFontSize' : Number.NEGATIVE_INFINITY,
'maxFontSize' : Number.POSITIVE_INFINITY
};

return this.each(function() {
var $this = $(this), // store the object
compressor = kompressor || 1; // set the compressor

if (options) {
for (var option in options)
settings[option] = options[option];
}
$.ender({
fitText: function(kompressor, options) {

// Resizer() resizes items based on the object width divided by the compressor * 10
var resizer = function() {
$this.css('font-size', Math.max(Math.min($this.width() / (compressor*10), parseFloat(settings.maxFontSize)), parseFloat(settings.minFontSize)));
};
// Setup options
var compressor = kompressor || 1
, settings = {
minFontSize : options.minFontSize || Number.NEGATIVE_INFINITY
, maxFontSize : options.maxFontSize || Number.POSITIVE_INFINITY
};

// Call once to set.
resizer();
return this.each(function() {
// Store the object
var $this = $(this)

// Call on resize. Opera debounces their resize by default.
$(window).resize(resizer);
});
}
}, true);
})(ender);
// Resizer() resizes items based on the object width divided by the compressor * 10
var resizer = function () {
$this.css('font-size', Math.max(Math.min($this.width() / (compressor * 10), parseFloat(settings.maxFontSize)), parseFloat(settings.minFontSize)))
}

// Call once to set.
resizer();

// Call on resize. Opera debounces their resize by default.
$(window).on('resize', resizer);
})
}
}, true)
})(ender)
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "ender-fittext",
"description": "an Ender plugin for inflating web type",
"version": "1.0.1",
"version": "1.0.2",
"homepage": "https://github.com/Calvein/ender-fitText",
"author": "François Robichet <@calvein> (http://francois.robichet.com)",
"repository": {
Expand Down

0 comments on commit b91a655

Please sign in to comment.