mirror of
https://github.com/multipleof4/4ev.link.git
synced 2026-01-13 15:57:53 +00:00
111 lines
8.9 KiB
HTML
111 lines
8.9 KiB
HTML
<!doctype html><html lang=en>
|
|
<head>
|
|
<meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1">
|
|
<title>4ev.link — Short links. Forever.</title>
|
|
<meta name=description content="Create simple, fast, permanent short links on 4ev.link.">
|
|
<meta name=color-scheme content="light dark">
|
|
<meta property=og:title content="4ev.link — Short links. Forever.">
|
|
<meta property=og:description content="Create simple, fast, permanent short links on 4ev.link.">
|
|
<meta property=og:type content=website><meta property=og:url content="https://4ev.link/">
|
|
<link rel=icon href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='64' height='64' viewBox='0 0 24 24'%3E%3Cpath fill='%23ff6a00' d='M10.59 13.41a1.996 1.996 0 0 1 0-2.82l2-2a2 2 0 1 1 2.82 2.83l-1 1 1.41 1.41 1-1a4 4 0 1 0-5.66-5.65l-2 2a4 4 0 0 0 0 5.65l.43.43 1.41-1.41-.41-.43Zm2.82-2.82a2 2 0 0 1 0 2.83l-2 2a2 2 0 1 1-2.82-2.83l1-1-1.41-1.41-1 1a4 4 0 1 0 5.66 5.65l2-2a4 4 0 0 0 0-5.65l-.43-.43-1.41 1.41.41.43Z'/%3E%3C/svg%3E">
|
|
<style>
|
|
:root{--bg:#0b0c0f;--card:#0f1116;--muted:#8a93a6;--fg:#e6e7eb;--brand:#ff6a00;--brand2:#ffb35c;--ok:#22c55e;--err:#ef4444;--ring:0 0 0 2px color-mix(in oklab,var(--brand) 40%,transparent)}
|
|
:root[data-t=light]{--bg:#ffffff;--card:#f6f7fb;--muted:#5b6476;--fg:#0b0c0f}
|
|
*{box-sizing:border-box}html,body{height:100%}body{margin:0;font:500 16px ui-sans-serif,system-ui,-apple-system,Segoe UI,Roboto,Inter,Arial,Apple Color Emoji,Segoe UI Emoji;background:radial-gradient(1200px 600px at 80% -10%,#ff6a0015,transparent 60%),radial-gradient(900px 500px at -10% 10%,#4f46e515,transparent 60%),var(--bg);color:var(--fg)}
|
|
a{color:inherit;text-decoration:none}button,input{font:inherit}
|
|
.container{max-width:1100px;margin:auto;padding:24px}
|
|
.nav{display:flex;gap:16px;align-items:center;justify-content:space-between}
|
|
.logo{display:flex;gap:10px;align-items:center}
|
|
.badge{font:700 10px/1.6 ui-monospace,monospace;background:#ffffff12;color:#fff;border:1px solid #ffffff22;padding:2px 6px;border-radius:999px;letter-spacing:.06em;text-transform:uppercase}
|
|
.nav a{opacity:.8} .nav a:hover{opacity:1}
|
|
.btn{display:inline-flex;gap:8px;align-items:center;justify-content:center;border:1px solid #ffffff22;background:linear-gradient(180deg,#ffffff10,#00000000);color:var(--fg);border-radius:10px;padding:10px 14px;cursor:pointer;transition:transform .05s ease,opacity .2s ease;will-change:transform,opacity}
|
|
.btn:active{transform:translateY(1px)} .btn[disabled]{opacity:.6;cursor:not-allowed}
|
|
.btn.brand{background:linear-gradient(180deg,color-mix(in oklab,var(--brand) 20%,transparent),transparent);border-color:color-mix(in oklab,var(--brand) 40%,transparent)}
|
|
.btn.ghost{background:transparent}
|
|
.hero{padding:60px 0 36px;text-align:center}
|
|
.h1{font-size:44px;line-height:1.08;letter-spacing:-.02em;margin:0 0 12px}
|
|
.p{margin:0 auto;color:var(--muted);max-width:740px}
|
|
.card{background:linear-gradient(180deg,#ffffff08,#0000),var(--card);border:1px solid #ffffff12;border-radius:14px;box-shadow:0 8px 40px #00000020}
|
|
.form{margin:28px auto 0;max-width:760px;display:flex;gap:10px;padding:14px}
|
|
.field{flex:1;display:flex;gap:10px;align-items:center;background:#00000025;border:1px solid #ffffff12;border-radius:10px;padding:10px 12px}
|
|
input.url{all:unset;color:var(--fg);width:100%} input.url::placeholder{color:#9aa3b2}
|
|
.msg{margin:10px auto 0;max-width:760px;color:var(--muted)}
|
|
.msg.err{color:var(--err)} .msg.ok{color:var(--ok)}
|
|
.result{margin:14px auto 0;max-width:760px;padding:12px;display:none;align-items:center;gap:10px}
|
|
.result.show{display:flex}
|
|
.code{flex:1;background:#00000025;border:1px dashed #ffffff22;border-radius:10px;padding:12px;font:600 14px ui-monospace,monospace;overflow:auto;white-space:nowrap}
|
|
.grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:14px;margin:36px 0 10px}
|
|
.card.i{padding:16px}
|
|
.card h3{margin:8px 0 4px;font-size:16px}
|
|
.card p{margin:0;color:var(--muted);font-weight:450}
|
|
footer{padding:30px 0 60px;color:var(--muted);text-align:center}
|
|
.kbd{font:600 12px ui-monospace,monospace;background:#ffffff10;padding:2px 6px;border-radius:6px;border:1px solid #ffffff22}
|
|
:focus-visible{outline:none;box-shadow:var(--ring);border-radius:10px}
|
|
@media (max-width:640px){.h1{font-size:34px}.form{flex-direction:column}.result{flex-direction:column;align-items:stretch}}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class=container>
|
|
<nav class=nav>
|
|
<div class=logo>
|
|
<i data-lucide=link stroke-width=2.6 style="color:var(--brand)"></i>
|
|
<strong>4ev.link</strong>
|
|
<span class=badge>beta</span>
|
|
</div>
|
|
<div style="display:flex;gap:8px;align-items:center">
|
|
<a class=btn ghost href="https://github.com/4ev-link/4ev.link" target=_blank rel=noopener><i data-lucide=github></i><span>GitHub</span></a>
|
|
<button id=theme class="btn ghost" aria-label="Toggle theme"><i data-lucide=sun></i></button>
|
|
</div>
|
|
</nav>
|
|
|
|
<header class=hero>
|
|
<h1 class=h1>Short links. Forever.</h1>
|
|
<p class=p>Generate simple, human-friendly slugs backed by an edge KV. No accounts. No bloat. Built to last.</p>
|
|
<form id=f class="card form" autocomplete=off>
|
|
<div class=field>
|
|
<i data-lucide=globe stroke-width=2></i>
|
|
<input class=url id=url name=url type=url placeholder="https://example.com/very/long/url" inputmode=url spellcheck=false required>
|
|
</div>
|
|
<button id=go class="btn brand" type=submit><i data-lucide=bolt></i><span>Shorten</span></button>
|
|
</form>
|
|
<div id=msg class=msg role=status aria-live=polite></div>
|
|
<div id=res class="card result" aria-live=polite>
|
|
<div class=code id=out title="Click to copy"></div>
|
|
<button id=copy class=btn><i data-lucide=copy></i><span>Copy</span></button>
|
|
<a id=open class="btn ghost" target=_blank rel=noopener><i data-lucide=external-link></i><span>Open</span></a>
|
|
</div>
|
|
</header>
|
|
|
|
<section class=grid aria-label="Highlights">
|
|
<article class="card i"><i data-lucide=zap></i><h3>Edge-fast</h3><p>Served from the edge with 302 redirects.</p></article>
|
|
<article class="card i"><i data-lucide=shield-check></i><h3>Safe by default</h3><p>Strict URL validation, CORS-ready API.</p></article>
|
|
<article class="card i"><i data-lucide=infinity></i><h3>Forever</h3><p>KV-backed slugs built to outlast tabs.</p></article>
|
|
<article class="card i"><i data-lucide=wand-2></i><h3>Nice slugs</h3><p>Clean, 4-char defaults; customize later.</p></article>
|
|
<article class="card i"><i data-lucide=palette></i><h3>Light/Dark</h3><p>Auto theme with manual toggle.</p></article>
|
|
<article class="card i"><i data-lucide=keyboard></i><h3>Keyboard-first</h3><p><span class=kbd>Enter</span> to shorten, <span class=kbd>⌘/Ctrl+C</span> to copy.</p></article>
|
|
</section>
|
|
|
|
<footer>© <span id=year></span> 4ev.link • Built on Cloudflare • Icons by Lucide</footer>
|
|
</div>
|
|
|
|
<script src="https://unpkg.com/lucide@0.462.0/dist/umd/lucide.min.js" defer></script>
|
|
<script>
|
|
(()=>{const d=document,e=(q,o=d)=>o.querySelector(q),A=(q,o=d)=>o.querySelectorAll(q),S=(k,v)=>localStorage.setItem(k,v),G=k=>localStorage.getItem(k),root=d.documentElement,yr=e('#year'),f=e('#f'),url=e('#url'),go=e('#go'),msg=e('#msg'),res=e('#res'),out=e('#out'),cpy=e('#copy'),op=e('#open'),th=e('#theme');yr.textContent=new Date().getFullYear();
|
|
const applyTheme=t=>{root.dataset.t=t;th.innerHTML='';th.insertAdjacentHTML('beforeend',`<i data-lucide='${t==='light'?'moon':'sun'}'></i>`);lucide&&lucide.createIcons()}
|
|
const initTheme=()=>{const pref=matchMedia('(prefers-color-scheme: dark)').matches?'dark':'light';applyTheme(G('t')||pref)}
|
|
th.onclick=()=>{const t=root.dataset.t==='dark'?'light':'dark';applyTheme(t);S('t',t)}
|
|
const setMsg=(m,c='')=>{msg.className=`msg ${c}`;msg.textContent=m||''}
|
|
const showRes=u=>{out.textContent=u;op.href=u;res.classList.add('show')}
|
|
const clearRes=()=>{res.classList.remove('show');out.textContent='';op.removeAttribute('href')}
|
|
const valid=v=>{try{return new URL(v),true}catch{return false}}
|
|
f.onsubmit=async ev=>{ev.preventDefault();setMsg('');clearRes();let v=url.value.trim();if(!valid(v))return setMsg('Please enter a valid URL', 'err');go.disabled=true;go.style.opacity=.7;
|
|
try{const r=await fetch('/',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({url:v})});if(!r.ok){const t=await r.text();throw new Error(t||'Failed')}const j=await r.json();showRes(j.shortUrl);setMsg('Link created!', 'ok')}catch(err){setMsg(err.message||'Something went wrong','err')}finally{go.disabled=false;go.style.opacity=1}}
|
|
cpy.onclick=async()=>{let t=out.textContent;if(!t)return;try{await navigator.clipboard.writeText(t);cpy.innerHTML='<i data-lucide=check></i><span>Copied</span>';lucide.createIcons();setTimeout(()=>{cpy.innerHTML='<i data-lucide=copy></i><span>Copy</span>';lucide.createIcons()},1200)}catch{}}
|
|
out.onclick=()=>cpy.click()
|
|
d.addEventListener('keydown',ev=>{if(ev.key==='Enter'&&d.activeElement===d.body)url.focus()})
|
|
d.addEventListener('DOMContentLoaded',()=>{lucide&&lucide.createIcons();initTheme();url.focus()})
|
|
})();
|
|
</script>
|
|
</body>
|
|
</html>
|