Unterstützung von Übersetzungen + Dark Mode

This commit is contained in:
Simon-Martens
2024-01-24 15:04:23 +01:00
parent 02822dbe06
commit a29080b117
15 changed files with 74 additions and 59 deletions

View File

@@ -34,6 +34,13 @@ public static class ConversionHelpers {
if (Int32.TryParse(number, out a)) return a;
else return RomanToInteger(number);
}
public static string ToRomanSafe(string number) {
var a = 0;
if (Int32.TryParse(number, out a)) return ToRoman(a);
else return number;
}
public static string ToRoman(int number) {
if ((number < 0) || (number > 3999)) return string.Empty;
if (number < 1) return string.Empty;

View File

@@ -93,7 +93,12 @@ public class TextRules {
sb.Append(HaWeb.HTMLHelpers.TagHelpers.CreateElement(DEFAULTELEMENT, CSSClasses.INDEXEDTEXTCONTAINERCLASS));
sb.Append(HaWeb.HTMLHelpers.TagHelpers.CreateElement(DEFAULTELEMENT, CSSClasses.INDEXEDTEXTCLASS));
reader.State.activelinecount = true;
})
}),
( ( x, _) => x.Name == "text", (sb, tag, reader) => {
sb.Append(HaWeb.HTMLHelpers.TagHelpers.CreateElement(DEFAULTELEMENT, CSSClasses.INDEXEDTEXTCONTAINERCLASS));
sb.Append(HaWeb.HTMLHelpers.TagHelpers.CreateElement(DEFAULTELEMENT, CSSClasses.INDEXEDTEXTCLASS));
reader.State.activelinecount = false;
}),
};
public static readonly TagFuncList CTagRules = new TagFuncList() {
@@ -157,7 +162,14 @@ public class TextRules {
reader.State.activelinecount = false;
sb.Append(HaWeb.HTMLHelpers.TagHelpers.CreateEndElement(DEFAULTELEMENT));
sb.Append(HaWeb.HTMLHelpers.TagHelpers.CreateEndElement(DEFAULTELEMENT));
})
}),
( ( x, _) => x.Name == "text", (sb, tag, reader) => {
reader.State.currline = "-1";
reader.State.currpage = "-1";
reader.State.activelinecount = false;
sb.Append(HaWeb.HTMLHelpers.TagHelpers.CreateEndElement(DEFAULTELEMENT));
sb.Append(HaWeb.HTMLHelpers.TagHelpers.CreateEndElement(DEFAULTELEMENT));
}),
};
public static readonly TextFuncList TRules = new TextFuncList() {

View File

@@ -8,8 +8,6 @@
minwidthtrads = "ha-minwidth"; *@
}
<script defer src="/js/briefe.js" asp-append-version="true"></script>
<div class="ha-letterheader">
@await Html.PartialAsync("/Views/Shared/_LetterHead.cshtml", (Model.MetaData, true, false))
<div class="ha-letterheadernav">
@@ -53,14 +51,14 @@
{
<a class="ml-1" href="@Model.PDFFilePath">
<div class="inline-block bg-slate-100 hover:bg-slate-200 border px-1.5 rounded">Brief @Model.MetaData.Meta.ID</div>
<div class="inline-block bg-slate-100 hover:bg-slate-200 border px-1.5 rounded dark:bg-black ">Brief @Model.MetaData.Meta.ID</div>
</a>
}
@if (Model.YearPDFFilePath != null)
{
<a class="ml-1 mr-2" href="@Model.YearPDFFilePath">
<div class="inline-block bg-slate-100 hover:bg-slate-200 border px-1.5 rounded">Jahr @Model.MetaData.Meta.Sort.Year</div>
<div class="inline-block bg-slate-100 hover:bg-slate-200 border px-1.5 rounded dark:bg-black">Jahr @Model.MetaData.Meta.Sort.Year</div>
</a>
}
@@ -201,3 +199,4 @@
</div>
}
</div>
<script defer src="/js/briefe.js" asp-append-version="true"></script>

View File

