1(function($){ 2 3 "use strict"; 4 5 6 //Switch words 7 var uxPageLoadingLetter = function(){ 8 var animationDelay = 2500, 9 //loading bar effect 10 barAnimationDelay = 3800, 11 barWaiting = barAnimationDelay - 3000, //3000 is the duration of the transition on the loading bar - set in the scss/css file 12 //letters effect 13 lettersDelay = 50, 14 //type effect 15 typeLettersDelay = 150, 16 selectionDuration = 500, 17 typeAnimationDelay = selectionDuration + 800, 18 //clip effect 19 revealDuration = 600, 20 revealAnimationDelay = 1500; 21 22 initHeadline(); 23 24 function initHeadline() { 25 singleLetters($('.cd-headline.letters').find('b')); 26 animateHeadline($('.cd-headline')); 27 } 28 29 function singleLetters($words) { 30 $words.each(function(){ 31 var word = $(this), 32 letters = word.text().split(''), 33 selected = word.hasClass('is-visible'), 34 i = ''; 35 for (i in letters) { 36 if(word.parents('.rotate-2').length > 0) letters[i] = '<em>' + letters[i] + '</em>'; 37 letters[i] = (selected) ? '<i class="in">' + letters[i] + '</i>': '<i>' + letters[i] + '</i>'; 38 } 39 var newLetters = letters.join(''); 40 word.html(newLetters).css('opacity', 1); 41 }); 42 } 43 44 function animateHeadline($headlines) { 45 var duration = animationDelay; 46 $headlines.each(function(){ 47 var headline = $(this); 48 var words = headline.find('.cd-words-wrapper b'), 49 width = 0; 50 words.each(function(){ 51 var wordWidth = $(this).width(); 52 if (wordWidth > width) width = wordWidth; 53 }); 54 headline.find('.cd-words-wrapper').css('width', width); 55 setTimeout(function(){ hideWord( headline.find('.is-visible').eq(0) ) }, duration); 56 }); 57 } 58 59 function hideWord($word) { 60 var nextWord = takeNext($word); 61 62 if($word.parents('.cd-headline').hasClass('letters')) { 63 var bool = ($word.children('i').length >= nextWord.children('i').length) ? true : false; 64 hideLetter($word.find('i').eq(0), $word, bool, lettersDelay); 65 showLetter(nextWord.find('i').eq(0), nextWord, bool, lettersDelay); 66 } else { 67 switchWord($word, nextWord); 68 setTimeout(function(){ hideWord(nextWord) }, animationDelay); 69 } 70 71 } 72 73 function hideLetter($letter, $word, $bool, $duration) { 74 $letter.removeClass('in').addClass('out'); 75 76 if(!$letter.is(':last-child')) { 77 setTimeout(function(){ hideLetter($letter.next(), $word, $bool, $duration); }, $duration); 78 } else if($bool) { 79 setTimeout(function(){ hideWord(takeNext($word)) }, animationDelay); 80 } 81 82 if($letter.is(':last-child') && $('html').hasClass('no-csstransitions')) { 83 var nextWord = takeNext($word); 84 switchWord($word, nextWord); 85 } 86 } 87 88 function showLetter($letter, $word, $bool, $duration) { 89 $letter.addClass('in').removeClass('out'); 90 91 if(!$letter.is(':last-child')) { 92 setTimeout(function(){ showLetter($letter.next(), $word, $bool, $duration); }, $duration); 93 } else { 94 if($word.parents('.cd-headline').hasClass('type')) { setTimeout(function(){ $word.parents('.cd-words-wrapper').addClass('waiting'); }, 200);} 95 if(!$bool) { setTimeout(function(){ hideWord($word) }, animationDelay) } 96 } 97 } 98 99 function takeNext($word) { 100 return (!$word.is(':last-child')) ? $word.next() : $word.parent().children().eq(0); 101 } 102 103 function switchWord($oldWord, $newWord) { 104 $oldWord.removeClass('is-visible').addClass('is-hidden'); 105 $newWord.removeClass('is-hidden').addClass('is-visible'); 106 } 107 108 } 109 110 111 112 $(document).ready(function(){ 113 114 //Call switch words 115 if($('.cd-headline').length) { 116 uxPageLoadingLetter(); 117 } 118 119 }) 120 121})(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.