1$(document).ready(function () { 2 3 // ð Fetch YUSD Supply from API, but use hardcoded APR = 11.5% 4 fetch("https://api.aegis.im/api/project-stats") 5 .then(response => response.json()) 6 .then(data => { 7 if (data.status === "success" && data.data) { 8 const aprValue = parseFloat(data.data.efficient_apr); 9 const yusdValue = parseFloat(data.data.yusd_total_supply); 10 11 animateNumber(".main__apr", 0, aprValue, "%", 1500, formatPercent); 12 animateNumber(".main__supply", 0, yusdValue, "", 1500, formatNumber); 13 } else { 14 showFallback(); 15 } 16 }) 17 .catch(error => { 18 console.error("â API error:", error); 19 showFallback(); 20 }); 21 22 function showFallback() { 23 const aprValue = 8; 24 const yusdValue = 27200000; 25 26 animateNumber(".main__apr", 0, aprValue, "%", 1500, formatPercent); 27 animateNumber(".main__supply", 0, yusdValue, "", 1500, formatNumber); 28 } 29 30 // ð¡ UI Interactions 31 $(".howit__item--title--inner").on("click", function () { 32 if ($(this).hasClass("active")) { 33 $(this).removeClass("active"); 34 $(this).siblings(".howit__item--content").slideUp(300); 35 } else { 36 $(".howit__item--title--inner").removeClass("active"); 37 $(".howit__item--content").slideUp(300); 38 39 $(this).addClass("active"); 40 $(this).siblings(".howit__item--content").slideDown({ 41 duration: 300, 42 start: function () { 43 $(this).css("display", "flex"); 44 } 45 }); 46 } 47 }); 48 49 const closeMenu = () => { 50 $("body").removeClass("scroll"); 51 $(".mobile__menu").removeClass("active"); 52 }; 53 54 $(".menu__button").on("click", function () { 55 $("body").addClass("scroll"); 56 $(".mobile__menu").addClass("active"); 57 }); 58 59 $(".mobile__menu--cross").on("click", function () { 60 closeMenu(); 61 }); 62 63 $(".go").on("click", function (e) { 64 e.preventDefault(); 65 let point = $(this).attr("data-point"); 66 closeMenu(); 67 $("body,html").animate({ scrollTop: $("#" + point).offset().top }, 500); 68 }); 69 70 $(".features__table--item--info").on("click", function () { 71 if ($(this).hasClass("active")) { 72 $(this).removeClass("active"); 73 $(this).siblings(".features__table--item--content").slideUp(300); 74 } else { 75 $(".features__table--item--info").removeClass("active"); 76 $(".features__table--item--content").slideUp(300); 77 78 $(this).addClass("active"); 79 $(this).siblings(".features__table--item--content").slideDown({ 80 duration: 300, 81 start: function () { 82 $(this).css("display", "flex"); 83 } 84 }); 85 } 86 }); 87 88 $(window).on("scroll", function () { 89 let scrollTop = $(this).scrollTop(); 90 91 let yOffset = scrollTop * 0.03; 92 let zOffset = -scrollTop * 0.03; 93 let rotateX = -1 * scrollTop * 0.02; 94 let scale = 1 - scrollTop * 0.0002; 95 let opacity = 1 - scrollTop * 0.001; 96 97 if (opacity < 0) opacity = 0; 98 99 $(".main__wrp").css("transform", `translate3d(0px, ${yOffset}vh, ${zOffset}px) rotateX(${rotateX}deg) scale(${scale})`); 100 $(".main__wrp").css("opacity", opacity); 101 }); 102 103 $(".press__effect").on("mousemove", function (e) { 104 let $this = $(this); 105 let offset = $this.offset(); 106 let width = $this.outerWidth(); 107 let height = $this.outerHeight(); 108 109 let centerX = offset.left + width / 2; 110 let centerY = offset.top + height / 2; 111 112 let deltaX = (e.pageX - centerX) / width; 113 let deltaY = (e.pageY - centerY) / height; 114 115 let rotateX = deltaY * 10; 116 let rotateY = -deltaX * 10; 117 118 $this.css({ 119 transform: `perspective(500px) rotateX(${rotateX}deg) rotateY(${rotateY}deg)`, 120 transition: "transform 0.1s ease-out" 121 }); 122 }); 123 124 $(".press__effect").on("mouseleave", function () { 125 $(this).css({ 126 transform: "perspective(500px) rotateX(0deg) rotateY(0deg)", 127 transition: "transform 0.3s ease-out" 128 }); 129 }); 130 131 // ð¾ Number Animation 132 function animateNumber(selector, start, end, suffix = "", duration = 1000, formatFn
132= (val) => val) { 133 let element = document.querySelector(selector); 134 if (!element) return; 135 136 let startTime = null; 137 let step = (timestamp) => { 138 if (!startTime) startTime = timestamp; 139 let progress = Math.min((timestamp - startTime) / duration, 1); 140 let currentValue = Math.ceil(progress * (end - start) + start); 141 element.textContent = formatFn(currentValue) + suffix; 142 if (progress < 1) { 143 requestAnimationFrame(step); 144 } 145 }; 146 requestAnimationFrame(step); 147 } 148 149 function formatNumber(value) { 150 if (value >= 1_000_000) { 151 return (value / 1_000_000).toFixed(1) + "M"; 152 } else if (value >= 1_000) { 153 return (value / 1_000).toFixed(0) + "K"; 154 } 155 return value; 156 } 157 158 function formatPercent(value) { 159 return value; 160 } 161 162 document.querySelectorAll(".whyyusd2__info--block--content--img--lottie-animation").forEach((lottiefile, index, lottiefiles) => { 163 let animationobjectwhyyusd2 = lottie.loadAnimation({ 164 container: lottiefiles[index], 165 renderer: "svg", 166 loop: true, 167 autoplay: true, 168 path: lottiefiles[index].getAttribute("data-lottie-file") 169 }); 170 }); 171 172 document.querySelectorAll(".benefits__info--block--content--img--lottie-animation").forEach((lottiefile, index, lottiefiles) => { 173 let animationobjectbenefits = lottie.loadAnimation({ 174 container: lottiefiles[index], 175 renderer: "svg", 176 loop: true, 177 autoplay: true, 178 path: lottiefiles[index].getAttribute("data-lottie-file") 179 }); 180 }); 181 182 // UTM Parameter Handler 183 function getUtmParams() { 184 const urlParams = new URLSearchParams(window.location.search); 185 const utmParams = {}; 186 for (const [key, value] of urlParams.entries()) { 187 if (key.startsWith('utm_')) {
188 utmParams[key] = value; 189 } 190 } 191 return utmParams; 192 } 193 194 function appendUtmToUrl(baseUrl) { 195 const utmParams = getUtmParams(); 196 if (Object.keys(utmParams).length === 0) { 197 return baseUrl; 198 } 199 200 const url = new URL(baseUrl); 201 Object.entries(utmParams).forEach(([key, value]) => { 202 url.searchParams.set(key, value); 203 }); 204 205 return url.toString(); 206 } 207 208 // Handle all app link UTM parameters 209 $('a[href^="https://app.aegis.im"], a[href^="https://app.aegis.im"] button').on('click', function(e) { 210 e.preventDefault(); 211 e.stopPropagation(); 212 213 // Get the anchor element (either this element or its parent) 214 const $anchor = $(this).is('a') ? $(this) : $(this).closest('a'); 215 const originalUrl = $anchor.attr('href'); 216 const urlWithUtm = appendUtmToUrl(originalUrl); 217 window.open(urlWithUtm, '_blank'); 218 }); 219 220});
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.