Compare commits

...

2 Commits

Author SHA1 Message Date
𓍼
526ec4f236 Merge branch 'main' of https://gitea.sentt.lol/sent/waves 2025-06-05 22:50:24 -05:00
𓍼
f78a14b79c Something 2025-06-05 22:49:17 -05:00
8 changed files with 613 additions and 616 deletions

View File

@ -14,19 +14,39 @@
<link rel="stylesheet" href="/assets/css/settings.css"> <link rel="stylesheet" href="/assets/css/settings.css">
<link rel="stylesheet" href="/assets/css/toast.css"> <link rel="stylesheet" href="/assets/css/toast.css">
<link rel="stylesheet" href="/assets/css/a.css"> <link rel="stylesheet" href="/assets/css/a.css">
<link rel="stylesheet" href="/assets/css/nprogress.css">
<link href="https://cdn.jsdelivr.net/gh/aquawolf04/font-awesome-pro@5cd1511/css/all.css" rel="stylesheet"> <link href="https://cdn.jsdelivr.net/gh/aquawolf04/font-awesome-pro@5cd1511/css/all.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/nprogress/0.2.0/nprogress.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/nprogress/0.2.0/nprogress.min.js"></script>
<script async src="https://www.googletagmanager.com/gtag/js?id=G-WGJ2192JZY"></script><script>window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'G-WGJ2192JZY');</script> <script async src="https://www.googletagmanager.com/gtag/js?id=G-WGJ2192JZY"></script><script>window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'G-WGJ2192JZY');</script>
<script type='text/javascript' src='//pl26200262.effectiveratecpm.com/f0/e8/15/f0e81559842363ebf19aa99900ff2d02.js'></script> <!-- Cool little title animation :D-->
<script>
document.addEventListener('DOMContentLoaded', function () {
NProgress.configure({ showSpinner: false });
NProgress.start();
const titleElement = document.querySelector('.search-title');
if (titleElement) {
const text = titleElement.textContent.trim();
titleElement.textContent = '';
text.split('').forEach((letter, i) => {
const span = document.createElement('span');
span.textContent = letter;
span.style.animationDelay = `${i * 0.05}s`;
titleElement.appendChild(span);
});
}
window.addEventListener('load', function () {
NProgress.done();
});
});
</script>
</head> </head>
<body> <body>
<script src="/baremux/index.js"></script> <script src="/baremux/index.js"></script>
<script src="/assets/js/nprogress.js?v=0.2.0"></script> <script src="/assets/js/nprogress.js?v=0.2.0"></script>
<script src="/wah/uv.bundle.js" defer></script> <script src="/wah/uv.bundle.js" defer></script>
<script src="/wah/cute1.js" defer></script> <script src="/wah/cute1.js" defer></script>
<script src="/assets/js/navbar.js?v=2.8.4" defer></script>
<script src="/assets/js/load.js?v=2.8.4" defer></script>
<script src="/assets/js/eruda.js?v=2.8.4" defer></script> <script src="/assets/js/eruda.js?v=2.8.4" defer></script>
<script src="/assets/js/register.js?v=2.8.5" defer></script> <script src="/assets/js/register.js?v=2.8.5" defer></script>
<script src="/assets/js/settings.js?v=2.8.7" defer></script> <script src="/assets/js/settings.js?v=2.8.7" defer></script>
@ -34,7 +54,6 @@
<script src="/assets/js/shortcuts.js?v=2.8.4" defer></script> <script src="/assets/js/shortcuts.js?v=2.8.4" defer></script>
<script src="/assets/js/$.js?v=2.8.4" defer></script> <script src="/assets/js/$.js?v=2.8.4" defer></script>
<script src="/assets/js/a.js?v=2.8.4" defer></script> <script src="/assets/js/a.js?v=2.8.4" defer></script>
<script src="/assets/js/wv.js?v=2.8.4" defer></script>
<script src="/assets/js/wv.js?v=1.4.1" defer></script> <script src="/assets/js/wv.js?v=1.4.1" defer></script>
<div class="relative flex flex-col h-[100vh] items-center justify-center bg-black transition-bg"> <div class="relative flex flex-col h-[100vh] items-center justify-center bg-black transition-bg">
<div class="absolute inset-0 overflow-hidden"> <div class="absolute inset-0 overflow-hidden">
@ -99,15 +118,5 @@
<div id="erudaLoadingScreen" style="display: none;">Eruda is loading...</div> <div id="erudaLoadingScreen" style="display: none;">Eruda is loading...</div>
<iframe id="cool-iframe" class="iframe"></iframe> <iframe id="cool-iframe" class="iframe"></iframe>
<script type='text/javascript' src='//pl26200346.effectiveratecpm.com/08/db/84/08db842da9b43ad3d13c14634f9fd1c8.js'></script> <script type='text/javascript' src='//pl26200346.effectiveratecpm.com/08/db/84/08db842da9b43ad3d13c14634f9fd1c8.js'></script>
<script type="text/javascript">
atOptions = {
'key' : '26bce7e7832b24b139944832990cf69d',
'format' : 'iframe',
'height' : 300,
'width' : 160,
'params' : {}
};
</script>
<script type="text/javascript" src="//spaniardinformationbookworm.com/26bce7e7832b24b139944832990cf69d/invoke.js"></script>
</body> </body>
</html> </html>

View File

@ -18,15 +18,37 @@
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/nprogress/0.2.0/nprogress.min.css"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/nprogress/0.2.0/nprogress.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/nprogress/0.2.0/nprogress.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/nprogress/0.2.0/nprogress.min.js"></script>
<script async src="https://www.googletagmanager.com/gtag/js?id=G-WGJ2192JZY"></script><script>window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'G-WGJ2192JZY');</script> <script async src="https://www.googletagmanager.com/gtag/js?id=G-WGJ2192JZY"></script><script>window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'G-WGJ2192JZY');</script>
<script type='text/javascript' src='//pl26200262.effectiveratecpm.com/f0/e8/15/f0e81559842363ebf19aa99900ff2d02.js'></script> <script type='text/javascript' src='//pl26200262.effectiveratecpm.com/f0/e8/15/f0e81559842363ebf19aa99900ff2d02.js'></script>
<!-- Cool little title animation :D-->
<script>
document.addEventListener('DOMContentLoaded', function () {
NProgress.configure({ showSpinner: false });
NProgress.start();
const titleElement = document.querySelector('.search-title');
if (titleElement) {
const text = titleElement.textContent.trim();
titleElement.textContent = '';
text.split('').forEach((letter, i) => {
const span = document.createElement('span');
span.textContent = letter;
span.style.animationDelay = `${i * 0.05}s`;
titleElement.appendChild(span);
});
}
window.addEventListener('load', function () {
NProgress.done();
});
});
</script>
</head> </head>
<body> <body>
<script src="/baremux/index.js"></script> <script src="/baremux/index.js"></script>
<script src="/assets/js/nprogress.js?v=0.2.0"></script> <script src="/assets/js/nprogress.js?v=0.2.0"></script>
<script src="/wah/uv.bundle.js" defer></script> <script src="/wah/uv.bundle.js" defer></script>
<script src="/wah/cute1.js" defer></script> <script src="/wah/cute1.js" defer></script>
<script src="/assets/js/navbar.js?v=2.8.4" defer></script>
<script src="/assets/js/load.js?v=2.8.4" defer></script>
<script src="/assets/js/eruda.js?v=2.8.4" defer></script> <script src="/assets/js/eruda.js?v=2.8.4" defer></script>
<script src="/assets/js/register.js?v=2.8.5" defer></script> <script src="/assets/js/register.js?v=2.8.5" defer></script>
<script src="/assets/js/settings.js?v=2.8.7" defer></script> <script src="/assets/js/settings.js?v=2.8.7" defer></script>
@ -98,15 +120,5 @@
<div id="erudaLoadingScreen" style="display: none;">Eruda is loading...</div> <div id="erudaLoadingScreen" style="display: none;">Eruda is loading...</div>
<iframe id="cool-iframe" class="iframe"></iframe> <iframe id="cool-iframe" class="iframe"></iframe>
<script type='text/javascript' src='//pl26200346.effectiveratecpm.com/08/db/84/08db842da9b43ad3d13c14634f9fd1c8.js'></script> <script type='text/javascript' src='//pl26200346.effectiveratecpm.com/08/db/84/08db842da9b43ad3d13c14634f9fd1c8.js'></script>
<script type="text/javascript">
atOptions = {
'key' : '26bce7e7832b24b139944832990cf69d',
'format' : 'iframe',
'height' : 300,
'width' : 160,
'params' : {}
};
</script>
<script type="text/javascript" src="//spaniardinformationbookworm.com/26bce7e7832b24b139944832990cf69d/invoke.js"></script>
</body> </body>
</html> </html>

