big-ideas-text
Advanced tools
Comparing version 0.2.0 to 0.3.0
/*! | ||
* Big Ideas Text v0.2.0, 2015-09-17 | ||
* Big Ideas Text v0.3.0, 2015-10-17 | ||
* https://github.com/kennethormandy/big-ideas-text | ||
@@ -57,8 +57,4 @@ * Copyright © 2011–2014 Zach Leatherman | ||
bindResize: function(eventName, resizeFunction) { | ||
window.removeEventListener('rezie', resizeFunction); | ||
// if(typeof window.Cowboy !== 'undefined' && typeof window.Cowboy.throttle !== 'undefined') { | ||
// window.addEventListener('resize', window.Cowboy.throttle(100, resizeFunction), false); | ||
// } else { | ||
window.addEventListener('resize', debounce(resizeFunction, 100), false); | ||
// } | ||
window.removeEventListener('resize', resizeFunction); | ||
window.addEventListener('resize', debounce(resizeFunction, 500), false); | ||
}, | ||
@@ -106,3 +102,2 @@ getStyleId: function(id) | ||
BigIdeasText.init(); | ||
options = extend({ | ||
@@ -123,3 +118,16 @@ minfontsize: BigIdeasText.DEFAULT_MIN_FONT_SIZE_PX, | ||
var children = options.childSelector ? self.querySelectorAll( options.childSelector ) : self.children; | ||
var minFontSizeAttr = self.getAttribute('bigIdeasText-minfontsize') || false; | ||
var maxFontSizeAttr = self.getAttribute('bigIdeasText-maxfontsize') || false; | ||
var selfWidthAttr = self.getAttribute('bigIdeasText-width') || self.offsetWidth; | ||
var minFontSize = options.minfontsize; | ||
var maxFontSize = options.maxfontsize; | ||
if(maxFontSizeAttr !== false) { | ||
maxFontSize = parseInt(maxFontSizeAttr, 10); | ||
} | ||
if(minFontSizeAttr !== false) { | ||
minFontSize = parseInt(minFontSizeAttr, 10); | ||
} | ||
addClass(self, 'bigIdeasText'); | ||
@@ -136,4 +144,6 @@ | ||
{ | ||
// TODO only call this if the width has changed. | ||
BigIdeasText.mainMethod.call(document.getElementById(id), options); | ||
if (selfWidthAttr !== self.offsetWidth) { | ||
self.setAttribute('bigIdeasText-width', self.offsetWidth); | ||
BigIdeasText.mainMethod.call(document.getElementById(id), options); | ||
} | ||
}); | ||
@@ -149,3 +159,3 @@ } | ||
var sizes = calculateSizes(self, children, maxWidth, options.maxfontsize, options.minfontsize); | ||
var sizes = calculateSizes(self, children, maxWidth, maxFontSize, minFontSize); | ||
headCache.appendChild(BigIdeasText.generateCss(id, sizes.fontSizes, sizes.wordSpacings, sizes.minFontSizes)); | ||
@@ -152,0 +162,0 @@ }); |
@@ -0,1 +1,29 @@ | ||
var log = []; | ||
QUnit.done(function( test_results ) { | ||
"use strict"; | ||
var tests = log.map(function(details){ | ||
return { | ||
name: details.name, | ||
result: details.result, | ||
expected: details.expected, | ||
actual: details.actual, | ||
source: details.source | ||
}; | ||
}); | ||
test_results.tests = tests; | ||
// delaying results a bit cause in real-world | ||
// scenario you won't get them immediately | ||
setTimeout(function () { window.global_test_results = test_results; }, 2000); | ||
}); | ||
QUnit.testStart(function(testDetails){ | ||
"use strict"; | ||
QUnit.log = function(details){ | ||
if (!details.result) { | ||
details.name = testDetails.name; | ||
log.push(details); | ||
} | ||
}; | ||
}); | ||
(function( w, $ ) { | ||
@@ -2,0 +30,0 @@ "use strict"; |
{ | ||
"name": "big-ideas-text", | ||
"title": "Big Ideas Text", | ||
"version": "0.2.0", | ||
"version": "0.3.0", | ||
"description": "Dynamically scale lines of text within a container.", | ||
@@ -33,11 +33,11 @@ "homepage": "https://github.com/kennethormandy/big-ideas-text", | ||
}, | ||
"contributors": | ||
[ "Zach Leatherman <zachleatherman@gmail.com> (http://zachleat.com)" | ||
, "Jordan Sitkin" | ||
, "Francisco Giordano" | ||
, "Igor Ribeio Lima <lima.igorribeiro@gmail.com>" | ||
, "bcaller" | ||
, "James Young <jmeyoung+github@gmail.com> (http://jamsyoung.com)" | ||
, "Phil Freo <phil@philfreo.com> (http://philfreo.com)" | ||
, "Kenneth Ormandy <hello@kennethormandy.com> (http://kennethormandy.com)" | ||
"contributors": [ | ||
"Zach Leatherman <zachleatherman@gmail.com> (http://zachleat.com)", | ||
"Jordan Sitkin", | ||
"Francisco Giordano", | ||
"Igor Ribeio Lima <lima.igorribeiro@gmail.com>", | ||
"bcaller", | ||
"James Young <jmeyoung+github@gmail.com> (http://jamsyoung.com)", | ||
"Phil Freo <phil@philfreo.com> (http://philfreo.com)", | ||
"Kenneth Ormandy <hello@kennethormandy.com> (http://kennethormandy.com)" | ||
], | ||
@@ -47,24 +47,27 @@ "scripts": { | ||
"test": "grunt test", | ||
"lint": "grunt lint" | ||
"lint": "grunt lint", | ||
"sauce": "grunt sauce" | ||
}, | ||
"dependencies": {}, | ||
"devDependencies": { | ||
"bytesize": "~0.2.0", | ||
"glob": "~3.2.9", | ||
"grunt": "~0.4.4", | ||
"grunt-banner": "~0.2.2", | ||
"grunt-bytesize": "~0.1.1", | ||
"grunt-contrib-clean": "~0.5.0", | ||
"grunt-contrib-concat": "~0.4.0", | ||
"grunt-contrib-connect": "0.11.2", | ||
"grunt-contrib-csslint": "~0.2.0", | ||
"grunt-contrib-jshint": "~0.10.0", | ||
"glob": "~3.2.9", | ||
"load-grunt-tasks": "~0.4.0", | ||
"matchdep": "~0.3.0", | ||
"grunt-contrib-clean": "~0.5.0", | ||
"grunt-contrib-qunit": "~0.4.0", | ||
"grunt-contrib-watch": "~0.6.1", | ||
"grunt-gh-pages": "~0.9.1", | ||
"grunt-contrib-concat": "~0.4.0", | ||
"bytesize": "~0.2.0", | ||
"grunt-bytesize": "~0.1.1", | ||
"grunt-contrib-csslint": "~0.2.0", | ||
"grunt-banner": "~0.2.2", | ||
"grunt-replace": "~0.7.6", | ||
"grunt-lintspaces": "~0.7.0", | ||
"grunt-mkdir": "~0.1.1", | ||
"grunt-replace": "~0.7.6", | ||
"grunt-saucelabs": "8.6.1", | ||
"jquery": "2.1.4", | ||
"load-grunt-tasks": "~0.4.0", | ||
"matchdep": "~0.3.0", | ||
"qunitjs": "1.19.0" | ||
@@ -71,0 +74,0 @@ }, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
35698
606
21