@@ -18,7 +18,7 @@
<div class="ha-headcomment">
<div class="ha-commentmetatext">
Briefwechsel mit &emsp;
<a class="ha-reversefilter" asp-controller="Index" asp-action="Index">←&nbsp;Alle&nbsp;Briefe</a>
<a class="ha-reversefilter dark:bg-black" asp-controller="Index" asp-action="Index">←&nbsp;Alle&nbsp;Briefe</a>
</div>
@Html.Raw(Model.PersonComment.ParsedComment)
@if (Model.PersonComment.ParsedSubComments != null && Model.PersonComment.ParsedSubComments.Any()) {
@@ -91,14 +91,14 @@
</div>
}
</div>
<div class="mr-2 leading-snug text-base px-1 bg-slate-200">
<div class="mr-2 leading-snug px-1 bg-slate-200 dark:bg-black rounded text-sm">
Derzeit kritisch geprüft, ediert und hochgeladen sind Briefe bis einschließlich @Model.EndYear (= @Model.EndPageString).
</div>
<form class="ha-zhform" id="ha-zhform">
<span>Z&hairsp;H Band</span>
<select name="zhvolume" id="ha-zhformvolume">
<form class="ha-zhform font-sans" id="ha-zhform">
<span>Z&hairsp;H</span>
<select class="text-base" name="zhvolume" id="ha-zhformvolume">
@foreach (var volume in Model.AvailablePages.OrderBy(x => x.Key)) {
<option>@volume.Key</option>
<option value="@volume.Key">@HaWeb.HTMLHelpers.ConversionHelpers.ToRomanSafe(volume.Key)</option>
}
</select>
<span>/ </span>
@@ -157,3 +157,4 @@
var AvailablePages = @Html.Raw(Json.Serialize(Model.AvailablePages))
</script>
<script defer src="/js/index.js" asp-append-version="true"></script>

View File

@@ -5,7 +5,7 @@
@await Html.PartialAsync("/Views/Shared/_Head.cshtml")
</head>
<body class="h-full w-full">
<body class="h-full w-full" hx-boost="true">
<div class="flex flex-col h-full">
@await Html.PartialAsync("/Views/Shared/_HKBMenu.cshtml")
<main role="main" class="mb-6 w-full desktop:max-w-screen-desktop mx-auto grow">

View File

@@ -3,8 +3,8 @@
}
<header class="sticky w-100 font-serif mb-6">
<nav class="flex flex-row w-100 bg-slate-50 border-t-[5px] border-gray-300 dark:shadow-xl dark:border-gray-900 py-3 px-3 desktop:px-8 flex-wrap">
<a asp-controller="Index" asp-action="Index" class="text-xl xl:text-3xl grow-0 shrink-0 text-black hover:text-black">
<nav class="flex flex-row w-100 bg-slate-50 border-t-[5px] border-gray-300 dark:shadow-xl dark:border-gray-900 py-3 px-3 desktop:px-8 flex-wrap dark:bg-black dark:text-slate-100">
<a asp-controller="Index" asp-action="Index" class="text-xl xl:text-3xl grow-0 shrink-0 text-black hover:text-black dark:text-slate-100">
<img src="/favicon.ico" class="inline-block w-8 h-8 xl:w-12 xl:h-12 mr-2 border border-gray-300 shadow-sm" alt="HKB-Logo" loading="lazy" />
<span class="sm:hidden">Hamann: Komm. Briefausgabe</span>
<span class="hidden sm:inline md:hidden">Johan Georg Hamann: Kommentierte Briefausgabe</span>
@@ -30,7 +30,7 @@
</svg>
</button>
</div>
<div class="ha-topnav " id="ha-topnav">
<div class="ha-topnav" id="ha-topnav">
<a class="ha-active-default" asp-controller="Index" asp-action="Index">
Suche & Briefauswahl

View File

