5 Commits

Author SHA1 Message Date
7ac00db134 fixed an issue with chapter navigation on reader 2026-01-10 21:24:07 +01:00
11927baf04 better schedule page 2026-01-10 21:15:22 +01:00
91d19049ef better titlebar ui 2026-01-10 20:19:08 +01:00
e6c3320a7c better titlebar and fixes 2026-01-09 20:35:45 +01:00
1e85de8db6 reduced .exe size 2026-01-09 18:54:39 +01:00
30 changed files with 2234 additions and 10383 deletions

View File

@@ -13,7 +13,7 @@ let win;
let backend; let backend;
const net = require('net'); const net = require('net');
function waitForServer(port, host = '127.0.0.1', timeout = 10000) { function waitForServer(port, host = '127.0.0.1', timeout = 30000) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const start = Date.now(); const start = Date.now();

8702
desktop/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -27,7 +27,7 @@
"jsonwebtoken": "^9.0.3", "jsonwebtoken": "^9.0.3",
"node-addon-api": "^8.5.0", "node-addon-api": "^8.5.0",
"node-cron": "^4.2.1", "node-cron": "^4.2.1",
"playwright-chromium": "^1.57.0", "playwright": "^1.57.0",
"sqlite3": "^5.1.7", "sqlite3": "^5.1.7",
"ws": "^8.18.3" "ws": "^8.18.3"
}, },
@@ -46,6 +46,7 @@
"build": { "build": {
"appId": "app.waifuboard", "appId": "app.waifuboard",
"productName": "Waifu Board", "productName": "Waifu Board",
"asar": true,
"files": [ "files": [
"electron/**/*", "electron/**/*",
"server.js", "server.js",
@@ -58,10 +59,6 @@
"loading.html" "loading.html"
], ],
"extraResources": [ "extraResources": [
{
"from": "C:\\Users\\synta\\AppData\\Local\\ms-playwright\\chromium_headless_shell-1200",
"to": "playwright/chromium"
},
".env" ".env"
], ],
"win": { "win": {

View File

@@ -1,6 +1,5 @@
;(() => { ;(() => {
const token = localStorage.getItem("token") const token = localStorage.getItem("token")
if (!token && window.location.pathname !== "/") { if (!token && window.location.pathname !== "/") {
window.location.href = "/" window.location.href = "/"
} }
@@ -8,45 +7,61 @@
async function loadMeUI() { async function loadMeUI() {
const token = localStorage.getItem("token") const token = localStorage.getItem("token")
if (!token) return if (!token) return
try { try {
const res = await fetch("/api/me", { const res = await fetch("/api/me", {
headers: { headers: { Authorization: `Bearer ${token}` },
Authorization: `Bearer ${token}`,
},
}) })
if (!res.ok) return if (!res.ok) return
const user = await res.json() const user = await res.json()
const avatarUrl = user.avatar || "/public/assets/avatar.png"
const navUser = document.getElementById("nav-user") const navUser = document.getElementById("nav-user")
const navUsername = document.getElementById("nav-username") const navUsername = document.getElementById("nav-username")
const navAvatar = document.getElementById("nav-avatar") const navAvatar = document.getElementById("nav-avatar")
const dropdownAvatar = document.getElementById("dropdown-avatar") const dropdownAvatar = document.getElementById("dropdown-avatar")
if (!navUser || !navUsername || !navAvatar) return if (navUser && navUsername && navAvatar) {
navUser.style.display = "flex" navUser.style.display = "flex"
navUsername.textContent = user.username navUsername.textContent = user.username
const avatarUrl = user.avatar || "/public/assets/avatar.png"
navAvatar.src = avatarUrl navAvatar.src = avatarUrl
if (dropdownAvatar) { if (dropdownAvatar) dropdownAvatar.src = avatarUrl
dropdownAvatar.src = avatarUrl }
const titlebarAvatar = document.getElementById("titlebar-avatar")
const titlebarActions = document.getElementById("titlebar-actions")
if (titlebarAvatar) {
titlebarAvatar.src = avatarUrl
}
if (titlebarActions) {
titlebarActions.style.display = "flex"
} }
setupDropdown() setupDropdown()
} catch (e) { } catch (e) {
console.error("Failed to load user UI:", e) console.error("Failed to load user UI:", e)
} }
} }
// Variable para saber si el modal ya fue cargado
let settingsModalLoaded = false; let settingsModalLoaded = false;
document.getElementById('nav-settings').addEventListener('click', openSettings) const navSettingsBtn = document.getElementById('nav-settings');
const titlebarSettingsBtn = document.getElementById('titlebar-settings');
if (navSettingsBtn) navSettingsBtn.addEventListener('click', openSettings);
if (titlebarSettingsBtn) titlebarSettingsBtn.addEventListener('click', (e) => {
e.stopPropagation();
openSettings();
document.getElementById("titlebar-dropdown")?.classList.remove("active");
});
async function openSettings() { async function openSettings() {
if (!settingsModalLoaded) { if (!settingsModalLoaded) {
@@ -55,63 +70,69 @@ async function openSettings() {
const html = await res.text() const html = await res.text()
document.body.insertAdjacentHTML('beforeend', html) document.body.insertAdjacentHTML('beforeend', html)
settingsModalLoaded = true; settingsModalLoaded = true;
// Esperar un momento para que el DOM se actualice
await new Promise(resolve => setTimeout(resolve, 50)); await new Promise(resolve => setTimeout(resolve, 50));
if (window.toggleSettingsModal) await window.toggleSettingsModal(false);
// Ahora cargar los settings
if (window.toggleSettingsModal) {
await window.toggleSettingsModal(false);
}
} catch (err) { } catch (err) {
console.error('Error loading settings modal:', err); console.error('Error loading settings modal:', err);
} }
} else { } else {
if (window.toggleSettingsModal) { if (window.toggleSettingsModal) await window.toggleSettingsModal(false);
await window.toggleSettingsModal(false);
}
}
}
function closeSettings() {
const modal = document.getElementById('settings-modal');
if (modal) {
modal.classList.add('hidden');
} }
} }
function setupDropdown() { function setupDropdown() {
const userAvatarBtn = document.querySelector(".user-avatar-btn") const userAvatarBtn = document.querySelector(".user-avatar-btn")
const navDropdown = document.getElementById("nav-dropdown") const navDropdown = document.getElementById("nav-dropdown")
const navLogout = document.getElementById("nav-logout") const navLogout = document.getElementById("nav-logout")
if (!userAvatarBtn || !navDropdown || !navLogout) return if (userAvatarBtn && navDropdown) {
userAvatarBtn.addEventListener("click", (e) => { userAvatarBtn.addEventListener("click", (e) => {
e.stopPropagation() e.stopPropagation()
navDropdown.classList.toggle("active") navDropdown.classList.toggle("active")
})
document.addEventListener("click", (e) => { document.getElementById("titlebar-dropdown")?.classList.remove("active")
if (!navDropdown.contains(e.target)) {
navDropdown.classList.remove("active")
}
}) })
if (navLogout) {
navDropdown.addEventListener("click", (e) => {
e.stopPropagation()
})
navLogout.addEventListener("click", () => { navLogout.addEventListener("click", () => {
localStorage.removeItem("token") localStorage.removeItem("token")
window.location.href = "/" window.location.href = "/"
}) })
}
}
const dropdownLinks = navDropdown.querySelectorAll("a.dropdown-item") const titlebarUserBox = document.getElementById("titlebar-user-box")
dropdownLinks.forEach((link) => { const titlebarDropdown = document.getElementById("titlebar-dropdown")
link.addEventListener("click", () => { const titlebarLogout = document.getElementById("titlebar-logout")
navDropdown.classList.remove("active")
if (titlebarUserBox && titlebarDropdown) {
titlebarUserBox.addEventListener("click", (e) => {
e.stopPropagation()
titlebarDropdown.classList.toggle("active")
document.getElementById("nav-dropdown")?.classList.remove("active")
}) })
if (titlebarLogout) {
titlebarLogout.addEventListener("click", (e) => {
e.stopPropagation()
localStorage.removeItem("token")
window.location.href = "/"
})
}
titlebarDropdown.addEventListener("click", (e) => {
e.stopPropagation()
})
}
document.addEventListener("click", (e) => {
if (navDropdown && !navDropdown.contains(e.target)) {
navDropdown.classList.remove("active")
}
if (titlebarDropdown && !titlebarDropdown.contains(e.target)) {
titlebarDropdown.classList.remove("active")
}
}) })
} }
@@ -159,7 +180,6 @@ searchWrapper.addEventListener('click', (e) => {
} }
}); });
// Cerrar el buscador si se hace clic fuera
document.addEventListener('click', (e) => { document.addEventListener('click', (e) => {
if (!searchWrapper.contains(e.target)) { if (!searchWrapper.contains(e.target)) {
searchWrapper.classList.remove('active-mobile'); searchWrapper.classList.remove('active-mobile');

View File

@@ -1,7 +1,7 @@
const urlParams = new URLSearchParams(window.location.search); const urlParams = new URLSearchParams(window.location.search);
const reader = document.getElementById('reader'); const reader = document.getElementById('reader');
const panel = document.getElementById('settings-panel'); const panel = document.getElementById('settings-panel');
const overlay = document.getElementById('overlay'); const overlay2 = document.getElementById('overlay');
const settingsBtn = document.getElementById('settings-btn'); const settingsBtn = document.getElementById('settings-btn');
const closePanel = document.getElementById('close-panel'); const closePanel = document.getElementById('close-panel');
const chapterLabel = document.getElementById('chapter-label'); const chapterLabel = document.getElementById('chapter-label');
@@ -47,7 +47,7 @@ let observer = null;
// === CAMBIO: Parseo de URL para obtener ID === // === CAMBIO: Parseo de URL para obtener ID ===
const parts = window.location.pathname.split('/'); const parts = window.location.pathname.split('/');
const bookId = parts[4]; const bookId = parts[4];
let currentChapterId = parts[3]; // Ahora es un ID (string) let currentChapterId = decodeURIComponent(parts[3]);
let provider = parts[2]; let provider = parts[2];
let chaptersList = []; // Buffer para guardar el orden de capítulos let chaptersList = []; // Buffer para guardar el orden de capítulos
@@ -181,8 +181,8 @@ async function loadChapter() {
); );
if (chapterMeta) { if (chapterMeta) {
chapterLabel.textContent = `Chapter ${chapterMeta.number} - ${chapterMeta.title}`; chapterLabel.textContent = `Chapter ${chapterMeta.number}`;
document.title = `Chapter ${chapterMeta.number} - ${chapterMeta.title}`; document.title = `Chapter ${chapterMeta.number}`;
} }
// Lógica específica para contenido LOCAL // Lógica específica para contenido LOCAL
@@ -665,14 +665,14 @@ document.getElementById('back-btn').addEventListener('click', () => {
// Panel de configuración // Panel de configuración
settingsBtn.addEventListener('click', () => { settingsBtn.addEventListener('click', () => {
panel.classList.add('open'); panel.classList.add('open');
overlay.classList.add('active'); overlay2.classList.add('active');
}); });
closePanel.addEventListener('click', closeSettings); closePanel.addEventListener('click', closeSettings);
overlay.addEventListener('click', closeSettings); overlay2.addEventListener('click', closeSettings);
function closeSettings() { function closeSettings() {
panel.classList.remove('open'); panel.classList.remove('open');
overlay.classList.remove('active'); overlay2.classList.remove('active');
} }
document.addEventListener('keydown', (e) => { document.addEventListener('keydown', (e) => {
if (e.key === 'Escape' && panel.classList.contains('open')) { if (e.key === 'Escape' && panel.classList.contains('open')) {

View File

@@ -1,5 +1,5 @@
const providerSelector = document.getElementById('provider-selector'); const providerSelector = document.getElementById('provider-selector');
const searchInput = document.getElementById('search-input'); const searchInput2 = document.getElementById('search-input');
const resultsContainer = document.getElementById('gallery-results'); const resultsContainer = document.getElementById('gallery-results');
let currentPage = 1; let currentPage = 1;
@@ -231,7 +231,7 @@ function showSkeletons(count, append = false) {
async function searchGallery(isLoadMore = false) { async function searchGallery(isLoadMore = false) {
if (isLoading) return; if (isLoading) return;
const query = searchInput.value.trim(); const query = searchInput2.value.trim();
const provider = providerSelector.value; const provider = providerSelector.value;
const page = isLoadMore ? currentPage + 1 : 1; const page = isLoadMore ? currentPage + 1 : 1;
@@ -351,22 +351,22 @@ async function loadExtensions() {
providerSelector.addEventListener('change', () => { providerSelector.addEventListener('change', () => {
if (providerSelector.value === 'favorites') { if (providerSelector.value === 'favorites') {
searchInput.placeholder = "Search in favorites..."; searchInput2.placeholder = "Search in favorites...";
} else { } else {
searchInput.placeholder = "Search in gallery..."; searchInput2.placeholder = "Search in gallery...";
} }
searchGallery(false); searchGallery(false);
}); });
let searchTimeout; let searchTimeout;
searchInput.addEventListener('input', () => { searchInput2.addEventListener('input', () => {
clearTimeout(searchTimeout); clearTimeout(searchTimeout);
searchTimeout = setTimeout(() => { searchTimeout = setTimeout(() => {
searchGallery(false); searchGallery(false);
}, 500); }, 500);
}); });
searchInput.addEventListener('keydown', e => { searchInput2.addEventListener('keydown', e => {
if (e.key === 'Enter') { if (e.key === 'Enter') {
clearTimeout(searchTimeout); clearTimeout(searchTimeout);
searchGallery(false); searchGallery(false);

View File

@@ -1,76 +1,373 @@
const ANILIST_API = 'https://graphql.anilist.co'; const ANILIST_API = 'https://graphql.anilist.co';
const CACHE_NAME = 'waifuboard-schedule-v1'; const CACHE_NAME = 'waifuboard-schedule-v5';
const CACHE_DURATION = 5 * 60 * 1000;
const CACHE_DURATION = 6 * 60 * 60 * 1000;
const state = { const state = {
currentDate: new Date(), currentDate: new Date(),
viewType: 'MONTH', viewType: 'MONTH',
mode: 'SUB', mode: 'SUB',
filter: 'ALL',
loading: false, loading: false,
abortController: null, abortController: null,
refreshInterval: null userListIds: new Set(),
scheduleData: [],
selectedWeekDayIndex: 0
}; };
document.addEventListener('DOMContentLoaded', () => { document.addEventListener('DOMContentLoaded', async () => {
await fetchUserList();
renderHeader(); renderHeader();
fetchSchedule(); fetchSchedule();
state.refreshInterval = setInterval(() => { if (state.userListIds.size > 0) {
console.log("Auto-refreshing schedule..."); const filterGroup = document.getElementById('filter-group');
fetchSchedule(true); if (filterGroup) filterGroup.style.display = 'flex';
}, CACHE_DURATION); }
}); });
async function getCache(key) { async function fetchUserList() {
const token = localStorage.getItem('token');
if (!token) return;
try { try {
const cache = await caches.open(CACHE_NAME); const res = await fetch('http://localhost:54322/api/list', {
headers: {
const response = await cache.match(`/schedule-cache/${key}`); 'Authorization': `Bearer ${token}`,
'Accept': 'application/json'
if (!response) return null;
const cached = await response.json();
const age = Date.now() - cached.timestamp;
if (age < CACHE_DURATION) {
console.log(`[Cache Hit] Loaded ${key} (Age: ${Math.round(age / 1000)}s)`);
return cached.data;
} }
});
console.log(`[Cache Stale] ${key} expired.`); if (res.ok) {
const json = await res.json();
if (json.results && Array.isArray(json.results)) {
state.userListIds.clear();
json.results.forEach(item => {
cache.delete(`/schedule-cache/${key}`); if (item.source === 'anilist') {
return null; state.userListIds.add(item.entry_id);
}
});
console.log(`[UserList] Loaded ${state.userListIds.size} entries.`);
}
}
} catch (e) { } catch (e) {
console.error("Cache read failed", e); console.warn("[UserList] Could not fetch user list:", e);
return null;
} }
} }
async function setCache(key, data) { async function fetchSchedule(forceRefresh = false) {
try { const key = getCacheKey();
const cache = await caches.open(CACHE_NAME);
const payload = JSON.stringify({ if (!forceRefresh) {
timestamp: Date.now(), const cachedData = await getCache(key);
data: data if (cachedData) {
}); console.log(`[Schedule] Using cached data for key: ${key}`);
state.scheduleData = cachedData;
renderContent();
updateAmbient(cachedData);
return;
const response = new Response(payload, {
headers: { 'Content-Type': 'application/json' }
});
await cache.put(`/schedule-cache/${key}`, response);
} catch (e) {
console.warn("Cache write failed", e);
} }
} }
if (state.abortController) state.abortController.abort();
state.abortController = new AbortController();
const signal = state.abortController.signal;
setLoading(true);
let startObj, endObj;
function getCacheKey() {
if (state.viewType === 'MONTH') { if (state.viewType === 'MONTH') {
return `M_${state.currentDate.getFullYear()}_${state.currentDate.getMonth()}`; const year = state.currentDate.getFullYear();
const month = state.currentDate.getMonth();
startObj = new Date(year, month, 1, 0, 0, 0, 0);
endObj = new Date(year, month + 1, 0, 23, 59, 59, 999);
} else { } else {
const start = getWeekStart(state.currentDate); const start = getWeekStart(state.currentDate);
return `W_${start.toISOString().split('T')[0]}`;
startObj = new Date(start);
endObj = new Date(startObj);
endObj.setDate(endObj.getDate() + 7);
endObj.setHours(23, 59, 59, 999);
} }
const startTs = Math.floor(startObj.getTime() / 1000);
const endTs = Math.floor(endObj.getTime() / 1000);
const query = `
query ($start: Int, $end: Int, $page: Int) {
Page(page: $page, perPage: 50) {
pageInfo { hasNextPage }
airingSchedules(airingAt_greater: $start, airingAt_lesser: $end, sort: TIME) {
airingAt
episode
media {
id
title { userPreferred english }
coverImage { large extraLarge }
bannerImage
isAdult
countryOfOrigin
format
duration
popularity
}
}
}
}
`;
let allData = [];
let page = 1;
let hasNext = true;
try {
while (hasNext && page <= 10) {
if (signal.aborted) throw new DOMException("Aborted", "AbortError");
const res = await fetch(ANILIST_API, {
method: 'POST',
headers: { 'Content-Type': 'application/json', 'Accept': 'application/json' },
body: JSON.stringify({ query, variables: { start: startTs, end: endTs, page } }),
signal: signal
});
if (res.status === 429) {
await delay(2000);
continue;
}
const json = await res.json();
if (json.errors) throw new Error("API Error");
const data = json.data.Page;
allData = [...allData, ...data.airingSchedules];
hasNext = data.pageInfo.hasNextPage;
page++;
await delay(200);
}
if (!signal.aborted) {
state.scheduleData = allData;
await setCache(key, allData);
renderContent();
updateAmbient(allData);
}
} catch (e) {
if (e.name !== 'AbortError') console.error("Fetch failed:", e);
} finally {
if (!signal.aborted) {
setLoading(false);
state.abortController = null;
}
}
}
function renderContent() {
let items = state.scheduleData.filter(i =>
!i.media.isAdult &&
i.media.countryOfOrigin === 'JP'
);
if (state.mode === 'DUB') {
items = items.filter(i => i.media.popularity > 20000);
}
if (state.filter === 'MY_LIST') {
items = items.filter(i => state.userListIds.has(i.media.id));
}
const container = document.getElementById('schedule-content');
if (!container) return;
container.innerHTML = '';
if (state.viewType === 'MONTH') {
renderMonthView(container, items);
} else {
renderWeekView(container, items);
}
}
function renderMonthView(container, items) {
const grid = document.createElement('div');
grid.className = 'calendar-grid';
const days = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'];
days.forEach(d => {
const h = document.createElement('div');
h.className = 'weekday-header';
h.textContent = d;
grid.appendChild(h);
});
const year = state.currentDate.getFullYear();
const month = state.currentDate.getMonth();
const daysInMonth = new Date(year, month + 1, 0).getDate();
let firstDayIndex = new Date(year, month, 1).getDay() - 1;
if (firstDayIndex === -1) firstDayIndex = 6;
for (let i = 0; i < firstDayIndex; i++) {
const empty = document.createElement('div');
empty.className = 'day-cell empty';
grid.appendChild(empty);
}
for (let day = 1; day <= daysInMonth; day++) {
const cell = document.createElement('div');
cell.className = 'day-cell';
const currentCellDate = new Date(year, month, day);
const now = new Date();
if (isSameDay(currentCellDate, now)) {
cell.classList.add('today');
}
cell.innerHTML = `<span class="day-number">${day}</span>`;
const dayEvents = items.filter(i => {
const releaseDate = new Date(i.airingAt * 1000);
return isSameDay(currentCellDate, releaseDate);
});
dayEvents.sort((a, b) => b.media.popularity - a.media.popularity);
dayEvents.forEach(evt => {
const title = evt.media.title.english || evt.media.title.userPreferred;
const ep = evt.episode;
const time = new Date(evt.airingAt * 1000).toLocaleTimeString([], {hour: '2-digit', minute:'2-digit'});
const isMine = state.userListIds.has(evt.media.id);
const el = document.createElement('a');
el.className = `anime-item-month ${isMine ? 'is-mine' : ''}`;
el.href = `/anime/${evt.media.id}`;
el.innerHTML = `
<span class="item-time">${time}</span>
<span class="item-title">
${title} <span class="ep-badge">EP ${ep}</span>
</span>
`;
cell.appendChild(el);
});
grid.appendChild(cell);
}
container.appendChild(grid);
}
function renderWeekView(container, items) {
const wrapper = document.createElement('div');
wrapper.className = 'week-container';
const nav = document.createElement('div');
nav.className = 'week-nav';
const startOfWeek = getWeekStart(state.currentDate);
const dayNames = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'];
for (let i = 0; i < 7; i++) {
const d = new Date(startOfWeek);
d.setDate(startOfWeek.getDate() + i);
const btn = document.createElement('button');
btn.className = `day-btn ${i === state.selectedWeekDayIndex ? 'active' : ''}`;
btn.onclick = () => {
state.selectedWeekDayIndex = i;
renderWeekCards(d, items);
document.querySelectorAll('.day-btn').forEach(b => b.classList.remove('active'));
btn.classList.add('active');
};
btn.innerHTML = `
<span class="name">${dayNames[i]}</span>
<span class="date">${d.getDate()}</span>
`;
nav.appendChild(btn);
}
wrapper.appendChild(nav);
const grid = document.createElement('div');
grid.className = 'week-grid';
grid.id = 'weekGrid';
wrapper.appendChild(grid);
container.appendChild(wrapper);
const selectedDate = new Date(startOfWeek);
selectedDate.setDate(selectedDate.getDate() + state.selectedWeekDayIndex);
renderWeekCards(selectedDate, items);
}
function renderWeekCards(targetDate, allItems) {
const grid = document.getElementById('weekGrid');
if (!grid) return;
grid.innerHTML = '';
const dayItems = allItems.filter(i => {
const releaseDate = new Date(i.airingAt * 1000);
return isSameDay(targetDate, releaseDate);
});
dayItems.sort((a, b) => b.media.popularity - a.media.popularity);
if (dayItems.length === 0) {
grid.innerHTML = `
<div style="grid-column: 1/-1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 4rem; opacity: 0.5;">
<p style="margin-top: 1rem; font-size: 1.2rem; font-weight: 500;">No releases found for this day</p>
</div>`;
return;
}
dayItems.forEach(evt => {
const m = evt.media;
const title = m.title.english || m.title.userPreferred;
const time = new Date(evt.airingAt * 1000).toLocaleTimeString([], {hour: '2-digit', minute:'2-digit'});
const card = document.createElement('div');
card.className = `card`;
card.onclick = () => window.location.href = `/anime/${m.id}`;
card.innerHTML = `
<div class="card-img-wrap">
<img src="${m.coverImage.large}" alt="${title}" loading="lazy">
<div class="card-ep-badge">EP ${evt.episode}${time}</div>
</div>
<div class="card-content">
<h3>${title}</h3>
<p>${m.format || 'TV'}</p>
</div>
`;
grid.appendChild(card);
});
}
function isSameDay(d1, d2) {
return d1.getFullYear() === d2.getFullYear() &&
d1.getMonth() === d2.getMonth() &&
d1.getDate() === d2.getDate();
}
function getWeekStart(d) {
const date = new Date(d);
date.setHours(0, 0, 0, 0);
const day = date.getDay();
const diff = date.getDate() - day + (day === 0 ? -6 : 1);
date.setDate(diff);
return date;
} }
function navigate(delta) { function navigate(delta) {
@@ -93,10 +390,19 @@ function setViewType(type) {
document.getElementById('btnViewMonth').classList.toggle('active', type === 'MONTH'); document.getElementById('btnViewMonth').classList.toggle('active', type === 'MONTH');
document.getElementById('btnViewWeek').classList.toggle('active', type === 'WEEK'); document.getElementById('btnViewWeek').classList.toggle('active', type === 'WEEK');
if (state.abortController) state.abortController.abort(); state.selectedWeekDayIndex = new Date().getDay() - 1;
if (state.selectedWeekDayIndex === -1) state.selectedWeekDayIndex = 6;
renderHeader(); renderHeader();
if (state.scheduleData.length) {
renderContent();
} else {
fetchSchedule(); fetchSchedule();
}
} }
function setMode(mode) { function setMode(mode) {
@@ -104,8 +410,18 @@ function setMode(mode) {
state.mode = mode; state.mode = mode;
document.getElementById('btnSub').classList.toggle('active', mode === 'SUB'); document.getElementById('btnSub').classList.toggle('active', mode === 'SUB');
document.getElementById('btnDub').classList.toggle('active', mode === 'DUB'); document.getElementById('btnDub').classList.toggle('active', mode === 'DUB');
renderContent();
fetchSchedule(); }
function setFilter(filterType) {
if (state.filter === filterType) return;
state.filter = filterType;
document.getElementById('btnAll').classList.toggle('active', filterType === 'ALL');
document.getElementById('btnMyList').classList.toggle('active', filterType === 'MY_LIST');
renderContent();
} }
function renderHeader() { function renderHeader() {
@@ -119,242 +435,86 @@ function renderHeader() {
const startStr = start.toLocaleDateString('en-US', { month: 'short', day: 'numeric' }); const startStr = start.toLocaleDateString('en-US', { month: 'short', day: 'numeric' });
const endStr = end.toLocaleDateString('en-US', { month: 'short', day: 'numeric' }); const endStr = end.toLocaleDateString('en-US', { month: 'short', day: 'numeric' });
title = `Week of ${startStr} - ${endStr}`; title = `${startStr} - ${endStr}`;
} }
document.getElementById('monthTitle').textContent = title; const titleEl = document.getElementById('monthTitle');
} if (titleEl) titleEl.textContent = title;
function getWeekStart(date) {
const d = new Date(date);
const day = d.getDay();
const diff = d.getDate() - day + (day === 0 ? -6 : 1);
return new Date(d.setDate(diff));
}
async function fetchSchedule(forceRefresh = false) {
const key = getCacheKey();
if (!forceRefresh) {
const cachedData = await getCache(key);
if (cachedData) {
renderGrid(cachedData);
updateAmbient(cachedData);
return;
}
}
if (state.abortController) state.abortController.abort();
state.abortController = new AbortController();
const signal = state.abortController.signal;
if (!forceRefresh) setLoading(true);
let startTs, endTs;
if (state.viewType === 'MONTH') {
const year = state.currentDate.getFullYear();
const month = state.currentDate.getMonth();
startTs = Math.floor(new Date(year, month, 1).getTime() / 1000);
endTs = Math.floor(new Date(year, month + 1, 0, 23, 59, 59).getTime() / 1000);
} else {
const start = getWeekStart(state.currentDate);
start.setHours(0, 0, 0, 0);
const end = new Date(start);
end.setDate(end.getDate() + 7);
startTs = Math.floor(start.getTime() / 1000);
endTs = Math.floor(end.getTime() / 1000);
}
const query = `
query ($start: Int, $end: Int, $page: Int) {
Page(page: $page, perPage: 50) {
pageInfo { hasNextPage }
airingSchedules(airingAt_greater: $start, airingAt_lesser: $end, sort: TIME) {
airingAt
episode
media {
id
title { userPreferred english }
coverImage { large }
bannerImage
isAdult
countryOfOrigin
popularity
}
}
}
}
`;
let allData = [];
let page = 1;
let hasNext = true;
let retries = 0;
try {
while (hasNext && page <= 6) {
if (signal.aborted) throw new DOMException("Aborted", "AbortError");
try {
const res = await fetch(ANILIST_API, {
method: 'POST',
headers: { 'Content-Type': 'application/json', 'Accept': 'application/json' },
body: JSON.stringify({
query,
variables: { start: startTs, end: endTs, page }
}),
signal: signal
});
if (res.status === 429) {
if (retries > 2) throw new Error("Rate Limited");
console.warn("429 Hit. Waiting...");
await delay(4000);
retries++;
continue;
}
const json = await res.json();
if (json.errors) throw new Error("API Error");
const data = json.data.Page;
allData = [...allData, ...data.airingSchedules];
hasNext = data.pageInfo.hasNextPage;
page++;
await delay(600);
} catch (e) {
if (e.name === 'AbortError') throw e;
console.error(e);
break;
}
}
if (!signal.aborted) {
await setCache(key, allData);
renderGrid(allData);
updateAmbient(allData);
}
} catch (e) {
if (e.name !== 'AbortError') console.error("Fetch failed:", e);
} finally {
if (!signal.aborted) {
setLoading(false);
state.abortController = null;
}
}
}
function renderGrid(data) {
const grid = document.getElementById('daysGrid');
grid.innerHTML = '';
let items = data.filter(i => !i.media.isAdult && i.media.countryOfOrigin === 'JP');
if (state.mode === 'DUB') {
items = items.filter(i => i.media.popularity > 20000);
}
if (state.viewType === 'MONTH') {
const year = state.currentDate.getFullYear();
const month = state.currentDate.getMonth();
const daysInMonth = new Date(year, month + 1, 0).getDate();
let firstDayIndex = new Date(year, month, 1).getDay() - 1;
if (firstDayIndex === -1) firstDayIndex = 6;
for (let i = 0; i < firstDayIndex; i++) {
const empty = document.createElement('div');
empty.className = 'day-cell empty';
grid.appendChild(empty);
}
for (let day = 1; day <= daysInMonth; day++) {
const dateObj = new Date(year, month, day);
renderDayCell(dateObj, items, grid);
}
} else {
const start = getWeekStart(state.currentDate);
for (let i = 0; i < 7; i++) {
const dateObj = new Date(start);
dateObj.setDate(start.getDate() + i);
renderDayCell(dateObj, items, grid);
}
}
}
function renderDayCell(dateObj, items, grid) {
const cell = document.createElement('div');
cell.className = 'day-cell';
if (state.viewType === 'WEEK') cell.style.minHeight = '300px';
const day = dateObj.getDate();
const month = dateObj.getMonth();
const year = dateObj.getFullYear();
const now = new Date();
if (day === now.getDate() && month === now.getMonth() && year === now.getFullYear()) {
cell.classList.add('today');
}
const dayEvents = items.filter(i => {
const eventDate = new Date(i.airingAt * 1000);
return eventDate.getDate() === day && eventDate.getMonth() === month && eventDate.getFullYear() === year;
});
dayEvents.sort((a, b) => b.media.popularity - a.media.popularity);
if (dayEvents.length > 0) {
const top = dayEvents[0].media;
const bg = document.createElement('div');
bg.className = 'cell-backdrop';
bg.style.backgroundImage = `url('${top.coverImage.large}')`;
cell.appendChild(bg);
}
const header = document.createElement('div');
header.className = 'day-header';
header.innerHTML = `
<span class="day-number">${day}</span>
<span class="today-label">Today</span>
`;
cell.appendChild(header);
const list = document.createElement('div');
list.className = 'events-list';
dayEvents.forEach(evt => {
const title = evt.media.title.english || evt.media.title.userPreferred;
const link = `/anime/${evt.media.id}`;
const chip = document.createElement('a');
chip.className = 'anime-chip';
chip.href = link;
chip.innerHTML = `
<span class="chip-title">${title}</span>
<span class="chip-ep">Ep ${evt.episode}</span>
`;
list.appendChild(chip);
});
cell.appendChild(list);
grid.appendChild(cell);
} }
function setLoading(bool) { function setLoading(bool) {
state.loading = bool; state.loading = bool;
const loader = document.getElementById('loader'); const loader = document.getElementById('loader');
if (loader) {
if (bool) loader.classList.add('active'); if (bool) loader.classList.add('active');
else loader.classList.remove('active'); else loader.classList.remove('active');
}
}
function updateAmbient(data) {
if (!data || !data.length) return;
const top = data.reduce((prev, curr) => (prev.media.popularity > curr.media.popularity) ? prev : curr, data[0]);
const img = top.media.bannerImage || top.media.coverImage.extraLarge;
const bgEl = document.getElementById('ambientBg');
if (bgEl && img) {
bgEl.style.backgroundImage = `url('${img}')`;
}
} }
function delay(ms) { return new Promise(r => setTimeout(r, ms)); } function delay(ms) { return new Promise(r => setTimeout(r, ms)); }
function updateAmbient(data) { async function getCache(key) {
if (!data || !data.length) return; try {
const top = data.reduce((prev, curr) => (prev.media.popularity > curr.media.popularity) ? prev : curr); const cache = await caches.open(CACHE_NAME);
const img = top.media.bannerImage || top.media.coverImage.large; const response = await cache.match(`/schedule-cache/${key}`);
if (img) document.getElementById('ambientBg').style.backgroundImage = `url('${img}')`; if (!response) return null;
const cached = await response.json();
const age = Date.now() - cached.timestamp;
if (age < CACHE_DURATION) {
console.log(`[Cache Hit] ${key}`);
return cached.data;
}
cache.delete(`/schedule-cache/${key}`);
return null;
} catch (e) {
return null;
}
} }
function getCacheKey() {
let d;
if (state.viewType === 'MONTH') {
d = new Date(state.currentDate.getFullYear(), state.currentDate.getMonth(), 1);
const year = d.getFullYear();
const month = String(d.getMonth() + 1).padStart(2, '0');
return `M_${year}_${month}`;
} else {
d = getWeekStart(state.currentDate);
const year = d.getFullYear();
const month = String(d.getMonth() + 1).padStart(2, '0');
const day = String(d.getDate()).padStart(2, '0');
return `W_${year}_${month}_${day}`;
}
}
async function setCache(key, data) {
try {
const cache = await caches.open(CACHE_NAME);
const payload = JSON.stringify({ timestamp: Date.now(), data: data });
const response = new Response(payload, { headers: { 'Content-Type': 'application/json' } });
await cache.put(`/schedule-cache/${key}`, response);
} catch (e) {
console.warn("Cache write failed", e);
}
}
window.navigate = navigate;
window.setViewType = setViewType;
window.setMode = setMode;
window.setFilter = setFilter;

View File

@@ -1,6 +1,6 @@
const path = require("path");
const fs = require("fs"); const fs = require("fs");
const { chromium } = require("playwright-core"); const { chromium } = require("playwright");
const {spawn} = require("node:child_process");
let browser; let browser;
let context; let context;
@@ -9,36 +9,31 @@ const BLOCK_LIST = [
"adsystem", "analytics", "tracker", "pixel", "quantserve", "newrelic" "adsystem", "analytics", "tracker", "pixel", "quantserve", "newrelic"
]; ];
function isPackaged() { function runHidden(cmd, args) {
return process.env.IS_PACKAGED === "true"; return new Promise((res, rej) => {
const p = spawn(cmd, args, {
stdio: "ignore",
shell: true,
windowsHide: true
});
p.on("exit", c => c === 0 ? res() : rej(new Error("exit " + c)));
});
} }
function getChromiumPath() { async function ensureChromiumShell() {
if (isPackaged()) { const exe = chromium.executablePath();
return path.join( if (exe && fs.existsSync(exe)) return;
process.resourcesPath,
"playwright",
"chromium",
"chrome-headless-shell-win64",
"chrome-headless-shell.exe"
);
}
return chromium.executablePath(); await runHidden("npx", ["playwright", "install", "chromium-headless-shell"]);
} }
async function initHeadless() { async function initHeadless() {
if (browser) return; if (browser) return;
const exePath = getChromiumPath(); await ensureChromiumShell();
if (!fs.existsSync(exePath)) {
throw new Error("Chromium not found: " + exePath);
}
browser = await chromium.launch({ browser = await chromium.launch({
headless: true, headless: true,
executablePath: exePath,
args: [ args: [
"--no-sandbox", "--no-sandbox",
"--disable-setuid-sandbox", "--disable-setuid-sandbox",

View File

@@ -1,7 +1,18 @@
import { FastifyInstance, FastifyRequest, FastifyReply } from 'fastify'; import {FastifyInstance, FastifyReply, FastifyRequest} from 'fastify';
import * as fs from 'fs'; import * as fs from 'fs';
import * as path from 'path'; import * as path from 'path';
let cachedTitlebar: string | null = null;
function getTitlebarHTML(): string {
if (!cachedTitlebar) {
const titlebarPath = path.join(__dirname, '..', '..', 'views', 'components', 'titlebar.html');
cachedTitlebar = fs.readFileSync(titlebarPath, 'utf-8');
}
return cachedTitlebar;
}
let cachedNavbar: string | null = null; let cachedNavbar: string | null = null;
function getNavbarHTML(activePage: string, showSearch: boolean = true): string { function getNavbarHTML(activePage: string, showSearch: boolean = true): string {
@@ -14,6 +25,7 @@ function getNavbarHTML(activePage: string, showSearch: boolean = true): string {
const pages = ['anime', 'books', 'gallery', 'schedule' , 'marketplace']; const pages = ['anime', 'books', 'gallery', 'schedule' , 'marketplace'];
pages.forEach(page => { pages.forEach(page => {
const regex = new RegExp(`(<button class="nav-button[^"]*)"\\s+data-page="${page}"`, 'g'); const regex = new RegExp(`(<button class="nav-button[^"]*)"\\s+data-page="${page}"`, 'g');
if (page === activePage) { if (page === activePage) {
navbar = navbar.replace(regex, `$1 active" data-page="${page}"`); navbar = navbar.replace(regex, `$1 active" data-page="${page}"`);
@@ -30,10 +42,15 @@ function getNavbarHTML(activePage: string, showSearch: boolean = true): string {
return navbar; return navbar;
} }
function injectNavbar(htmlContent: string, activePage: string, showSearch: boolean = true): string { function injectLayout(htmlContent: string, activePage: string | null = null, showSearch: boolean = true): string {
const navbar = getNavbarHTML(activePage, showSearch); let contentToInject = getTitlebarHTML();
return htmlContent.replace(/<body[^>]*>/, `$&\n${navbar}`); if (activePage !== null) {
const navbar = getNavbarHTML(activePage, showSearch);
contentToInject += `\n${navbar}`;
}
return htmlContent.replace(/<body[^>]*>/, `$&\n${contentToInject}`);
} }
async function viewsRoutes(fastify: FastifyInstance) { async function viewsRoutes(fastify: FastifyInstance) {
@@ -41,105 +58,116 @@ async function viewsRoutes(fastify: FastifyInstance) {
fastify.get('/', (req: FastifyRequest, reply: FastifyReply) => { fastify.get('/', (req: FastifyRequest, reply: FastifyReply) => {
const htmlPath = path.join(__dirname, '..', '..', 'views', 'users.html'); const htmlPath = path.join(__dirname, '..', '..', 'views', 'users.html');
const html = fs.readFileSync(htmlPath, 'utf-8'); const html = fs.readFileSync(htmlPath, 'utf-8');
reply.type('text/html').send(html);
const finalHtml = injectLayout(html, null);
reply.type('text/html').send(finalHtml);
}); });
fastify.get('/anime', (req: FastifyRequest, reply: FastifyReply) => { fastify.get('/anime', (req: FastifyRequest, reply: FastifyReply) => {
const htmlPath = path.join(__dirname, '..', '..', 'views', 'anime', 'animes.html'); const htmlPath = path.join(__dirname, '..', '..', 'views', 'anime', 'animes.html');
const html = fs.readFileSync(htmlPath, 'utf-8'); const html = fs.readFileSync(htmlPath, 'utf-8');
const htmlWithNavbar = injectNavbar(html, 'anime', true); const finalHtml = injectLayout(html, 'anime', true);
reply.type('text/html').send(htmlWithNavbar); reply.type('text/html').send(finalHtml);
}); });
fastify.get('/profile', (req: FastifyRequest, reply: FastifyReply) => { fastify.get('/profile', (req: FastifyRequest, reply: FastifyReply) => {
const htmlPath = path.join(__dirname, '..', '..', 'views', 'profile.html'); const htmlPath = path.join(__dirname, '..', '..', 'views', 'profile.html');
const html = fs.readFileSync(htmlPath, 'utf-8'); const html = fs.readFileSync(htmlPath, 'utf-8');
const htmlWithNavbar = injectNavbar(html, '', false); const finalHtml = injectLayout(html, '', false);
reply.type('text/html').send(htmlWithNavbar); reply.type('text/html').send(finalHtml);
}); });
fastify.get('/books', (req: FastifyRequest, reply: FastifyReply) => { fastify.get('/books', (req: FastifyRequest, reply: FastifyReply) => {
const htmlPath = path.join(__dirname, '..', '..', 'views', 'books', 'books.html'); const htmlPath = path.join(__dirname, '..', '..', 'views', 'books', 'books.html');
const html = fs.readFileSync(htmlPath, 'utf-8'); const html = fs.readFileSync(htmlPath, 'utf-8');
const htmlWithNavbar = injectNavbar(html, 'books', true); const finalHtml = injectLayout(html, 'books', true);
reply.type('text/html').send(htmlWithNavbar); reply.type('text/html').send(finalHtml);
}); });
fastify.get('/schedule', (req: FastifyRequest, reply: FastifyReply) => { fastify.get('/schedule', (req: FastifyRequest, reply: FastifyReply) => {
const htmlPath = path.join(__dirname, '..', '..', 'views', 'schedule.html'); const htmlPath = path.join(__dirname, '..', '..', 'views', 'schedule.html');
const html = fs.readFileSync(htmlPath, 'utf-8'); const html = fs.readFileSync(htmlPath, 'utf-8');
const htmlWithNavbar = injectNavbar(html, 'schedule', false); const finalHtml = injectLayout(html, 'schedule', false);
reply.type('text/html').send(htmlWithNavbar); reply.type('text/html').send(finalHtml);
}); });
fastify.get('/gallery', (req: FastifyRequest, reply: FastifyReply) => { fastify.get('/gallery', (req: FastifyRequest, reply: FastifyReply) => {
const htmlPath = path.join(__dirname, '..', '..', 'views', 'gallery', 'gallery.html'); const htmlPath = path.join(__dirname, '..', '..', 'views', 'gallery', 'gallery.html');
const html = fs.readFileSync(htmlPath, 'utf-8'); const html = fs.readFileSync(htmlPath, 'utf-8');
const htmlWithNavbar = injectNavbar(html, 'gallery', true); const finalHtml = injectLayout(html, 'gallery', true);
reply.type('text/html').send(htmlWithNavbar); reply.type('text/html').send(finalHtml);
}); });
fastify.get('/marketplace', (req: FastifyRequest, reply: FastifyReply) => { fastify.get('/marketplace', (req: FastifyRequest, reply: FastifyReply) => {
const htmlPath = path.join(__dirname, '..', '..', 'views', 'marketplace.html'); const htmlPath = path.join(__dirname, '..', '..', 'views', 'marketplace.html');
const html = fs.readFileSync(htmlPath, 'utf-8'); const html = fs.readFileSync(htmlPath, 'utf-8');
const htmlWithNavbar = injectNavbar(html, 'marketplace', false); const finalHtml = injectLayout(html, 'marketplace', false);
reply.type('text/html').send(htmlWithNavbar); reply.type('text/html').send(finalHtml);
}); });
fastify.get('/gallery/:extension/*', (req: FastifyRequest, reply: FastifyReply) => { fastify.get('/gallery/:extension/*', (req: FastifyRequest, reply: FastifyReply) => {
const htmlPath = path.join(__dirname, '..', '..', 'views', 'gallery', 'image.html'); const htmlPath = path.join(__dirname, '..', '..', 'views', 'gallery', 'image.html');
const html = fs.readFileSync(htmlPath, 'utf-8'); const html = fs.readFileSync(htmlPath, 'utf-8');
const htmlWithNavbar = injectNavbar(html, 'gallery', true); const finalHtml = injectLayout(html, 'gallery', true);
reply.type('text/html').send(htmlWithNavbar); reply.type('text/html').send(finalHtml);
}); });
fastify.get('/gallery/favorites/*', (req: FastifyRequest, reply: FastifyReply) => { fastify.get('/gallery/favorites/*', (req: FastifyRequest, reply: FastifyReply) => {
const htmlPath = path.join(__dirname, '..', '..', 'views', 'gallery', 'image.html'); const htmlPath = path.join(__dirname, '..', '..', 'views', 'gallery', 'image.html');
const html = fs.readFileSync(htmlPath, 'utf-8'); const html = fs.readFileSync(htmlPath, 'utf-8');
const htmlWithNavbar = injectNavbar(html, 'gallery', true); const finalHtml = injectLayout(html, 'gallery', true);
reply.type('text/html').send(htmlWithNavbar); reply.type('text/html').send(finalHtml);
}); });
fastify.get('/anime/:id', (req: FastifyRequest, reply: FastifyReply) => { fastify.get('/anime/:id', (req: FastifyRequest, reply: FastifyReply) => {
const htmlPath = path.join(__dirname, '..', '..', 'views', 'anime', 'anime.html'); const htmlPath = path.join(__dirname, '..', '..', 'views', 'anime', 'anime.html');
const html = fs.readFileSync(htmlPath, 'utf-8'); const html = fs.readFileSync(htmlPath, 'utf-8');
reply.type('text/html').send(html);
const finalHtml = injectLayout(html, null);
reply.type('text/html').send(finalHtml);
}); });
fastify.get('/anime/:extension/*', (req: FastifyRequest, reply: FastifyReply) => { fastify.get('/anime/:extension/*', (req: FastifyRequest, reply: FastifyReply) => {
const htmlPath = path.join(__dirname, '..', '..', 'views', 'anime', 'anime.html'); const htmlPath = path.join(__dirname, '..', '..', 'views', 'anime', 'anime.html');
const html = fs.readFileSync(htmlPath, 'utf-8'); const html = fs.readFileSync(htmlPath, 'utf-8');
reply.type('text/html').send(html); const finalHtml = injectLayout(html, null);
reply.type('text/html').send(finalHtml);
}); });
fastify.get('/book/:id', (req: FastifyRequest, reply: FastifyReply) => { fastify.get('/book/:id', (req: FastifyRequest, reply: FastifyReply) => {
const htmlPath = path.join(__dirname, '..', '..', 'views', 'books', 'book.html'); const htmlPath = path.join(__dirname, '..', '..', 'views', 'books', 'book.html');
const html = fs.readFileSync(htmlPath, 'utf-8'); const html = fs.readFileSync(htmlPath, 'utf-8');
reply.type('text/html').send(html); const finalHtml = injectLayout(html, null);
reply.type('text/html').send(finalHtml);
}); });
fastify.get('/book/:extension/*', (req: FastifyRequest, reply: FastifyReply) => { fastify.get('/book/:extension/*', (req: FastifyRequest, reply: FastifyReply) => {
const htmlPath = path.join(__dirname, '..', '..', 'views', 'books', 'book.html'); const htmlPath = path.join(__dirname, '..', '..', 'views', 'books', 'book.html');
const html = fs.readFileSync(htmlPath, 'utf-8'); const html = fs.readFileSync(htmlPath, 'utf-8');
reply.type('text/html').send(html); const finalHtml = injectLayout(html, null);
reply.type('text/html').send(finalHtml);
}); });
fastify.get('/read/:provider/:chapter/*', (req: FastifyRequest, reply: FastifyReply) => { fastify.get('/read/:provider/:chapter/*', (req: FastifyRequest, reply: FastifyReply) => {
const htmlPath = path.join(__dirname, '..', '..', 'views', 'books', 'read.html'); const htmlPath = path.join(__dirname, '..', '..', 'views', 'books', 'read.html');
const html = fs.readFileSync(htmlPath, 'utf-8'); const html = fs.readFileSync(htmlPath, 'utf-8');
reply.type('text/html').send(html);
const finalHtml = injectLayout(html, null);
reply.type('text/html').send(finalHtml);
}); });
fastify.get('/room', (req: FastifyRequest, reply: FastifyReply) => { fastify.get('/room', (req: FastifyRequest, reply: FastifyReply) => {
const htmlPath = path.join(__dirname, '..', '..', 'views', 'room.html'); const htmlPath = path.join(__dirname, '..', '..', 'views', 'room.html');
const html = fs.readFileSync(htmlPath, 'utf-8'); const html = fs.readFileSync(htmlPath, 'utf-8');
reply.type('text/html').send(html); const finalHtml = injectLayout(html, null);
reply.type('text/html').send(finalHtml);
}); });
fastify.setNotFoundHandler((req, reply) => { fastify.setNotFoundHandler((req, reply) => {
const htmlPath = path.join(__dirname, '..', '..', 'views', '404.html'); const htmlPath = path.join(__dirname, '..', '..', 'views', '404.html');
const html = fs.readFileSync(htmlPath, 'utf-8'); const html = fs.readFileSync(htmlPath, 'utf-8');
reply.code(404).type('text/html').send(html); const finalHtml = injectLayout(html, null);
reply.code(404).type('text/html').send(finalHtml);
}); });
} }

View File

@@ -45,18 +45,6 @@
</head> </head>
<body> <body>
<div id="titlebar">
<div class="title-left">
<img class="app-icon" src="/public/assets/waifuboards.ico" alt=""/>
<span class="app-title">WaifuBoard</span>
</div>
<div class="title-right">
<button class="min"></button>
<button class="max">🗖</button>
<button class="close"></button>
</div>
</div>
<nav class="navbar" id="navbar"> <nav class="navbar" id="navbar">
<a href="#" class="nav-brand"> <a href="#" class="nav-brand">
<div class="brand-icon"> <div class="brand-icon">

View File

@@ -15,21 +15,11 @@
<link rel="stylesheet" href="/views/css/anime/anime.css" /> <link rel="stylesheet" href="/views/css/anime/anime.css" />
<link rel="stylesheet" href="/views/css/anime/player.css" /> <link rel="stylesheet" href="/views/css/anime/player.css" />
<link rel="stylesheet" href="/views/css/components/match-modal.css"> <link rel="stylesheet" href="/views/css/components/match-modal.css">
<link rel="stylesheet" href="/views/css/components/titlebar.css">
<script src="/src/scripts/titlebar.js"></script> <script src="/src/scripts/titlebar.js"></script>
<link rel="stylesheet" href="/views/css/components/titlebar.css">
</head> </head>
<body> <body>
<div id="titlebar">
<div class="title-left">
<img class="app-icon" src="/public/assets/waifuboards.ico" alt=""/>
<span class="app-title">WaifuBoard</span>
</div>
<div class="title-right">
<button class="min"></button>
<button class="max">🗖</button>
<button class="close"></button>
</div>
</div>
<a href="/anime" class="back-btn"> <a href="/anime" class="back-btn">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"> <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
<path d="M19 12H5"/><path d="M12 19l-7-7 7-7"/> <path d="M19 12H5"/><path d="M12 19l-7-7 7-7"/>

View File

@@ -17,18 +17,6 @@
<script src="/src/scripts/titlebar.js"></script> <script src="/src/scripts/titlebar.js"></script>
</head> </head>
<body> <body>
<div id="titlebar">
<div class="title-left">
<img class="app-icon" src="/public/assets/waifuboards.ico" alt=""/>
<span class="app-title">WaifuBoard</span>
</div>
<div class="title-right">
<button class="min"></button>
<button class="max">🗖</button>
<button class="close"></button>
</div>
</div>
<div class="hero-wrapper"> <div class="hero-wrapper">
<div class="hero-background"> <div class="hero-background">
<img id="hero-bg-media" alt=""> <img id="hero-bg-media" alt="">

View File

@@ -15,16 +15,6 @@
<script src="/src/scripts/titlebar.js"></script> <script src="/src/scripts/titlebar.js"></script>
</head> </head>
<body> <body>
<div id="titlebar"> <div class="title-left">
<img class="app-icon" src="/public/assets/waifuboards.ico" alt=""/>
<span class="app-title">WaifuBoard</span>
</div>
<div class="title-right">
<button class="min"></button>
<button class="max">🗖</button>
<button class="close"></button>
</div>
</div>
<a href="/books" class="back-btn"> <a href="/books" class="back-btn">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"> <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
<path d="M19 12H5"/><path d="M12 19l-7-7 7-7"/> <path d="M19 12H5"/><path d="M12 19l-7-7 7-7"/>

View File

@@ -16,17 +16,6 @@
<script src="/src/scripts/titlebar.js"></script> <script src="/src/scripts/titlebar.js"></script>
</head> </head>
<body> <body>
<div id="titlebar"> <div class="title-left">
<img class="app-icon" src="/public/assets/waifuboards.ico" alt=""/>
<span class="app-title">WaifuBoard</span>
</div>
<div class="title-right">
<button class="min"></button>
<button class="max">🗖</button>
<button class="close"></button>
</div>
</div>
<div class="hero-wrapper"> <div class="hero-wrapper">
<div class="hero-background"> <div class="hero-background">
<img id="hero-bg-media" src="" alt=""> <img id="hero-bg-media" src="" alt="">

View File

@@ -12,17 +12,6 @@
<script src="/src/scripts/titlebar.js"></script> <script src="/src/scripts/titlebar.js"></script>
</head> </head>
<body> <body>
<div id="titlebar"> <div class="title-left">
<img class="app-icon" src="/public/assets/waifuboards.ico" alt=""/>
<span class="app-title">WaifuBoard</span>
</div>
<div class="title-right">
<button class="min"></button>
<button class="max">🗖</button>
<button class="close"></button>
</div>
</div>
<header class="top-bar"> <header class="top-bar">
<button id="back-btn" class="glass-btn"> <button id="back-btn" class="glass-btn">
← Back ← Back

View File

@@ -0,0 +1,40 @@
<div id="titlebar">
<div class="title-left">
<div class="app-icon">
<img src="/public/assets/waifuboards.ico" alt="WB"/>
</div>
<span class="app-title">WaifuBoard</span>
</div>
<div class="title-drag-area"></div>
<div class="title-right">
<div id="titlebar-actions" style="display: none; height: 100%; align-items: center;">
<button class="title-action-btn" id="titlebar-settings" title="Settings">
<svg width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24">
<circle cx="12" cy="12" r="3"/>
<path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06A1.65 1.65 0 0 0 15 19.4a1.65 1.65 0 0 0-1 .6 1.65 1.65 0 0 0-.33 1.82V22a2 2 0 1 1-4 0v-.18a1.65 1.65 0 0 0-.33-1.82 1.65 1.65 0 0 0-1-.6 1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06A1.65 1.65 0 0 0 4.6 15a1.65 1.65 0 0 0-.6-1 1.65 1.65 0 0 0-1.82-.33H2a2 2 0 1 1 0-4h.18a1.65 1.65 0 0 0 1.82-.33 1.65 1.65 0 0 0 .6-1 1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06A1.65 1.65 0 0 0 9 4.6c.37 0 .72-.14 1-.6A1.65 1.65 0 0 0 10.33 2.18V2a2 2 0 1 1 4 0v.18a1.65 1.65 0 0 0 .33 1.82c.28.46.63.6 1 .6a1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9c0 .37.14.72.6 1 .46.28.6.63.6 1z"/>
</svg>
</button>
<a href="/profile" class="title-avatar-link" id="titlebar-profile-link" title="Profile">
<img id="titlebar-avatar" src="/public/assets/waifuboards.ico" alt="User" />
</a>
<div class="title-sep"></div>
</div>
<div class="window-controls">
<button class="control-btn min" title="Minimize">
<svg width="11" height="1" viewBox="0 0 11 1"><path d="M0 0h11v1H0z" fill="currentColor"/></svg>
</button>
<button class="control-btn max" title="Maximize">
<svg width="10" height="10" viewBox="0 0 10 10"><path d="M1 1v8h8V1H1zm1 1h6v6H2V2z" fill="currentColor"/></svg>
</button>
<button class="control-btn close" title="Close">
<svg width="11" height="11" viewBox="0 0 11 11"><path d="M5.5 4.793L1.854 1.146.646 2.354 4.293 6 .646 9.646l1.208 1.208L5.5 7.207l3.646 3.647 1.208-1.208L6.707 6l3.647-3.646-1.208-1.208L5.5 4.793z" fill="currentColor"/></svg>
</button>
</div>
</div>
</div>

View File

@@ -1,5 +1,7 @@
:root { :root {
--titlebar-height: 40px; --titlebar-height: 40px;
--primary-glass: rgba(9, 9, 11, 0.95);
--border-color: rgba(139, 92, 246, 0.2);
} }
* { * {
@@ -34,7 +36,7 @@ html.electron .panel-content {
margin-top: 2rem; margin-top: 2rem;
} }
html.electron .calendar-wrapper{ html.electron .calendar-wrapper {
margin-top: 4rem; margin-top: 4rem;
} }
@@ -47,42 +49,46 @@ html.electron .back-btn {
} }
#titlebar { #titlebar {
display: none; width: calc(100vw - 12px); display: none;
height: var(--titlebar-height); height: var(--titlebar-height);
background: rgba(9, 9, 11, 0.95); background: var(--primary-glass);
color: white; color: white;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
padding: 0 12px; padding-left: 12px;
padding-right: 0;
-webkit-app-region: drag; -webkit-app-region: drag;
user-select: none; user-select: none;
font-family: "Inter", system-ui, sans-serif;
border-bottom: 1px solid rgba(139, 92, 246, 0.2);
position: fixed; position: fixed;
top: 0; top: 0;
left: 0; left: 0;
width: 100vw;
z-index: 999999; z-index: 999999;
font-family: "Inter", system-ui, sans-serif;
border-bottom: 1px solid var(--border-color);
backdrop-filter: blur(12px); backdrop-filter: blur(12px);
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3); box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
} }
.title-left { .title-left {
display: flex; display: flex;
align-items: center !important; align-items: center;
gap: 10px; gap: 10px;
pointer-events: none;
} }
#titlebar .app-icon { #titlebar .app-icon {
width: 24px; width: 22px;
height: 24px; height: 22px;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
border-radius: 6px; border-radius: 5px;
background: rgba(139, 92, 246, 0.15); background: rgba(139, 92, 246, 0.1);
border: 1px solid rgba(139, 92, 246, 0.3); border: 1px solid rgba(139, 92, 246, 0.25);
padding: 3px; padding: 2px;
} }
#titlebar .app-icon img { #titlebar .app-icon img {
@@ -95,85 +101,19 @@ html.electron .back-btn {
font-size: 13px; font-size: 13px;
font-weight: 600; font-weight: 600;
color: rgba(255, 255, 255, 0.9); color: rgba(255, 255, 255, 0.9);
letter-spacing: -0.2px; letter-spacing: -0.1px;
}
.title-drag-area {
flex-grow: 1;
height: 100%;
} }
.title-right { .title-right {
display: flex; display: flex;
height: 100%; height: 100%;
gap: 1px;
}
.title-right button {
-webkit-app-region: no-drag;
border: none;
background: transparent;
color: rgba(255, 255, 255, 0.7);
width: 46px;
height: 100%;
cursor: pointer;
font-size: 16px;
display: flex;
align-items: center; align-items: center;
justify-content: center; -webkit-app-region: no-drag;
position: relative;
}
.title-right button svg {
width: 16px;
height: 16px;
transition: transform 0.2s;
}
.title-right button:hover {
color: white;
}
.title-right button:active {
transform: scale(0.95);
}
.title-right .min:hover {
background: rgba(139, 92, 246, 0.2);
}
.title-right .max:hover {
background: rgba(34, 197, 94, 0.2);
}
.title-right .close:hover {
background: #e81123;
color: white;
}
.title-right button:hover svg {
transform: scale(1.1);
}
html.electron::-webkit-scrollbar {
width: 12px;
position: absolute;
}
html.electron::-webkit-scrollbar-track {
background: #09090b;
margin-top: var(--titlebar-height);
}
html.electron::-webkit-scrollbar-thumb {
background: rgba(139, 92, 246, 0.3);
border-radius: 6px;
border: 2px solid #09090b;
}
html.electron::-webkit-scrollbar-thumb:hover {
background: rgba(139, 92, 246, 0.5);
}
body {
margin: 0;
padding: 0;
overflow-x: hidden;
} }
.user-box { .user-box {
@@ -181,18 +121,104 @@ body {
align-items: center; align-items: center;
gap: 8px; gap: 8px;
margin-right: 12px; margin-right: 12px;
padding: 4px 8px;
border-radius: 4px;
transition: background 0.2s;
cursor: default;
}
.user-box:hover {
background: rgba(255, 255, 255, 0.05);
} }
.user-box img { .user-box img {
width: 26px; width: 24px;
height: 26px; height: 24px;
border-radius: 50%; border-radius: 50%;
object-fit: cover; object-fit: cover;
border: 1px solid rgba(139, 92, 246, 0.3);
} }
.user-box span { .user-box span {
font-size: 13px; font-size: 12px;
font-weight: 500;
opacity: 0.9; opacity: 0.9;
color: #e4e4e7;
}
.window-controls {
display: flex;
height: 100%;
}
.control-btn {
border: none;
background: transparent;
color: #a1a1aa;
width: 46px;
height: 100%;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
transition: all 0.2s;
outline: none;
}
.control-btn:hover {
color: white;
background: rgba(255, 255, 255, 0.05);
}
.control-btn.min:hover {
background: rgba(255, 255, 255, 0.1);
}
.control-btn.max:hover {
background: rgba(255, 255, 255, 0.1);
}
.control-btn.close:hover {
background: #e81123;
color: white;
}
.control-btn:active {
background: rgba(255, 255, 255, 0.15);
}
.control-btn.close:active {
background: #bf0f1d;
}
html.electron::-webkit-scrollbar {
width: 12px;
position: absolute;
z-index: 0;
}
html.electron::-webkit-scrollbar-track {
background: #09090b;
margin-top: var(--titlebar-height);
border-left: 1px solid rgba(255, 255, 255, 0.05);
}
html.electron::-webkit-scrollbar-thumb {
background: rgba(139, 92, 246, 0.3);
border-radius: 6px;
border: 2px solid #09090b;
background-clip: content-box;
}
html.electron::-webkit-scrollbar-thumb:hover {
background: rgba(139, 92, 246, 0.5);
border: 2px solid #09090b;
}
body {
margin: 0;
padding: 0;
overflow-x: hidden;
} }
.hidden { .hidden {
@@ -208,3 +234,218 @@ html.electron #room-view {
html.electron #room-view .room-layout { html.electron #room-view .room-layout {
height: 100%; height: 100%;
} }
#titlebar-user-box {
position: relative;
z-index: 1000000;
}
#titlebar-dropdown {
position: absolute;
top: calc(100% + 8px);
right: 0;
width: 240px;
background: rgba(18, 18, 21, 0.98);
backdrop-filter: blur(20px);
border: 1px solid rgba(255, 255, 255, 0.1);
border-radius: 12px;
box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
display: none;
flex-direction: column;
overflow: hidden;
z-index: 1000001;
transform-origin: top right;
animation: titlebarDropdownSlide 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
#titlebar-dropdown.active {
display: flex;
}
@keyframes titlebarDropdownSlide {
from { opacity: 0; transform: scale(0.95) translateY(-5px); }
to { opacity: 1; transform: scale(1) translateY(0); }
}
#titlebar-dropdown .dropdown-header {
display: flex;
align-items: center;
gap: 12px;
padding: 16px;
background: rgba(139, 92, 246, 0.05);
border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
#titlebar-dropdown .dropdown-avatar {
width: 40px;
height: 40px;
border-radius: 50%;
border: 2px solid #8b5cf6;
}
#titlebar-dropdown .dropdown-user-info {
display: flex;
flex-direction: column;
}
#titlebar-dropdown .dropdown-username {
font-size: 14px;
font-weight: 600;
color: white;
}
#titlebar-dropdown .dropdown-status {
font-size: 11px;
color: #22c55e;
font-weight: 500;
}
#titlebar-dropdown .dropdown-item {
display: flex;
align-items: center;
gap: 10px;
padding: 10px 16px;
color: #a1a1aa;
text-decoration: none;
font-size: 13px;
transition: all 0.2s;
background: transparent;
border: none;
width: 100%;
cursor: pointer;
font-family: inherit;
text-align: left;
}
#titlebar-dropdown .dropdown-item:hover {
background: rgba(255, 255, 255, 0.05);
color: white;
padding-left: 20px;
}
#titlebar-dropdown .dropdown-item svg {
color: inherit;
transition: transform 0.2s;
}
#titlebar-dropdown .dropdown-item:hover svg {
color: #8b5cf6;
}
#titlebar-dropdown .dropdown-divider {
height: 1px;
background: rgba(255, 255, 255, 0.05);
margin: 4px 0;
}
#titlebar-dropdown .logout-item {
color: #ef4444;
}
#titlebar-dropdown .logout-item:hover {
background: rgba(239, 68, 68, 0.1);
color: #f87171;
}
#titlebar-dropdown .logout-item:hover svg {
color: #f87171;
}
html.electron::-webkit-scrollbar {
width: 12px;
}
html.electron::-webkit-scrollbar-track {
margin-top: var(--titlebar-height);
}
#titlebar .control-btn {
width: 46px !important;
height: 100% !important;
color: #a1a1aa;
transition: all 0.2s;
}
#titlebar .control-btn svg {
width: auto !important;
height: auto !important;
max-width: 14px;
max-height: 14px;
pointer-events: none;
}
#titlebar .app-icon img {
width: 100%;
height: 100%;
object-fit: contain;
max-width: none;
}
/* Nuevo estilo para la parte derecha */
.title-right {
display: flex;
height: 100%;
align-items: center;
-webkit-app-region: no-drag;
gap: 0; /* Quitamos gap general para controlar mejor los botones */
}
/* Botones de acción (Settings, etc) */
.title-action-btn {
width: 40px; /* Un poco más estrechos que los controles de ventana */
height: 100%;
display: flex;
align-items: center;
justify-content: center;
background: transparent;
border: none;
color: #a1a1aa;
cursor: pointer;
transition: all 0.2s;
outline: none;
}
.title-action-btn:hover {
background: rgba(255, 255, 255, 0.08);
color: white;
}
.title-action-btn svg {
width: 16px;
height: 16px;
}
/* Contenedor del Avatar */
.title-avatar-link {
display: flex;
align-items: center;
justify-content: center;
height: 100%;
padding: 0 10px; /* Espacio a los lados */
cursor: pointer;
transition: background 0.2s;
/* Quitamos el borde por defecto de los links */
text-decoration: none;
}
.title-avatar-link:hover {
background: rgba(255, 255, 255, 0.08);
}
.title-avatar-link img {
width: 22px;
height: 22px;
border-radius: 50%;
object-fit: cover;
border: 1px solid rgba(139, 92, 246, 0.4); /* Borde morado sutil */
}
/* Separador visual antes de los controles de ventana */
.title-sep {
width: 1px;
height: 16px;
background: rgba(255, 255, 255, 0.1);
margin: 0 4px;
}

View File

@@ -1,363 +1,440 @@
:root { :root {
--bg-glass: rgba(18, 18, 21, 0.8); --header-height: 140px;
--bg-cell: #0c0c0e;
--color-primary-glow: rgba(139, 92, 246, 0.3);
} }
body { body {
margin: 0; background-color: #050505;
background-color: var(--color-bg-base); overflow-x: hidden;
color: var(--color-text-primary);
overflow: hidden;
height: 100vh;
display: flex;
flex-direction: column;
}
html.electron body {
padding-top: 0;
} }
.ambient-bg { .ambient-bg {
position: absolute; position: fixed;
inset: 0; top: 0;
z-index: -1; left: 0;
background-size: cover;
background-position: center;
opacity: 0.06;
filter: blur(120px) saturate(1.2);
transition: background-image 1s ease-in-out;
pointer-events: none;
}
.calendar-wrapper {
flex: 1;
display: flex;
flex-direction: column;
overflow: hidden;
padding: 3rem;
max-width: 1920px;
width: 100%; width: 100%;
margin: 0 auto; height: 100%;
background-size: cover;
background-position: center top;
opacity: 0.15;
filter: blur(80px) saturate(1.5);
z-index: -2;
transition: background-image 1s ease;
} }
.calendar-controls { .bg-overlay {
padding: 1.5rem 0; position: fixed;
inset: 0;
background: radial-gradient(circle at top, transparent 0%, #050505 80%);
z-index: -1;
}
.schedule-container {
padding: calc(var(--nav-height) + 2rem) 3rem 2rem 3rem;
max-width: 1800px;
margin: 0 auto;
min-height: 100vh;
}
.schedule-header {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: flex-end;
flex-shrink: 0; margin-bottom: 2rem;
padding-bottom: 1.5rem;
border-bottom: 1px solid rgba(255,255,255,0.08);
flex-wrap: wrap;
gap: 1.5rem;
} }
.month-selector { .page-title {
font-size: 2.5rem;
font-weight: 900;
margin: 0 0 0.5rem 0;
letter-spacing: -1px;
}
.header-left {
display: flex;
flex-direction: column;
}
.month-navigator {
display: flex;
align-items: center;
gap: 1rem;
}
.current-date-label {
font-size: 1.2rem;
font-weight: 600;
color: var(--color-primary);
min-width: 180px;
text-align: center;
}
.nav-btn {
background: rgba(255,255,255,0.05);
border: 1px solid rgba(255,255,255,0.1);
color: white;
width: 32px;
height: 32px;
border-radius: 50%;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
transition: all 0.2s;
font-size: 1.2rem;
line-height: 0;
}
.nav-btn:hover {
background: var(--color-primary);
border-color: var(--color-primary);
}
.header-controls {
display: flex; display: flex;
align-items: center; align-items: center;
gap: 1.5rem; gap: 1.5rem;
} }
.month-title { .divider-vertical {
font-size: 2.2rem; width: 1px;
font-weight: 800; height: 30px;
letter-spacing: -0.03em; background: rgba(255,255,255,0.1);
background: linear-gradient(to right, #fff, #a1a1aa);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
min-width: 350px;
} }
.icon-btn { .toggle-group {
background: rgba(255, 255, 255, 0.03); background: rgba(0,0,0,0.3);
border: 1px solid var(--border-subtle); border: 1px solid rgba(255,255,255,0.1);
width: 44px;
height: 44px;
border-radius: 12px;
color: white;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
transition: 0.2s;
}
.icon-btn:hover {
background: var(--color-primary);
border-color: var(--color-primary);
transform: translateY(-2px);
}
.controls-right {
display: flex;
gap: 1rem;
}
.view-toggles {
display: flex;
background: #0f0f12;
padding: 4px; padding: 4px;
border-radius: 99px; border-radius: 99px;
border: 1px solid var(--border-subtle); display: flex;
box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3); gap: 4px;
} }
.toggle-item { .toggle-btn {
padding: 10px 24px;
border-radius: 99px;
border: none;
background: transparent; background: transparent;
border: none;
color: var(--color-text-secondary); color: var(--color-text-secondary);
padding: 6px 16px;
border-radius: 99px;
font-weight: 600; font-weight: 600;
font-size: 0.9rem; font-size: 0.9rem;
cursor: pointer; cursor: pointer;
transition: all 0.2s ease; transition: all 0.2s;
} }
.toggle-item.active { .toggle-btn:hover { color: white; }
background: var(--color-primary); .toggle-btn.active {
color: white;
box-shadow: 0 2px 10px var(--color-primary-glow);
}
.calendar-board {
flex: 1;
display: flex;
flex-direction: column;
overflow: hidden;
border: 1px solid var(--border-subtle);
border-radius: var(--radius-lg);
background: var(--color-bg-elevated); background: var(--color-bg-elevated);
box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5); color: white;
box-shadow: 0 2px 8px rgba(0,0,0,0.2);
} }
.weekdays-grid { .view-switcher {
display: grid;
grid-template-columns: repeat(7, 1fr);
border-bottom: 1px solid var(--border-subtle);
background: rgba(255, 255, 255, 0.02);
flex-shrink: 0;
}
.weekday-header {
padding: 16px;
text-align: center;
text-transform: uppercase;
font-size: 0.75rem;
font-weight: 800;
color: var(--color-text-secondary);
letter-spacing: 0.1em;
border-right: 1px solid var(--border-subtle);
}
.weekday-header:last-child {
border-right: none;
}
.days-grid {
display: grid;
grid-template-columns: repeat(7, 1fr);
width: 100%;
overflow-y: auto;
flex: 1;
grid-auto-rows: minmax(180px, 1fr);
background: var(--color-bg-base);
}
.day-cell {
position: relative;
background: var(--bg-cell);
border-right: 1px solid var(--border-subtle);
border-bottom: 1px solid var(--border-subtle);
display: flex; display: flex;
flex-direction: column; gap: 0.5rem;
padding: 12px;
transition: background 0.2s;
overflow: hidden;
} }
.day-cell:nth-child(7n) { .view-btn {
border-right: none; background: transparent;
} border: 1px solid rgba(255,255,255,0.1);
.day-cell.empty {
background: rgba(0, 0, 0, 0.2);
pointer-events: none;
}
.day-cell:hover {
background: #16161a;
}
.day-cell.today {
background: rgba(139, 92, 246, 0.03);
box-shadow: inset 0 0 0 1px var(--color-primary);
}
.day-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 12px;
z-index: 2;
pointer-events: none;
}
.day-number {
font-size: 1.1rem;
font-weight: 700;
color: var(--color-text-secondary); color: var(--color-text-secondary);
width: 32px; width: 40px;
height: 32px; height: 40px;
border-radius: 8px;
cursor: pointer;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
border-radius: 50%; transition: all 0.2s;
} }
.day-cell.today .day-number { .view-btn:hover { border-color: white; color: white; }
.view-btn.active {
background: var(--color-primary); background: var(--color-primary);
border-color: var(--color-primary);
color: white; color: white;
box-shadow: 0 0 15px var(--color-primary-glow);
} }
.today-label { .calendar-grid {
font-size: 0.65rem; display: grid;
font-weight: 800; grid-template-columns: repeat(7, 1fr);
color: var(--color-primary); gap: 1px;
letter-spacing: 0.05em; background: rgba(255,255,255,0.05);
text-transform: uppercase; border: 1px solid rgba(255,255,255,0.05);
display: none; border-radius: 12px;
}
.day-cell.today .today-label {
display: block;
}
.events-list {
flex: 1;
display: flex;
flex-direction: column;
gap: 6px;
overflow-y: auto;
z-index: 2;
padding-right: 4px;
}
.events-list::-webkit-scrollbar {
width: 4px;
}
.events-list::-webkit-scrollbar-thumb {
background: rgba(255, 255, 255, 0.1);
border-radius: 4px;
}
.anime-chip {
display: flex;
align-items: center;
justify-content: space-between;
background: rgba(255, 255, 255, 0.03);
border: 1px solid rgba(255, 255, 255, 0.05);
padding: 8px 10px;
border-radius: 8px;
font-size: 0.8rem;
color: #d4d4d8;
text-decoration: none;
transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
cursor: pointer;
position: relative;
overflow: hidden; overflow: hidden;
} }
.anime-chip::before { .weekday-header {
content: ""; background: var(--color-bg-card);
position: absolute; padding: 1rem;
left: 0; text-align: center;
top: 0;
bottom: 0;
width: 3px;
background: var(--color-primary);
opacity: 0;
transition: opacity 0.2s;
}
.anime-chip:hover {
background: rgba(255, 255, 255, 0.1);
color: white;
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
padding-left: 14px;
}
.anime-chip:hover::before {
opacity: 1;
}
.chip-title {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
font-weight: 500;
margin-right: 8px;
}
.chip-ep {
font-size: 0.7rem;
font-weight: 700; font-weight: 700;
color: var(--color-text-secondary); color: var(--color-text-secondary);
background: rgba(0, 0, 0, 0.4); font-size: 0.9rem;
padding: 2px 6px; text-transform: uppercase;
border-radius: 4px; letter-spacing: 1px;
white-space: nowrap;
} }
.cell-backdrop { .day-cell {
position: absolute; background: var(--color-bg-base);
inset: 0; min-height: 160px;
background-size: cover; max-height: 160px;
background-position: center; padding: 0.8rem;
opacity: 0; position: relative;
transition: opacity 0.4s ease; display: flex;
filter: grayscale(100%) brightness(0.25); flex-direction: column;
z-index: 1; gap: 0.5rem;
pointer-events: none;
overflow-y: auto;
scrollbar-width: none;
-ms-overflow-style: none;
} }
.day-cell:hover .cell-backdrop { .day-cell::-webkit-scrollbar { display: none; }
opacity: 1; .day-cell.empty { background: rgba(0,0,0,0.2); }
} .day-cell.today { background: rgba(139, 92, 246, 0.05); box-shadow: inset 0 0 0 1px var(--color-primary); }
.loader { .day-number {
position: fixed; font-weight: 700;
bottom: 30px; font-size: 1rem;
right: 30px; color: var(--color-text-secondary);
background: #18181b; margin-bottom: 4px;
border: 1px solid var(--border-subtle); display: block;
padding: 12px 24px; }
border-radius: 99px; .today .day-number { color: var(--color-primary); }
.anime-item-month {
display: flex; display: flex;
align-items: center; align-items: center;
gap: 12px; gap: 8px;
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5); padding: 6px;
transform: translateY(100px); background: rgba(255,255,255,0.03);
transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1); border-radius: 6px;
z-index: 1000; text-decoration: none;
transition: 0.2s;
border-left: 2px solid transparent;
} }
.loader.active { .anime-item-month:hover {
transform: translateY(0); background: rgba(255,255,255,0.08);
transform: translateX(2px);
}
.anime-item-month.is-mine {
border-left-color: var(--color-success);
background: rgba(34, 197, 94, 0.05);
} }
.spinner { .item-time { font-size: 0.75rem; color: var(--color-text-muted); font-family: monospace; }
width: 18px; .item-title { font-size: 0.8rem; color: #ddd; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
height: 18px;
border: 2px solid rgba(255, 255, 255, 0.1); .week-container {
border-top-color: var(--color-primary); display: flex;
border-radius: 50%; flex-direction: column;
animation: spin 0.8s infinite linear; gap: 2rem;
} }
@keyframes spin { .week-nav {
to { display: flex;
transform: rotate(360deg); gap: 1rem;
overflow-x: auto;
padding-bottom: 1rem;
scrollbar-width: none;
mask-image: linear-gradient(to right, black 90%, transparent 100%);
}
.week-nav::-webkit-scrollbar { display: none; }
.day-btn {
flex: 1;
min-width: 120px;
background: rgba(255, 255, 255, 0.03);
border: 1px solid rgba(255, 255, 255, 0.08);
color: var(--color-text-secondary);
border-radius: 12px;
padding: 1rem;
cursor: pointer;
transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
text-align: center;
display: flex;
flex-direction: column;
gap: 0.5rem;
}
.day-btn:hover {
background: rgba(255, 255, 255, 0.08);
color: white;
transform: translateY(-2px);
border-color: rgba(255, 255, 255, 0.2);
}
.day-btn.active {
background: var(--color-primary);
border-color: var(--color-primary);
color: white;
box-shadow: 0 8px 20px var(--color-primary-glow);
}
.day-btn span.name {
font-size: 0.9rem;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 1px;
opacity: 0.8;
}
.day-btn span.date {
font-size: 1.8rem;
font-weight: 800;
line-height: 1;
}
.week-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
gap: 1.5rem;
animation: fadeInUp 0.4s ease;
}
.card-ep-badge {
position: absolute;
top: 8px;
right: 8px;
background: rgba(0,0,0,0.8);
color: var(--color-primary);
padding: 4px 8px;
border-radius: 4px;
font-size: 0.8rem;
font-weight: 800;
border: 1px solid rgba(139, 92, 246, 0.3);
}
.card.mine .card-img-wrap {
box-shadow: 0 0 0 2px var(--color-success);
}
.card.mine::after {
content: "IN LIST";
position: absolute;
top: 8px; left: 8px;
background: var(--color-success);
color: black;
font-size: 0.65rem;
font-weight: 900;
padding: 2px 6px;
border-radius: 4px;
}
.loader-overlay {
position: fixed;
inset: 0;
background: rgba(0,0,0,0.6);
backdrop-filter: blur(5px);
display: flex;
justify-content: center;
align-items: center;
z-index: 999;
opacity: 0;
pointer-events: none;
transition: opacity 0.3s;
}
.loader-overlay.active { opacity: 1; pointer-events: auto; }
@media (max-width: 1024px) {
.schedule-container {
padding: 5rem 1.5rem 2rem 1.5rem;
}
}
@media (max-width: 768px) {
.schedule-header {
flex-direction: column;
align-items: stretch;
gap: 1.5rem;
}
.header-left {
align-items: center;
width: 100%;
}
.header-controls {
flex-wrap: wrap;
justify-content: center;
width: 100%;
gap: 1rem;
}
.page-title {
font-size: 2rem;
text-align: center;
}
.calendar-grid {
display: flex;
flex-direction: column;
gap: 1rem;
background: transparent;
border: none;
}
.weekday-header, .day-cell.empty { display: none; }
.day-cell {
min-height: auto;
max-height: none;
overflow: visible;
border: 1px solid rgba(255,255,255,0.08);
border-radius: 12px;
background: var(--color-bg-elevated);
}
.week-nav {
margin: 0 -1.5rem;
padding: 0 1.5rem 1rem 1.5rem;
}
.day-btn {
min-width: 90px;
padding: 0.8rem;
}
.day-btn span.name { font-size: 0.75rem; }
.day-btn span.date { font-size: 1.5rem; }
.week-grid {
grid-template-columns: repeat(2, 1fr);
gap: 0.75rem;
}
.week-grid .card {
min-width: 0 !important;
width: 100% !important;
flex: none !important;
}
.card-content h3 { font-size: 0.8rem; }
.card-ep-badge { font-size: 0.65rem; padding: 2px 4px; }
}
@media (max-width: 380px) {
.header-controls {
gap: 0.5rem;
}
.toggle-btn {
padding: 6px 10px;
font-size: 0.8rem;
}
.nav-btn {
width: 28px;
height: 28px;
}
.current-date-label {
font-size: 1rem;
min-width: 140px;
} }
} }

View File

@@ -10,23 +10,11 @@
<link rel="icon" href="/public/assets/waifuboards.ico" type="image/x-icon"> <link rel="icon" href="/public/assets/waifuboards.ico" type="image/x-icon">
<link rel="stylesheet" href="/views/css/components/updateNotifier.css"> <link rel="stylesheet" href="/views/css/components/updateNotifier.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.2/css/all.min.css"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.2/css/all.min.css">
<script src="/src/scripts/room-modal.js"></script>
<script src="https://unpkg.com/masonry-layout@4/dist/masonry.pkgd.min.js" async></script> <script src="https://unpkg.com/masonry-layout@4/dist/masonry.pkgd.min.js" async></script>
<link rel="stylesheet" href="/views/css/components/titlebar.css"> <link rel="stylesheet" href="/views/css/components/titlebar.css">
<script src="/src/scripts/titlebar.js"></script> <script src="/src/scripts/titlebar.js"></script>
</head> </head>
<body> <body>
<div id="titlebar"> <div class="title-left">
<img class="app-icon" src="/public/assets/waifuboards.ico" alt=""/>
<span class="app-title">WaifuBoard</span>
</div>
<div class="title-right">
<button class="min"></button>
<button class="max">🗖</button>
<button class="close"></button>
</div>
</div>
<main class="gallery-main"> <main class="gallery-main">
<div class="gallery-hero-placeholder"></div> <div class="gallery-hero-placeholder"></div>

View File

@@ -16,17 +16,6 @@
<script src="/src/scripts/titlebar.js"></script> <script src="/src/scripts/titlebar.js"></script>
</head> </head>
<body> <body>
<div id="titlebar"> <div class="title-left">
<img class="app-icon" src="/public/assets/waifuboards.ico" alt=""/>
<span class="app-title">WaifuBoard</span>
</div>
<div class="title-right">
<button class="min"></button>
<button class="max">🗖</button>
<button class="close"></button>
</div>
</div>
<a href="/gallery" class="back-btn"> <a href="/gallery" class="back-btn">
<svg width="20" height="20" fill="none" stroke="currentColor" stroke-width="2.5" viewBox="0 0 24 24"><path d="M15 19l-7-7 7-7"/></svg> <svg width="20" height="20" fill="none" stroke="currentColor" stroke-width="2.5" viewBox="0 0 24 24"><path d="M15 19l-7-7 7-7"/></svg>
Back to Gallery Back to Gallery

View File

@@ -14,18 +14,6 @@
<script src="/src/scripts/titlebar.js"></script> <script src="/src/scripts/titlebar.js"></script>
</head> </head>
<body> <body>
<div id="titlebar">
<div class="title-left">
<img class="app-icon" src="/public/assets/waifuboards.ico" alt=""/>
<span class="app-title">WaifuBoard</span>
</div>
<div class="title-right">
<button class="min"></button>
<button class="max">🗖</button>
<button class="close"></button>
</div>
</div>
<div class="hero-spacer"></div> <div class="hero-spacer"></div>
<main> <main>

View File

@@ -15,17 +15,6 @@
<script src="/src/scripts/titlebar.js"></script> <script src="/src/scripts/titlebar.js"></script>
</head> </head>
<body> <body>
<div id="titlebar">
<div class="title-left">
<img class="app-icon" src="/public/assets/waifuboards.ico" alt=""/>
<span class="app-title">WaifuBoard</span>
</div>
<div class="title-right">
<button class="min"></button>
<button class="max">🗖</button>
<button class="close"></button>
</div>
</div>
<div class="main-wrapper"> <div class="main-wrapper">
<section class="profile-header"> <section class="profile-header">

View File

@@ -18,17 +18,6 @@
<script src="/src/scripts/titlebar.js"></script> <script src="/src/scripts/titlebar.js"></script>
</head> </head>
<body> <body>
<div id="titlebar">
<div class="title-left">
<img class="app-icon" src="/public/assets/waifuboards.ico" alt=""/>
<span class="app-title">WaifuBoard</span>
</div>
<div class="title-right">
<button class="min"></button>
<button class="max">🗖</button>
<button class="close"></button>
</div>
</div>
<div id="room-view"> <div id="room-view">
<div class="room-layout" id="room-layout"> <div class="room-layout" id="room-layout">
<div class="video-area"> <div class="video-area">

View File

@@ -4,80 +4,67 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>WaifuBoard - Schedule</title> <title>WaifuBoard - Schedule</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link rel="icon" href="/public/assets/waifuboards.ico" type="image/x-icon"> <link rel="icon" href="/public/assets/waifuboards.ico" type="image/x-icon">
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;900&display=swap" rel="stylesheet"> <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap" rel="stylesheet">
<link rel="stylesheet" href="/views/css/globals.css"> <link rel="stylesheet" href="/views/css/globals.css">
<link rel="stylesheet" href="/views/css/schedule/schedule.css"> <link rel="stylesheet" href="/views/css/schedule/schedule.css">
<link rel="stylesheet" href="/views/css/components/navbar.css"> <link rel="stylesheet" href="/views/css/components/navbar.css">
<link rel="stylesheet" href="/views/css/components/updateNotifier.css"> <link rel="stylesheet" href="/views/css/components/updateNotifier.css">
<link rel="stylesheet" href="/views/css/components/titlebar.css">
<link rel="stylesheet" href="/views/css/components/create-room.css"/> <link rel="stylesheet" href="/views/css/components/create-room.css"/>
<script src="/src/scripts/titlebar.js"></script> <script src="/src/scripts/titlebar.js"></script>
<link rel="stylesheet" href="/views/css/components/titlebar.css">
</head> </head>
<body> <body>
<div id="titlebar"> <div class="title-left"> <div class="ambient-bg" id="ambientBg"></div>
<img class="app-icon" src="/public/assets/waifuboards.ico" alt=""/> <div class="bg-overlay"></div>
<span class="app-title">WaifuBoard</span>
</div> <div class="schedule-container">
<div class="title-right">
<button class="min"></button> <header class="schedule-header">
<button class="max">🗖</button> <div class="header-left">
<button class="close"></button> <h1 class="page-title">Release Schedule</h1>
<div class="month-navigator">
<button class="nav-btn" onclick="navigate(-1)"></button>
<span id="monthTitle" class="current-date-label">Loading...</span>
<button class="nav-btn" onclick="navigate(1)"></button>
</div>
</div> </div>
</div>
<div class="ambient-bg" id="ambientBg"></div> <div class="header-controls">
<div class="toggle-group" id="filter-group" style="display: none;">
<button class="toggle-btn active" id="btnAll" onclick="setFilter('ALL')">All</button>
<button class="toggle-btn" id="btnMyList" onclick="setFilter('MY_LIST')">My List</button>
</div>
<div class="calendar-wrapper"> <div class="divider-vertical"></div>
<div class="calendar-controls">
<div class="month-selector"> <div class="toggle-group">
<button class="icon-btn" onclick="navigate(-1)"> <button class="toggle-btn active" id="btnSub" onclick="setMode('SUB')">Sub</button>
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M15 18l-6-6 6-6"/></svg> <button class="toggle-btn" id="btnDub" onclick="setMode('DUB')">Dub</button>
</div>
<div class="view-switcher">
<button class="view-btn active" id="btnViewMonth" onclick="setViewType('MONTH')" title="Month View">
<svg width="20" height="20" fill="none" stroke="currentColor" viewBox="0 0 24 24"><rect x="3" y="4" width="18" height="18" rx="2" ry="2"></rect><line x1="16" y1="2" x2="16" y2="6"></line><line x1="8" y1="2" x2="8" y2="6"></line><line x1="3" y1="10" x2="21" y2="10"></line></svg>
</button> </button>
<div class="month-title" id="monthTitle">Loading...</div> <button class="view-btn" id="btnViewWeek" onclick="setViewType('WEEK')" title="Week View">
<button class="icon-btn" onclick="navigate(1)"> <svg width="20" height="20" fill="none" stroke="currentColor" viewBox="0 0 24 24"><rect x="3" y="4" width="18" height="18" rx="2" ry="2"></rect><line x1="16" y1="2" x2="16" y2="6"></line><line x1="8" y1="2" x2="8" y2="6"></line><line x1="3" y1="10" x2="21" y2="10"></line><path d="M8 14h.01"/><path d="M12 14h.01"/><path d="M16 14h.01"/><path d="M8 18h.01"/><path d="M12 18h.01"/><path d="M16 18h.01"/></svg>
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M9 18l6-6-6-6"/></svg>
</button> </button>
</div> </div>
</div>
</header>
<div class="controls-right"> <main id="schedule-content">
</main>
<div class="view-toggles"> </div>
<button class="toggle-item active" id="btnViewMonth" onclick="setViewType('MONTH')">Month</button>
<button class="toggle-item" id="btnViewWeek" onclick="setViewType('WEEK')">Week</button>
</div>
<div class="view-toggles"> <div class="loader-overlay" id="loader">
<button class="toggle-item active" id="btnSub" onclick="setMode('SUB')">Sub</button>
<button class="toggle-item" id="btnDub" onclick="setMode('DUB')">Dub</button>
</div>
</div>
</div>
<div class="calendar-board">
<div class="weekdays-grid">
<div class="weekday-header">Mon</div>
<div class="weekday-header">Tue</div>
<div class="weekday-header">Wed</div>
<div class="weekday-header">Thu</div>
<div class="weekday-header">Fri</div>
<div class="weekday-header">Sat</div>
<div class="weekday-header">Sun</div>
</div>
<div class="days-grid" id="daysGrid">
</div>
</div>
</div>
<div class="loader" id="loader">
<div class="spinner"></div> <div class="spinner"></div>
<span id="loadingText">Syncing Schedule...</span> </div>
</div>
<div id="updateToast" class="hidden"> <div id="updateToast" class="hidden">
<p>Update available: <span id="latestVersionDisplay">v1.x</span></p> <p>Update available: <span id="latestVersionDisplay">v1.x</span></p>
<a <a
@@ -87,13 +74,13 @@
> >
Click To Download Click To Download
</a> </a>
</div> </div>
<script src="/src/scripts/updateNotifier.js"></script> <script src="/src/scripts/room-modal.js"></script>
<script src="/src/scripts/room-modal.js"></script> <script src="/src/scripts/auth-guard.js"></script>
<script src="/src/scripts/schedule/schedule.js"></script> <script src="/src/scripts/schedule/schedule.js"></script>
<script src="/src/scripts/rpc-inapp.js"></script> <script src="/src/scripts/updateNotifier.js"></script>
<script src="/src/scripts/auth-guard.js"></script> <script src="/src/scripts/settings.js"></script>
<script src="/src/scripts/settings.js"></script> <script src="/src/scripts/rcp-inapp.js"></script>
</body> </body>
</html> </html>

View File

@@ -11,16 +11,6 @@
<script src="/src/scripts/titlebar.js"></script> <script src="/src/scripts/titlebar.js"></script>
</head> </head>
<body> <body>
<div id="titlebar"> <div class="title-left">
<img class="app-icon" src="/public/assets/waifuboards.ico" alt=""/>
<span class="app-title">WaifuBoard</span>
</div>
<div class="title-right">
<button class="min"></button>
<button class="max">🗖</button>
<button class="close"></button>
</div>
</div>
<div class="page-wrapper"> <div class="page-wrapper">
<div class="background-gradient"></div> <div class="background-gradient"></div>

View File

@@ -47,7 +47,7 @@ let observer = null;
// === CAMBIO: Parseo de URL para obtener ID === // === CAMBIO: Parseo de URL para obtener ID ===
const parts = window.location.pathname.split('/'); const parts = window.location.pathname.split('/');
const bookId = parts[4]; const bookId = parts[4];
let currentChapterId = parts[3]; // Ahora es un ID (string) let currentChapterId = decodeURIComponent(parts[3]);
let provider = parts[2]; let provider = parts[2];
let chaptersList = []; // Buffer para guardar el orden de capítulos let chaptersList = []; // Buffer para guardar el orden de capítulos
@@ -181,8 +181,8 @@ async function loadChapter() {
); );
if (chapterMeta) { if (chapterMeta) {
chapterLabel.textContent = `Chapter ${chapterMeta.number} - ${chapterMeta.title}`; chapterLabel.textContent = `Chapter ${chapterMeta.number}`;
document.title = `Chapter ${chapterMeta.number} - ${chapterMeta.title}`; document.title = `Chapter ${chapterMeta.number}`;
} }
// Lógica específica para contenido LOCAL // Lógica específica para contenido LOCAL

View File

@@ -1,5 +1,5 @@
const providerSelector = document.getElementById('provider-selector'); const providerSelector = document.getElementById('provider-selector');
const searchInput = document.getElementById('search-input'); const searchInput2 = document.getElementById('search-input');
const resultsContainer = document.getElementById('gallery-results'); const resultsContainer = document.getElementById('gallery-results');
let currentPage = 1; let currentPage = 1;
@@ -231,7 +231,7 @@ function showSkeletons(count, append = false) {
async function searchGallery(isLoadMore = false) { async function searchGallery(isLoadMore = false) {
if (isLoading) return; if (isLoading) return;
const query = searchInput.value.trim(); const query = searchInput2.value.trim();
const provider = providerSelector.value; const provider = providerSelector.value;
const page = isLoadMore ? currentPage + 1 : 1; const page = isLoadMore ? currentPage + 1 : 1;
@@ -351,22 +351,22 @@ async function loadExtensions() {
providerSelector.addEventListener('change', () => { providerSelector.addEventListener('change', () => {
if (providerSelector.value === 'favorites') { if (providerSelector.value === 'favorites') {
searchInput.placeholder = "Search in favorites..."; searchInput2.placeholder = "Search in favorites...";
} else { } else {
searchInput.placeholder = "Search in gallery..."; searchInput2.placeholder = "Search in gallery...";
} }
searchGallery(false); searchGallery(false);
}); });
let searchTimeout; let searchTimeout;
searchInput.addEventListener('input', () => { searchInput2.addEventListener('input', () => {
clearTimeout(searchTimeout); clearTimeout(searchTimeout);
searchTimeout = setTimeout(() => { searchTimeout = setTimeout(() => {
searchGallery(false); searchGallery(false);
}, 500); }, 500);
}); });
searchInput.addEventListener('keydown', e => { searchInput2.addEventListener('keydown', e => {
if (e.key === 'Enter') { if (e.key === 'Enter') {
clearTimeout(searchTimeout); clearTimeout(searchTimeout);
searchGallery(false); searchGallery(false);

View File

@@ -1,76 +1,373 @@
const ANILIST_API = 'https://graphql.anilist.co'; const ANILIST_API = 'https://graphql.anilist.co';
const CACHE_NAME = 'waifuboard-schedule-v1'; const CACHE_NAME = 'waifuboard-schedule-v5';
const CACHE_DURATION = 5 * 60 * 1000;
const CACHE_DURATION = 6 * 60 * 60 * 1000;
const state = { const state = {
currentDate: new Date(), currentDate: new Date(),
viewType: 'MONTH', viewType: 'MONTH',
mode: 'SUB', mode: 'SUB',
filter: 'ALL',
loading: false, loading: false,
abortController: null, abortController: null,
refreshInterval: null userListIds: new Set(),
scheduleData: [],
selectedWeekDayIndex: 0
}; };
document.addEventListener('DOMContentLoaded', () => { document.addEventListener('DOMContentLoaded', async () => {
await fetchUserList();
renderHeader(); renderHeader();
fetchSchedule(); fetchSchedule();
state.refreshInterval = setInterval(() => { if (state.userListIds.size > 0) {
console.log("Auto-refreshing schedule..."); const filterGroup = document.getElementById('filter-group');
fetchSchedule(true); if (filterGroup) filterGroup.style.display = 'flex';
}, CACHE_DURATION); }
}); });
async function getCache(key) { async function fetchUserList() {
const token = localStorage.getItem('token');
if (!token) return;
try { try {
const cache = await caches.open(CACHE_NAME); const res = await fetch('http://localhost:54322/api/list', {
headers: {
const response = await cache.match(`/schedule-cache/${key}`); 'Authorization': `Bearer ${token}`,
'Accept': 'application/json'
if (!response) return null;
const cached = await response.json();
const age = Date.now() - cached.timestamp;
if (age < CACHE_DURATION) {
console.log(`[Cache Hit] Loaded ${key} (Age: ${Math.round(age / 1000)}s)`);
return cached.data;
} }
});
console.log(`[Cache Stale] ${key} expired.`); if (res.ok) {
const json = await res.json();
if (json.results && Array.isArray(json.results)) {
state.userListIds.clear();
json.results.forEach(item => {
cache.delete(`/schedule-cache/${key}`); if (item.source === 'anilist') {
return null; state.userListIds.add(item.entry_id);
}
});
console.log(`[UserList] Loaded ${state.userListIds.size} entries.`);
}
}
} catch (e) { } catch (e) {
console.error("Cache read failed", e); console.warn("[UserList] Could not fetch user list:", e);
return null;
} }
} }
async function setCache(key, data) { async function fetchSchedule(forceRefresh = false) {
try { const key = getCacheKey();
const cache = await caches.open(CACHE_NAME);
const payload = JSON.stringify({ if (!forceRefresh) {
timestamp: Date.now(), const cachedData = await getCache(key);
data: data if (cachedData) {
}); console.log(`[Schedule] Using cached data for key: ${key}`);
state.scheduleData = cachedData;
renderContent();
updateAmbient(cachedData);
return;
const response = new Response(payload, {
headers: { 'Content-Type': 'application/json' }
});
await cache.put(`/schedule-cache/${key}`, response);
} catch (e) {
console.warn("Cache write failed", e);
} }
} }
if (state.abortController) state.abortController.abort();
state.abortController = new AbortController();
const signal = state.abortController.signal;
setLoading(true);
let startObj, endObj;
function getCacheKey() {
if (state.viewType === 'MONTH') { if (state.viewType === 'MONTH') {
return `M_${state.currentDate.getFullYear()}_${state.currentDate.getMonth()}`; const year = state.currentDate.getFullYear();
const month = state.currentDate.getMonth();
startObj = new Date(year, month, 1, 0, 0, 0, 0);
endObj = new Date(year, month + 1, 0, 23, 59, 59, 999);
} else { } else {
const start = getWeekStart(state.currentDate); const start = getWeekStart(state.currentDate);
return `W_${start.toISOString().split('T')[0]}`;
startObj = new Date(start);
endObj = new Date(startObj);
endObj.setDate(endObj.getDate() + 7);
endObj.setHours(23, 59, 59, 999);
} }
const startTs = Math.floor(startObj.getTime() / 1000);
const endTs = Math.floor(endObj.getTime() / 1000);
const query = `
query ($start: Int, $end: Int, $page: Int) {
Page(page: $page, perPage: 50) {
pageInfo { hasNextPage }
airingSchedules(airingAt_greater: $start, airingAt_lesser: $end, sort: TIME) {
airingAt
episode
media {
id
title { userPreferred english }
coverImage { large extraLarge }
bannerImage
isAdult
countryOfOrigin
format
duration
popularity
}
}
}
}
`;
let allData = [];
let page = 1;
let hasNext = true;
try {
while (hasNext && page <= 10) {
if (signal.aborted) throw new DOMException("Aborted", "AbortError");
const res = await fetch(ANILIST_API, {
method: 'POST',
headers: { 'Content-Type': 'application/json', 'Accept': 'application/json' },
body: JSON.stringify({ query, variables: { start: startTs, end: endTs, page } }),
signal: signal
});
if (res.status === 429) {
await delay(2000);
continue;
}
const json = await res.json();
if (json.errors) throw new Error("API Error");
const data = json.data.Page;
allData = [...allData, ...data.airingSchedules];
hasNext = data.pageInfo.hasNextPage;
page++;
await delay(200);
}
if (!signal.aborted) {
state.scheduleData = allData;
await setCache(key, allData);
renderContent();
updateAmbient(allData);
}
} catch (e) {
if (e.name !== 'AbortError') console.error("Fetch failed:", e);
} finally {
if (!signal.aborted) {
setLoading(false);
state.abortController = null;
}
}
}
function renderContent() {
let items = state.scheduleData.filter(i =>
!i.media.isAdult &&
i.media.countryOfOrigin === 'JP'
);
if (state.mode === 'DUB') {
items = items.filter(i => i.media.popularity > 20000);
}
if (state.filter === 'MY_LIST') {
items = items.filter(i => state.userListIds.has(i.media.id));
}
const container = document.getElementById('schedule-content');
if (!container) return;
container.innerHTML = '';
if (state.viewType === 'MONTH') {
renderMonthView(container, items);
} else {
renderWeekView(container, items);
}
}
function renderMonthView(container, items) {
const grid = document.createElement('div');
grid.className = 'calendar-grid';
const days = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'];
days.forEach(d => {
const h = document.createElement('div');
h.className = 'weekday-header';
h.textContent = d;
grid.appendChild(h);
});
const year = state.currentDate.getFullYear();
const month = state.currentDate.getMonth();
const daysInMonth = new Date(year, month + 1, 0).getDate();
let firstDayIndex = new Date(year, month, 1).getDay() - 1;
if (firstDayIndex === -1) firstDayIndex = 6;
for (let i = 0; i < firstDayIndex; i++) {
const empty = document.createElement('div');
empty.className = 'day-cell empty';
grid.appendChild(empty);
}
for (let day = 1; day <= daysInMonth; day++) {
const cell = document.createElement('div');
cell.className = 'day-cell';
const currentCellDate = new Date(year, month, day);
const now = new Date();
if (isSameDay(currentCellDate, now)) {
cell.classList.add('today');
}
cell.innerHTML = `<span class="day-number">${day}</span>`;
const dayEvents = items.filter(i => {
const releaseDate = new Date(i.airingAt * 1000);
return isSameDay(currentCellDate, releaseDate);
});
dayEvents.sort((a, b) => b.media.popularity - a.media.popularity);
dayEvents.forEach(evt => {
const title = evt.media.title.english || evt.media.title.userPreferred;
const ep = evt.episode;
const time = new Date(evt.airingAt * 1000).toLocaleTimeString([], {hour: '2-digit', minute:'2-digit'});
const isMine = state.userListIds.has(evt.media.id);
const el = document.createElement('a');
el.className = `anime-item-month ${isMine ? 'is-mine' : ''}`;
el.href = `/anime/${evt.media.id}`;
el.innerHTML = `
<span class="item-time">${time}</span>
<span class="item-title">
${title} <span class="ep-badge">EP ${ep}</span>
</span>
`;
cell.appendChild(el);
});
grid.appendChild(cell);
}
container.appendChild(grid);
}
function renderWeekView(container, items) {
const wrapper = document.createElement('div');
wrapper.className = 'week-container';
const nav = document.createElement('div');
nav.className = 'week-nav';
const startOfWeek = getWeekStart(state.currentDate);
const dayNames = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'];
for (let i = 0; i < 7; i++) {
const d = new Date(startOfWeek);
d.setDate(startOfWeek.getDate() + i);
const btn = document.createElement('button');
btn.className = `day-btn ${i === state.selectedWeekDayIndex ? 'active' : ''}`;
btn.onclick = () => {
state.selectedWeekDayIndex = i;
renderWeekCards(d, items);
document.querySelectorAll('.day-btn').forEach(b => b.classList.remove('active'));
btn.classList.add('active');
};
btn.innerHTML = `
<span class="name">${dayNames[i]}</span>
<span class="date">${d.getDate()}</span>
`;
nav.appendChild(btn);
}
wrapper.appendChild(nav);
const grid = document.createElement('div');
grid.className = 'week-grid';
grid.id = 'weekGrid';
wrapper.appendChild(grid);
container.appendChild(wrapper);
const selectedDate = new Date(startOfWeek);
selectedDate.setDate(selectedDate.getDate() + state.selectedWeekDayIndex);
renderWeekCards(selectedDate, items);
}
function renderWeekCards(targetDate, allItems) {
const grid = document.getElementById('weekGrid');
if (!grid) return;
grid.innerHTML = '';
const dayItems = allItems.filter(i => {
const releaseDate = new Date(i.airingAt * 1000);
return isSameDay(targetDate, releaseDate);
});
dayItems.sort((a, b) => b.media.popularity - a.media.popularity);
if (dayItems.length === 0) {
grid.innerHTML = `
<div style="grid-column: 1/-1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 4rem; opacity: 0.5;">
<p style="margin-top: 1rem; font-size: 1.2rem; font-weight: 500;">No releases found for this day</p>
</div>`;
return;
}
dayItems.forEach(evt => {
const m = evt.media;
const title = m.title.english || m.title.userPreferred;
const time = new Date(evt.airingAt * 1000).toLocaleTimeString([], {hour: '2-digit', minute:'2-digit'});
const card = document.createElement('div');
card.className = `card`;
card.onclick = () => window.location.href = `/anime/${m.id}`;
card.innerHTML = `
<div class="card-img-wrap">
<img src="${m.coverImage.large}" alt="${title}" loading="lazy">
<div class="card-ep-badge">EP ${evt.episode}${time}</div>
</div>
<div class="card-content">
<h3>${title}</h3>
<p>${m.format || 'TV'}</p>
</div>
`;
grid.appendChild(card);
});
}
function isSameDay(d1, d2) {
return d1.getFullYear() === d2.getFullYear() &&
d1.getMonth() === d2.getMonth() &&
d1.getDate() === d2.getDate();
}
function getWeekStart(d) {
const date = new Date(d);
date.setHours(0, 0, 0, 0);
const day = date.getDay();
const diff = date.getDate() - day + (day === 0 ? -6 : 1);
date.setDate(diff);
return date;
} }
function navigate(delta) { function navigate(delta) {
@@ -93,10 +390,19 @@ function setViewType(type) {
document.getElementById('btnViewMonth').classList.toggle('active', type === 'MONTH'); document.getElementById('btnViewMonth').classList.toggle('active', type === 'MONTH');
document.getElementById('btnViewWeek').classList.toggle('active', type === 'WEEK'); document.getElementById('btnViewWeek').classList.toggle('active', type === 'WEEK');
if (state.abortController) state.abortController.abort(); state.selectedWeekDayIndex = new Date().getDay() - 1;
if (state.selectedWeekDayIndex === -1) state.selectedWeekDayIndex = 6;
renderHeader(); renderHeader();
if (state.scheduleData.length) {
renderContent();
} else {
fetchSchedule(); fetchSchedule();
}
} }
function setMode(mode) { function setMode(mode) {
@@ -104,8 +410,18 @@ function setMode(mode) {
state.mode = mode; state.mode = mode;
document.getElementById('btnSub').classList.toggle('active', mode === 'SUB'); document.getElementById('btnSub').classList.toggle('active', mode === 'SUB');
document.getElementById('btnDub').classList.toggle('active', mode === 'DUB'); document.getElementById('btnDub').classList.toggle('active', mode === 'DUB');
renderContent();
fetchSchedule(); }
function setFilter(filterType) {
if (state.filter === filterType) return;
state.filter = filterType;
document.getElementById('btnAll').classList.toggle('active', filterType === 'ALL');
document.getElementById('btnMyList').classList.toggle('active', filterType === 'MY_LIST');
renderContent();
} }
function renderHeader() { function renderHeader() {
@@ -119,242 +435,86 @@ function renderHeader() {
const startStr = start.toLocaleDateString('en-US', { month: 'short', day: 'numeric' }); const startStr = start.toLocaleDateString('en-US', { month: 'short', day: 'numeric' });
const endStr = end.toLocaleDateString('en-US', { month: 'short', day: 'numeric' }); const endStr = end.toLocaleDateString('en-US', { month: 'short', day: 'numeric' });
title = `Week of ${startStr} - ${endStr}`; title = `${startStr} - ${endStr}`;
} }
document.getElementById('monthTitle').textContent = title; const titleEl = document.getElementById('monthTitle');
} if (titleEl) titleEl.textContent = title;
function getWeekStart(date) {
const d = new Date(date);
const day = d.getDay();
const diff = d.getDate() - day + (day === 0 ? -6 : 1);
return new Date(d.setDate(diff));
}
async function fetchSchedule(forceRefresh = false) {
const key = getCacheKey();
if (!forceRefresh) {
const cachedData = await getCache(key);
if (cachedData) {
renderGrid(cachedData);
updateAmbient(cachedData);
return;
}
}
if (state.abortController) state.abortController.abort();
state.abortController = new AbortController();
const signal = state.abortController.signal;
if (!forceRefresh) setLoading(true);
let startTs, endTs;
if (state.viewType === 'MONTH') {
const year = state.currentDate.getFullYear();
const month = state.currentDate.getMonth();
startTs = Math.floor(new Date(year, month, 1).getTime() / 1000);
endTs = Math.floor(new Date(year, month + 1, 0, 23, 59, 59).getTime() / 1000);
} else {
const start = getWeekStart(state.currentDate);
start.setHours(0, 0, 0, 0);
const end = new Date(start);
end.setDate(end.getDate() + 7);
startTs = Math.floor(start.getTime() / 1000);
endTs = Math.floor(end.getTime() / 1000);
}
const query = `
query ($start: Int, $end: Int, $page: Int) {
Page(page: $page, perPage: 50) {
pageInfo { hasNextPage }
airingSchedules(airingAt_greater: $start, airingAt_lesser: $end, sort: TIME) {
airingAt
episode
media {
id
title { userPreferred english }
coverImage { large }
bannerImage
isAdult
countryOfOrigin
popularity
}
}
}
}
`;
let allData = [];
let page = 1;
let hasNext = true;
let retries = 0;
try {
while (hasNext && page <= 6) {
if (signal.aborted) throw new DOMException("Aborted", "AbortError");
try {
const res = await fetch(ANILIST_API, {
method: 'POST',
headers: { 'Content-Type': 'application/json', 'Accept': 'application/json' },
body: JSON.stringify({
query,
variables: { start: startTs, end: endTs, page }
}),
signal: signal
});
if (res.status === 429) {
if (retries > 2) throw new Error("Rate Limited");
console.warn("429 Hit. Waiting...");
await delay(4000);
retries++;
continue;
}
const json = await res.json();
if (json.errors) throw new Error("API Error");
const data = json.data.Page;
allData = [...allData, ...data.airingSchedules];
hasNext = data.pageInfo.hasNextPage;
page++;
await delay(600);
} catch (e) {
if (e.name === 'AbortError') throw e;
console.error(e);
break;
}
}
if (!signal.aborted) {
await setCache(key, allData);
renderGrid(allData);
updateAmbient(allData);
}
} catch (e) {
if (e.name !== 'AbortError') console.error("Fetch failed:", e);
} finally {
if (!signal.aborted) {
setLoading(false);
state.abortController = null;
}
}
}
function renderGrid(data) {
const grid = document.getElementById('daysGrid');
grid.innerHTML = '';
let items = data.filter(i => !i.media.isAdult && i.media.countryOfOrigin === 'JP');
if (state.mode === 'DUB') {
items = items.filter(i => i.media.popularity > 20000);
}
if (state.viewType === 'MONTH') {
const year = state.currentDate.getFullYear();
const month = state.currentDate.getMonth();
const daysInMonth = new Date(year, month + 1, 0).getDate();
let firstDayIndex = new Date(year, month, 1).getDay() - 1;
if (firstDayIndex === -1) firstDayIndex = 6;
for (let i = 0; i < firstDayIndex; i++) {
const empty = document.createElement('div');
empty.className = 'day-cell empty';
grid.appendChild(empty);
}
for (let day = 1; day <= daysInMonth; day++) {
const dateObj = new Date(year, month, day);
renderDayCell(dateObj, items, grid);
}
} else {
const start = getWeekStart(state.currentDate);
for (let i = 0; i < 7; i++) {
const dateObj = new Date(start);
dateObj.setDate(start.getDate() + i);
renderDayCell(dateObj, items, grid);
}
}
}
function renderDayCell(dateObj, items, grid) {
const cell = document.createElement('div');
cell.className = 'day-cell';
if (state.viewType === 'WEEK') cell.style.minHeight = '300px';
const day = dateObj.getDate();
const month = dateObj.getMonth();
const year = dateObj.getFullYear();
const now = new Date();
if (day === now.getDate() && month === now.getMonth() && year === now.getFullYear()) {
cell.classList.add('today');
}
const dayEvents = items.filter(i => {
const eventDate = new Date(i.airingAt * 1000);
return eventDate.getDate() === day && eventDate.getMonth() === month && eventDate.getFullYear() === year;
});
dayEvents.sort((a, b) => b.media.popularity - a.media.popularity);
if (dayEvents.length > 0) {
const top = dayEvents[0].media;
const bg = document.createElement('div');
bg.className = 'cell-backdrop';
bg.style.backgroundImage = `url('${top.coverImage.large}')`;
cell.appendChild(bg);
}
const header = document.createElement('div');
header.className = 'day-header';
header.innerHTML = `
<span class="day-number">${day}</span>
<span class="today-label">Today</span>
`;
cell.appendChild(header);
const list = document.createElement('div');
list.className = 'events-list';
dayEvents.forEach(evt => {
const title = evt.media.title.english || evt.media.title.userPreferred;
const link = `/anime/${evt.media.id}`;
const chip = document.createElement('a');
chip.className = 'anime-chip';
chip.href = link;
chip.innerHTML = `
<span class="chip-title">${title}</span>
<span class="chip-ep">Ep ${evt.episode}</span>
`;
list.appendChild(chip);
});
cell.appendChild(list);
grid.appendChild(cell);
} }
function setLoading(bool) { function setLoading(bool) {
state.loading = bool; state.loading = bool;
const loader = document.getElementById('loader'); const loader = document.getElementById('loader');
if (loader) {
if (bool) loader.classList.add('active'); if (bool) loader.classList.add('active');
else loader.classList.remove('active'); else loader.classList.remove('active');
}
}
function updateAmbient(data) {
if (!data || !data.length) return;
const top = data.reduce((prev, curr) => (prev.media.popularity > curr.media.popularity) ? prev : curr, data[0]);
const img = top.media.bannerImage || top.media.coverImage.extraLarge;
const bgEl = document.getElementById('ambientBg');
if (bgEl && img) {
bgEl.style.backgroundImage = `url('${img}')`;
}
} }
function delay(ms) { return new Promise(r => setTimeout(r, ms)); } function delay(ms) { return new Promise(r => setTimeout(r, ms)); }
function updateAmbient(data) { async function getCache(key) {
if (!data || !data.length) return; try {
const top = data.reduce((prev, curr) => (prev.media.popularity > curr.media.popularity) ? prev : curr); const cache = await caches.open(CACHE_NAME);
const img = top.media.bannerImage || top.media.coverImage.large; const response = await cache.match(`/schedule-cache/${key}`);
if (img) document.getElementById('ambientBg').style.backgroundImage = `url('${img}')`; if (!response) return null;
const cached = await response.json();
const age = Date.now() - cached.timestamp;
if (age < CACHE_DURATION) {
console.log(`[Cache Hit] ${key}`);
return cached.data;
}
cache.delete(`/schedule-cache/${key}`);
return null;
} catch (e) {
return null;
}
} }
function getCacheKey() {
let d;
if (state.viewType === 'MONTH') {
d = new Date(state.currentDate.getFullYear(), state.currentDate.getMonth(), 1);
const year = d.getFullYear();
const month = String(d.getMonth() + 1).padStart(2, '0');
return `M_${year}_${month}`;
} else {
d = getWeekStart(state.currentDate);
const year = d.getFullYear();
const month = String(d.getMonth() + 1).padStart(2, '0');
const day = String(d.getDate()).padStart(2, '0');
return `W_${year}_${month}_${day}`;
}
}
async function setCache(key, data) {
try {
const cache = await caches.open(CACHE_NAME);
const payload = JSON.stringify({ timestamp: Date.now(), data: data });
const response = new Response(payload, { headers: { 'Content-Type': 'application/json' } });
await cache.put(`/schedule-cache/${key}`, response);
} catch (e) {
console.warn("Cache write failed", e);
}
}
window.navigate = navigate;
window.setViewType = setViewType;
window.setMode = setMode;
window.setFilter = setFilter;

View File

@@ -1,457 +1,440 @@
:root { :root {
--bg-glass: rgba(18, 18, 21, 0.8); --header-height: 140px;
--bg-cell: #0c0c0e;
--color-primary-glow: rgba(139, 92, 246, 0.3);
} }
body { body {
margin: 0; background-color: #050505;
background-color: var(--color-bg-base); overflow-x: hidden;
color: var(--color-text-primary);
overflow: hidden;
height: 100vh;
display: flex;
flex-direction: column;
}
html.electron body {
padding-top: 0;
} }
.ambient-bg { .ambient-bg {
position: absolute; position: fixed;
inset: 0; top: 0;
z-index: -1; left: 0;
background-size: cover;
background-position: center;
opacity: 0.06;
filter: blur(120px) saturate(1.2);
transition: background-image 1s ease-in-out;
pointer-events: none;
}
.calendar-wrapper {
flex: 1;
display: flex;
flex-direction: column;
overflow: hidden;
padding: 3rem;
max-width: 1920px;
width: 100%; width: 100%;
margin: 0 auto; height: 100%;
background-size: cover;
background-position: center top;
opacity: 0.15;
filter: blur(80px) saturate(1.5);
z-index: -2;
transition: background-image 1s ease;
} }
.calendar-controls { .bg-overlay {
padding: 1.5rem 0; position: fixed;
inset: 0;
background: radial-gradient(circle at top, transparent 0%, #050505 80%);
z-index: -1;
}
.schedule-container {
padding: calc(var(--nav-height) + 2rem) 3rem 2rem 3rem;
max-width: 1800px;
margin: 0 auto;
min-height: 100vh;
}
.schedule-header {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: flex-end;
flex-shrink: 0; margin-bottom: 2rem;
padding-bottom: 1.5rem;
border-bottom: 1px solid rgba(255,255,255,0.08);
flex-wrap: wrap;
gap: 1.5rem;
} }
.month-selector { .page-title {
font-size: 2.5rem;
font-weight: 900;
margin: 0 0 0.5rem 0;
letter-spacing: -1px;
}
.header-left {
display: flex;
flex-direction: column;
}
.month-navigator {
display: flex;
align-items: center;
gap: 1rem;
}
.current-date-label {
font-size: 1.2rem;
font-weight: 600;
color: var(--color-primary);
min-width: 180px;
text-align: center;
}
.nav-btn {
background: rgba(255,255,255,0.05);
border: 1px solid rgba(255,255,255,0.1);
color: white;
width: 32px;
height: 32px;
border-radius: 50%;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
transition: all 0.2s;
font-size: 1.2rem;
line-height: 0;
}
.nav-btn:hover {
background: var(--color-primary);
border-color: var(--color-primary);
}
.header-controls {
display: flex; display: flex;
align-items: center; align-items: center;
gap: 1.5rem; gap: 1.5rem;
} }
.month-title { .divider-vertical {
font-size: 2.2rem; width: 1px;
font-weight: 800; height: 30px;
letter-spacing: -0.03em; background: rgba(255,255,255,0.1);
background: linear-gradient(to right, #fff, #a1a1aa);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
min-width: 350px;
} }
.icon-btn { .toggle-group {
background: rgba(255, 255, 255, 0.03); background: rgba(0,0,0,0.3);
border: 1px solid var(--border-subtle); border: 1px solid rgba(255,255,255,0.1);
width: 44px;
height: 44px;
border-radius: 12px;
color: white;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
transition: 0.2s;
}
.icon-btn:hover {
background: var(--color-primary);
border-color: var(--color-primary);
transform: translateY(-2px);
}
.controls-right {
display: flex;
gap: 1rem;
}
.view-toggles {
display: flex;
background: #0f0f12;
padding: 4px; padding: 4px;
border-radius: 99px; border-radius: 99px;
border: 1px solid var(--border-subtle); display: flex;
box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3); gap: 4px;
} }
.toggle-item { .toggle-btn {
padding: 10px 24px;
border-radius: 99px;
border: none;
background: transparent; background: transparent;
border: none;
color: var(--color-text-secondary); color: var(--color-text-secondary);
padding: 6px 16px;
border-radius: 99px;
font-weight: 600; font-weight: 600;
font-size: 0.9rem; font-size: 0.9rem;
cursor: pointer; cursor: pointer;
transition: all 0.2s ease; transition: all 0.2s;
} }
.toggle-item.active { .toggle-btn:hover { color: white; }
background: var(--color-primary); .toggle-btn.active {
color: white;
box-shadow: 0 2px 10px var(--color-primary-glow);
}
.calendar-board {
flex: 1;
display: flex;
flex-direction: column;
overflow: hidden;
border: 1px solid var(--border-subtle);
border-radius: var(--radius-lg);
background: var(--color-bg-elevated); background: var(--color-bg-elevated);
box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5); color: white;
box-shadow: 0 2px 8px rgba(0,0,0,0.2);
} }
.weekdays-grid { .view-switcher {
display: grid;
grid-template-columns: repeat(7, 1fr);
border-bottom: 1px solid var(--border-subtle);
background: rgba(255, 255, 255, 0.02);
flex-shrink: 0;
}
.weekday-header {
padding: 16px;
text-align: center;
text-transform: uppercase;
font-size: 0.75rem;
font-weight: 800;
color: var(--color-text-secondary);
letter-spacing: 0.1em;
border-right: 1px solid var(--border-subtle);
}
.weekday-header:last-child {
border-right: none;
}
.days-grid {
display: grid;
grid-template-columns: repeat(7, 1fr);
width: 100%;
overflow-y: auto;
flex: 1;
grid-auto-rows: minmax(180px, 1fr);
background: var(--color-bg-base);
}
.day-cell {
position: relative;
background: var(--bg-cell);
border-right: 1px solid var(--border-subtle);
border-bottom: 1px solid var(--border-subtle);
display: flex; display: flex;
flex-direction: column; gap: 0.5rem;
padding: 12px;
transition: background 0.2s;
overflow: hidden;
} }
.day-cell:nth-child(7n) { .view-btn {
border-right: none; background: transparent;
} border: 1px solid rgba(255,255,255,0.1);
.day-cell.empty {
background: rgba(0, 0, 0, 0.2);
pointer-events: none;
}
.day-cell:hover {
background: #16161a;
}
.day-cell.today {
background: rgba(139, 92, 246, 0.03);
box-shadow: inset 0 0 0 1px var(--color-primary);
}
.day-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 12px;
z-index: 2;
pointer-events: none;
}
.day-number {
font-size: 1.1rem;
font-weight: 700;
color: var(--color-text-secondary); color: var(--color-text-secondary);
width: 32px; width: 40px;
height: 32px; height: 40px;
border-radius: 8px;
cursor: pointer;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
border-radius: 50%; transition: all 0.2s;
} }
.day-cell.today .day-number { .view-btn:hover { border-color: white; color: white; }
.view-btn.active {
background: var(--color-primary); background: var(--color-primary);
border-color: var(--color-primary);
color: white; color: white;
box-shadow: 0 0 15px var(--color-primary-glow);
} }
.today-label { .calendar-grid {
font-size: 0.65rem; display: grid;
font-weight: 800; grid-template-columns: repeat(7, 1fr);
color: var(--color-primary); gap: 1px;
letter-spacing: 0.05em; background: rgba(255,255,255,0.05);
text-transform: uppercase; border: 1px solid rgba(255,255,255,0.05);
display: none; border-radius: 12px;
}
.day-cell.today .today-label {
display: block;
}
.events-list {
flex: 1;
display: flex;
flex-direction: column;
gap: 6px;
overflow-y: auto;
z-index: 2;
padding-right: 4px;
}
.events-list::-webkit-scrollbar {
width: 4px;
}
.events-list::-webkit-scrollbar-thumb {
background: rgba(255, 255, 255, 0.1);
border-radius: 4px;
}
.anime-chip {
display: flex;
align-items: center;
justify-content: space-between;
background: rgba(255, 255, 255, 0.03);
border: 1px solid rgba(255, 255, 255, 0.05);
padding: 8px 10px;
border-radius: 8px;
font-size: 0.8rem;
color: #d4d4d8;
text-decoration: none;
transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
cursor: pointer;
position: relative;
overflow: hidden; overflow: hidden;
} }
.anime-chip::before { .weekday-header {
content: ""; background: var(--color-bg-card);
position: absolute; padding: 1rem;
left: 0; text-align: center;
top: 0;
bottom: 0;
width: 3px;
background: var(--color-primary);
opacity: 0;
transition: opacity 0.2s;
}
.anime-chip:hover {
background: rgba(255, 255, 255, 0.1);
color: white;
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
padding-left: 14px;
}
.anime-chip:hover::before {
opacity: 1;
}
.chip-title {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
font-weight: 500;
margin-right: 8px;
}
.chip-ep {
font-size: 0.7rem;
font-weight: 700; font-weight: 700;
color: var(--color-text-secondary); color: var(--color-text-secondary);
background: rgba(0, 0, 0, 0.4); font-size: 0.9rem;
padding: 2px 6px; text-transform: uppercase;
border-radius: 4px; letter-spacing: 1px;
white-space: nowrap;
} }
.cell-backdrop { .day-cell {
position: absolute; background: var(--color-bg-base);
inset: 0; min-height: 160px;
background-size: cover; max-height: 160px;
background-position: center; padding: 0.8rem;
opacity: 0; position: relative;
transition: opacity 0.4s ease; display: flex;
filter: grayscale(100%) brightness(0.25); flex-direction: column;
z-index: 1; gap: 0.5rem;
pointer-events: none;
overflow-y: auto;
scrollbar-width: none;
-ms-overflow-style: none;
} }
.day-cell:hover .cell-backdrop { .day-cell::-webkit-scrollbar { display: none; }
opacity: 1; .day-cell.empty { background: rgba(0,0,0,0.2); }
} .day-cell.today { background: rgba(139, 92, 246, 0.05); box-shadow: inset 0 0 0 1px var(--color-primary); }
.loader { .day-number {
position: fixed; font-weight: 700;
bottom: 30px; font-size: 1rem;
right: 30px; color: var(--color-text-secondary);
background: #18181b; margin-bottom: 4px;
border: 1px solid var(--border-subtle); display: block;
padding: 12px 24px; }
border-radius: 99px; .today .day-number { color: var(--color-primary); }
.anime-item-month {
display: flex; display: flex;
align-items: center; align-items: center;
gap: 12px; gap: 8px;
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5); padding: 6px;
transform: translateY(100px); background: rgba(255,255,255,0.03);
transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1); border-radius: 6px;
z-index: 1000; text-decoration: none;
transition: 0.2s;
border-left: 2px solid transparent;
} }
.loader.active { .anime-item-month:hover {
transform: translateY(0); background: rgba(255,255,255,0.08);
transform: translateX(2px);
}
.anime-item-month.is-mine {
border-left-color: var(--color-success);
background: rgba(34, 197, 94, 0.05);
} }
.spinner { .item-time { font-size: 0.75rem; color: var(--color-text-muted); font-family: monospace; }
width: 18px; .item-title { font-size: 0.8rem; color: #ddd; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
height: 18px;
border: 2px solid rgba(255, 255, 255, 0.1); .week-container {
border-top-color: var(--color-primary); display: flex;
border-radius: 50%; flex-direction: column;
animation: spin 0.8s infinite linear; gap: 2rem;
} }
@keyframes spin { .week-nav {
to { display: flex;
transform: rotate(360deg); gap: 1rem;
overflow-x: auto;
padding-bottom: 1rem;
scrollbar-width: none;
mask-image: linear-gradient(to right, black 90%, transparent 100%);
}
.week-nav::-webkit-scrollbar { display: none; }
.day-btn {
flex: 1;
min-width: 120px;
background: rgba(255, 255, 255, 0.03);
border: 1px solid rgba(255, 255, 255, 0.08);
color: var(--color-text-secondary);
border-radius: 12px;
padding: 1rem;
cursor: pointer;
transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
text-align: center;
display: flex;
flex-direction: column;
gap: 0.5rem;
}
.day-btn:hover {
background: rgba(255, 255, 255, 0.08);
color: white;
transform: translateY(-2px);
border-color: rgba(255, 255, 255, 0.2);
}
.day-btn.active {
background: var(--color-primary);
border-color: var(--color-primary);
color: white;
box-shadow: 0 8px 20px var(--color-primary-glow);
}
.day-btn span.name {
font-size: 0.9rem;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 1px;
opacity: 0.8;
}
.day-btn span.date {
font-size: 1.8rem;
font-weight: 800;
line-height: 1;
}
.week-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
gap: 1.5rem;
animation: fadeInUp 0.4s ease;
}
.card-ep-badge {
position: absolute;
top: 8px;
right: 8px;
background: rgba(0,0,0,0.8);
color: var(--color-primary);
padding: 4px 8px;
border-radius: 4px;
font-size: 0.8rem;
font-weight: 800;
border: 1px solid rgba(139, 92, 246, 0.3);
}
.card.mine .card-img-wrap {
box-shadow: 0 0 0 2px var(--color-success);
}
.card.mine::after {
content: "IN LIST";
position: absolute;
top: 8px; left: 8px;
background: var(--color-success);
color: black;
font-size: 0.65rem;
font-weight: 900;
padding: 2px 6px;
border-radius: 4px;
}
.loader-overlay {
position: fixed;
inset: 0;
background: rgba(0,0,0,0.6);
backdrop-filter: blur(5px);
display: flex;
justify-content: center;
align-items: center;
z-index: 999;
opacity: 0;
pointer-events: none;
transition: opacity 0.3s;
}
.loader-overlay.active { opacity: 1; pointer-events: auto; }
@media (max-width: 1024px) {
.schedule-container {
padding: 5rem 1.5rem 2rem 1.5rem;
} }
} }
@media (max-width: 768px) { @media (max-width: 768px) {
body {
height: auto;
overflow-y: auto;
overflow-x: hidden;
}
.calendar-wrapper { .schedule-header {
padding: 1rem;
height: auto;
overflow: visible;
display: block;
}
.calendar-controls {
flex-direction: column; flex-direction: column;
gap: 1rem; align-items: stretch;
padding-bottom: 1rem; gap: 1.5rem;
} }
.month-selector { .header-left {
align-items: center;
width: 100%; width: 100%;
justify-content: space-between;
gap: 0.5rem;
} }
.month-title { .header-controls {
font-size: 1.5rem; flex-wrap: wrap;
min-width: auto;
text-align: center;
flex: 1;
}
.controls-right {
width: 100%;
justify-content: center; justify-content: center;
width: 100%;
gap: 1rem;
} }
.calendar-board { .page-title {
border: none; font-size: 2rem;
background: transparent; text-align: center;
box-shadow: none;
overflow: visible;
} }
.weekdays-grid { .calendar-grid {
display: none;
}
.days-grid {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 1rem; gap: 1rem;
background: transparent; background: transparent;
height: auto; border: none;
overflow: visible;
} }
.day-cell.empty { .weekday-header, .day-cell.empty { display: none; }
display: none;
}
.day-cell { .day-cell {
border: 1px solid var(--border-subtle);
border-radius: var(--radius-lg);
background: var(--color-bg-elevated);
min-height: auto; min-height: auto;
padding: 1rem; max-height: none;
overflow: visible;
border: 1px solid rgba(255,255,255,0.08);
border-radius: 12px;
background: var(--color-bg-elevated);
} }
.day-cell:nth-child(7n) { .week-nav {
border-right: 1px solid var(--border-subtle); margin: 0 -1.5rem;
padding: 0 1.5rem 1rem 1.5rem;
} }
.day-header { .day-btn {
border-bottom: 1px solid rgba(255, 255, 255, 0.05); min-width: 90px;
padding-bottom: 0.5rem; padding: 0.8rem;
margin-bottom: 0.8rem; }
.day-btn span.name { font-size: 0.75rem; }
.day-btn span.date { font-size: 1.5rem; }
.week-grid {
grid-template-columns: repeat(2, 1fr);
gap: 0.75rem;
} }
.day-number { .week-grid .card {
background: rgba(255, 255, 255, 0.05); min-width: 0 !important;
width: 100% !important;
flex: none !important;
} }
.anime-chip { .card-content h3 { font-size: 0.8rem; }
padding: 12px; .card-ep-badge { font-size: 0.65rem; padding: 2px 4px; }
font-size: 0.95rem; }
}
.cell-backdrop { @media (max-width: 380px) {
display: none; .header-controls {
gap: 0.5rem;
}
.toggle-btn {
padding: 6px 10px;
font-size: 0.8rem;
}
.nav-btn {
width: 28px;
height: 28px;
}
.current-date-label {
font-size: 1rem;
min-width: 140px;
} }
} }

View File

@@ -4,67 +4,65 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>WaifuBoard - Schedule</title> <title>WaifuBoard - Schedule</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link rel="icon" href="/public/assets/waifuboards.ico" type="image/x-icon"> <link rel="icon" href="/public/assets/waifuboards.ico" type="image/x-icon">
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;900&display=swap" rel="stylesheet"> <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap" rel="stylesheet">
<link rel="stylesheet" href="/views/css/globals.css"> <link rel="stylesheet" href="/views/css/globals.css">
<link rel="stylesheet" href="/views/css/schedule/schedule.css"> <link rel="stylesheet" href="/views/css/schedule/schedule.css">
<link rel="stylesheet" href="/views/css/components/navbar.css"> <link rel="stylesheet" href="/views/css/components/navbar.css">
<link rel="stylesheet" href="/views/css/components/create-room.css"/>
<link rel="stylesheet" href="/views/css/components/updateNotifier.css"> <link rel="stylesheet" href="/views/css/components/updateNotifier.css">
<link rel="stylesheet" href="/views/css/components/create-room.css"/>
</head> </head>
<body> <body>
<div class="ambient-bg" id="ambientBg"></div> <div class="ambient-bg" id="ambientBg"></div>
<div class="bg-overlay"></div>
<div class="calendar-wrapper"> <div class="schedule-container">
<div class="calendar-controls">
<div class="month-selector"> <header class="schedule-header">
<button class="icon-btn" onclick="navigate(-1)"> <div class="header-left">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M15 18l-6-6 6-6"/></svg> <h1 class="page-title">Release Schedule</h1>
<div class="month-navigator">
<button class="nav-btn" onclick="navigate(-1)"></button>
<span id="monthTitle" class="current-date-label">Loading...</span>
<button class="nav-btn" onclick="navigate(1)"></button>
</div>
</div>
<div class="header-controls">
<div class="toggle-group" id="filter-group" style="display: none;">
<button class="toggle-btn active" id="btnAll" onclick="setFilter('ALL')">All</button>
<button class="toggle-btn" id="btnMyList" onclick="setFilter('MY_LIST')">My List</button>
</div>
<div class="divider-vertical"></div>
<div class="toggle-group">
<button class="toggle-btn active" id="btnSub" onclick="setMode('SUB')">Sub</button>
<button class="toggle-btn" id="btnDub" onclick="setMode('DUB')">Dub</button>
</div>
<div class="view-switcher">
<button class="view-btn active" id="btnViewMonth" onclick="setViewType('MONTH')" title="Month View">
<svg width="20" height="20" fill="none" stroke="currentColor" viewBox="0 0 24 24"><rect x="3" y="4" width="18" height="18" rx="2" ry="2"></rect><line x1="16" y1="2" x2="16" y2="6"></line><line x1="8" y1="2" x2="8" y2="6"></line><line x1="3" y1="10" x2="21" y2="10"></line></svg>
</button> </button>
<div class="month-title" id="monthTitle">Loading...</div> <button class="view-btn" id="btnViewWeek" onclick="setViewType('WEEK')" title="Week View">
<button class="icon-btn" onclick="navigate(1)"> <svg width="20" height="20" fill="none" stroke="currentColor" viewBox="0 0 24 24"><rect x="3" y="4" width="18" height="18" rx="2" ry="2"></rect><line x1="16" y1="2" x2="16" y2="6"></line><line x1="8" y1="2" x2="8" y2="6"></line><line x1="3" y1="10" x2="21" y2="10"></line><path d="M8 14h.01"/><path d="M12 14h.01"/><path d="M16 14h.01"/><path d="M8 18h.01"/><path d="M12 18h.01"/><path d="M16 18h.01"/></svg>
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M9 18l6-6-6-6"/></svg>
</button> </button>
</div> </div>
</div>
</header>
<div class="controls-right"> <main id="schedule-content">
</main>
<div class="view-toggles"> </div>
<button class="toggle-item active" id="btnViewMonth" onclick="setViewType('MONTH')">Month</button>
<button class="toggle-item" id="btnViewWeek" onclick="setViewType('WEEK')">Week</button>
</div>
<div class="view-toggles"> <div class="loader-overlay" id="loader">
<button class="toggle-item active" id="btnSub" onclick="setMode('SUB')">Sub</button>
<button class="toggle-item" id="btnDub" onclick="setMode('DUB')">Dub</button>
</div>
</div>
</div>
<div class="calendar-board">
<div class="weekdays-grid">
<div class="weekday-header">Mon</div>
<div class="weekday-header">Tue</div>
<div class="weekday-header">Wed</div>
<div class="weekday-header">Thu</div>
<div class="weekday-header">Fri</div>
<div class="weekday-header">Sat</div>
<div class="weekday-header">Sun</div>
</div>
<div class="days-grid" id="daysGrid">
</div>
</div>
</div>
<div class="loader" id="loader">
<div class="spinner"></div> <div class="spinner"></div>
<span id="loadingText">Syncing Schedule...</span> </div>
</div>
<div id="updateToast" class="hidden"> <div id="updateToast" class="hidden">
<p>Update available: <span id="latestVersionDisplay">v1.x</span></p> <p>Update available: <span id="latestVersionDisplay">v1.x</span></p>
<a <a
@@ -74,12 +72,12 @@
> >
Click To Download Click To Download
</a> </a>
</div> </div>
<script src="/src/scripts/updateNotifier.js"></script> <script src="/src/scripts/room-modal.js"></script>
<link rel="stylesheet" href="/views/css/components/create-room.css"/> <script src="/src/scripts/auth-guard.js"></script>
<script src="/src/scripts/schedule/schedule.js"></script> <script src="/src/scripts/schedule/schedule.js"></script>
<script src="/src/scripts/auth-guard.js"></script> <script src="/src/scripts/updateNotifier.js"></script>
<script src="/src/scripts/settings.js"></script> <script src="/src/scripts/settings.js"></script>
</body> </body>
</html> </html>