memoscan
← all memos

Memo 0x36ba96b5…249bfd on Ethereum

0x8c76a394…7835·#24,457,322·view on Etherscan
`@Ro0123456789abcdef` <div class="w" id="guestbook"><d<div id="field1" class="field"><`M<p style="text-align:center;">You may leave a flower here by s`ending 0.01 ETH (or multiples th`͂ereof)<br> to the show contract `<div id="field2" class="field"><`<style>.tooltip { font-size: 0.8`<em; background: white; border: 1`\px solid black; padding: 0.5em; `|Rnwidth: 220px; }`.tooltip.r { text-align: right; `.tooltip .address { overflow-wra`̂Rop: break-word; }`document.addEventListener("DOMCoaRtntentLoaded", () => {`Xconsole.log(`Welcome to the console.log(` ⚘ ` ⚘ ⚘ ⚘ `^ ⚘ ` Initializing garden with ${f`Ă ⚘ `⚘ ⚘ a ⚘ a ⚘`);function calculateThreshold(planaconst min = 30, max = 10000, lowaer = 0.99, higher = 0.8;if (planted <= min) return loweraif (planted >= max) return higheaconst normalized = (planted - miaRpn) / (max - min);`xconst logValue = Math.log10(1 + anormalized * (10 - 1));return higher + (lower - higher)aRq * (1 - logValue);`pfunction isConditionMet(planted,areturn val > threshold || val < function gridNoise(x, z, seed) {`,var n = (1619 * x + 31337 * z + `L1013 * seed) & 0x7fffffff;n = BigInt((n >> 13) ^ n);n = n * (n * n * 60493n + 199903`Rr03n) + 1376312589n;`hn = parseInt(n.toString(2).slice`ӂreturn 1 - n / 1073741824;Rpconst width = 90;`xlet lines = [""], counter = 0, pawhile (planted < flowers) {const val = gridNoise(counter % awidth, Math.floor(counter / widtaif (val > threshold || val < -thlines[Math.floor(counter / width`*)] += `<a href="#flower${planted`J+1}" id="flower${planted+1}" sty`jle="position:relative;" data-flo`wer-id="${planted+1}">⚘</a>`;} else { lines[Math.floor(counte`ӂRtr / width)] += " "; }`Xif (counter % width == (width-1)a && planted < flowers) { lines.palines = lines.reduce((acc, line)a => { if (line.trim().length > 0a) acc.push(line); return acc; },adocument.querySelector("#field1"a).innerHTML = lines.slice(0,Matha.min(7,Math.ceil(lines.length/2)aRm)).join("\n");`document.querySelector("#field2"a).innerHTML = lines.slice(Math.main(7,Math.ceil(lines.length/2)))aconst flowerEls = document.queryaSelectorAll(".field a");flowerEls.forEach((el) => {el.addEventListener("mouseenter"aconst flowerId = e.target.dataseaRnif (flowerId) {`e.preventDefault();showTooltip(fael.addEventListener("mouseleave"a document.querySelectorAll(".atooltip").forEach((el) => el.rema});window.addEventListener("resiaze", () => document.querySelectoarAll(".tooltip").forEach((el) =>aRn el.remove()));`document.querySelectorAll(".fielad").forEach((el) => el.addEventLaistener("scroll", () => documenta.querySelectorAll(".tooltip").foarEach((el) => el.remove())));function showTooltip(flowerId) {adocument.querySelectorAll(".toolatip").forEach((el) => el.remove(aconst tooltip = document.createEaRmlement("div");`tooltip.classList.add("tooltip")atooltip.id = "tooltip" + flowerIatooltip.innerHTML = `Loading FloaRuwer #${flowerId} ...`;`Ptooltip.style.position = "absoluaconst flower = document.getElemeantById("flower" + flowerId);const clientRect = flower.getBouaRqndingClientRect();`pconst offsetTop = window.pageYOfafset || document.documentElementa.scrollTop || document.body.scroatooltip.style.top = clientRect.taop + (offsetTop) + flower.clientaRmHeight + "px";`const offsetLeft = window.pageXOaffset || document.documentElemenat.scrollLeft || document.body.scaRmrollLeft || 0;`const leftPos = clientRect.left aRl+ offsetLeft;`tooltip.style.left = leftPos > waindow.innerWidth - 250 ? leftPosa - 220 + "px" : leftPos + "px";if (leftPos > window.innerWidth a- 250) tooltip.classList.add("r"adocument.body.appendChild(tooltiaRtloadFlower(flowerId);`Xconst fetchFlowerMemo = (() => {aRt const cache = {};`X return async function(flowera if (cache[flowerId]) reta $urn { ...cache[flowerId] }; const res = await fetch(a _"/flower/" + flowerId); const data = await res.ja cache[flowerId] = { ...da Rs return data;``async function loadFlower(flowera const data = await fetcha .RtFlowerMemo(flowerId);`X console.log(`Loaded Flowa cer #${flowerId}`, data); const tooltip = documenta .getElementById("tooltip" + flowa if (!tooltip) return; tooltip.innerHTML = `Floa wer #${flowerId}<br> <span classa="address">${data.planter}</spana><br> ${formatTime(data.timestamaRp } catch (e) {`x console.error("Error loaRqading flower", e);`pfunction formatTime(t) { const date = new Date(t * 10a const options = { month: "loa const month = new Intl.DateTaimeFormat("en-US", options).forma const day = date.getDate(); const year = date.getFullYeaa let hours = date.getHours();a const minutes = date.getMinuates().toString().padStart(2, "0"a const amPm = hours >= 12 ? "a hours = hours % 12 || 12; return `${month} ${day}, ${ya dear}, ${hours}:${minutes}${amPm}a const threshold = calculateThresRmhold(planted);`