1/*global jQuery */ 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* Modified to adapt the latest jQuery version (v3 above) included on WordPress 5.6: 12* - (2021-02-05) - Number type value passed to css method is deprecated. 13*/ 14 15(function( $ ){ 16 17 $.fn.fitText = function( kompressor, options ) { 18 19 // Setup options 20 var compressor = kompressor || 1, 21 settings = $.extend({ 22 'minFontSize' : Number.NEGATIVE_INFINITY, 23 'maxFontSize' : $(this).css('font-size') 24 }, options); 25 26 return this.each(function(){ 27 28 // Store the object 29 var $this = $(this); 30 31 // Resizer() resizes items based on the object width divided by the compressor * 10 32 var resizer = function () { 33 $this.css('font-size', Math.max(Math.min($this.width() / (compressor*10), parseFloat(settings.maxFontSize)), parseFloat(settings.minFontSize)) + 'px'); 34 }; 35 36 // Call once to set. 37 resizer(); 38 39 // Call on resize. Opera debounces their resize by default. 40 $(window).on('resize.fittext orientationchange.fittext', resizer); 41 42 }); 43 44 }; 45 46})( jQuery );
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.