@@ -8,19 +8,17 @@
<script defer src="/js/scrollbutton.js" asp-append-version="true"></script>
<script defer src="/js/clipboard.js" asp-append-version="true"></script>
@if (ViewData.ContainsKey("Mark")) {
<script src="/js/mark.min.js" asp-append-version="true"></script>
@* This uses Razor Syntax so it is inlined into this razor file *@
<script>
document.addEventListener("DOMContentLoaded", (event) => {
var elements = document.querySelectorAll(".ha-register-body, .ha-searchresultpreview, .ha-commenthead, .ha-entry");
if (elements.length < 1000) {
var instancesearch = new Mark(elements);
instancesearch.mark('@ViewData["Mark"]', { "element": "span", "className": "ha-found", "acrossElements": true, "separateWordSearch": false, "exclude": [".ha-searchresultcommentpill", ".ha-letlink", ".ha-letlinks", ".ha-hkb"] });
}
var instanceletter = new Mark(document.querySelectorAll(".ha-letterbody"));
instanceletter.mark('@ViewData["Mark"]', { "element": "span", "className": "ha-found", "acrossElements": true, "separateWordSearch": false, "exclude": [".ha-searchresultcommentpill", ".ha-letlink", ".ha-letlinks", ".ha-hkb"] });
});
</script>
}
<script src="/js/mark.min.js" asp-append-version="true"></script>
@* This uses Razor Syntax so it is inlined into this razor file *@
<script>
document.addEventListener("DOMContentLoaded", (event) => {
var elements = document.querySelectorAll(".ha-register-body, .ha-searchresultpreview, .ha-commenthead, .ha-entry");
if (elements.length < 1000) {
var instancesearch = new Mark(elements);
instancesearch.mark('@ViewData["Mark"]', { "element": "span", "className": "ha-found", "acrossElements": true, "separateWordSearch": false, "exclude": [".ha-searchresultcommentpill", ".ha-letlink", ".ha-letlinks", ".ha-hkb"] });
}
var instanceletter = new Mark(document.querySelectorAll(".ha-letterbody"));
instanceletter.mark('@ViewData["Mark"]', { "element": "span", "className": "ha-found", "acrossElements": true, "separateWordSearch": false, "exclude": [".ha-searchresultcommentpill", ".ha-letlink", ".ha-letlinks", ".ha-hkb"] });
});
</script>

View File

@@ -18,12 +18,5 @@
"BareRepositoryPathWindows": "D:/Simon/source/hamann-xml/.git/",
"WorkingTreePathLinux": "/var/www/vhosts/hamann-ausgabe.de/httpdocs/Repo/",
"WorkingTreePathWindows": "D:/Simon/source/hamann-xml/",
"RepositoryBranch": "Release",
"RepositoryURL": "https://github.com/Theodor-Springmann-Stiftung/hamann-xml",
"StoredPDFPathWindows": "",
"StoredPDFPathLinux": "",
"FileSizeLimit": 52428800,
"AvailableStartYear": 1700,
"AvailableEndYear": 1800,
"LettersOnPage": 80
"RepositoryBranch": "main"
}

View File

