forked from sent/waves
Shortcuts
This commit is contained in:
parent
a21cb430a3
commit
2e8fb40eb7
|
@ -8,7 +8,7 @@
|
||||||
<meta property="og:image" content="/assets/images/icons/favicon.ico"/>
|
<meta property="og:image" content="/assets/images/icons/favicon.ico"/>
|
||||||
<meta name="theme-color" content="#ffffff"/>
|
<meta name="theme-color" content="#ffffff"/>
|
||||||
<meta name="msapplication-TileColor" content="#ffffff"/>
|
<meta name="msapplication-TileColor" content="#ffffff"/>
|
||||||
<title>Waves.</title>
|
<title>Waves</title>
|
||||||
<link rel="icon" type="image/x-icon" href="/assets/images/icons/favicon.ico">
|
<link rel="icon" type="image/x-icon" href="/assets/images/icons/favicon.ico">
|
||||||
<link rel="stylesheet" href="/assets/css/$.css">
|
<link rel="stylesheet" href="/assets/css/$.css">
|
||||||
<link rel="stylesheet" href="/assets/css/settings.css">
|
<link rel="stylesheet" href="/assets/css/settings.css">
|
||||||
|
@ -30,6 +30,7 @@
|
||||||
<script src="/assets/js/register.js" defer></script>
|
<script src="/assets/js/register.js" defer></script>
|
||||||
<script src="/assets/js/settings.js" defer></script>
|
<script src="/assets/js/settings.js" defer></script>
|
||||||
<script src="/assets/js/greetings.js" defer></script>
|
<script src="/assets/js/greetings.js" defer></script>
|
||||||
|
<script src="/assets/js/shortcuts.js" defer></script>
|
||||||
<script src="/assets/js/$.js" defer></script>
|
<script src="/assets/js/$.js" defer></script>
|
||||||
<script src="/assets/js/a.js" defer></script>
|
<script src="/assets/js/a.js" 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">
|
||||||
|
@ -55,7 +56,6 @@
|
||||||
<li><a id="backIcon" href="#"><i class="fa-regular fa-arrow-left"></i></a></li>
|
<li><a id="backIcon" href="#"><i class="fa-regular fa-arrow-left"></i></a></li>
|
||||||
<li><a id="refreshIcon" href="#"><i class="fa-regular fa-rotate-right"></i></a></li>
|
<li><a id="refreshIcon" href="#"><i class="fa-regular fa-rotate-right"></i></a></li>
|
||||||
<li><a id="forwardIcon" href="#"><i class="fa-regular fa-arrow-right"></i></a></li>
|
<li><a id="forwardIcon" href="#"><i class="fa-regular fa-arrow-right"></i></a></li>
|
||||||
<li><a id="fullscreenIcon" href="#"><i class="fa-regular fa-expand"></i></a></li>
|
|
||||||
<li>
|
<li>
|
||||||
<div class="small-searchbar" style="position: relative;">
|
<div class="small-searchbar" style="position: relative;">
|
||||||
<i id="lockIcon" class="fa-solid fa-lock"></i>
|
<i id="lockIcon" class="fa-solid fa-lock"></i>
|
||||||
|
@ -65,8 +65,7 @@
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
<li><a href="/"><i class="fa-regular fa-home"></i></a></li>
|
<li><a href="/"><i class="fa-regular fa-home"></i></a></li>
|
||||||
<li><a href="/g"><i class="fa-regular fa-gamepad"></i></a></li>
|
<li><a id="fullscreenIcon" href="#"><i class="fa-regular fa-expand"></i></a></li>
|
||||||
<li><a href="/a"><i class="fa-regular fa-grid-2"></i></a></li>
|
|
||||||
<li><a id="erudaIcon" href="#"><i class="fa-regular fa-code"></i></a></li>
|
<li><a id="erudaIcon" href="#"><i class="fa-regular fa-code"></i></a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
@ -74,6 +73,7 @@
|
||||||
<h1>Apps</h1>
|
<h1>Apps</h1>
|
||||||
<div class="apps-search-bar">
|
<div class="apps-search-bar">
|
||||||
<input type="text" id="appSearchInput" placeholder="Search apps..." autocomplete="off" />
|
<input type="text" id="appSearchInput" placeholder="Search apps..." autocomplete="off" />
|
||||||
|
<span class="shortcut-indicator-4">Ctrl + S</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="apps-grid">
|
<div class="apps-grid">
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
<meta property="og:image" content="/assets/images/icons/favicon.ico"/>
|
<meta property="og:image" content="/assets/images/icons/favicon.ico"/>
|
||||||
<meta name="theme-color" content="#ffffff"/>
|
<meta name="theme-color" content="#ffffff"/>
|
||||||
<meta name="msapplication-TileColor" content="#ffffff"/>
|
<meta name="msapplication-TileColor" content="#ffffff"/>
|
||||||
<title>Waves.</title>
|
<title>Waves</title>
|
||||||
<link rel="icon" type="image/x-icon" href="/assets/images/icons/favicon.ico">
|
<link rel="icon" type="image/x-icon" href="/assets/images/icons/favicon.ico">
|
||||||
<link rel="stylesheet" href="/assets/css/$.css">
|
<link rel="stylesheet" href="/assets/css/$.css">
|
||||||
<link rel="stylesheet" href="/assets/css/settings.css">
|
<link rel="stylesheet" href="/assets/css/settings.css">
|
||||||
|
@ -30,6 +30,7 @@
|
||||||
<script src="/assets/js/register.js" defer></script>
|
<script src="/assets/js/register.js" defer></script>
|
||||||
<script src="/assets/js/settings.js" defer></script>
|
<script src="/assets/js/settings.js" defer></script>
|
||||||
<script src="/assets/js/greetings.js" defer></script>
|
<script src="/assets/js/greetings.js" defer></script>
|
||||||
|
<script src="/assets/js/shortcuts.js" defer></script>
|
||||||
<script src="/assets/js/$.js" defer></script>
|
<script src="/assets/js/$.js" defer></script>
|
||||||
<script src="/assets/js/g.js" defer></script>
|
<script src="/assets/js/g.js" 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">
|
||||||
|
@ -55,7 +56,6 @@
|
||||||
<li><a id="backIcon" href="#"><i class="fa-regular fa-arrow-left"></i></a></li>
|
<li><a id="backIcon" href="#"><i class="fa-regular fa-arrow-left"></i></a></li>
|
||||||
<li><a id="refreshIcon" href="#"><i class="fa-regular fa-rotate-right"></i></a></li>
|
<li><a id="refreshIcon" href="#"><i class="fa-regular fa-rotate-right"></i></a></li>
|
||||||
<li><a id="forwardIcon" href="#"><i class="fa-regular fa-arrow-right"></i></a></li>
|
<li><a id="forwardIcon" href="#"><i class="fa-regular fa-arrow-right"></i></a></li>
|
||||||
<li><a id="fullscreenIcon" href="#"><i class="fa-regular fa-expand"></i></a></li>
|
|
||||||
<li>
|
<li>
|
||||||
<div class="small-searchbar" style="position: relative;">
|
<div class="small-searchbar" style="position: relative;">
|
||||||
<i id="lockIcon" class="fa-solid fa-lock"></i>
|
<i id="lockIcon" class="fa-solid fa-lock"></i>
|
||||||
|
@ -65,8 +65,7 @@
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
<li><a href="/"><i class="fa-regular fa-home"></i></a></li>
|
<li><a href="/"><i class="fa-regular fa-home"></i></a></li>
|
||||||
<li><a href="/g"><i class="fa-regular fa-gamepad"></i></a></li>
|
<li><a id="fullscreenIcon" href="#"><i class="fa-regular fa-expand"></i></a></li>
|
||||||
<li><a href="/a"><i class="fa-regular fa-grid-2"></i></a></li>
|
|
||||||
<li><a id="erudaIcon" href="#"><i class="fa-regular fa-code"></i></a></li>
|
<li><a id="erudaIcon" href="#"><i class="fa-regular fa-code"></i></a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
@ -74,6 +73,7 @@
|
||||||
<h1>Games</h1>
|
<h1>Games</h1>
|
||||||
<div class="games-search-bar">
|
<div class="games-search-bar">
|
||||||
<input type="text" id="gameSearchInput" placeholder="Search games..." autocomplete="off" />
|
<input type="text" id="gameSearchInput" placeholder="Search games..." autocomplete="off" />
|
||||||
|
<span class="shortcut-indicator-3">Ctrl + S</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="games-grid">
|
<div class="games-grid">
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
<script src="/assets/js/settings.js" defer></script>
|
<script src="/assets/js/settings.js" defer></script>
|
||||||
<script src="/assets/js/ping.js" defer></script>
|
<script src="/assets/js/ping.js" defer></script>
|
||||||
<script src="/assets/js/greetings.js" defer></script>
|
<script src="/assets/js/greetings.js" defer></script>
|
||||||
|
<script src="/assets/js/shortcuts.js" defer></script>
|
||||||
<script src="/assets/js/$.js" defer></script>
|
<script src="/assets/js/$.js" defer></script>
|
||||||
<div class="relative flex flex-col h-[100vh] items-center justify-center bg-white transition-bg">
|
<div class="relative flex flex-col h-[100vh] items-center justify-center bg-white transition-bg">
|
||||||
<div class="absolute inset-0 overflow-hidden">
|
<div class="absolute inset-0 overflow-hidden">
|
||||||
|
@ -61,6 +62,7 @@
|
||||||
<input class="waves" type="text" id="searchInputt"
|
<input class="waves" type="text" id="searchInputt"
|
||||||
placeholder="Search for a query or enter a URL..." autocomplete="off"
|
placeholder="Search for a query or enter a URL..." autocomplete="off"
|
||||||
style="padding-left: 40px;">
|
style="padding-left: 40px;">
|
||||||
|
<span class="shortcut-indicator-2">Ctrl + S</span>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
<li><a href="/"><i class="fa-regular fa-home"></i></a></li>
|
<li><a href="/"><i class="fa-regular fa-home"></i></a></li>
|
||||||
|
@ -72,7 +74,8 @@
|
||||||
<div class="search-container">
|
<div class="search-container">
|
||||||
<div class="search-title">Waves.</div>
|
<div class="search-title">Waves.</div>
|
||||||
<div class="search-bar">
|
<div class="search-bar">
|
||||||
<input class="waves" type="text" id="searchInput" placeholder="What been on your mind lately?" autocomplete="off">
|
<input class="waves" type="text" id="searchInput" placeholder="What's been on your mind lately?" autocomplete="off">
|
||||||
|
<span class="shortcut-indicator">Ctrl + S</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="erudaLoadingScreen" style="display: none;">Eruda is loading...</div>
|
<div id="erudaLoadingScreen" style="display: none;">Eruda is loading...</div>
|
||||||
|
|
|
@ -222,6 +222,20 @@ body {
|
||||||
color: #818181;
|
color: #818181;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.shortcut-indicator-2 {
|
||||||
|
position: absolute;
|
||||||
|
top: 50%;
|
||||||
|
left: 50%;
|
||||||
|
transform: translate(calc(-50% + 300px), -50%);
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: 500;
|
||||||
|
color: #000000;
|
||||||
|
background-color: #c4c4c4;
|
||||||
|
padding: 2px 6px;
|
||||||
|
border-radius: 7px;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
#lockIcon {
|
#lockIcon {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: 25px;
|
left: 25px;
|
||||||
|
@ -284,7 +298,7 @@ body {
|
||||||
background-size: 35px 35px;
|
background-size: 35px 35px;
|
||||||
background-position: 10px center;
|
background-position: 10px center;
|
||||||
background-repeat: no-repeat;
|
background-repeat: no-repeat;
|
||||||
border-radius: 20px;
|
border-radius: 25px;
|
||||||
color: #e0e0e0;
|
color: #e0e0e0;
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
border: 1px solid #ffffff1a;
|
border: 1px solid #ffffff1a;
|
||||||
|
@ -304,6 +318,20 @@ body {
|
||||||
color: #ffffff69;
|
color: #ffffff69;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.shortcut-indicator {
|
||||||
|
position: absolute;
|
||||||
|
top: 50%;
|
||||||
|
left: 50%;
|
||||||
|
transform: translate(calc(-50% + 235px), -50%);
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: 500;
|
||||||
|
color: #000000;
|
||||||
|
background-color: #c4c4c4;
|
||||||
|
padding: 2px 6px;
|
||||||
|
border-radius: 7px;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
#erudaLoadingScreen {
|
#erudaLoadingScreen {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
top: 50%;
|
top: 50%;
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: flex-start;
|
align-items: flex-start;
|
||||||
|
align-content: flex-start;
|
||||||
gap: 20px;
|
gap: 20px;
|
||||||
max-width: 80%;
|
max-width: 80%;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
|
@ -35,7 +36,7 @@
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
user-select: none;
|
user-select: none;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
border: 2px solid #ffffff21;
|
border: 1px solid #ffffff21;
|
||||||
backdrop-filter: blur(10px);
|
backdrop-filter: blur(10px);
|
||||||
transition: all 0.3s ease;
|
transition: all 0.3s ease;
|
||||||
width: 180px;
|
width: 180px;
|
||||||
|
@ -82,6 +83,7 @@
|
||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
color: #a8a8a8;
|
color: #a8a8a8;
|
||||||
animation: fadeIn 2s ease;
|
animation: fadeIn 2s ease;
|
||||||
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|
||||||
#appSearchInput {
|
#appSearchInput {
|
||||||
|
@ -102,11 +104,25 @@
|
||||||
transition: all 0.3s ease;
|
transition: all 0.3s ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
#appSearchInput::placeholder {
|
|
||||||
color: #a8a8a8;
|
|
||||||
}
|
|
||||||
|
|
||||||
#appSearchInput:focus,
|
#appSearchInput:focus,
|
||||||
#appSearchInput:hover {
|
#appSearchInput:hover {
|
||||||
border: 1px solid #ffffff69;
|
border: 1px solid #ffffff69;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#appSearchInput::placeholder {
|
||||||
|
color: #a8a8a8;
|
||||||
|
}
|
||||||
|
|
||||||
|
.shortcut-indicator-4 {
|
||||||
|
position: absolute;
|
||||||
|
top: 50%;
|
||||||
|
left: 50%;
|
||||||
|
transform: translate(calc(-50% + 195px), -50%);
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: 500;
|
||||||
|
color: #000000;
|
||||||
|
background-color: #c4c4c4;
|
||||||
|
padding: 2px 6px;
|
||||||
|
border-radius: 7px;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
|
@ -83,6 +83,7 @@
|
||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
color: #a8a8a8;
|
color: #a8a8a8;
|
||||||
animation: fadeIn 2s ease;
|
animation: fadeIn 2s ease;
|
||||||
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|
||||||
#gameSearchInput {
|
#gameSearchInput {
|
||||||
|
@ -103,11 +104,25 @@
|
||||||
transition: all 0.3s ease;
|
transition: all 0.3s ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
#gameSearchInput::placeholder {
|
|
||||||
color: #a8a8a8;
|
|
||||||
}
|
|
||||||
|
|
||||||
#gameSearchInput:focus,
|
#gameSearchInput:focus,
|
||||||
#gameSearchInput:hover {
|
#gameSearchInput:hover {
|
||||||
border: 1px solid #ffffff69;
|
border: 1px solid #ffffff69;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#gameSearchInput::placeholder {
|
||||||
|
color: #a8a8a8;
|
||||||
|
}
|
||||||
|
|
||||||
|
.shortcut-indicator-3 {
|
||||||
|
position: absolute;
|
||||||
|
top: 50%;
|
||||||
|
left: 50%;
|
||||||
|
transform: translate(calc(-50% + 195px), -50%);
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: 500;
|
||||||
|
color: #000000;
|
||||||
|
background-color: #c4c4c4;
|
||||||
|
padding: 2px 6px;
|
||||||
|
border-radius: 7px;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
|
@ -53,7 +53,7 @@
|
||||||
border: none;
|
border: none;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
font-size: 10px;
|
font-size: 10px;
|
||||||
color: #868686;
|
color: #888888;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
z-index: 1000;
|
z-index: 1000;
|
||||||
outline: none;
|
outline: none;
|
||||||
|
@ -63,7 +63,7 @@
|
||||||
|
|
||||||
#close-settings:hover {
|
#close-settings:hover {
|
||||||
transform: rotate(90deg);
|
transform: rotate(90deg);
|
||||||
color: #f44336;
|
color: #d3d3d3;
|
||||||
}
|
}
|
||||||
|
|
||||||
#close-settings i {
|
#close-settings i {
|
||||||
|
|
|
@ -84,7 +84,7 @@
|
||||||
.toast .toast-close {
|
.toast .toast-close {
|
||||||
background: none;
|
background: none;
|
||||||
border: none;
|
border: none;
|
||||||
color: #868686;
|
color: #888888;
|
||||||
font-size: 18px;
|
font-size: 18px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
|
@ -93,5 +93,5 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.toast-close:hover {
|
.toast-close:hover {
|
||||||
color: #f44336;
|
color: #d3d3d3;
|
||||||
}
|
}
|
|
@ -8,10 +8,8 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||||
const iframe = document.getElementById('cool-iframe')
|
const iframe = document.getElementById('cool-iframe')
|
||||||
const erudaLoadingScreen = document.getElementById('erudaLoadingScreen')
|
const erudaLoadingScreen = document.getElementById('erudaLoadingScreen')
|
||||||
if (!refreshIcon || !fullscreenIcon || !backIcon || !forwardIcon || !iframe) return
|
if (!refreshIcon || !fullscreenIcon || !backIcon || !forwardIcon || !iframe) return
|
||||||
|
|
||||||
const originalTitle = document.title
|
const originalTitle = document.title
|
||||||
let loadingHidden = false
|
let loadingHidden = false
|
||||||
|
|
||||||
function showLoadingScreen(withToast = true, showEruda = false) {
|
function showLoadingScreen(withToast = true, showEruda = false) {
|
||||||
loadingHidden = false
|
loadingHidden = false
|
||||||
NProgress.start()
|
NProgress.start()
|
||||||
|
@ -24,14 +22,12 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function hideLoadingScreen() {
|
function hideLoadingScreen() {
|
||||||
if (loadingHidden) return
|
if (loadingHidden) return
|
||||||
loadingHidden = true
|
loadingHidden = true
|
||||||
NProgress.done()
|
NProgress.done()
|
||||||
document.title = originalTitle
|
document.title = originalTitle
|
||||||
}
|
}
|
||||||
|
|
||||||
refreshIcon.addEventListener('click', () => {
|
refreshIcon.addEventListener('click', () => {
|
||||||
refreshIcon.classList.add('spin')
|
refreshIcon.classList.add('spin')
|
||||||
if (iframe.tagName === 'IFRAME') {
|
if (iframe.tagName === 'IFRAME') {
|
||||||
|
@ -43,14 +39,12 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||||
}
|
}
|
||||||
setTimeout(() => refreshIcon.classList.remove('spin'), 300)
|
setTimeout(() => refreshIcon.classList.remove('spin'), 300)
|
||||||
})
|
})
|
||||||
|
|
||||||
fullscreenIcon.addEventListener('click', () => {
|
fullscreenIcon.addEventListener('click', () => {
|
||||||
if (iframe.requestFullscreen) iframe.requestFullscreen()
|
if (iframe.requestFullscreen) iframe.requestFullscreen()
|
||||||
else if (iframe.mozRequestFullScreen) iframe.mozRequestFullScreen()
|
else if (iframe.mozRequestFullScreen) iframe.mozRequestFullScreen()
|
||||||
else if (iframe.webkitRequestFullscreen) iframe.webkitRequestFullscreen()
|
else if (iframe.webkitRequestFullscreen) iframe.webkitRequestFullscreen()
|
||||||
else if (iframe.msRequestFullscreen) iframe.msRequestFullscreen()
|
else if (iframe.msRequestFullscreen) iframe.msRequestFullscreen()
|
||||||
})
|
})
|
||||||
|
|
||||||
backIcon.addEventListener('click', () => {
|
backIcon.addEventListener('click', () => {
|
||||||
if (currentIndex > 0) {
|
if (currentIndex > 0) {
|
||||||
currentIndex--
|
currentIndex--
|
||||||
|
@ -60,7 +54,6 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||||
updateDecodedSearchInput()
|
updateDecodedSearchInput()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
forwardIcon.addEventListener('click', () => {
|
forwardIcon.addEventListener('click', () => {
|
||||||
if (currentIndex < historyStack.length - 1) {
|
if (currentIndex < historyStack.length - 1) {
|
||||||
currentIndex++
|
currentIndex++
|
||||||
|
@ -70,17 +63,15 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||||
updateDecodedSearchInput()
|
updateDecodedSearchInput()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
function normalizeUrl(urlStr) {
|
function normalizeUrl(urlStr) {
|
||||||
try {
|
try {
|
||||||
const url = new URL(urlStr)
|
const url = new URL(urlStr)
|
||||||
url.searchParams.delete('ia')
|
url.searchParams.delete('ia')
|
||||||
return url.toString()
|
return url.toString()
|
||||||
} catch (e) {
|
} catch {
|
||||||
return urlStr
|
return urlStr
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function addToHistory(url) {
|
function addToHistory(url) {
|
||||||
const normalized = normalizeUrl(url)
|
const normalized = normalizeUrl(url)
|
||||||
if (currentIndex >= 0 && normalizeUrl(historyStack[currentIndex]) === normalized) return
|
if (currentIndex >= 0 && normalizeUrl(historyStack[currentIndex]) === normalized) return
|
||||||
|
@ -90,14 +81,12 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||||
updateNavButtons()
|
updateNavButtons()
|
||||||
updateDecodedSearchInput()
|
updateDecodedSearchInput()
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateNavButtons() {
|
function updateNavButtons() {
|
||||||
backIcon.disabled = currentIndex <= 0
|
backIcon.disabled = currentIndex <= 0
|
||||||
forwardIcon.disabled = currentIndex >= historyStack.length - 1
|
forwardIcon.disabled = currentIndex >= historyStack.length - 1
|
||||||
backIcon.classList.toggle('disabled', currentIndex <= 0)
|
backIcon.classList.toggle('disabled', currentIndex <= 0)
|
||||||
forwardIcon.classList.toggle('disabled', currentIndex >= historyStack.length - 1)
|
forwardIcon.classList.toggle('disabled', currentIndex >= historyStack.length - 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateDecodedSearchInput() {
|
function updateDecodedSearchInput() {
|
||||||
const searchInput2 = document.getElementById('searchInputt')
|
const searchInput2 = document.getElementById('searchInputt')
|
||||||
if (!searchInput2) return
|
if (!searchInput2) return
|
||||||
|
@ -116,7 +105,6 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||||
lockIcon.style.color = ''
|
lockIcon.style.color = ''
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
iframe.addEventListener('load', () => {
|
iframe.addEventListener('load', () => {
|
||||||
try {
|
try {
|
||||||
hideLoadingScreen()
|
hideLoadingScreen()
|
||||||
|
@ -126,18 +114,15 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||||
if (erudaLoadingScreen) erudaLoadingScreen.style.display = 'none'
|
if (erudaLoadingScreen) erudaLoadingScreen.style.display = 'none'
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
iframe.addEventListener('error', () => {
|
iframe.addEventListener('error', () => {
|
||||||
hideLoadingScreen()
|
hideLoadingScreen()
|
||||||
})
|
})
|
||||||
|
|
||||||
iframe.addEventListener('loadstart', () => {
|
iframe.addEventListener('loadstart', () => {
|
||||||
const navBar = document.querySelector('.navbar')
|
const navBar = document.querySelector('.navbar')
|
||||||
const navbarToggle = document.getElementById('navbar-toggle')
|
const navbarToggle = document.getElementById('navbar-toggle')
|
||||||
if (navbarToggle && navbarToggle.checked && navBar) navBar.style.display = 'block'
|
if (navbarToggle && navbarToggle.checked && navBar) navBar.style.display = 'block'
|
||||||
showLoadingScreen(false, false)
|
showLoadingScreen(false, false)
|
||||||
})
|
})
|
||||||
|
|
||||||
const navBar = document.querySelector('.navbar')
|
const navBar = document.querySelector('.navbar')
|
||||||
const topBar = document.querySelector('.topbar')
|
const topBar = document.querySelector('.topbar')
|
||||||
const searchInput1 = document.getElementById('searchInput')
|
const searchInput1 = document.getElementById('searchInput')
|
||||||
|
@ -145,7 +130,6 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||||
const movies = document.getElementById('movies')
|
const movies = document.getElementById('movies')
|
||||||
const ai = document.getElementById('ai')
|
const ai = document.getElementById('ai')
|
||||||
const navbarToggle = document.getElementById('navbar-toggle')
|
const navbarToggle = document.getElementById('navbar-toggle')
|
||||||
|
|
||||||
if (navbarToggle && navBar) {
|
if (navbarToggle && navBar) {
|
||||||
const savedNavbarState = localStorage.getItem('navbarToggled')
|
const savedNavbarState = localStorage.getItem('navbarToggled')
|
||||||
navbarToggle.checked = savedNavbarState === null ? true : savedNavbarState === 'true'
|
navbarToggle.checked = savedNavbarState === null ? true : savedNavbarState === 'true'
|
||||||
|
@ -155,28 +139,27 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||||
navBar.style.display = iframe.style.display === 'block' && navbarToggle.checked ? 'block' : 'none'
|
navBar.style.display = iframe.style.display === 'block' && navbarToggle.checked ? 'block' : 'none'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
iframe.style.display = 'none'
|
iframe.style.display = 'none'
|
||||||
window.addEventListener('load', hideLoadingScreen)
|
window.addEventListener('load', hideLoadingScreen)
|
||||||
|
;[searchInput1, searchInput2].forEach(input => {
|
||||||
;
|
|
||||||
[searchInput1, searchInput2].forEach(input => {
|
|
||||||
if (input) {
|
if (input) {
|
||||||
input.addEventListener('keyup', e => {
|
input.addEventListener('keyup', e => {
|
||||||
if (e.key === 'Enter') handleSearch(input.value)
|
if (e.key === 'Enter') {
|
||||||
|
const val = input.value.trim()
|
||||||
|
if (val) handleSearch(val)
|
||||||
|
else showToast('Please enter something in the Search Bar.', 'error', 'warning')
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
if (movies) movies.addEventListener('click', e => {
|
if (movies) movies.addEventListener('click', e => {
|
||||||
e.preventDefault();
|
e.preventDefault()
|
||||||
handleSearch('https://movies.usewaves.site/')
|
handleSearch('https://movies.usewaves.site/')
|
||||||
})
|
})
|
||||||
if (ai) ai.addEventListener('click', e => {
|
if (ai) ai.addEventListener('click', e => {
|
||||||
e.preventDefault();
|
e.preventDefault()
|
||||||
handleSearch('https://ai.usewaves.site/')
|
handleSearch('https://ai.usewaves.site/')
|
||||||
})
|
})
|
||||||
|
|
||||||
function clearBackground() {
|
function clearBackground() {
|
||||||
const preserved = [
|
const preserved = [
|
||||||
document.querySelector('.navbar'),
|
document.querySelector('.navbar'),
|
||||||
|
@ -188,8 +171,11 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||||
if (!preserved.includes(child)) child.remove()
|
if (!preserved.includes(child)) child.remove()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
async function handleSearch(query) {
|
async function handleSearch(query) {
|
||||||
|
if (!query || !query.trim()) {
|
||||||
|
showToast('Please enter something in the Search Bar.', 'error', 'warning')
|
||||||
|
return
|
||||||
|
}
|
||||||
clearBackground()
|
clearBackground()
|
||||||
let searchURL
|
let searchURL
|
||||||
if (
|
if (
|
||||||
|
@ -229,9 +215,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||||
hideLoadingScreen()
|
hideLoadingScreen()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
window.handleSearch = handleSearch
|
window.handleSearch = handleSearch
|
||||||
|
|
||||||
function generateSearchUrl(query) {
|
function generateSearchUrl(query) {
|
||||||
try {
|
try {
|
||||||
return new URL(query).toString()
|
return new URL(query).toString()
|
||||||
|
@ -243,7 +227,6 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||||
}
|
}
|
||||||
return `https://duckduckgo.com/?q=${encodeURIComponent(query)}&ia=web`
|
return `https://duckduckgo.com/?q=${encodeURIComponent(query)}&ia=web`
|
||||||
}
|
}
|
||||||
|
|
||||||
function showToast(message, type = 'success', iconType = 'check') {
|
function showToast(message, type = 'success', iconType = 'check') {
|
||||||
const toast = document.createElement('div')
|
const toast = document.createElement('div')
|
||||||
toast.className = `toast show ${type}`
|
toast.className = `toast show ${type}`
|
||||||
|
@ -273,7 +256,6 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||||
setTimeout(() => toast.remove(), 500)
|
setTimeout(() => toast.remove(), 500)
|
||||||
}, 3000)
|
}, 3000)
|
||||||
}
|
}
|
||||||
|
|
||||||
function preloadResources(url) {
|
function preloadResources(url) {
|
||||||
if (!url) return
|
if (!url) return
|
||||||
try {
|
try {
|
||||||
|
@ -285,17 +267,14 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||||
document.head.appendChild(link)
|
document.head.appendChild(link)
|
||||||
} catch {}
|
} catch {}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getUrl(url) {
|
function getUrl(url) {
|
||||||
return Promise.resolve(__uv$config.prefix + __uv$config.encodeUrl(url))
|
return Promise.resolve(__uv$config.prefix + __uv$config.encodeUrl(url))
|
||||||
}
|
}
|
||||||
|
|
||||||
function generateSubject() {
|
function generateSubject() {
|
||||||
const subjects = ['math', 'science', 'history', 'art', 'programming', 'philosophy']
|
const subjects = ['math', 'science', 'history', 'art', 'programming', 'philosophy']
|
||||||
const random = subjects[Math.floor(Math.random() * subjects.length)]
|
const random = subjects[Math.floor(Math.random() * subjects.length)]
|
||||||
history.replaceState({}, '', '/learning?subject=' + random)
|
history.replaceState({}, '', '/learning?subject=' + random)
|
||||||
}
|
}
|
||||||
|
|
||||||
function decodeUrl(enc) {
|
function decodeUrl(enc) {
|
||||||
try {
|
try {
|
||||||
const o = new URL(enc, window.location.origin)
|
const o = new URL(enc, window.location.origin)
|
||||||
|
@ -307,7 +286,6 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||||
} catch {}
|
} catch {}
|
||||||
return enc
|
return enc
|
||||||
}
|
}
|
||||||
|
|
||||||
window.decodeUrl = decodeUrl
|
window.decodeUrl = decodeUrl
|
||||||
window.addToHistory = addToHistory
|
window.addToHistory = addToHistory
|
||||||
window.updateDecodedSearchInput = updateDecodedSearchInput
|
window.updateDecodedSearchInput = updateDecodedSearchInput
|
||||||
|
|
109
public/assets/js/shortcuts.js
Normal file
109
public/assets/js/shortcuts.js
Normal file
|
@ -0,0 +1,109 @@
|
||||||
|
(function () {
|
||||||
|
document.addEventListener('DOMContentLoaded', function () {
|
||||||
|
function getSearchInputs() {
|
||||||
|
return [
|
||||||
|
document.getElementById('searchInput'),
|
||||||
|
document.getElementById('searchInputt'),
|
||||||
|
document.getElementById('gameSearchInput'),
|
||||||
|
document.getElementById('appSearchInput')
|
||||||
|
].filter(Boolean);
|
||||||
|
}
|
||||||
|
|
||||||
|
function isVisible(el) {
|
||||||
|
return !!(el.offsetWidth || el.offsetHeight || el.getClientRects().length);
|
||||||
|
}
|
||||||
|
|
||||||
|
function focusFirstVisibleInput() {
|
||||||
|
const inputs = getSearchInputs();
|
||||||
|
for (const input of inputs) {
|
||||||
|
if (isVisible(input)) {
|
||||||
|
input.focus();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (inputs.length) {
|
||||||
|
inputs[0].focus();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
document.addEventListener('keydown', function (e) {
|
||||||
|
if (e.key === 'Escape') {
|
||||||
|
const inputs = getSearchInputs();
|
||||||
|
const active = document.activeElement;
|
||||||
|
if (inputs.includes(active)) {
|
||||||
|
active.blur();
|
||||||
|
e.preventDefault();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (e.ctrlKey && e.key.toLowerCase() === 's') {
|
||||||
|
e.preventDefault();
|
||||||
|
focusFirstVisibleInput();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
document.querySelectorAll(
|
||||||
|
'.shortcut-indicator, .shortcut-indicator-2, .shortcut-indicator-3, .shortcut-indicator-4'
|
||||||
|
).forEach(function (el) {
|
||||||
|
el.addEventListener('click', function (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
focusFirstVisibleInput();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
document.body.addEventListener('click', function (e) {
|
||||||
|
if (
|
||||||
|
e.target.classList.contains('shortcut-indicator') ||
|
||||||
|
e.target.classList.contains('shortcut-indicator-2') ||
|
||||||
|
e.target.classList.contains('shortcut-indicator-3') ||
|
||||||
|
e.target.classList.contains('shortcut-indicator-4')
|
||||||
|
) {
|
||||||
|
e.preventDefault();
|
||||||
|
focusFirstVisibleInput();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const coolIframe = document.getElementById('cool-iframe');
|
||||||
|
if (coolIframe) {
|
||||||
|
coolIframe.addEventListener('load', function () {
|
||||||
|
const doc = coolIframe.contentWindow.document;
|
||||||
|
|
||||||
|
doc.addEventListener('keydown', function (e) {
|
||||||
|
if (e.key === 'Escape') {
|
||||||
|
if (doc.activeElement && doc.activeElement.blur) {
|
||||||
|
doc.activeElement.blur();
|
||||||
|
e.preventDefault();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (e.ctrlKey && e.key.toLowerCase() === 's') {
|
||||||
|
e.preventDefault();
|
||||||
|
document.dispatchEvent(new KeyboardEvent('keydown', {
|
||||||
|
key: 's',
|
||||||
|
ctrlKey: true
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
doc.querySelectorAll(
|
||||||
|
'.shortcut-indicator, .shortcut-indicator-2, .shortcut-indicator-3, .shortcut-indicator-4'
|
||||||
|
).forEach(function (iframeEl) {
|
||||||
|
iframeEl.addEventListener('click', function (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
window.parent.postMessage({
|
||||||
|
type: 'iframe-focus-search'
|
||||||
|
}, '*');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
window.addEventListener('message', function (event) {
|
||||||
|
const msg = event.data;
|
||||||
|
if (msg.type === 'iframe-focus-search') {
|
||||||
|
focusFirstVisibleInput();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
})();
|
Loading…
Reference in New Issue
Block a user