View File

@ -15,26 +15,43 @@
<link rel="stylesheet" href="/assets/css/toast.css"> <link rel="stylesheet" href="/assets/css/toast.css">
<link rel="stylesheet" href="/assets/css/nprogress.css"> <link rel="stylesheet" href="/assets/css/nprogress.css">
<link href="https://cdn.jsdelivr.net/gh/aquawolf04/font-awesome-pro@5cd1511/css/all.css" rel="stylesheet"> <link href="https://cdn.jsdelivr.net/gh/aquawolf04/font-awesome-pro@5cd1511/css/all.css" rel="stylesheet">
<script async src="https://www.googletagmanager.com/gtag/js?id=G-WGJ2192JZY"></script> <script async src="https://www.googletagmanager.com/gtag/js?id=G-WGJ2192JZY"></script><script>window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'G-WGJ2192JZY');</script>
<!-- Cool little title animation :D-->
<script> <script>
window.dataLayer=window.dataLayer||[];function gtag(){dataLayer.push(arguments);}gtag('js',new Date());gtag('config','G-WGJ2192JZY'); document.addEventListener('DOMContentLoaded', function () {
NProgress.configure({ showSpinner: false });
NProgress.start();
const titleElement = document.querySelector('.search-title');
if (titleElement) {
const text = titleElement.textContent.trim();
titleElement.textContent = '';
text.split('').forEach((letter, i) => {
const span = document.createElement('span');
span.textContent = letter;
span.style.animationDelay = `${i * 0.05}s`;
titleElement.appendChild(span);
});
}
window.addEventListener('load', function () {
NProgress.done();
});
});
</script> </script>
<script type="text/javascript" src="//pl26200262.effectiveratecpm.com/f0/e8/15/f0e81559842363ebf19aa99900ff2d02.js"></script>
</head> </head>
<body> <body>
<script src="/baremux/index.js"></script> <script src="/baremux/index.js"></script>
<script src="/assets/js/nprogress.js?v=0.2.0"></script> <script src="/assets/js/nprogress.js?v=0.2.0"></script>
<script src="/wah/uv.bundle.js" defer></script> <script src="/wah/uv.bundle.js" defer></script>
<script src="/wah/cute1.js" defer></script> <script src="/wah/cute1.js" defer></script>
<script src="/assets/js/navbar.js?v=2.8.4" defer></script>
<script src="/assets/js/load.js?v=2.8.5" defer></script>
<script src="/assets/js/eruda.js?v=2.8.4" defer></script> <script src="/assets/js/eruda.js?v=2.8.4" defer></script>
<script src="/assets/js/register.js?v=2.8.4" defer></script> <script src="/assets/js/register.js?v=2.8.4" defer></script>
<script src="/assets/js/settings.js?v=2.8.8" defer></script> <script src="/assets/js/settings.js?v=2.8.8" defer></script>
<script src="/assets/js/ping.js?v=2.8.4" defer></script> <script src="/assets/js/ping.js?v=2.8.4" defer></script>
<script src="/assets/js/greetings.js?v=2.8.4" defer></script> <script src="/assets/js/greetings.js?v=2.8.4" defer></script>
<script src="/assets/js/shortcuts.js?v=2.8.4" defer></script> <script src="/assets/js/shortcuts.js?v=2.8.4" defer></script>
<script src="/assets/js/latest-commit.js?v=2.8.4" defer></script>
<script src="/assets/js/$.js?v=2.8.4" defer></script> <script src="/assets/js/$.js?v=2.8.4" defer></script>
<script src="/assets/js/wv.js?v=1.4.1" defer></script> <script src="/assets/js/wv.js?v=1.4.1" defer></script>

View File