@@ -1,7 +1,7 @@
@layer components {
/* COLORS */
.ha-footer .ha-footertext {
@apply bg-slate-50 text-hamannSlate-900 dark:bg-slate-700 dark:text-white
@apply bg-slate-50 text-hamannSlate-900 dark:bg-slate-900 dark:text-white
}
.ha-footer .ha-themetoggles {
@@ -18,7 +18,7 @@
/* STYLES */
.ha-footer {
@apply font-serif;
@apply font-sans !text-xs;
}
.ha-footer .ha-footertext {

View File

@@ -1,19 +1,19 @@
@layer components {
/* COLORS */
.ha-topnav-dropdown .ha-topnav-dropdown-content {
@apply bg-slate-50 shadow-md border-slate-400 border-b
@apply bg-slate-50 shadow-md border-slate-400 border-b dark:bg-black
}
.ha-topnav-dropdown .ha-topnav-dropdown-content a:hover {
@apply bg-slate-100
@apply bg-slate-100 dark:bg-black
}
.ha-topnav a {
@apply text-slate-700 hover:text-slate-900 desktop:border-b-4 desktop:border-transparent
@apply text-slate-700 dark:text-slate-100 dark:hover:text-slate-50 hover:text-slate-900 desktop:border-b-4 desktop:border-transparent
}
.ha-topnav a.active {
@apply desktop:border-b-4 desktop:border-slate-200 dark:border-slate-700 dark:font-bold
@apply desktop:border-b-4 desktop:border-slate-200 dark:border-none dark:font-bold dark:!text-slate-100
}
.ha-topnav.ha-topnav-collapsed

View File

@@ -1,15 +1,15 @@
@layer components {
/* THEME OPTIONS */
.ha-index {
@apply bg-slate-50 dark:bg-slate-900
@apply bg-slate-50 dark:bg-gray-900
}
.ha-index .ha-indexbody .ha-letterlist .ha-letterlistentry .ha-letterlistsearchresults .ha-letterlistsearchresult:nth-child(even) {
@apply bg-slate-100 dark:bg-slate-900
@apply bg-slate-100
}
.ha-index .ha-indexbody .ha-letterlist .ha-letterlistentry .ha-letterlistsearchresults .ha-letterlistsearchresult:nth-child(odd) {
@apply bg-slate-50 dark:bg-slate-900
@apply bg-slate-50
}
.ha-index .ha-indexbody .ha-letterlist .ha-letterlistentry {
@@ -33,7 +33,11 @@
}
.ha-index .ha-indexbody .ha-filterlist .ha-personfilter .ha-personlist a:nth-child(odd) {
@apply bg-slate-100 dark:bg-zinc-900
@apply bg-slate-100 dark:bg-gray-800
}
.ha-index .ha-activefilterinfo {
@apply bg-slate-200 dark:bg-black
}
/* NON THEME RULES */
@@ -62,7 +66,7 @@
}
.ha-index .ha-comment {
@apply font-serif hyphenate px-9 md:px-16 py-3 pb-12 border-l-2
@apply font-serif hyphenate px-9 md:px-16 py-3 pb-12
}
.ha-index .ha-comment .ha-commentmetatext {
@@ -70,11 +74,11 @@
}
.ha-index .ha-comment .ha-commentmetatext a {
@apply float-right bg-slate-200 text-sm inline-block px-2 rounded
@apply float-right bg-slate-200 dark:bg-black text-sm inline-block px-2 rounded
}
.ha-index .ha-comment .ha-lemma {
@apply font-bold font-bold text-2xl desktop:font-normal desktop:text-5xl mb-3 inline-block font-serif
@apply font-bold text-2xl desktop:font-normal desktop:text-5xl mb-3 inline-block font-serif
}
.ha-index .ha-comment .ha-entry {
@@ -163,7 +167,7 @@
}
.ha-index .ha-indexbody .ha-filterlist .ha-activefilterinfo {
@apply font-sans text-sm bg-slate-200 px-1 rounded mt-1
@apply font-sans text-sm px-1 rounded mt-1
}
.ha-index .ha-indexbody .ha-filterlist .ha-reversefilter {

View File

@@ -1,7 +1,7 @@
@layer components {
/* COLORS */
.ha-tooltiptext {
@apply shadow-sm bg-slate-50 border-hamannSlate-900 text-hamannSlate-900 border dark:border-none dark:shadow dark:bg-slate-800
@apply shadow-sm bg-slate-50 border-hamannSlate-900 text-hamannSlate-900 dark:text-slate-100 border dark:border-none dark:shadow dark:bg-slate-800
}
.ha-tooltip .ha-tooltiptext::after {
@@ -9,7 +9,7 @@
}
.ha-pill {
@apply rounded bg-gray-200 text-gray-600
@apply rounded bg-gray-200 text-gray-600 dark:bg-black shadow dark:text-gray-200
}
/* .ha-pill {

File diff suppressed because one or more lines are too long

View File

@@ -122,7 +122,7 @@
}
.ha-search .ha-searchhead .ha-reversefilter {
@apply inline-block text-right decoration-dotted underline hover:decoration-solid
@apply inline-block text-right decoration-dotted underline hover:decoration-solid dark:bg-black
}
.ha-search .ha-searchhead .ha-searchfilter .ha-alternativesearches a {

1
HaWeb/wwwroot/js/htmx.min.js vendored Normal file

File diff suppressed because one or more lines are too long