Skip to content

Commit 7152bc3

Browse files
committed
Merge branch 'feature/redesign'
2 parents 48057f6 + 80ccbb3 commit 7152bc3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+1427
-176
lines changed

frontend/.vitepress/config.mts

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,19 @@ export default defineConfig({
1111
description: "OneScript. Официальная документация, релизы, справка, синтакс-помощник",
1212

1313
head: [
14-
['link', { rel: 'icon', href: '/favicon.ico' }]
14+
['link', { rel: 'icon', href: '/favicon.ico' }],
15+
// Preload critical resources for faster initial load
16+
['link', { rel: 'preload', href: '/2-min.png', as: 'image' }],
17+
['link', { rel: 'preload', href: '/logo-white-small.png', as: 'image' }],
18+
['link', { rel: 'preconnect', href: 'https://fonts.googleapis.com' }],
19+
// Inline script to set home page class immediately to prevent navbar flash
20+
['script', {}, `
21+
(function() {
22+
if (window.location.pathname === '/' || window.location.pathname === '/index.html') {
23+
document.documentElement.classList.add('is-home-page');
24+
}
25+
})();
26+
`],
1527
],
1628

1729
lang: 'ru-RU',
@@ -72,7 +84,7 @@ export default defineConfig({
7284
{
7385
text: 'Быстрое вхождение',
7486
items: [
75-
{ text: 'Что такое 1Скрипт?', link: '/learn/' },
87+
{ text: 'Что такое OneScript?', link: '/learn/' },
7688
{ text: 'Установка', link: '/learn/install' },
7789
{ text: 'Среда разработки', link: '/learn/dev-tools' },
7890
{ text: 'Урок: Информация о системе', link: '/learn/tutorial-info'},
@@ -164,6 +176,11 @@ export default defineConfig({
164176
darkModeSwitchTitle: 'Переключить на тёмную тему',
165177
sidebarMenuLabel: 'Меню',
166178
returnToTopLabel: 'Вернуться к началу',
179+
180+
footer: {
181+
message: 'All trademarks, logos, and brand names are the property of their respective owners. Use of these names, trademarks, and brands does not imply endorsement.',
182+
copyright: ${new Date().getFullYear()} OneScript. All rights reserved.`
183+
},
167184
},
168185

169186
async transformPageData(pageData, _) {

frontend/.vitepress/theme/Layout.vue

Lines changed: 74 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
<script setup>
22
import DefaultTheme from "vitepress/theme";
3-
import { onMounted } from "vue";
4-
import { useRouter } from "vitepress";
3+
import { onMounted, onUnmounted, watch } from "vue";
4+
import { useRouter, useData } from "vitepress";
55
import mediumZoom from "medium-zoom";
66
77
const { Layout } = DefaultTheme;
88
const router = useRouter();
9+
const { frontmatter } = useData();
910
1011
// Setup medium zoom with the desired options
1112
const setupMediumZoom = () => {
@@ -14,11 +15,79 @@ const setupMediumZoom = () => {
1415
});
1516
};
1617
18+
// Mark html with home class for CSS to work immediately
19+
const updateHomeClass = () => {
20+
const isHome = frontmatter.value.layout === 'home';
21+
if (isHome) {
22+
document.documentElement.classList.add('is-home-page');
23+
document.body.classList.add('is-home-page');
24+
} else {
25+
document.documentElement.classList.remove('is-home-page');
26+
document.body.classList.remove('is-home-page');
27+
}
28+
};
29+
30+
// Handle navbar scroll state on home page with gradual opacity
31+
const handleScroll = () => {
32+
const navbar = document.querySelector('.VPNavBar');
33+
if (!navbar) return;
34+
35+
const isHome = frontmatter.value.layout === 'home';
36+
if (!isHome) {
37+
navbar.classList.remove('scrolled');
38+
navbar.style.removeProperty('--navbar-opacity');
39+
return;
40+
}
41+
42+
const scrollY = window.scrollY;
43+
const fadeStart = window.innerHeight * 0.25;
44+
const fadeEnd = window.innerHeight * 0.85;
45+
46+
if (scrollY <= fadeStart) {
47+
navbar.style.setProperty('--navbar-opacity', '0');
48+
navbar.classList.remove('scrolled');
49+
} else if (scrollY >= fadeEnd) {
50+
navbar.style.setProperty('--navbar-opacity', '1');
51+
navbar.classList.add('scrolled');
52+
} else {
53+
const progress = (scrollY - fadeStart) / (fadeEnd - fadeStart);
54+
navbar.style.setProperty('--navbar-opacity', progress.toString());
55+
navbar.classList.remove('scrolled');
56+
}
57+
};
58+
59+
const setupNavbarTransparency = () => {
60+
updateHomeClass();
61+
handleScroll();
62+
window.addEventListener('scroll', handleScroll);
63+
};
64+
65+
const cleanupNavbarTransparency = () => {
66+
window.removeEventListener('scroll', handleScroll);
67+
document.documentElement.classList.remove('is-home-page');
68+
document.body.classList.remove('is-home-page');
69+
const navbar = document.querySelector('.VPNavBar');
70+
if (navbar) {
71+
navbar.classList.remove('scrolled');
72+
}
73+
};
74+
1775
// Apply medium zoom on load
18-
onMounted(setupMediumZoom);
76+
onMounted(() => {
77+
setupMediumZoom();
78+
setupNavbarTransparency();
79+
});
1980
20-
// Subscribe to route changes to re-apply medium zoom effect
21-
router.onAfterRouteChanged = setupMediumZoom;
81+
onUnmounted(() => {
82+
cleanupNavbarTransparency();
83+
});
84+
85+
// Subscribe to route changes
86+
router.onAfterRouteChanged = () => {
87+
setupMediumZoom();
88+
updateHomeClass();
89+
setTimeout(handleScroll, 50);
90+
};
2291
</script>
2392

2493
<template>

0 commit comments

Comments
 (0)