@ -1,293 +1,470 @@
document.addEventListener('DOMContentLoaded', () => { document.addEventListener('DOMContentLoaded', () => {
const historyStack = [] window.APP = {};
let currentIndex = -1
const refreshIcon = document.getElementById('refreshIcon') const iframe = document.getElementById('cool-iframe');
const fullscreenIcon = document.getElementById('fullscreenIcon') const erudaLoadingScreen = document.getElementById('erudaLoadingScreen');
const backIcon = document.getElementById('backIcon') const searchInput1 = document.getElementById('searchInput');
const forwardIcon = document.getElementById('forwardIcon') const movies = document.getElementById('movies');
const iframe = document.getElementById('cool-iframe') const ai = document.getElementById('ai');
const erudaLoadingScreen = document.getElementById('erudaLoadingScreen') const topBar = document.querySelector('.topbar');
if (!refreshIcon || !fullscreenIcon || !backIcon || !forwardIcon || !iframe) return const refreshIcon = document.getElementById('refreshIcon');
const originalTitle = document.title const fullscreenIcon = document.getElementById('fullscreenIcon');
let loadingHidden = false const backIcon = document.getElementById('backIcon');
function showLoadingScreen(withToast = true, showEruda = false) { const forwardIcon = document.getElementById('forwardIcon');
loadingHidden = false const searchInput2 = document.getElementById('searchInputt');
NProgress.start() const lockIcon = document.getElementById('lockIcon');
document.title = 'Loading... <3' const navbarToggle = document.getElementById('navbar-toggle');
if (withToast) { const navBar = document.querySelector('.navbar');
showToast(
'Consider joining our <a href="https://discord.gg/dJvdkPRheV" target="_blank" class="hover-link">Discord</a>&nbsp;<3', const historyStack = [];
'success', let currentIndex = -1;
'heart' const originalTitle = document.title;
) let isLoading = false;
}
} if (!iframe || !refreshIcon || !fullscreenIcon || !backIcon || !forwardIcon) {
function hideLoadingScreen() { return;
if (loadingHidden) return }
loadingHidden = true
NProgress.done() const animationStyle = document.createElement('style');
document.title = originalTitle animationStyle.textContent = `
} @keyframes slideLeft {0% { transform: translateX(0); } 50% { transform: translateX(-5px); } 100% { transform: translateX(0); }}
refreshIcon.addEventListener('click', () => { @keyframes slideRight {0% { transform: translateX(0); } 50% { transform: translateX(5px); } 100% { transform: translateX(0); }}
refreshIcon.classList.add('spin') .button-animate-back { animation: slideLeft 0.3s ease-in-out; }
if (iframe.tagName === 'IFRAME') { .button-animate-forward { animation: slideRight 0.3s ease-in-out; }
const currentUrl = iframe.contentWindow.location.href .spin { animation: spinAnimation 0.3s linear; }
if (normalizeUrl(currentUrl) !== normalizeUrl(historyStack[currentIndex] || '')) { @keyframes spinAnimation { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
addToHistory(currentUrl) `;
} document.head.appendChild(animationStyle);
iframe.contentWindow.location.reload(true)
} function showLoadingScreen(withToast = true) {
setTimeout(() => refreshIcon.classList.remove('spin'), 300) if (isLoading) return;
}) isLoading = true;
fullscreenIcon.addEventListener('click', () => { if (typeof NProgress !== 'undefined') NProgress.start();
if (iframe.requestFullscreen) iframe.requestFullscreen()
else if (iframe.mozRequestFullScreen) iframe.mozRequestFullScreen() if (withToast) {
else if (iframe.webkitRequestFullscreen) iframe.webkitRequestFullscreen() showToast(
else if (iframe.msRequestFullscreen) iframe.msRequestFullscreen() 'Consider joining our <a href="https://discord.gg/dJvdkPRheV" target="_blank" class="hover-link">Discord</a>&nbsp;<3',
}) 'success',
backIcon.addEventListener('click', () => { 'heart'
if (currentIndex > 0) { );
currentIndex-- }
iframe.src = historyStack[currentIndex] }
showLoadingScreen(false, false)
updateNavButtons() function hideLoadingScreen() {
updateDecodedSearchInput() if (!isLoading) return;
} if (typeof NProgress !== 'undefined') NProgress.done();
}) document.title = originalTitle;
forwardIcon.addEventListener('click', () => { isLoading = false;
if (currentIndex < historyStack.length - 1) { if (erudaLoadingScreen) erudaLoadingScreen.style.display = 'none';
currentIndex++ }
iframe.src = historyStack[currentIndex]
showLoadingScreen(false, false) function normalizeUrl(urlStr) {
updateNavButtons() if (!urlStr || urlStr === 'about:blank') return urlStr;
updateDecodedSearchInput() try {
} const url = new URL(urlStr);
}) url.searchParams.delete('ia');
function normalizeUrl(urlStr) { return url.toString();
try { } catch {
const url = new URL(urlStr) return urlStr;
url.searchParams.delete('ia') }
return url.toString() }
} catch {
return urlStr function decodeUrl(encodedUrl) {
} if (!encodedUrl) return '';
} try {
function addToHistory(url) { const prefix = (typeof __uv$config !== 'undefined' && __uv$config.prefix) ? __uv$config.prefix : '/wa/a/';
const normalized = normalizeUrl(url) const decodeFunction = (typeof __uv$config !== 'undefined' && __uv$config.decodeUrl) ? __uv$config.decodeUrl : decodeURIComponent;
if (currentIndex >= 0 && normalizeUrl(historyStack[currentIndex]) === normalized) return const urlObject = new URL(encodedUrl, window.location.origin);
if (currentIndex < historyStack.length - 1) historyStack.splice(currentIndex + 1) if (urlObject.pathname.startsWith(prefix)) {
historyStack.push(url) const encodedPart = urlObject.pathname.slice(prefix.length);
currentIndex++ return decodeFunction(encodedPart) + urlObject.search + urlObject.hash;
updateNavButtons() }
updateDecodedSearchInput() } catch {}
} try {
function updateNavButtons() { return decodeURIComponent(encodedUrl);
backIcon.disabled = currentIndex <= 0 } catch {
forwardIcon.disabled = currentIndex >= historyStack.length - 1 return encodedUrl;
backIcon.classList.toggle('disabled', currentIndex <= 0) }
forwardIcon.classList.toggle('disabled', currentIndex >= historyStack.length - 1) }
}
function updateDecodedSearchInput() { function updateNavButtons() {
const searchInput2 = document.getElementById('searchInputt') if (!backIcon || !forwardIcon) return;
if (!searchInput2) return const canGoBack = currentIndex > 0;
let url = '' const canGoForward = currentIndex < historyStack.length - 1;
if (currentIndex >= 0 && historyStack[currentIndex]) { backIcon.disabled = !canGoBack;
url = historyStack[currentIndex] forwardIcon.disabled = !canGoForward;
} else if (iframe.src) { backIcon.classList.toggle('disabled', !canGoBack);
url = iframe.src forwardIcon.classList.toggle('disabled', !canGoForward);
} }
searchInput2.value = decodeUrl(url)
const lockIcon = document.getElementById('lockIcon') function updateDecodedSearchInput() {
if (lockIcon) { if (!searchInput2) return;
lockIcon.className = decodeUrl(url).startsWith('https://') ? let currentUrl = '';
'fa-regular fa-lock' : if (currentIndex >= 0 && historyStack[currentIndex]) {
'fa-regular fa-lock-open' currentUrl = historyStack[currentIndex];
lockIcon.style.color = '' } else if (iframe.src && iframe.src !== 'about:blank') {
} currentUrl = iframe.src;
} }
iframe.addEventListener('load', () => { const decoded = decodeUrl(currentUrl);
try { searchInput2.value = decoded;
hideLoadingScreen()
} catch { if (lockIcon) {
hideLoadingScreen() const isSecure = decoded.startsWith('https://');
} finally { lockIcon.className = isSecure ? 'fa-regular fa-lock' : 'fa-regular fa-lock-open';
if (erudaLoadingScreen) erudaLoadingScreen.style.display = 'none' }
} }
})
iframe.addEventListener('error', () => { function addToHistory(url, isReplacingCurrent = false) {
hideLoadingScreen() if (!url || url === 'about:blank') return;
})
iframe.addEventListener('loadstart', () => { const normalizedNewUrl = normalizeUrl(url);
const navBar = document.querySelector('.navbar') const currentHistoryEntry = historyStack[currentIndex];
const navbarToggle = document.getElementById('navbar-toggle') const normalizedCurrentHistoryEntry = currentIndex >= 0 ? normalizeUrl(currentHistoryEntry) : null;
if (navbarToggle && navbarToggle.checked && navBar) navBar.style.display = 'block'
showLoadingScreen(false, false) if (isReplacingCurrent && currentIndex >= 0) {
}) if (normalizedCurrentHistoryEntry !== normalizedNewUrl || currentHistoryEntry !== url) {
const navBar = document.querySelector('.navbar') historyStack[currentIndex] = url;
const topBar = document.querySelector('.topbar') } else {
const searchInput1 = document.getElementById('searchInput') return;
const searchInput2 = document.getElementById('searchInputt') }
const movies = document.getElementById('movies') } else {
const ai = document.getElementById('ai') if (normalizedCurrentHistoryEntry === normalizedNewUrl && currentHistoryEntry === url) {
const navbarToggle = document.getElementById('navbar-toggle') return;
if (navbarToggle && navBar) { }
const savedNavbarState = localStorage.getItem('navbarToggled') if (currentIndex < historyStack.length - 1) {
navbarToggle.checked = savedNavbarState === null ? true : savedNavbarState === 'true' historyStack.splice(currentIndex + 1);
navBar.style.display = iframe.style.display === 'block' && navbarToggle.checked ? 'block' : 'none' }
navbarToggle.addEventListener('change', () => { historyStack.push(url);
localStorage.setItem('navbarToggled', navbarToggle.checked) currentIndex++;
navBar.style.display = iframe.style.display === 'block' && navbarToggle.checked ? 'block' : 'none' }
}) updateNavButtons();
} updateDecodedSearchInput();
iframe.style.display = 'none' }
window.addEventListener('load', hideLoadingScreen)
;[searchInput1, searchInput2].forEach(input => { function generateSubject() {
if (input) { const subjects = ['math', 'science', 'history', 'art', 'programming', 'philosophy'];
input.addEventListener('keyup', e => { const randomSubject = subjects[Math.floor(Math.random() * subjects.length)];
if (e.key === 'Enter') { try {
const val = input.value.trim() history.replaceState({}, '', `/learning?subject=${randomSubject}`);
if (val) handleSearch(val) } catch(e) {}
else showToast('Please enter something in the Search Bar.', 'error', 'warning') }
}
}) function setupIframeNavigationListeners() {
} try {
}) const iframeWindow = iframe.contentWindow;
if (movies) movies.addEventListener('click', e => { if (!iframeWindow || iframeWindow === window || iframeWindow.location.href === 'about:blank') return;
e.preventDefault()
handleSearch('https://movies.usewaves.site/') const handleNav = (isReplace = false) => {
}) setTimeout(() => {
if (ai) ai.addEventListener('click', e => { try {
e.preventDefault() const newUrlInIframe = iframeWindow.location.href;
handleSearch('https://ai.usewaves.site/') if (newUrlInIframe === 'about:blank' && historyStack[currentIndex] === 'about:blank') return;
}) addToHistory(newUrlInIframe, isReplace);
function clearBackground() { } catch (e) {}
const preserved = [ }, 0);
document.querySelector('.navbar'), };
document.getElementById('cool-iframe'),
document.querySelector('.loading-screen'), if (!iframeWindow.history.pushState.__isPatched) {
erudaLoadingScreen const originalPushState = iframeWindow.history.pushState;
] iframeWindow.history.pushState = function(...args) {
Array.from(document.body.children).forEach(child => { originalPushState.apply(this, args);
if (!preserved.includes(child)) child.remove() handleNav(false);
}) };
} iframeWindow.history.pushState.__isPatched = true;
async function handleSearch(query) { }
if (!query || !query.trim()) { if (!iframeWindow.history.replaceState.__isPatched) {
showToast('Please enter something in the Search Bar.', 'error', 'warning') const originalReplaceState = iframeWindow.history.replaceState;
return iframeWindow.history.replaceState = function(...args) {
} originalReplaceState.apply(this, args);
clearBackground() handleNav(true);
let searchURL };
if ( iframeWindow.history.replaceState.__isPatched = true;
query.startsWith('/assets/g/') || }
query.startsWith(window.location.origin + '/assets/g/')
) { iframeWindow.removeEventListener('popstate', iframeWindow.__popstateHandler);
searchURL = query iframeWindow.__popstateHandler = () => handleNav(false);
} else { iframeWindow.addEventListener('popstate', iframeWindow.__popstateHandler);
searchURL = generateSearchUrl(query)
} iframeWindow.removeEventListener('hashchange', iframeWindow.__hashchangeHandler);
if (searchInput2) searchInput2.value = searchURL iframeWindow.__hashchangeHandler = () => handleNav(false);
historyStack.length = 0 iframeWindow.addEventListener('hashchange', iframeWindow.__hashchangeHandler);
currentIndex = -1 } catch (error) {}
showLoadingScreen(true, false) }
iframe.style.display = 'block'
if (topBar) topBar.style.display = 'none' iframe.addEventListener('loadstart', () => {
backIcon.disabled = forwardIcon.disabled = true showLoadingScreen(false);
let finalUrl if (navbarToggle && navbarToggle.checked && navBar) {
try { navBar.style.display = 'block';
const u = new URL(searchURL, window.location.origin) }
if (u.origin === window.location.origin && u.pathname.startsWith('/assets/g/')) { });
finalUrl = u.href
} else { iframe.addEventListener('load', () => {
finalUrl = await getUrl(searchURL) hideLoadingScreen();
} try {
} catch { const newUrl = iframe.contentWindow ? iframe.contentWindow.location.href : iframe.src;
finalUrl = await getUrl(searchURL) if (newUrl && newUrl !== 'about:blank') {
} if (currentIndex === -1 || normalizeUrl(historyStack[currentIndex]) !== normalizeUrl(newUrl) || historyStack[currentIndex] !== newUrl ) {
iframe.src = finalUrl addToHistory(newUrl);
iframe.onload = () => { } else if (historyStack[currentIndex] !== newUrl) {
hideLoadingScreen() addToHistory(newUrl, true);
if (navbarToggle && navbarToggle.checked && navBar) navBar.style.display = 'block' }
generateSubject() } else if (newUrl === 'about:blank' && historyStack.length > 0 && historyStack[currentIndex] !== 'about:blank') {
updateDecodedSearchInput() if (currentIndex > 0) {
} const previousUrl = historyStack[currentIndex -1];
iframe.onerror = () => { currentIndex--;
hideLoadingScreen() iframe.src = previousUrl;
} return;
} }
window.handleSearch = handleSearch }
function generateSearchUrl(query) { setupIframeNavigationListeners();
try { generateSubject();
return new URL(query).toString() if (navbarToggle && navbarToggle.checked && navBar) {
} catch { navBar.style.display = 'block';
try { }
const u = new URL(`https://${query}`) } catch (error) {
if (u.hostname.includes('.')) return u.toString() } finally {
} catch {} updateNavButtons();
} updateDecodedSearchInput();
return `https://duckduckgo.com/search?q=${encodeURIComponent(query)}&ia=web` }
} });
function showToast(message, type = 'success', iconType = 'check') {
const toast = document.createElement('div') iframe.addEventListener('error', () => {
toast.className = `toast show ${type}` hideLoadingScreen();
const icons = { showToast('Error: Could not load page content.', 'error', 'times-circle');
success: '<i class="fa-regular fa-check-circle" style="margin-right: 8px;"></i>', updateNavButtons();
error: '<i class="fa-regular fa-times-circle" style="margin-right: 8px;"></i>', updateDecodedSearchInput();
info: '<i class="fa-regular fa-info-circle" style="margin-right: 8px;"></i>', });
warning: '<i class="fa-regular fa-exclamation-triangle" style="margin-right: 8px;"></i>',
heart: '<i class="fa-solid fa-heart" style="margin-right: 8px;"></i>' function toggleButtonAnimation(button, animationClass) {
} if (button) {
const icon = icons[iconType] || icons.heart button.classList.add(animationClass);
toast.innerHTML = `${icon}${message} ` setTimeout(() => button.classList.remove(animationClass), 200);
const progressBar = document.createElement('div') }
progressBar.className = 'progress-bar' }
toast.appendChild(progressBar)
const closeBtn = document.createElement('button') backIcon.addEventListener('click', () => {
closeBtn.className = 'toast-close' toggleButtonAnimation(backIcon, 'button-animate-back');
closeBtn.innerHTML = '<i class="fa-solid fa-xmark" style="margin-left: 8px; font-size: 0.8em;"></i>' if (currentIndex > 0) {
closeBtn.addEventListener('click', () => { currentIndex--;
toast.classList.add('hide') showLoadingScreen(false);
setTimeout(() => toast.remove(), 500) iframe.src = historyStack[currentIndex];
}) updateNavButtons();
toast.appendChild(closeBtn) updateDecodedSearchInput();
document.body.appendChild(toast) }
setTimeout(() => { });
toast.classList.add('hide')
setTimeout(() => toast.remove(), 500) forwardIcon.addEventListener('click', () => {
}, 3000) toggleButtonAnimation(forwardIcon, 'button-animate-forward');
} if (currentIndex < historyStack.length - 1) {
function preloadResources(url) { currentIndex++;
if (!url) return showLoadingScreen(false);
try { iframe.src = historyStack[currentIndex];
const link = document.createElement('link') updateNavButtons();
link.rel = 'preload' updateDecodedSearchInput();
link.href = url }
link.as = 'fetch' });
link.crossOrigin = 'anonymous'
document.head.appendChild(link) refreshIcon.addEventListener('click', () => {
} catch {} if (refreshIcon) refreshIcon.classList.add('spin');
} if (iframe.contentWindow) {
function getUrl(url) { showLoadingScreen(false);
return Promise.resolve(__uv$config.prefix + __uv$config.encodeUrl(url)) const currentIframeUrl = iframe.contentWindow.location.href;
} if (normalizeUrl(currentIframeUrl) !== normalizeUrl(historyStack[currentIndex] || '')) {
function generateSubject() { addToHistory(currentIframeUrl);
const subjects = ['math', 'science', 'history', 'art', 'programming', 'philosophy'] }
const random = subjects[Math.floor(Math.random() * subjects.length)] iframe.contentWindow.location.reload(true);
history.replaceState({}, '', '/learning?subject=' + random) }
} if (refreshIcon) setTimeout(() => refreshIcon.classList.remove('spin'), 300);
function decodeUrl(enc) { });
try {
const o = new URL(enc, window.location.origin) fullscreenIcon.addEventListener('click', () => {
const p = (__uv$config && __uv$config.prefix) || '/wa/a/' if (iframe.requestFullscreen) iframe.requestFullscreen();
if (o.pathname.startsWith(p)) { else if (iframe.mozRequestFullScreen) iframe.mozRequestFullScreen();
const part = o.pathname.slice(p.length) else if (iframe.webkitRequestFullscreen) iframe.webkitRequestFullscreen();
return (__uv$config.decodeUrl ? __uv$config.decodeUrl(part) : decodeURIComponent(part)) else if (iframe.msRequestFullscreen) iframe.msRequestFullscreen();
} });
} catch {}
return enc function generateSearchUrl(query) {
} query = query.trim();
window.decodeUrl = decodeUrl if (!query) return `https://duckduckgo.com/?q=&ia=web`;
window.addToHistory = addToHistory
window.updateDecodedSearchInput = updateDecodedSearchInput if (/^[a-zA-Z]+:\/\//.test(query)) {
window.normalizeUrl = normalizeUrl try {
}) new URL(query);
return query;
} catch (e) {}
}
if (/^(localhost|(\d{1,3}\.){3}\d{1,3})(:\d+)?(\/.*)?$/.test(query) || query.toLowerCase() === "localhost") {
if (!query.toLowerCase().startsWith("http:") && !query.toLowerCase().startsWith("https:")) {
return `http://${query}`;
}
return query;
}
try {
const urlWithHttps = new URL(`https://${query}`);
if (urlWithHttps.hostname &&
urlWithHttps.hostname.includes('.') &&
!urlWithHttps.hostname.endsWith('.') &&
urlWithHttps.hostname !== '.' &&
urlWithHttps.hostname.split('.').pop().length >= 2 &&
!/^\d+$/.test(urlWithHttps.hostname.split('.').pop())
) {
return urlWithHttps.toString();
}
} catch (e) {}
return `https://duckduckgo.com/?q=${encodeURIComponent(query)}&ia=web`;
}
async function getUrl(url) {
if (typeof __uv$config !== 'undefined' && __uv$config.encodeUrl) {
return Promise.resolve(__uv$config.prefix + __uv$config.encodeUrl(url));
}
return Promise.resolve(url);
}
function clearBackground() {
const preservedElements = [
navBar, iframe, document.querySelector('.loading-screen'),
erudaLoadingScreen, topBar
].filter(el => el != null);
Array.from(document.body.children).forEach(child => {
if (!preservedElements.includes(child) && child.tagName !== 'SCRIPT' && child.tagName !== 'STYLE' && !child.classList.contains('toast')) {
child.remove();
}
});
}
async function handleSearch(query) {
if (!query || !query.trim()) {
showToast('Please enter something in the Search Bar.', 'error', 'warning');
return;
}
clearBackground();
let searchURL = generateSearchUrl(query);
historyStack.length = 0;
currentIndex = -1;
updateNavButtons();
showLoadingScreen(true);
iframe.style.display = 'block';
if (topBar) topBar.style.display = 'flex';
if (navBar && navbarToggle && navbarToggle.checked) navBar.style.display = 'block';
let finalUrlToLoad;
if (searchURL.startsWith(window.location.origin + '/assets/g/')) {
finalUrlToLoad = searchURL;
} else if (searchURL.startsWith('/assets/g/')) {
finalUrlToLoad = new URL(searchURL, window.location.origin).href;
}
else {
try {
const tempUrl = new URL(searchURL);
if (tempUrl.origin === window.location.origin && tempUrl.pathname.startsWith('/assets/g/')) {
finalUrlToLoad = tempUrl.href;
} else { finalUrlToLoad = await getUrl(searchURL); }
} catch (e) { finalUrlToLoad = await getUrl(searchURL); }
}
if (searchInput2) searchInput2.value = decodeUrl(finalUrlToLoad);
iframe.src = finalUrlToLoad;
}
window.APP.handleSearch = handleSearch;
[searchInput1, searchInput2].forEach(input => {
if (input) {
input.addEventListener('keyup', e => {
if (e.key === 'Enter') {
const queryValue = input.value.trim();
if (queryValue) {
APP.handleSearch(queryValue);
if (input === searchInput1) searchInput1.value = '';
} else {
showToast('Please enter something in the Search Bar.', 'error', 'warning');
}
}
});
if (input === searchInput2) {
input.addEventListener('focus', updateDecodedSearchInput);
}
}
});
if (movies) movies.addEventListener('click', e => { e.preventDefault(); APP.handleSearch('https://movies.usewaves.site/'); });
if (ai) ai.addEventListener('click', e => { e.preventDefault(); APP.handleSearch('https://ai.usewaves.site/'); });
function showToast(message, type = 'success', iconType = 'check') {
const toast = document.createElement('div');
toast.className = `toast show ${type}`;
const icons = { 'check': 'fa-regular fa-check-circle', 'times-circle': 'fa-regular fa-times-circle', 'info': 'fa-regular fa-info-circle', 'warning': 'fa-regular fa-exclamation-triangle', 'heart': 'fa-solid fa-heart' };
toast.innerHTML = `<i class="${icons[iconType] || icons.heart}" style="margin-right: 8px;"></i>${message}`;
const progressBar = document.createElement('div'); progressBar.className = 'progress-bar'; toast.appendChild(progressBar);
const closeBtn = document.createElement('button'); closeBtn.className = 'toast-close';
closeBtn.innerHTML = '<i class="fa-solid fa-xmark" style="margin-left: 8px; font-size: 0.8em;"></i>';
closeBtn.onclick = () => { toast.classList.add('hide'); setTimeout(() => toast.remove(), 500); };
toast.appendChild(closeBtn);
document.body.appendChild(toast);
setTimeout(() => { toast.classList.add('hide'); setTimeout(() => toast.remove(), 500); }, 3000);
}
if (navbarToggle && navBar && iframe) {
const savedNavbarState = localStorage.getItem('navbarToggled');
const defaultChecked = iframe.style.display !== 'block' ? true : (savedNavbarState === null ? false : savedNavbarState === 'true');
navbarToggle.checked = defaultChecked;
const updateNavbarDisplayBasedOnToggle = () => {
if (iframe.style.display === 'block') {
navBar.style.display = navbarToggle.checked ? 'block' : 'none';
} else {
navBar.style.display = 'none';
}
};
updateNavbarDisplayBasedOnToggle();
navbarToggle.addEventListener('change', () => {
localStorage.setItem('navbarToggled', navbarToggle.checked.toString());
updateNavbarDisplayBasedOnToggle();
});
window.APP.updateNavbarDisplay = updateNavbarDisplayBasedOnToggle;
}
window.addEventListener('load', () => {
let iframeInitiallyHidden = true;
if (iframe.src && iframe.src !== 'about:blank') {
iframeInitiallyHidden = false;
}
if (iframeInitiallyHidden) {
hideLoadingScreen();
if (topBar) topBar.style.display = 'flex';
iframe.style.display = 'none';
} else {
if (topBar) topBar.style.display = 'flex';
iframe.style.display = 'block';
}
if(window.APP.updateNavbarDisplay) window.APP.updateNavbarDisplay();
updateNavButtons();
updateDecodedSearchInput();
});
window.APP.decodeUrl = decodeUrl;
window.APP.normalizeUrl = normalizeUrl;
});
(async () => {
try {
const res = await fetch('/api/github-updates');
const { updates } = await res.json();
const u = updates[0];
const commitUrl = `https://github.com/xojw/waves/commit/${u.sha}`;
document.getElementById('lastest-commit').innerHTML =
`<a href="${commitUrl}" class="hover-link" target="_blank" rel="noopener noreferrer"><i class="fa-solid fa-code-commit"></i> ${u.sha}</a>`;
} catch {
document.getElementById('lastest-commit').textContent =
'Failed to load lastest commit';
}
})();

