diff --git a/.gitignore b/.gitignore index 7f16228..7c18ea9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,9 @@ dist/ +dist-misc/ node_modules/ pnpm-lock.yaml .vercel # Local Netlify folder .netlify +.idea/ \ No newline at end of file diff --git a/README.md b/README.md index df1e8f7..96e8f49 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ You are welcome to open a pull request to contribute! > You are more likely to be helped in the Discord Server than open an issue. You **MUST** join the discord server to apply for staff. > [!NOTE] -> If you are forking this repository and want to keep your fork up to date. You can use the sync fork button **(safer)** on the repository or https://github.com/apps/pull (Github Only) to auto sync **(but read the warning below)**. +> If you are forking this repository and want to keep your fork up to date, you can use the sync fork button **(safer)** on the repository or https://github.com/apps/pull (Github Only) to auto sync **(but read the warning below)**. > [!WARNING] > If you choose to use the pull GitHub app, it deletes all the changes you made when it syncs to a new commit; so you should backup your changes. diff --git a/css/styles.css b/css/styles.css index 8951063..91368d4 100644 --- a/css/styles.css +++ b/css/styles.css @@ -1,17 +1,16 @@ /* General Styles */ body { - font-family: 'Arial', sans-serif; + font-family: 'Raleway', sans-serif; background-color: var(--ctp-macchiato-overlay0); - background-size: auto; margin: 0; padding: 0; - text-align: center; - display: flex; - flex-direction: column; min-height: 100vh; overflow-x: hidden; color: var(--ctp-macchiato-mantle); - transition: background-color 0.5s cubic-bezier(0.68, -0.55, 0.27, 1.55), color 0.5s cubic-bezier(0.68, -0.55, 0.27, 1.55); + display: grid; + grid-template-rows: auto 1fr auto; + transition: all 0.6s cubic-bezier(0.16, 1, 0.3, 1); + text-align: center; } body.dark-mode { @@ -22,88 +21,193 @@ body.dark-mode { header { background-color: var(--ctp-macchiato-green); color: var(--ctp-macchiato-crust); - padding: 20px 0; - text-align: center; - transition: background-color 0.5s cubic-bezier(0.68, -0.55, 0.27, 1.55), color 0.5s cubic-bezier(0.68, -0.55, 0.27, 1.55); + padding: 1.5rem 0; + transition: all 0.6s cubic-bezier(0.16, 1, 0.3, 1); } header h1 { margin: 0; + transform: translateY(0); + transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1); +} + +header h1:hover { + transform: translateY(-2px); } main { - flex: 1; - padding: 20px; + display: grid; + gap: 2rem; + padding: 2rem; + max-width: 1200px; + margin: 0 auto; + width: 100%; + place-items: center; } .darkmodediv { - padding-left: 480px; - padding-right: 480px; + padding: 1rem; background: var(--ctp-macchiato-rosewater); -} - -.counter, .info, .clients, .danger-zone { - margin-bottom: 20px; + border-radius: 8px; + margin: 0 auto; + max-width: 800px; + width: 100%; } .Container18, .Container15, .ContainerOther { display: flex; flex-wrap: wrap; justify-content: center; - gap: 40px; - margin: 20px 0; + align-items: center; + gap: 1rem; + width: 100%; + max-width: 1200px; + padding: 2rem; + background-color: var(--ctp-macchiato-surface0); + border-radius: 12px; + margin: 1rem 0; } +/* To prevent buttons from becoming too small on narrow screens */ +.Container18 button, +.Container15 button, +.ContainerOther button, +.Container18 .source-btn, +.Container15 .source-btn, +.ContainerOther .source-btn, +.Container18 .dsc-btn, +.Container15 .dsc-btn, +.ContainerOther .dsc-btn, +.Container18 .clr-btn, +.Container15 .clr-btn, +.ContainerOther .clr-btn { + min-width: 120px; + margin: 0.5rem; + flex-shrink: 0; +} + +/* Add a container for each version category for better organization */ +.version-category { + width: 100%; + margin: 1rem 0; + padding: 1rem; + background-color: var(--ctp-macchiato-surface0); + border-radius: 8px; +} + +/* Make sure the category title is visible */ +.version-category h2 { + margin-bottom: 1rem; + color: var(--ctp-macchiato-text); +} + +/* Responsive adjustments */ +@media (max-width: 768px) { + .Container18, .Container15, .ContainerOther { + padding: 0.5rem; + } + + .Container18 button, + .Container15 button, + .ContainerOther button, + .Container18 .source-btn, + .Container15 .source-btn, + .ContainerOther .source-btn, + .Container18 .dsc-btn, + .Container15 .dsc-btn, + .ContainerOther .dsc-btn, + .Container18 .clr-btn, + .Container15 .clr-btn, + .ContainerOther .clr-btn { + min-width: 100px; + font-size: 0.9rem; + padding: 0.5rem 1rem; + } +} + +@media (max-width: 480px) { + .Container18, .Container15, .ContainerOther { + justify-content: flex-start; + overflow-x: auto; + padding: 1rem 0.5rem; + -webkit-overflow-scrolling: touch; + scrollbar-width: thin; + } + + .Container18::-webkit-scrollbar, + .Container15::-webkit-scrollbar, + .ContainerOther::-webkit-scrollbar { + height: 4px; + } + + .Container18::-webkit-scrollbar-thumb, + .Container15::-webkit-scrollbar-thumb, + .ContainerOther::-webkit-scrollbar-thumb { + background-color: var(--ctp-macchiato-overlay2); + border-radius: 4px; + } +} + +/* Base button styles */ button, .source-btn, .dsc-btn, .clr-btn { background-color: var(--ctp-macchiato-green); color: var(--ctp-macchiato-mantle); - padding: 10px 20px; - font-size: 16px; + padding: 0.75rem 1.5rem; + font-size: 1rem; cursor: pointer; border: none; - border-radius: 5px; + border-radius: 8px; text-decoration: none; - display: inline-block; - transition: background-color 0.5s cubic-bezier(0.68, -0.55, 0.27, 1.55), transform 0.5s cubic-bezier(0.68, -0.55, 0.27, 1.55); } -.clientbutton button { - background-color: var(--ctp-macchiato-green); +/* GSAP-like animations only for regular buttons */ +button { + position: relative; + overflow: hidden; + transform-origin: center; + transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1), + background-color 0.3s cubic-bezier(0.16, 1, 0.3, 1), + box-shadow 0.3s cubic-bezier(0.16, 1, 0.3, 1); +} + +button::before { + content: ''; + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + background: linear-gradient( + 120deg, + transparent, + rgba(255, 255, 255, 0.2), + transparent + ); + transform: translateX(-100%); + transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1); +} + +button:hover::before { + transform: translateX(100%); } button:hover { - transform: scale(+1.14) translateX(-20px); + transform: scale(1.05) translateY(-2px); + box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1); } -button:focus { - outline: 3px solid var(--ctp-macchiato-overlay2); - outline-offset: 2px; +button:active { + transform: scale(0.95); + transition-duration: 0.1s; } -.clr-btn:hover { - background-color: var(--ctp-macchiato-peach); - transform: scale(+1.14) translateX(-20px); -} - -.dsc-btn:hover { - background-color: var(--ctp-macchiato-mauve); - transform: scale(+1.14) translateX(-20px); - color: var(--ctp-macchiato-mantle); -} - -.source-btn:hover { - background-color: var(--ctp-macchiato-mantle); - transform: scale(+1.14) translateX(-20px); -} - -.source-btn { - background-color: var(--ctp-macchiato-mantle); /* Black color for GitHub button */ +/* Simple transitions for dsc-btn and clr-btn */ +.dsc-btn, .clr-btn { + transition: background-color 0.3s ease; } .dsc-btn { - background-color: var(--ctp-macchiato-crust); - color: var(--ctp-macchiato-lavender); - transition: 0.6s cubic-bezier(0.68, -0.55, 0.27, 1.55); + background-color: var(--ctp-macchiato-mauve); } .clr-btn { @@ -111,183 +215,148 @@ button:focus { } .search-container { - margin: 20px 0; + display: grid; + place-items: center; + gap: 1rem; + margin: 2rem 0; + width: 100%; } #search-bar { background-color: var(--ctp-macchiato-mantle); - padding: 10px; - border-radius: 35px; - width: 50%; + padding: 1rem 1.5rem; + border-radius: 999px; + width: 100%; + max-width: 500px; outline: none; - border: 4px solid var(--ctp-macchiato-green); + border: 3px solid var(--ctp-macchiato-green); color: var(--ctp-macchiato-text); + transition: all 0.6s cubic-bezier(0.16, 1, 0.3, 1); } #search-bar:focus { - border-width: 5px; -} - -#search-bar::placeholder { - color: var(--ctp-macchiato-text); + border-width: 4px; + transform: translateY(-1px); + box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1); } .footer { - display: flex; - justify-content: center; - align-items: center; - gap: 40px; + display: grid; + grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); + gap: 2rem; + padding: 1.5rem; background-color: var(--ctp-macchiato-overlay1); - color: var(--ctp-macchiato-mantle); /* Light text color for footer */ - padding: 10px; - text-align: center; - opacity: 0.9; - transition: background-color 0.5s cubic-bezier(0.68, -0.55, 0.27, 1.55), color 0.5s cubic-bezier(0.68, -0.55, 0.27, 1.55); + color: var(--ctp-macchiato-text); + place-items: center; + transition: all 0.6s cubic-bezier(0.16, 1, 0.3, 1); } -.footer a { - color: var(--ctp-macchiato-text); /* Light text color for footer links */ - text-decoration: none; - margin: 0 10px; - opacity: 1; -} - -.footer a:hover { - text-decoration: underline; - opacity: 1; -} - -.footer button { - color: var(--ctp-macchiato-mantle); - padding: 10px 20px; - font-size: 16px; - cursor: pointer; - border: none; - border-radius: 5px; - text-decoration: none; - display: inline-block; - transition: background-color 0.5s cubic-bezier(0.68, -0.55, 0.27, 1.55), transform 0.5s cubic-bezier(0.68, -0.55, 0.27, 1.55); - opacity: 1; -} - -/* Modal Styles */ .modal { display: none; position: fixed; - z-index: 1; - left: 0; - top: 0; - width: 100%; - height: 100%; - background-color: var(--ctp-macchiato-mantle); - justify-content: center; - align-items: center; + inset: 0; + background-color: rgba(0, 0, 0, 0.5); + place-items: center; + backdrop-filter: blur(4px); } .modal-content { background-color: var(--ctp-macchiato-text); - padding: 20px; - border-radius: 10px; - width: 80%; - max-width: 400px; - text-align: center; - box-shadow: 0px 4px 8px var(--ctp-macchiato-mantle); - transition: background-color 0.5s cubic-bezier(0.68, -0.55, 0.27, 1.55), color 0.5s cubic-bezier(0.68, -0.55, 0.27, 1.55); + padding: 2rem; + border-radius: 12px; + width: 90%; + max-width: 500px; + display: grid; + gap: 1.5rem; + place-items: center; + transform: translateY(0); + transition: all 0.6s cubic-bezier(0.34, 1.56, 0.64, 1); + box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1); } -.modal h2 { - color: var(--ctp-macchiato-surface1); +/* Source button with minimal animation */ +.source-btn { + background-color: var(--ctp-macchiato-mantle); + transition: background-color 0.3s ease; } -.modal p { - color: var(--ctp-macchiato-mantle); - margin-bottom: 20px; -} - -.modal button { - background-color: var(--ctp-macchiato-green); - color: var(--ctp-macchiato-text); - padding: 10px 20px; - font-size: 16px; - cursor: pointer; - border: none; - border-radius: 5px; - margin: 5px; -} - -.modal button.cancel-btn { - background-color: var(--ctp-macchiato-peach); -} - -.modal button:hover { - background-color: var(--ctp-macchiato-green); -} - -.modal button.cancel-btn:hover { - background-color: var(--ctp-macchiato-maroon); -} - -.copy-link { - background-color: var(--ctp-macchiato-lavender); - padding: 10px; - border: 1px solid var(--ctp-macchiato-text); - border-radius: 5px; - margin-bottom: 15px; -} - -.copy-btn { - background-color: var(--ctp-macchiato-mauve); -} - -.copy-btn:hover { - filter: brightness(1.2); -} - -/* Dark Mode Styles */ +/* Dark Mode enhancements */ body.dark-mode .modal-content { background-color: var(--ctp-macchiato-mantle); - color: var(--ctp-macchiato-text); -} - -body.dark-mode .modal h2 { - color: var(--ctp-macchiato-text); -} - -body.dark-mode .modal p { - color: var(--ctp-macchiato-text); + box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2); } body.dark-mode #search-bar { background-color: var(--ctp-macchiato-overlay0); - color: var(--ctp-macchiato-text); - border-color: var(--ctp-macchiato-overlay1); -} - -body.dark-mode #search-bar:focus { - border-color: var(--ctp-macchiato-green); + box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2); } body.dark-mode .footer { - background-color: var(--ctp-macchiato-overlay0); /* Dark gray color for footer in dark mode */ - color: var(--ctp-macchiato-text); /* Light text color for footer in dark mode */ + background-color: var(--ctp-macchiato-overlay0); + border-top: 1px solid var(--ctp-macchiato-overlay1); } -body.dark-mode .footer a { - color: var(--ctp-macchiato-text); /* Light text color for footer links in dark mode */ +/* Responsive centering for smaller screens */ +@media (max-width: 768px) { + .Container18, .Container15, .ContainerOther { + grid-template-columns: 1fr; + max-width: 400px; + margin: 0 auto; + } + + .darkmodediv { + padding: 1rem; + margin: 0 1rem; + } } -body.dark-mode .footer button.server-list { - background-color: var(--ctp-macchiato-crust); /* Black color for Server List button in dark mode */ +/* Tabs styling */ +.tabs { + display: flex; + justify-content: center; + gap: 0.5rem; + margin-bottom: 2rem; + padding: 0 1rem; } -body.dark-mode .footer button.server-list:hover { - background-color: var(--ctp-macchiato-overlay1); /* Slightly lighter shade for hover effect in dark mode */ +.tab { + background-color: var(--ctp-macchiato-surface0); + color: var(--ctp-macchiato-text); + padding: 0.75rem 1.5rem; + border: none; + border-radius: 8px; + cursor: pointer; + font-family: 'Raleway', sans-serif; + font-weight: 500; + transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1); } -body.dark-mode .footer button.eaglerrinth-mod-list { - background-color: var(--ctp-macchiato-mauve); /* Same color as Discord link button in dark mode */ +.tab.active { + background-color: var(--ctp-macchiato-mauve); + color: var(--ctp-macchiato-base); + transform: translateY(-2px); + box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1); } -body.dark-mode .footer button.eaglerrinth-mod-list:hover { - filter: brightness(1.2); /* Slightly lighter shade for hover effect in dark mode */ +.tab:hover:not(.active) { + background-color: var(--ctp-macchiato-surface1); + transform: translateY(-1px); } + +.tab-content { + display: none; + opacity: 0; + transform: translateY(10px); + transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1); +} + +.tab-content.active { + display: block; + opacity: 1; + transform: translateY(0); +} + +/* Version text styling */ +.version-text { + display: none; /* Hide the original version text */ +} \ No newline at end of file diff --git a/dist-templates/messages/sitePerformance.js b/dist-templates/messages/sitePerformance.js new file mode 100644 index 0000000..fd19270 --- /dev/null +++ b/dist-templates/messages/sitePerformance.js @@ -0,0 +1,49 @@ +import prettifyMilliseconds from '../packages/pretty-ms/index.js'; + +export default function getPageLoadTime() { + const [navigation] = performance.getEntriesByType('navigation'); + const loadTime = navigation.loadEventEnd - navigation.startTime; + const prettifiedLoadTime = prettifyMilliseconds(loadTime); + + return { loadTime, prettifiedLoadTime }; +} + +export function initializePeformanceChecks() { + window.addEventListener('load', () => { + const { loadTime, prettifiedLoadTime } = getPageLoadTime(); + const { sanitize } = self.DOMPurify; + + if (loadTime >= 2500) { + document.body.setAttribute('data-slow', 'true'); + } + + const pageLoadedSlowly = Boolean(document.body.dataset.slow); + + if (pageLoadedSlowly) + document.body.classList.add('performance-popover'); + + if (document.body.classList.contains('performance-popover')) { + document.body.innerHTML = sanitize( + ` +
Looks like ${location.host} loaded slower than usual!
+Precisely, it loaded in ${prettifiedLoadTime}.
+ ++ Do you want to turn off script obfuscation or continue? +
+