1/*global jQuery */ 2/*! 3* Lettering.JS 0.7.0 4* 5* Copyright 2010, Dave Rupert http://daverupert.com 6* Released under the WTFPL license 7* http://sam.zoy.org/wtfpl/ 8* 9* Thanks to Paul Irish - http://paulirish.com - for the feedback. 10* 11* Date: Mon Sep 20 17:14:00 2010 -0600 12*/ 13(function($){ 14 function injector(t, splitter, klass, after) { 15 var text = t.text() 16 , a = text.split(splitter) 17 , inject = ''; 18 if (a.length) { 19 $(a).each(function(i, item) { 20 inject += '<span class="'+klass+(i+1)+'" aria-hidden="true">'+item+'</span>'+after; 21 }); 22 t.attr('aria-label',text) 23 .empty() 24 .append(inject) 25 26 } 27 } 28 29 30 var methods = { 31 init : function() { 32 33 return this.each(function() { 34 injector($(this), '', 'char', ''); 35 }); 36 37 }, 38 39 words : function() { 40 41 return this.each(function() { 42 injector($(this), ' ', 'word', ' '); 43 }); 44 45 }, 46 47 lines : function() { 48 49 return this.each(function() { 50 var r = "eefec303079ad17405c889e092e105b0"; 51 // Because it's hard to split a <br/> tag consistently across browsers, 52 // (*ahem* IE *ahem*), we replace all <br/> instances with an md5 hash 53 // (of the word "split"). If you're trying to use this plugin on that 54 // md5 hash string, it will fail because you're being ridiculous. 55 injector($(this).children("br").replaceWith(r).end(), r, 'line', ''); 56 }); 57 58 } 59 }; 60 61 $.fn.lettering = function( method ) { 62 // Method calling logic 63 if ( method && methods[method] ) { 64 return methods[ method ].apply( this, [].slice.call( arguments, 1 )); 65 } else if ( method === 'letters' || ! method ) { 66 return methods.init.apply( this, [].slice.call( arguments, 0 ) ); // always pass an array 67 } 68 $.error( 'Method ' + method + ' does not exist on jQuery.lettering' ); 69 return this; 70 }; 71 72})(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.