1/* global jQuery, define */ 2/*! 3* FitText.js 1.2 4* 5* Copyright 2011, Dave Rupert http://daverupert.com 6* Released under the WTFPL license 7* http://sam.zoy.org/wtfpl/ 8* 9* Date: Thu May 05 14:23:00 2011 -0600 10*/ 11;(function (factory) { 12 if (typeof define === 'function' && define.amd) { 13 define(['jquery'], factory) 14 } else if (typeof exports !== 'undefined') { 15 module.exports = factory(require('jquery')) 16 } else { 17 factory(jQuery) 18 } 19}(function ($) { 20 $.fn.fitText = function (kompressor, options) { 21 // Setup options 22 var compressor = kompressor || 1 23 var settings = $.extend({ 24 'minFontSize': Number.NEGATIVE_INFINITY, 25 'maxFontSize': Number.POSITIVE_INFINITY 26 }, options) 27 28 return this.each(function () { 29 // Store the object 30 var $this = $(this) 31 32 // Resizer() resizes items based on the object width divided by the compressor * 10 33 var resizer = function () { 34 $this.css('font-size', Math.max(Math.min($this.width() / (compressor * 10), parseFloat(settings.maxFontSize)), parseFloat(settings.minFontSize))) 35 } 36 37 // Call once to set. 38 resizer() 39 40 // Call on resize. Opera debounces their resize by default. 41 $(window).on('resize.fittext orientationchange.fittext', resizer) 42 }) 43 } 44}))
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.