View File

@ -28,7 +28,6 @@ function submitName() {
updateGreeting(name); updateGreeting(name);
document.getElementById('namePrompt').classList.add('fade-out'); document.getElementById('namePrompt').classList.add('fade-out');
showToast(`Hey, ${name}! Welcome to Waves!`, 'success', 'wave'); showToast(`Hey, ${name}! Welcome to Waves!`, 'success', 'wave');
setTimeout(() => { setTimeout(() => {
document.getElementById('namePrompt').style.display = 'none'; document.getElementById('namePrompt').style.display = 'none';
document.getElementById('overlay').style.display = 'none'; document.getElementById('overlay').style.display = 'none';
@ -52,40 +51,92 @@ function getIconType(path) {
return 'wave'; return 'wave';
} }
function updateGreeting(name) { const generalGreetings = [
const { text, icon } = getGreeting(); { text: 'Welcome aboard', icon: '<i class="fa-regular fa-rocket"></i>', suffix: '!' },
{ text: 'Hii', icon: '<i class="fa-regular fa-hand-wave"></i>', suffix: '!!' },
{ text: 'Hope you enjoy Waves', icon: '<i class="fa-solid fa-heart"></i>', suffix: ' <3' },
{ text: 'Consider joining our Discord (discord.gg/ire)', icon: '<i class="fa-solid fa-smile"></i>', suffix: '!' },
{ text: 'How you doing today', icon: '<i class="fa-regular fa-question"></i>', suffix: '?' }
];
const el = document.getElementById('greeting'); const timeGreetings = [];
if (el) {
if (text === 'Hope you enjoy Waves') { timeGreetings.push(
el.innerHTML = `${icon} ${text}, ${name} <3`; { text: 'Good morning, sunshine', icon: '<i class="fa-regular fa-sun"></i>', suffix: ' :D' },
} else { { text: 'Heres to a bright morning', icon: '<i class="fa-regular fa-cloud-sun"></i>', suffix: '.' },
el.innerHTML = `${icon} ${text}, ${name}!`; { text: 'Enjoy your morning', icon: '<i class="fa-regular fa-mug-hot"></i>', suffix: '!' },
} { text: 'Your day starts here', icon: '<i class="fa-regular fa-star"></i>', suffix: ' !' }
el.style.opacity = 1; );
timeGreetings.push(
{ text: 'Good afternoon', icon: '<i class="fa-regular fa-leaf"></i>', suffix: '!' },
{ text: 'Hope your day is going well', icon: '<i class="fa-regular fa-coffee"></i>', suffix: '.' },
{ text: 'Keep up the pace', icon: '<i class="fa-regular fa-book"></i>', suffix: '!' },
{ text: 'Stay on track today', icon: '<i class="fa-regular fa-sun"></i>', suffix: '.' }
);
timeGreetings.push(
{ text: 'Good evening', icon: '<i class="fa-regular fa-cloud-moon"></i>', suffix: '!' },
{ text: 'Time to unwind', icon: '<i class="fa-regular fa-fire"></i>', suffix: '.' },
{ text: 'Evenings here—relax', icon: '<i class="fa-regular fa-star"></i>', suffix: '.' },
{ text: 'Breathe and recharge', icon: '<i class="fa-regular fa-moon"></i>', suffix: '…' }
);
timeGreetings.push(
{ text: 'Good night', icon: '<i class="fa-regular fa-bed"></i>', suffix: '!' },
{ text: 'Rest well', icon: '<i class="fa-regular fa-blanket"></i>', suffix: '.' },
{ text: 'Sweet dreams', icon: '<i class="fa-regular fa-star-and-crescent"></i>', suffix: '!' },
{ text: 'See you tomorrow', icon: '<i class="fa-regular fa-moon"></i>', suffix: '!' }
);
function getGreeting() {
const now = new Date();
const hour = now.getHours();
let pool = [];
if (hour >= 5 && hour < 12) {
pool = timeGreetings.slice(0, 4);
} else if (hour < 17) {
pool = timeGreetings.slice(4, 8);
} else if (hour < 21) {
pool = timeGreetings.slice(8, 12);
} else {
pool = timeGreetings.slice(12, 16);
} }
if (Math.random() < 0.5) {
pool = generalGreetings;
}
const choice = pool[Math.floor(Math.random() * pool.length)];
return { text: choice.text, icon: choice.icon, suffix: choice.suffix };
}
function updateGreeting(name) {
const { text, icon, suffix } = getGreeting();
const el = document.getElementById('greeting');
if (!el) return;
if (text === 'Hope you enjoy Waves') {
el.innerHTML = `${icon} ${text}, ${name}${suffix}`;
} else {
el.innerHTML = `${icon} ${text}, ${name}${suffix}`;
}
el.style.opacity = 1;
} }
function showToast(message, type = 'success', iconType = 'wave') { function showToast(message, type = 'success', iconType = 'wave') {
const toast = document.createElement('div'); const toast = document.createElement('div');
toast.className = `toast show ${type}`; toast.className = `toast show ${type}`;
const icons = { const icons = {
success: '<i class="fas fa-check-circle" style="margin-right: 8px;"></i>', success: '<i class="fas fa-check-circle" style="margin-right: 8px;"></i>',
error: '<i class="fas fa-times-circle" style="margin-right: 8px;"></i>', error: '<i class="fas fa-times-circle" style="margin-right: 8px;"></i>',
info: '<i class="fas fa-info-circle" style="margin-right: 8px;"></i>', info: '<i class="fas fa-info-circle" style="margin-right: 8px;"></i>',
warning: '<i class="fas fa-exclamation-triangle" style="margin-right: 8px;"></i>', warning: '<i class="fas fa-exclamation-triangle" style="margin-right: 8px;"></i>',
wave: '<i class="fa-regular fa-hand-wave" style="margin-right: 8px;"></i>', wave: '<i class="fa-regular fa-hand-wave" style="margin-right: 8px;"></i>',
game: '<i class="fa-regular fa-gamepad" style="margin-right: 8px;"></i>', game: '<i class="fa-regular fa-gamepad" style="margin-right: 8px;"></i>',
apps: '<i class="fa-regular fa-th" style="margin-right: 8px;"></i>', apps: '<i class="fa-regular fa-th" style="margin-right: 8px;"></i>'
}; };
toast.innerHTML = `${icons[iconType] || icons.wave}${message}`; toast.innerHTML = `${icons[iconType] || icons.wave}${message}`;
const progressBar = document.createElement('div'); const progressBar = document.createElement('div');
progressBar.className = 'progress-bar'; progressBar.className = 'progress-bar';
toast.appendChild(progressBar); toast.appendChild(progressBar);
const closeBtn = document.createElement('button'); const closeBtn = document.createElement('button');
closeBtn.className = 'toast-close'; closeBtn.className = 'toast-close';
closeBtn.innerHTML = '<i class="fas fa-xmark" style="margin-left: 8px; font-size: 0.8em;"></i>'; closeBtn.innerHTML = '<i class="fas fa-xmark" style="margin-left: 8px; font-size: 0.8em;"></i>';
@ -94,61 +145,9 @@ function showToast(message, type = 'success', iconType = 'wave') {
setTimeout(() => toast.remove(), 500); setTimeout(() => toast.remove(), 500);
}); });
toast.appendChild(closeBtn); toast.appendChild(closeBtn);
document.body.appendChild(toast); document.body.appendChild(toast);
setTimeout(() => { setTimeout(() => {
toast.classList.add('hide'); toast.classList.add('hide');
setTimeout(() => toast.remove(), 500); setTimeout(() => toast.remove(), 500);
}, 3000); }, 3000);
}
function getGreeting() {
const now = new Date();
const hour = now.getHours();
const timeGreetings = [];
const generalGreetings = [
{ text: 'Welcome aboard', icon: '<i class="fa-regular fa-rocket"></i>' },
{ text: 'Lets do something great', icon: '<i class="fa-regular fa-lightbulb"></i>' },
{ text: 'Hope you enjoy Waves', icon: '<i class="fa-solid fa-heart"></i>' },
{ text: 'Time to explore', icon: '<i class="fa-regular fa-compass"></i>' },
{ text: 'Lets roll', icon: '<i class="fa-regular fa-tire"></i>' },
{ text: 'Consider joining our Discord (discord.gg/ire)', icon: '<i class="fa-solid fa-smile"></i>' },
{ text: 'The adventure continues', icon: '<i class="fa-regular fa-map"></i>' }
];
if (hour >= 5 && hour < 12) {
timeGreetings.push(
{ text: 'Good morning, sunshine', icon: '<i class="fa-regular fa-sun"></i>' },
{ text: 'Heres to a bright morning', icon: '<i class="fa-regular fa-cloud-sun"></i>' },
{ text: 'Enjoy your morning', icon: '<i class="fa-regular fa-mug-hot"></i>' },
{ text: 'Your day starts here', icon: '<i class="fa-regular fa-star"></i>' }
);
} else if (hour < 17) {
timeGreetings.push(
{ text: 'Good afternoon', icon: '<i class="fa-regular fa-leaf"></i>' },
{ text: 'Hope your day is going well', icon: '<i class="fa-regular fa-coffee"></i>' },
{ text: 'Keep up the pace', icon: '<i class="fa-regular fa-book"></i>' },
{ text: 'Stay on track today', icon: '<i class="fa-regular fa-sun"></i>' }
);
} else if (hour < 21) {
timeGreetings.push(
{ text: 'Good evening', icon: '<i class="fa-regular fa-cloud-moon"></i>' },
{ text: 'Time to unwind', icon: '<i class="fa-regular fa-fire"></i>' },
{ text: 'Evenings here—relax', icon: '<i class="fa-regular fa-star"></i>' },
{ text: 'Breathe and recharge', icon: '<i class="fa-regular fa-moon"></i>' }
);
} else {
timeGreetings.push(
{ text: 'Good night', icon: '<i class="fa-regular fa-bed"></i>' },
{ text: 'Rest well', icon: '<i class="fa-regular fa-blanket"></i>' },
{ text: 'Sweet dreams', icon: '<i class="fa-regular fa-star-and-crescent"></i>' },
{ text: 'See you tomorrow', icon: '<i class="fa-regular fa-moon"></i>' }
);
}
const useGeneral = Math.random() < 0.5;
const pool = useGeneral ? generalGreetings : timeGreetings;
return pool[Math.floor(Math.random() * pool.length)];
} }

View File

@ -1,13 +0,0 @@
(async () => {
try {
const res = await fetch('/api/latest-commit');
const { updates } = await res.json();
const u = updates[0];
const commitUrl = `https://github.com/xojw/waves/commit/${u.sha}`;
document.getElementById('lastest-commit').innerHTML =
`<a href="${commitUrl}" class="hover-link" target="_blank" rel="noopener noreferrer"><i class="fa-solid fa-code-commit"></i> ${u.sha}</a>`;
} catch {
document.getElementById('lastest-commit').textContent =
'Failed to load lastest commit';
}
})();

View File

@ -1,21 +0,0 @@
document.addEventListener('DOMContentLoaded', function () {
NProgress.configure({ showSpinner: false });
NProgress.start();
const titleElement = document.querySelector('.search-title');
if (titleElement) {
const text = titleElement.textContent.trim();
titleElement.textContent = '';
text.split('').forEach((letter, i) => {
const span = document.createElement('span');
span.textContent = letter;
span.style.animationDelay = `${i * 0.05}s`;
titleElement.appendChild(span);
});
}
window.addEventListener('load', function () {
NProgress.done();
});
});

View File

@ -1,183 +0,0 @@
const style = document.createElement('style');
style.textContent = `
@keyframes slideLeft {0% { transform: translateX(0); } 50% { transform: translateX(-5px); } 100% { transform: translateX(0); }}
@keyframes slideRight {0% { transform: translateX(0); } 50% { transform: translateX(5px); } 100% { transform: translateX(0); }}
.button-animate-back { animation: slideLeft 0.3s ease-in-out; }
.button-animate-forward { animation: slideRight 0.3s ease-in-out; }
`;
document.head.appendChild(style);
const historyStack = [];
let currentIndex = -1;
const elements = {
refreshIcon: document.getElementById('refreshIcon'),
fullscreenIcon: document.getElementById('fullscreenIcon'),
backIcon: document.getElementById('backIcon'),
forwardIcon: document.getElementById('forwardIcon'),
searchInput2: document.getElementById('searchInputt'),
iframe: document.getElementById('cool-iframe')
};
const originalTitle = document.title;
let loadingFallbackTimeout;
elements.refreshIcon.addEventListener('click', handleRefresh);
elements.fullscreenIcon.addEventListener('click', handleFullscreen);
elements.backIcon.addEventListener('click', handleBack);
elements.forwardIcon.addEventListener('click', handleForward);
function showLoadingScreen() {
if (typeof NProgress !== 'undefined') {
NProgress.start();
document.title = 'Loading... <3';
setTimeout(() => {
if (typeof NProgress !== 'undefined') NProgress.done();
}, 10000);
}
}
function hideLoadingScreen() {
if (typeof NProgress !== 'undefined') NProgress.done();
document.title = originalTitle;
}
function handleRefresh() {
elements.refreshIcon.classList.add('spin');
const iframe = elements.iframe;
const currentUrl = iframe.contentWindow.location.href;
if (normalizeUrl(currentUrl) !== normalizeUrl(historyStack[currentIndex] || '')) {
addToHistory(currentUrl);
}
iframe.contentWindow.location.reload(true);
setTimeout(() => elements.refreshIcon.classList.remove('spin'), 300);
}
function handleFullscreen() {
const iframe = elements.iframe;
if (iframe && iframe.tagName === 'IFRAME') iframe.requestFullscreen();
}
function handleBack() {
toggleButtonAnimation(elements.backIcon, 'button-animate-back');
if (currentIndex > 0) {
currentIndex--;
updateIframeSrc();
}
}
function handleForward() {
toggleButtonAnimation(elements.forwardIcon, 'button-animate-forward');
if (currentIndex < historyStack.length - 1) {
currentIndex++;
updateIframeSrc();
}
}
function toggleButtonAnimation(button, animationClass) {
button.classList.add(animationClass);
setTimeout(() => button.classList.remove(animationClass), 200);
}
function normalizeUrl(urlStr) {
try {
const url = new URL(urlStr);
url.searchParams.delete('ia');
return url.toString();
} catch (e) {
return urlStr;
}
}
function addToHistory(url) {
const normalized = normalizeUrl(url);
if (currentIndex >= 0 && normalizeUrl(historyStack[currentIndex]) === normalized) return;
if (currentIndex < historyStack.length - 1) historyStack.splice(currentIndex + 1);
historyStack.push(url);
currentIndex++;
updateNavButtons();
updateDecodedSearchInput();
}
function updateIframeSrc() {
showLoadingScreen();
elements.iframe.src = historyStack[currentIndex];
updateNavButtons();
updateDecodedSearchInput();
}
function updateNavButtons() {
const isAtStart = currentIndex <= 0;
const isAtEnd = currentIndex >= historyStack.length - 1;
elements.backIcon.disabled = isAtStart;
elements.forwardIcon.disabled = isAtEnd;
elements.backIcon.classList.toggle('disabled', isAtStart);
elements.forwardIcon.classList.toggle('disabled', isAtEnd);
}
function updateDecodedSearchInput() {
if (elements.searchInput2) {
const url = historyStack[currentIndex] || elements.iframe.src;
elements.searchInput2.value = decodeUrl(url);
}
}
function decodeUrl(url) {
try {
return decodeURIComponent(url);
} catch (e) {
return url;
}
}
window.addToHistory = addToHistory;
window.updateDecodedSearchInput = updateDecodedSearchInput;
window.normalizeUrl = normalizeUrl;
function detectIframeNavigation() {
try {
const iframeWindow = elements.iframe.contentWindow;
const pushState = iframeWindow.history.pushState;
const replaceState = iframeWindow.history.replaceState;
iframeWindow.history.pushState = function() {
pushState.apply(this, arguments);
handleIframeNavigation(iframeWindow.location.href);
};
iframeWindow.history.replaceState = function() {
replaceState.apply(this, arguments);
handleIframeNavigation(iframeWindow.location.href);
};
iframeWindow.addEventListener('popstate', () => handleIframeNavigation(iframeWindow.location.href));
iframeWindow.addEventListener('hashchange', () => handleIframeNavigation(iframeWindow.location.href));
} catch (error) {}
}
function handleIframeNavigation(rawUrl) {
let urlStr = rawUrl;
try {
urlStr = decodeUrl(rawUrl);
} catch {}
try {
const u = new URL(urlStr);
if (u.hostname.endsWith('duckduckgo.com')) {
if (typeof NProgress !== 'undefined') NProgress.done();
return;
}
} catch (e) {}
if (normalizeUrl(urlStr) !== normalizeUrl(historyStack[currentIndex] || '')) {
showLoadingScreen();
addToHistory(urlStr);
} else {
hideLoadingScreen();
}
}
elements.iframe.addEventListener('load', () => {
try {
detectIframeNavigation();
if (historyStack.length === 0) {
addToHistory(elements.iframe.contentWindow.location.href);
} else {
handleIframeNavigation(elements.iframe.contentWindow.location.href);
}
} catch (error) {}
hideLoadingScreen();
});