94 lines
3.5 KiB
HTML
94 lines
3.5 KiB
HTML
<!DOCTYPE html>
|
||
<html lang="ru">
|
||
<head>
|
||
<meta charset="UTF-8">
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||
<title>Анонимные опросы</title>
|
||
<!-- Добавляем проверку на различные пути -->
|
||
<script>
|
||
// Определяем путь к статическим файлам с учетом prod и dev окружений
|
||
function getStaticPath() {
|
||
const pathname = window.location.pathname;
|
||
if (pathname.includes('/ms/questioneer')) {
|
||
// Для продакшна
|
||
return '/ms/questioneer/static';
|
||
} else {
|
||
// Для локальной разработки
|
||
// Если путь заканчивается на слеш или на /questioneer, добавляем /static
|
||
if (pathname.endsWith('/') || pathname.endsWith('/questioneer')) {
|
||
return pathname + '/static';
|
||
} else {
|
||
return pathname + '/static';
|
||
}
|
||
}
|
||
}
|
||
|
||
// Динамически добавляем CSS
|
||
const cssLink = document.createElement('link');
|
||
cssLink.rel = 'stylesheet';
|
||
cssLink.href = getStaticPath() + '/css/style.css';
|
||
document.head.appendChild(cssLink);
|
||
</script>
|
||
|
||
<!-- Добавляем jQuery -->
|
||
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
||
<script>
|
||
document.addEventListener('DOMContentLoaded', function() {
|
||
// Динамически добавляем скрипты
|
||
const scriptPaths = [
|
||
'/js/common.js',
|
||
'/js/index.js'
|
||
];
|
||
|
||
const staticPath = getStaticPath();
|
||
scriptPaths.forEach(path => {
|
||
const script = document.createElement('script');
|
||
script.src = staticPath + path;
|
||
document.body.appendChild(script);
|
||
});
|
||
});
|
||
</script>
|
||
</head>
|
||
<body>
|
||
<!-- Навигационная шапка -->
|
||
<header class="nav-header">
|
||
<div class="nav-container">
|
||
<a href="javascript:;" id="nav-home-link" class="nav-logo">Анонимные опросы</a>
|
||
<nav class="nav-menu">
|
||
<a href="javascript:;" id="nav-main-link" class="nav-link active">Главная</a>
|
||
<a href="javascript:;" id="nav-create-link" class="nav-link">Создать опрос</a>
|
||
</nav>
|
||
</div>
|
||
</header>
|
||
|
||
<div class="container">
|
||
<h1>Сервис анонимных опросов</h1>
|
||
|
||
<div class="main-buttons">
|
||
<a href="javascript:;" id="create-button" class="btn">Создать новый опрос</a>
|
||
</div>
|
||
|
||
<div class="questionnaires-list">
|
||
<h2>Ваши опросы</h2>
|
||
<div id="questionnaires-container">
|
||
<p>Загрузка опросов...</p>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<script>
|
||
// Добавляем корректные пути к ссылкам после загрузки страницы
|
||
document.addEventListener('DOMContentLoaded', function() {
|
||
// Определяем базовый путь с учетом /ms в продакшен-версии
|
||
const isMsPath = window.location.pathname.includes('/ms/questioneer');
|
||
const basePath = isMsPath ? '/ms/questioneer' : '/questioneer';
|
||
|
||
// Устанавливаем правильные ссылки
|
||
document.getElementById('nav-home-link').href = basePath;
|
||
document.getElementById('nav-main-link').href = basePath;
|
||
document.getElementById('nav-create-link').href = basePath + '/create';
|
||
document.getElementById('create-button').href = basePath + '/create';
|
||
});
|
||
</script>
|
||
</body>
|
||
</html> |