1/*! 2* FitText.js 1.0 jQuery free version 3* 4* Copyright 2011, Dave Rupert http://daverupert.com 5* Released under the WTFPL license 6* http://sam.zoy.org/wtfpl/ 7* Modified by Slawomir Kolodziej http://slawekk.info 8* 9* Date: Tue Aug 09 2011 10:45:54 GMT+0200 (CEST) 10*/ 11(function(){ 12 var css = function (el, prop) { 13 return window.getComputedStyle ? getComputedStyle(el).getPropertyValue(prop) : el.currentStyle[prop]; 14 }; 15 16 var addEvent = function (el, type, fn) { 17 if (el.addEventListener) 18 el.addEventListener(type, fn, false); 19 else 20 el.attachEvent('on'+type, fn); 21 }; 22 23 window.fitText = function (el, kompressor) { 24 25 var settings = { 26 'minFontSize' : -1/0, 27 'maxFontSize' : 1/0 28 }; 29 30 var fit = function (el) { 31 var compressor = kompressor || 1; 32 33 var resizer = function () { 34 el.style.fontSize = Math.max(Math.min(el.clientWidth / (compressor*10), parseFloat(settings.maxFontSize)), parseFloat(settings.minFontSize)) + 'px'; 35 }; 36 37 // Call once to set. 38 resizer(); 39 40 // Bind events 41 // If you have any js library which support Events, replace this part 42 // and remove addEvent function (or use original jQuery version) 43 addEvent(window, 'resize', resizer); 44 }; 45 46 if (el.length) 47 for(var i=0; i<el.length; i++) 48 fit(el[i]); 49 else 50 fit(el); 51 52 // return set of elements 53 return el; 54 }; 55})();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.