1(function($) { 2 3 $.fn.isInViewport = function() { 4 var elementTop = $(this).offset().top; 5 var elementBottom = elementTop + $(this).outerHeight(); 6 var viewportTop = $(window).scrollTop(); 7 var viewportBottom = viewportTop + $(window).height(); 8 return elementBottom > viewportTop && elementTop < viewportBottom; 9 }; 10 11 if( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ) { 12 $(document).addClass("no-video"); 13 } 14 15 function isMobile() { 16 return (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)); 17 } 18 19 20 $(window).on('resize scroll', function() { 21 checkAnimate(); 22 }); 23 24 $(document).on("click", '.menu-more', function(e) { 25 e.preventDefault(); 26 $("#nav-wrap").toggleClass("show-hidden"); 27 }); 28 29 function getViewportOffset($e) { 30 var $window = $(window), 31 scrollLeft = $window.scrollLeft(), 32 scrollTop = $window.scrollTop(), 33 offset = $e.offset(), 34 rect1 = { x1: scrollLeft, y1: scrollTop, x2: scrollLeft + $window.width(), y2: scrollTop + $window.height() }, 35 rect2 = { x1: offset.left, y1: offset.top, x2: offset.left + $e.width(), y2: offset.top + $e.height() }; 36 return { 37 left: offset.left - scrollLeft, 38 top: offset.top - scrollTop, 39 insideViewport: rect1.x1 < rect2.x2 && rect1.x2 > rect2.x1 && rect1.y1 < rect2.y2 && rect1.y2 > rect2.y1 40 }; 41 } 42 43 function percentage(partialValue, totalValue) { 44 var sumUp = (100 * partialValue) / totalValue; 45 return (sumUp <= 100) ? sumUp : 100; 46 } 47 48 function reversePercentage(finalNum, per) { 49 return ((finalNum*100)/(per+100)); 50 } 51 52 function checkAnimate() { 53 54 55 $(".list-item").each(function() { 56 if($(this).isInViewport()) { 57 var viewportOffset = getViewportOffset($(this)); 58 var viewportHeight = $(window).outerHeight(); 59 var scrollMath = (percentage(viewportHeight - viewportOffset.top, viewportHeight) / 3) + "%"; 60 $(this).find(".inner-scroll").css('margin-top',scrollMath); 61 } 62 }); 63 64 $(".animate-once, .animate-loop").each(function() { 65 if($(this).hasClass("animate-once") && $(this).isInViewport() && !$(this).hasClass("start")) { 66 $(this).addClass("start"); 67 } 68 if($(this).hasClass("animate-loop") && $(this).isInViewport() && !$(this).hasClass("start")) { 69 $(this).addClass("start"); 70 } 71 if($(this).hasClass("start") && !$(this).isInViewport()) { 72 $(this).removeClass("start"); 73 } 74 }); 75 } 76 77 checkAnimate(); 78 79 if($('div.grid').length) { 80 $(".grid a").each(function() { 81 var randRotate = Math.floor(Math.random() * 2) + 1; 82 var randRotatep = Math.floor(Math.random() * 8) + 1; 83 var randFlip = (Math.random() < 0.5) ? "-" : ""; 84 $(this).css({'transform' : 'rotate('+ randFlip + randRotate +'.'+randRotatep+'deg)'}); 85 }); 86 } 87 88 $('body').on('click', '.grid a', function(e) { 89 e.preventDefault(); 90 var imgDesc = $(this).text(); 91 var imgSrc = $(this).find('img').attr('src'); 92 $('#photo-modal .photo').css('background-image', 'url(' + imgSrc + ')'); 93 $('#photo-modal span').text(imgDesc); 94 $('#photo-modal').toggleClass("show"); 95 }); 96 97 $('body').on('click', '#photo-modal a', function(e) { 98 e.preventDefault(); 99 $('#photo-modal').toggleClass("show"); 100 }); 101 102 $('body').on('click', '.closer', function(e) { 103 e.preventDefault(); 104 var cookieName = "hide-" + $(this).parent().parent().attr('id'); 105 $(this).parent().parent().hide(); 106 document.cookie = cookieName+"=hide;path=/"; 107 }); 108 109})( 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.