Added dark mode, updated bootstrap
This commit is contained in:
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -80,7 +80,7 @@ async function generateCriticalCSSForViews() {
|
|||||||
|
|
||||||
// Generate critical CSS
|
// Generate critical CSS
|
||||||
await generate({
|
await generate({
|
||||||
src: `http://localhost:5146${urlPath}`,
|
src: `http://localhost:5146${urlPath}?noCriticalCSS`,
|
||||||
inline: false,
|
inline: false,
|
||||||
width: 1920,
|
width: 1920,
|
||||||
height: 1080,
|
height: 1080,
|
||||||
@@ -90,7 +90,7 @@ async function generateCriticalCSSForViews() {
|
|||||||
},
|
},
|
||||||
forceExclude: ['.btn'], // Otherwise buttons end up colorless and .btn overrides other classes like .btn-warning, etc. - so it has to be force-excluded here and re-added later
|
forceExclude: ['.btn'], // Otherwise buttons end up colorless and .btn overrides other classes like .btn-warning, etc. - so it has to be force-excluded here and re-added later
|
||||||
forceInclude: [
|
forceInclude: [
|
||||||
'[data-bs-theme=dark]',
|
'[data-bs-theme="dark"]', '[data-bs-theme="dark"] body', '[data-bs-theme="dark"] .navbar', '[data-bs-theme="dark"] .card', '[data-bs-theme="dark"] .btn',
|
||||||
'.navbar',
|
'.navbar',
|
||||||
'.col-md-4',
|
'.col-md-4',
|
||||||
'.visually-hidden', // visually hidden headings
|
'.visually-hidden', // visually hidden headings
|
||||||
|
|||||||
@@ -12,13 +12,18 @@
|
|||||||
<meta name="description" content="Embeddingsearch server" />
|
<meta name="description" content="Embeddingsearch server" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>@ViewData["Title"] - embeddingsearch</title>
|
<title>@ViewData["Title"] - embeddingsearch</title>
|
||||||
@if (!Context.Request.Query.ContainsKey("renderRaw"))
|
@if (!Context.Request.Query.ContainsKey("renderRaw") && !Context.Request.Query.ContainsKey("noCriticalCSS"))
|
||||||
{
|
{
|
||||||
<link rel="preload" href="~/lib/bootstrap/dist/css/bootstrap.min.css" as="style"/>
|
<link rel="preload" href="~/lib/bootstrap/dist/css/bootstrap.min.css" as="style"/>
|
||||||
<link rel="stylesheet" fetchpriority="high"
|
<link rel="stylesheet" fetchpriority="high"
|
||||||
href="~/lib/bootstrap/dist/css/bootstrap.min.css"
|
href="~/lib/bootstrap/dist/css/bootstrap.min.css"
|
||||||
media="print"
|
media="print"
|
||||||
onload="this.media='all'">
|
onload="this.media='all'">
|
||||||
|
} else if (Context.Request.Query.ContainsKey("noCriticalCSS"))
|
||||||
|
{
|
||||||
|
<link rel="preload" href="~/lib/bootstrap/dist/css/bootstrap.min.css" as="style"/>
|
||||||
|
<link rel="stylesheet" fetchpriority="high"
|
||||||
|
href="~/lib/bootstrap/dist/css/bootstrap.min.css">
|
||||||
}
|
}
|
||||||
<style>
|
<style>
|
||||||
@Html.Raw(File.ReadAllText(System.IO.Path.Combine(Directory.GetCurrentDirectory(), "wwwroot", "css", "site.css")))
|
@Html.Raw(File.ReadAllText(System.IO.Path.Combine(Directory.GetCurrentDirectory(), "wwwroot", "css", "site.css")))
|
||||||
@@ -29,7 +34,6 @@
|
|||||||
@if (Context.Request.Path.Value is not null)
|
@if (Context.Request.Path.Value is not null)
|
||||||
{
|
{
|
||||||
string path = System.IO.Path.Combine("CriticalCSS", Context.Request.Path.Value.Trim('/').Replace("/", ".") + ".css");
|
string path = System.IO.Path.Combine("CriticalCSS", Context.Request.Path.Value.Trim('/').Replace("/", ".") + ".css");
|
||||||
Console.WriteLine(path);
|
|
||||||
if (File.Exists(path))
|
if (File.Exists(path))
|
||||||
{
|
{
|
||||||
@Html.Raw(File.ReadAllText(path));
|
@Html.Raw(File.ReadAllText(path));
|
||||||
@@ -43,9 +47,9 @@
|
|||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body data-bs-theme="dark">
|
||||||
<header>
|
<header>
|
||||||
<nav class="navbar navbar-expand-sm navbar-toggleable-sm navbar-light bg-white border-bottom box-shadow mb-3">
|
<nav class="navbar navbar-expand-sm navbar-toggleable-sm navbar-light border-bottom box-shadow mb-3">
|
||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
<a class="navbar-brand" asp-area="" asp-controller="Home" asp-action="Index">embeddingsearch</a>
|
<a class="navbar-brand" asp-area="" asp-controller="Home" asp-action="Index">embeddingsearch</a>
|
||||||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target=".navbar-collapse" aria-controls="navbarSupportedContent"
|
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target=".navbar-collapse" aria-controls="navbarSupportedContent"
|
||||||
@@ -57,31 +61,31 @@
|
|||||||
@if (User.Identity?.IsAuthenticated == true)
|
@if (User.Identity?.IsAuthenticated == true)
|
||||||
{
|
{
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Index">@T["Home"]</a>
|
<a class="nav-link text" asp-area="" asp-controller="Home" asp-action="Index">@T["Home"]</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Searchdomains">@T["Searchdomains"]</a>
|
<a class="nav-link text" asp-area="" asp-controller="Home" asp-action="Searchdomains">@T["Searchdomains"]</a>
|
||||||
</li>
|
</li>
|
||||||
@if (User.IsInRole("Admin") || User.IsInRole("Swagger"))
|
@if (User.IsInRole("Admin") || User.IsInRole("Swagger"))
|
||||||
{
|
{
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link text-dark" href="/swagger/index.html?ReturnUrl=@(currentUrl)">@T["Swagger"]</a>
|
<a class="nav-link text" href="/swagger/index.html?ReturnUrl=@(currentUrl)">@T["Swagger"]</a>
|
||||||
</li>
|
</li>
|
||||||
}
|
}
|
||||||
@if (User.IsInRole("Admin"))
|
@if (User.IsInRole("Admin"))
|
||||||
{
|
{
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link text-dark" href="/elmah?ReturnUrl=@(currentUrl)">@T["Elmah"]</a>
|
<a class="nav-link text" href="/elmah?ReturnUrl=@(currentUrl)">@T["Elmah"]</a>
|
||||||
</li>
|
</li>
|
||||||
}
|
}
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link text-dark" asp-area="" asp-controller="Account" asp-action="Logout">@T["Logout"]</a>
|
<a class="nav-link text" asp-area="" asp-controller="Account" asp-action="Logout">@T["Logout"]</a>
|
||||||
</li>
|
</li>
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link text-dark" asp-area="" asp-controller="Account" asp-action="Login">@T["Login"]</a>
|
<a class="nav-link text" asp-area="" asp-controller="Account" asp-action="Login">@T["Login"]</a>
|
||||||
</li>
|
</li>
|
||||||
}
|
}
|
||||||
</ul>
|
</ul>
|
||||||
@@ -106,3 +110,16 @@
|
|||||||
@await RenderSectionAsync("Scripts", required: false)
|
@await RenderSectionAsync("Scripts", required: false)
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
<script>
|
||||||
|
const mediaQuery = window.matchMedia('(prefers-color-scheme: dark)');
|
||||||
|
|
||||||
|
function applyTheme(e) {
|
||||||
|
document.body.setAttribute(
|
||||||
|
'data-bs-theme',
|
||||||
|
e.matches ? 'dark' : 'light'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
applyTheme(mediaQuery);
|
||||||
|
mediaQuery.addEventListener('change', applyTheme);
|
||||||
|
</script>
|
||||||
|
|||||||
@@ -75,3 +75,8 @@ url("/fonts/bootstrap-icons.woff") format("woff");
|
|||||||
}
|
}
|
||||||
|
|
||||||
.bi-info-circle-fill::before { content: "\f430"; }
|
.bi-info-circle-fill::before { content: "\f430"; }
|
||||||
|
|
||||||
|
td.btn-group {
|
||||||
|
display: revert;
|
||||||
|
min-width: 15rem;
|
||||||
|
}
|
||||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user