krying
Version:
krying — games hub, AI, movies, and tools
367 lines (314 loc) • 10.3 kB
HTML
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Nai Nai UBG</title>
<script async src="https://www.googletagmanager.com/gtag/js?id=G-W0KXN0103E"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-W0KXN0103E');
</script>
<style>
:root{
--bg:#050814;
--panel:#0b1224;
--card:#111c33;
--text:#eaf2ff;
--muted:#8aa0c8;
--accent:#3a86ff;
}
*{box-sizing:border-box;margin:0;padding:0}
body{
font-family:system-ui, -apple-system, sans-serif;
background: var(--bg);
background: radial-gradient(circle at top, #0a1430, #050814);
color: var(--text);
overflow: hidden;
height: 100vh;
text-align: center;
}
header{
text-align: center;
padding: 15px 10px 5px;
font-size: 24px;
font-weight: 800;
letter-spacing: 1px;
text-transform: uppercase;
color: var(--accent);
}
.icon-row{
display: flex;
justify-content: center;
gap: 12px;
margin-bottom: 10px;
}
.icon-row a{
width: 40px;
height: 40px;
display: flex;
align-items: center;
justify-content: center;
border-radius: 10px;
background: var(--panel);
transition: .2s ease;
border: 1px solid rgba(255,255,255,0.05);
}
.icon-row a:hover{
transform: translateY(-2px);
background: #14244a;
border-color: var(--accent);
}
.icon-row svg{
width: 20px;
height: 20px;
fill: white;
}
.controls{
display: flex;
gap: 10px;
padding: 10px 20px;
max-width: 800px;
margin: 0 auto;
}
input{
flex: 1;
padding: 12px 20px;
border: 1px solid rgba(255,255,255,0.1);
border-radius: 12px;
background: var(--panel);
color: white;
outline: none;
font-size: 16px;
}
input:focus{ border-color: var(--accent); }
.count{
padding: 12px;
border-radius: 12px;
background: var(--panel);
color: var(--muted);
font-size: 13px;
min-width: 80px;
text-align: center;
}
.grid{
position: relative;
height: calc(100vh - 180px);
overflow-y: auto;
padding: 20px;
scrollbar-width: thin;
scrollbar-color: var(--card) transparent;
}
.spacer{ width: 100%; position: relative; }
.card{
position: absolute;
width: 140px;
height: 160px;
background: var(--card);
border-radius: 12px;
overflow: hidden;
cursor: pointer;
transition: transform .2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}
.card:hover{
transform: scale(1.05);
z-index: 10;
}
.card img{
width: 100%;
height: 105px;
object-fit: cover;
background: #000;
}
.card p{
text-align: center;
font-size: 11px;
font-weight: 500;
padding: 8px 4px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.viewer{
position: fixed;
inset: 0;
background: #000;
display: none;
flex-direction: column;
z-index: 10000;
}
.topbar{
display: flex;
background: #0b1426;
border-bottom: 1px solid #1e2a44;
}
.topbar div{
flex: 1;
text-align: center;
padding: 14px;
cursor: pointer;
font-weight: 600;
transition: .2s;
}
.topbar div:hover{ background: #1a2a4a; }
.topbar #closeBtn { color: #ff4d4d; }
iframe{
flex: 1;
border: none;
background: #fff;
}
</style>
</head>
<body>
<div style="background: linear-gradient(135deg, #00004d, #004080); width: 100%; padding-bottom: 15px;">
<header>Nai Nai UBG</header>
<p>Created by the Discord user NCkidd <a href="https://discord.com/users/1449207478683177050" target="_blank" rel="noopener noreferrer" style="color:var(--accent)">Profile</a></p>
<p>Co-Owner is Tharun9772Gaming <a href="https://discord.com/users/1338663717956616264" target="_blank" rel="noopener noreferrer" style="color:var(--accent)">Profile</a></p>
<div class="icon-row" style="margin-top:10px;">
<a href="https://discord.gg/sqPFYEsz8F" title="Discord" target="_blank" rel="noopener noreferrer">
<svg viewBox="0 0 576 512"><path d="M492.5 69.8c-.2-.3-.4-.6-.8-.7-38.1-17.5-78.4-30-119.7-37.1-.4-.1-.8 0-1.1 .1s-.6 .4-.8 .8c-5.5 9.9-10.5 20.2-14.9 30.6-44.6-6.8-89.9-6.8-134.4 0-4.5-10.5-9.5-20.7-15.1-30.6-.2-.3-.5-.6-.8-.8s-.7-.2-1.1-.2c-41.3 7.1-81.6 19.6-119.7 37.1-.3 .1-.6 .4-.8 .7-76.2 113.8-97.1 224.9-86.9 334.5 0 .3 .1 .5 .2 .8s.3 .4 .5 .6c44.4 32.9 94 58 146.8 74.2 .4 .1 .8 .1 1.1 0s.7-.4 .9-.7c11.3-15.4 21.4-31.8 30-48.8 .1-.2 .2-.5 .2-.8s0-.5-.1-.8-.2-.5-.4-.6-.4-.3-.7-.4c-15.8-6.1-31.2-13.4-45.9-21.9-.3-.2-.5-.4-.7-.6s-.3-.6-.3-.9 0-.6 .2-.9 .3-.5 .6-.7c3.1-2.3 6.2-4.7 9.1-7.1 .3-.2 .6-.4 .9-.4s.7 0 1 .1c96.2 43.9 200.4 43.9 295.5 0 .3-.1 .7-.2 1-.2s.7 .2 .9 .4c2.9 2.4 6 4.9 9.1 7.2 .2 .2 .4 .4 .6 .7s.2 .6 .2 .9-.1 .6-.3 .9-.4 .5-.6 .6c-14.7 8.6-30 15.9-45.9 21.8-.2 .1-.5 .2-.7 .4s-.3 .4-.4 .7-.1 .5-.1 .8 .1 .5 .2 .8c8.8 17 18.8 33.3 30 48.8 .2 .3 .6 .6 .9 .7s.8 .1 1.1 0c52.9-16.2 102.6-41.3 147.1-74.2 .2-.2 .4-.4 .5-.6s.2-.5 .2-.8c12.3-126.8-20.5-236.9-86.9-334.5zm-302 267.7c-29 0-52.8-26.6-52.8-59.2s23.4-59.2 52.8-59.2c29.7 0 53.3 26.8 52.8 59.2 0 32.7-23.4 59.2-52.8 59.2zm195.4 0c-29 0-52.8-26.6-52.8-59.2s23.4-59.2 52.8-59.2c29.7 0 53.3 26.8 52.8 59.2 0 32.7-23.2 59.2-52.8 59.2z"/></svg>
</a>
<a href="https://docs.google.com/document/d/1UC3Eo6UoPCVlq1SiOFEj0HahQGPqqbadXSho5NKHbQU/edit" title="UBG Links" target="_blank" rel="noopener noreferrer">
<svg viewBox="0 0 384 512"><path d="M0 64C0 28.7 28.7 0 64 0L213.5 0c17 0 33.3 6.7 45.3 18.7L365.3 125.3c12 12 18.7 28.3 18.7 45.3L384 448c0 35.3-28.7 64-64 64L64 512c-35.3 0-64-28.7-64-64L0 64zm208-5.5l0 93.5c0 13.3 10.7 24 24 24L325.5 176 208 58.5zM120 256c-13.3 0-24 10.7-24 24s10.7 24 24 24l144 0c13.3 0 24-10.7 24-24s-10.7-24-24-24l-144 0zm0 96c-13.3 0-24 10.7-24 24s10.7 24 24 24l144 0c13.3 0 24-10.7 24-24s-10.7-24-24-24l-144 0z"/></svg>
</a>
</div>
<div class="controls">
<input id="search" placeholder="Search 4000+ games..." autocomplete="off">
<div class="count" id="count">0</div>
</div>
</div>
<div class="grid" id="grid">
<div class="spacer" id="spacer"></div>
</div>
<div class="viewer" id="viewer">
<div class="topbar">
<div id="closeBtn" onclick="closeGame()">CLOSE GAME</div>
<div id="openNewTab">OPEN IN NEW TAB</div>
</div>
<iframe id="viewerFrame"></iframe>
</div>
<script>
const DATA = { all: [] };
const grid = document.getElementById("grid");
const spacer = document.getElementById("spacer");
const countEl = document.getElementById("count");
const search = document.getElementById("search");
const viewer = document.getElementById("viewer");
const openNewTabBtn = document.getElementById("openNewTab");
let viewerFrame = document.getElementById("viewerFrame");
const HYDRA_BASE = "https://cdn.jsdelivr.net/gh/Hydra-Network/hydra-assets@main/";
const HYDRA_JSON = HYDRA_BASE + "gmes.json";
let filtered = [];
const CARD_W = 160;
const CARD_H = 180;
let cols = 1;
async function loadHydra(){
try{
const r = await fetch(HYDRA_JSON);
const d = await r.json();
return d.map(g => ({
name: g.title || "Unknown",
img: g.thumb ? HYDRA_BASE + g.thumb : "https://via.placeholder.com/150x110?text=No+Image",
url: HYDRA_BASE + "gmes/" + g.file_name,
type: "hydra"
}));
}catch(e){ return []; }
}
async function loadUGS(){
const repos = ["tharun9772/ugs-1","tharun9772/ugs-2","tharun9772/ugs-3"];
let games = [];
for(const repo of repos){
try{
const r = await fetch(`https://api.github.com/repos/${repo}/contents/`);
if(!r.ok) continue;
const d = await r.json();
d.forEach(f=>{
if(f.name.startsWith("cl") && f.name.endsWith(".html")){
games.push({
name: f.name.replace(/^cl/,"").replace(".html","").replace(/-/g," "),
url: `https://cdn.jsdelivr.net/gh/${repo}@main/${f.name}`,
img: "https://cdn.jsdelivr.net/gh/tharun9772/game-assets@main/5968517.png",
type: "ugs"
});
}
});
}catch(e){}
}
return games;
}
function updateLayout(){
cols = Math.max(1, Math.floor(grid.clientWidth / CARD_W));
}
function render(){
const scrollTop = grid.scrollTop;
const startRow = Math.floor(scrollTop / CARD_H);
const visibleRows = Math.ceil(grid.clientHeight / CARD_H);
const start = Math.max(0, (startRow - 1) * cols);
const end = Math.min(filtered.length, (startRow + visibleRows + 1) * cols);
grid.querySelectorAll(".card").forEach(e => e.remove());
for(let i=start; i<end; i++){
const g = filtered[i];
const row = Math.floor(i / cols);
const col = i % cols;
const el = document.createElement("div");
el.className = "card";
const offsetX = (grid.clientWidth - (cols * CARD_W)) / 2;
el.style.left = `${offsetX + (col * CARD_W) + 10}px`;
el.style.top = `${(row * CARD_H)}px`;
el.innerHTML = `<img src="${g.img}" loading="lazy"><p>${g.name}</p>`;
el.onclick = () => openGame(g);
grid.appendChild(el);
}
spacer.style.height = Math.ceil(filtered.length / cols) * CARD_H + "px";
}
search.oninput = () => {
const q = search.value.toLowerCase();
filtered = DATA.all.filter(g => g.name.toLowerCase().includes(q));
countEl.textContent = filtered.length;
grid.scrollTop = 0;
render();
};
async function openGame(g){
viewer.style.display = "flex";
try {
const res = await fetch(g.url);
const code = await res.text();
const doc = viewerFrame.contentWindow.document;
doc.open();
doc.write(code);
doc.close();
openNewTabBtn.onclick = () => {
const win = window.open("about:blank", "_blank");
win.document.write(code);
win.document.close();
};
} catch (err) {
console.error("Failed to fetch game code:", err);
}
}
function closeGame(){
viewer.style.display = "none";
const newFrame = document.createElement("iframe");
newFrame.id = "viewerFrame";
viewerFrame.replaceWith(newFrame);
viewerFrame = newFrame;
}
(async ()=>{
const [hydra, ugs] = await Promise.all([loadHydra(), loadUGS()]);
DATA.all = [...hydra, ...ugs];
filtered = DATA.all;
countEl.textContent = filtered.length;
updateLayout();
render();
grid.addEventListener("scroll", render);
window.addEventListener("resize", ()=>{
updateLayout();
render();
});
})();
</script>
</body>
</html>