1(function ($, Drupal) { 2 $.fn.wordAnimate = function(delay, count) { 3 return this.each(function() { 4 var $this = $(this); 5 var text = $this.text(); 6 var length = text.length; 7 var counter = 0; 8 $this.text(''); 9 10 var timer = setInterval(function () { 11 var symbol = text[counter]; 12 var symbols = getSymbols(symbol, count); 13 14 var i = 0; 15 var duration = Math.floor(delay/symbols.length/10)*10; 16 var timer2 = setInterval(function() { 17 if(!i) { 18 var html = $this.html(); 19 html += '<span style="opacity: 0;"></span>'; 20 $this.html(html); 21 } 22 var $span = $this.find('span').last(); 23 24 i++; 25 if(i === symbols.length) { 26 clearInterval(timer2); 27 $span.text(symbol); 28 $span.css('opacity', 1); 29 } else { 30 $span.text(symbols[i]); 31 $span.css('opacity', 1/(symbols.length-i)); 32 } 33 }, duration); 34 35 counter++; 36 if(counter === length) { 37 clearInterval(timer); 38 if(typeof timer2 !== 'undefined') { 39 clearInterval(timer2); 40 } 41 $this.html(text); 42 } 43 }, delay); 44 }); 45 }; 46 47 $.fn.textAnimate = function() { 48 return this.each(function() { 49 var $this = $(this); 50 var height = $this.height(); 51 var lineHeight = parseFloat($this.css('line-height')); 52 var rows = height / lineHeight; 53 var html = ''; 54 var delay = 0; 55 for(var i = 0; i < rows; i++) { 56 html += '<div class="text-row" style="height: '+(lineHeight-2)+'px; animation-delay: '+delay+'s;"></div>'; 57 delay += 0.5; 58 } 59 $this.append('<div class="text-rows">'+html+'</div>'); 60 setTimeout(function() { 61 $this.find('.text-rows').remove(); 62 }, rows*500); 63 }); 64 }; 65 66 $.fn.textIsMultiple = function(className) { 67 return this.each(function() { 68 var $this = $(this); 69 $this.removeClass(className+'_multiple'); 70 var height = $this.height(); 71 var lineHeight = parseFloat($this.css('line-height')); 72 var rows = height / lineHeight; 73 if(rows > 1) { 74 $this.addClass(className+'_multiple'); 75 if($this.find('br').length) { 76 $this.find('span').css('left', $this.find('br').offset().left-$this.offset().left); 77 } else { 78 $this.append('<span class="'+className+'__hidden" style="padding: 0;"></span>'); 79 var $row = $this.find('.'+className+'__hidden'); 80 var words = $this.html().replace(/(<([^>]+)>)/ig, '').trim().split(' '); 81 words.forEach(function(word) { 82 $row.html($row.html().trim()+' '+word); 83 if($row.height() > lineHeight) { 84 $row.html($row.html().replace(word, '')); 85 $this.find('span:not(.creatio-section-menu-title__hidden)').css('left', $row.width()); 86 $row.remove(); 87 } 88 }); 89 90 } 91 } 92 }); 93 }; 94 95 $.fn.fitText = function(generate) { 96 return this.each(function() { 97 const elem = $(this); 98 if(generate) { 99 const lines = elem.html().split('<br>'); 100 elem.html('<span>' + lines.join('</span><span>') + '</span>'); 101 } else { 102 elem.find('> span').removeAttr('style'); 103 } 104 elem.find('> span').each((index, item) => { 105 let size = parseInt(elem.css('font-size')); 106 while($(item).width() < elem.width()) { 107 $(item).css('font-size', size+'px'); 108 size += 0.25; 109 } 110 }); 111 }); 112 }; 113 114 function getSymbols(symbol, count) { 115 var symbols = []; 116 var string = ''; 117 switch(drupalSettings.path.currentLanguage) { 118 case 'ru': 119 break; 120 case 'uk': 121 break; 122 default: 123 string = 'abcdefghiklmnopqrstvxyz'; 124 } 125 string = string.replace(symbol.toLowerCase(), ''); 126 127 for(var i = 0; i < count; i++) { 128 var index = Math.floor((Math.random() * string.length-1) + 1); 129 symbols[i] = string[index]; 130 } 131 symbols[symbols.length] = symbol; 132 133 return symbols; 134 } 135} (jQuery, Drupal));
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.