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"Winter Breeze", "type": "manhwa", "chapter": "Chapter 34"},
|
| 7 |
+
{"title": "Strong Girl Geumjoo", "type": "manhwa", "chapter": "Chapter 39"},
|
| 8 |
+
{"title": "The Now (2021)", "type": "manhwa", "chapter": "Chapter 77"},
|
| 9 |
+
{"title": "From Disgraced Lady to Beloved Stepmother", "type": "manhwa", "chapter": "Chapter 9"},
|
| 10 |
+
{"title": "You're the Only One I Can See", "type": "manhwa", "chapter": "Chapter 1"},
|
| 11 |
+
{"title": "Immortal Simulator: Cultivating in Secret", "type": "manhua", "chapter": "Chapter 3"},
|
| 12 |
+
],
|
| 13 |
+
"updates": [
|
| 14 |
+
{"title": "Greetings, Sect Leader", "type": "manhua", "chapter": "Chapter 13", "time": "16 Menit lalu"},
|
| 15 |
+
{"title": "Killer Lawyer", "type": "manhwa", "chapter": "Chapter 25", "time": "47 Menit lalu"},
|
| 16 |
+
{"title": "The End Has Come", "type": "manhwa", "chapter": "Chapter 54", "time": "47 Menit lalu"},
|
| 17 |
+
{"title": "Super God of War", "type": "manhua", "chapter": "Chapter 7", "time": "1 Jam lalu"},
|
| 18 |
+
{"title": "Shijou Saikyou no Mahou Kenshi, F Rank Boukensha ni Tensei Suru", "type": "manga", "chapter": "Chapter 131", "time": "1 Jam lalu"},
|
| 19 |
+
{"title": "7-Nin no Nemuri Hime", "type": "manga", "chapter": "Chapter 48", "time": "1 Jam lalu"},
|
| 20 |
+
{"title": "Even the Absolute Being Is a First-Time Dad", "type": "manhwa", "chapter": "Chapter 45", "time": "1 Jam lalu"},
|
| 21 |
+
{"title": "My Gift LVL 9999 Unlimited Gacha", "type": "manga", "chapter": "Chapter 196", "time": "1 Jam lalu"},
|
| 22 |
+
{"title": "The World's Best Kunlun Tavern", "type": "manhwa", "chapter": "Chapter 111", "time": "2 Jam lalu"},
|
| 23 |
+
{"title": "The Eunuchs Second Life", "type": "manhwa", "chapter": "Chapter 35", "time": "2 Jam lalu"},
|
| 24 |
+
{"title": "The Peaceful Life of a Maid", "type": "manhwa", "chapter": "Chapter 20", "time": "2 Jam lalu"},
|
| 25 |
+
{"title": "Shamoneyism", "type": "manhwa", "chapter": "Chapter 40", "time": "2 Jam lalu"},
|
| 26 |
+
{"title": "The Villain Of Destiny", "type": "manhua", "chapter": "Chapter 323", "time": "2 Jam lalu"},
|
| 27 |
+
{"title": "Overlord Of Sichuan", "type": "manhwa", "chapter": "Chapter 21", "time": "2 Jam lalu"},
|
| 28 |
+
{"title": "The Rebel Of The Tyrant Noble Family", "type": "manhwa", "chapter": "Chapter 16", "time": "2 Jam lalu"},
|
| 29 |
+
{"title": "The Regressed Mercenary's Machinations", "type": "manhwa", "chapter": "Chapter 84", "time": "2 Jam lalu"},
|
| 30 |
+
{"title": "The Youngest Son Of A Rich Family", "type": "manhwa", "chapter": "Chapter 197", "time": "2 Jam lalu"},
|
| 31 |
+
{"title": "Magical Realm Shopkeeper", "type": "manhwa", "chapter": "Chapter 95", "time": "2 Jam lalu"},
|
| 32 |
+
{"title": "Riches Can't Buy Loyalty", "type": "manhua", "chapter": "Chapter 80", "time": "3 Jam lalu"},
|
| 33 |
+
{"title": "Global Beast Tamer", "type": "manhua", "chapter": "Chapter 61", "time": "3 Jam lalu"},
|
| 34 |
+
{"title": "Martial Evolution", "type": "manhwa", "chapter": "Chapter 106", "time": "3 Jam lalu"},
|
| 35 |
+
{"title": "Tanaka Ke, Tensei Suru", "type": "manga", "chapter": "Chapter 54", "time": "3 Jam lalu"},
|
| 36 |
+
{"title": "The Merciless Fairy Shall Become a Cultivation Vessel", "type": "manhua", "chapter": "Chapter 6", "time": "3 Jam lalu"},
|
| 37 |
+
{"title": "DANDADAN (2021)", "type": "manga", "chapter": "Chapter 231", "time": "3 Jam lalu"},
|
| 38 |
+
{"title": "Rebirth of the Emperor in the Reverse World", "type": "manhua", "chapter": "Chapter 42", "time": "4 Jam lalu"},
|
| 39 |
+
{"title": "Tang Clan Legend", "type": "manhwa", "chapter": "Chapter 43", "time": "5 Jam lalu"},
|
| 40 |
+
{"title": "Reincarnated Escort Warrior", "type": "manhwa", "chapter": "Chapter 147", "time": "10 Jam lalu"},
|
| 41 |
+
{"title": "The Emperor's Sword", "type": "manhwa", "chapter": "Chapter 112", "time": "10 Jam lalu"},
|
| 42 |
+
{"title": "World-Saving Is A Skill", "type": "manhwa", "chapter": "Chapter 21", "time": "10 Jam lalu"},
|
| 43 |
+
{"title": "High-Martial World", "type": "manhua", "chapter": "Chapter 21", "time": "11 Jam lalu"},
|
| 44 |
+
],
|
| 45 |
+
"genres": ["action","adventure","comedy","drama","fantasy","horror","isekai","martial_arts","mystery","romance","school_life","scifi","slice_of_life","supernatural","thriller","webtoons"]
|
| 46 |
+
}
|
| 47 |
+
|
| 48 |
+
CSS = """
|
| 49 |
+
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');
|
| 50 |
+
:root{--bg:#0b0e14;--bg-card:#151a25;--bg-card-hover:#1c2333;--border:#252d3d;--primary:#8b5cf6;--text:#e4e8f1;--text-muted:#959fb5;--text-dim:#5a6478}
|
| 51 |
+
*{margin:0;padding:0;box-sizing:border-box}
|
| 52 |
+
body{font-family:'Inter',sans-serif;background:var(--bg);color:var(--text);line-height:1.5}
|
| 53 |
+
.container{max-width:1200px;margin:0 auto;padding:0 16px}
|
| 54 |
+
.header{position:sticky;top:0;z-index:100;background:rgba(11,14,20,.95);backdrop-filter:blur(12px);border-bottom:1px solid var(--border)}
|
| 55 |
+
.hi{display:flex;align-items:center;gap:20px;height:60px}
|
| 56 |
+
.logo{font-weight:800;font-size:1.5rem;color:#fff;text-decoration:none}.logo span{color:var(--primary)}
|
| 57 |
+
.sb{flex:1;display:flex;max-width:400px}.sb input{flex:1;padding:8px 12px;border:1px solid var(--border);border-radius:8px 0 0 8px;background:var(--bg-card);color:var(--text);font-size:.9rem;outline:none}.sb button{padding:8px 12px;background:var(--primary);border:none;border-radius:0 8px 8px 0;color:#fff;cursor:pointer}
|
| 58 |
+
nav{display:flex;gap:4px;margin-left:auto}nav a{color:var(--text-muted);text-decoration:none;font-size:.85rem;padding:6px 12px;border-radius:8px}nav a:hover{color:#fff;background:rgba(139,92,246,.15)}
|
| 59 |
+
.hero{background:linear-gradient(135deg,#7c3aed,#2563eb);padding:48px 0 36px;text-align:center}.hero h1{font-size:1.8rem;font-weight:800;margin-bottom:6px}.hero p{color:rgba(255,255,255,.8)}
|
| 60 |
+
.section{padding:40px 0}.sa{background:var(--bg-card);border-top:1px solid var(--border);border-bottom:1px solid var(--border)}
|
| 61 |
+
.st{font-size:1.2rem;font-weight:700;margin-bottom:16px}.st i{color:var(--primary);margin-right:6px}
|
| 62 |
+
.cg{display:grid;grid-template-columns:repeat(auto-fill,minmax(140px,1fr));gap:14px}
|
| 63 |
+
.c{background:var(--bg-card);border-radius:12px;overflow:hidden;transition:transform .2s;cursor:pointer;display:block}.c:hover{transform:translateY(-4px)}
|
| 64 |
+
.ci{width:100%;aspect-ratio:3/4;background:linear-gradient(135deg,#1e293b,#334155);display:flex;align-items:center;justify-content:center;font-size:2rem;color:var(--text-dim);position:relative}
|
| 65 |
+
.badge{position:absolute;top:6px;left:6px;padding:2px 8px;border-radius:20px;font-size:.65rem;font-weight:600;text-transform:uppercase;color:#fff}.bmanga{background:#3b82f6}.bmanhua{background:#ef4444}.bmanhwa{background:#10b981}
|
| 66 |
+
.cb{padding:8px 10px}.cb h3{font-size:.8rem;font-weight:600;margin-bottom:2px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.cb p{font-size:.7rem;color:var(--text-muted)}
|
| 67 |
+
.ul{display:flex;flex-direction:column;gap:2px}
|
| 68 |
+
.ui{display:flex;align-items:center;gap:12px;padding:8px 12px;background:var(--bg-card);border-radius:8px;text-decoration:none;color:inherit;transition:background .15s}.ui:hover{background:var(--bg-card-hover)}
|
| 69 |
+
.ui .t{min-width:65px;text-align:center;padding:2px 8px;border-radius:4px;font-size:.65rem;font-weight:700;text-transform:uppercase;color:#fff}.ui .ti{flex:1;font-weight:600;font-size:.85rem}.ui .ch{color:var(--text-muted);font-size:.8rem;white-space:nowrap}.ui .tm{color:var(--text-dim);font-size:.7rem;white-space:nowrap}
|
| 70 |
+
.gn{display:flex;flex-wrap:wrap;gap:6px}
|
| 71 |
+
.gt{padding:4px 14px;background:var(--bg-card);border:1px solid var(--border);border-radius:999px;font-size:.75rem;color:var(--text-muted);text-transform:capitalize;cursor:pointer}.gt:hover{border-color:var(--primary);color:#fff}
|
| 72 |
+
.footer{text-align:center;padding:24px 0;color:var(--text-dim);font-size:.75rem;border-top:1px solid var(--border)}
|
| 73 |
+
@media(max-width:768px){.sb{max-width:100%}.cg{grid-template-columns:repeat(auto-fill,minmax(120px,1fr))}.hero h1{font-size:1.3rem}.hero{padding:32px 0 24px}nav{display:none}}
|
| 74 |
+
"""
|
| 75 |
+
|
| 76 |
+
HTML = """
|
| 77 |
+
<header class="header"><div class="container hi">
|
| 78 |
+
<a href="#" class="logo">Komik<span>Hub</span></a>
|
| 79 |
+
<div class="sb"><input type="text" placeholder="Cari komik..." id="si"><button>🔍</button></div>
|
| 80 |
+
<nav><a href="#">Home</a><a href="#">Komik</a><a href="#">Library</a><a href="#">Akun</a></nav>
|
| 81 |
+
</div></header>
|
| 82 |
+
<section class="hero"><div class="container">
|
| 83 |
+
<h1>Baca Komik, Manga, Manhua & Manhwa Gratis</h1>
|
| 84 |
+
<p>Ribuan judul terupdate setiap hari.</p>
|
| 85 |
+
</div></section>
|
| 86 |
+
<section class="section"><div class="container">
|
| 87 |
+
<h2 class="st">⏰ Komik Baru</h2>
|
| 88 |
+
<div class="cg" id="nc"></div>
|
| 89 |
+
</div></section>
|
| 90 |
+
<section class="section sa"><div class="container">
|
| 91 |
+
<h2 class="st">⚡ Update Terbaru</h2>
|
| 92 |
+
<div class="ul" id="ul"></div>
|
| 93 |
+
</div></section>
|
| 94 |
+
<section class="section"><div class="container">
|
| 95 |
+
<h2 class="st">🏷️ Genre</h2>
|
| 96 |
+
<div class="gn" id="gn"></div>
|
| 97 |
+
</div></section>
|
| 98 |
+
<footer class="footer"><div class="container">
|
| 99 |
+
<p>Semua komik adalah preview. Belilah komik asli jika tersedia.</p>
|
| 100 |
+
<p>© 2026 KomikHub</p>
|
| 101 |
+
</div></footer>
|
| 102 |
+
"""
|
| 103 |
+
|
| 104 |
+
JS = """
|
| 105 |
+
document.addEventListener('DOMContentLoaded', () => {
|
| 106 |
+
const DATA = __DATA__;
|
| 107 |
+
const nc = document.getElementById('nc');
|
| 108 |
+
if(nc) DATA.newComics.forEach(c => {
|
| 109 |
+
const b = c.type === 'manga' ? 'bmanga' : c.type === 'manhua' ? 'bmanhua' : 'bmanhwa';
|
| 110 |
+
nc.innerHTML += '<a class="c"><div class="ci"><span class="badge '+b+'">'+c.type+'</span>'+c.title.charAt(0)+'</div><div class="cb"><h3>'+c.title+'</h3><p>'+c.chapter+'</p></div></a>';
|
| 111 |
+
});
|
| 112 |
+
const ul = document.getElementById('ul');
|
| 113 |
+
if(ul) DATA.updates.forEach(u => {
|
| 114 |
+
const b = u.type === 'manga' ? 'bmanga' : u.type === 'manhua' ? 'bmanhua' : 'bmanhwa';
|
| 115 |
+
ul.innerHTML += '<a class="ui"><span class="t '+b+'">'+u.type+'</span><span class="ti">'+u.title+'</span><span class="ch">'+u.chapter+'</span><span class="tm">'+u.time+'</span></a>';
|
| 116 |
+
});
|
| 117 |
+
const gn = document.getElementById('gn');
|
| 118 |
+
if(gn) DATA.genres.forEach(g => { gn.innerHTML += '<span class="gt">'+g.replace(/_/g,' ')+'</span>'; });
|
| 119 |
+
const si = document.getElementById('si');
|
| 120 |
+
if(si) si.addEventListener('input', e => {
|
| 121 |
+
const q = e.target.value.toLowerCase();
|
| 122 |
+
document.querySelectorAll('#nc .c').forEach(x => {
|
| 123 |
+
const t = x.querySelector('h3')?.textContent.toLowerCase()||'';
|
| 124 |
+
x.style.display = t.includes(q) ? '' : 'none';
|
| 125 |
+
});
|
| 126 |
+
});
|
| 127 |
+
});
|
| 128 |
+
"""
|
| 129 |
+
|
| 130 |
+
data_json = json.dumps(DATA)
|
| 131 |
+
js_with_data = JS.replace('"__DATA__"', data_json)
|
| 132 |
+
|
| 133 |
+
HEAD = """<head>
|
| 134 |
+
<meta charset="UTF-8">
|
| 135 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 136 |
+
<title>KomikHub</title>
|
| 137 |
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.0/css/all.min.css">
|
| 138 |
+
</head>"""
|
| 139 |
+
|
| 140 |
+
FULL = f"<html>{HEAD}<body><style>{CSS}</style>{HTML}<script>{js_with_data}</script></body></html>"
|
| 141 |
+
|
| 142 |
+
with gr.Blocks(title="KomikHub") as app:
|
| 143 |
+
gr.HTML(FULL)
|
| 144 |
+
|
| 145 |
+
app.launch(share=False)
|